1#
2# Copyright (c) 2005-2012 Alon Bar-Lev <alon.barlev@gmail.com>
3# All rights reserved.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 2
7# as published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program (see the file COPYING.GPL included with this
16# distribution); if not, write to the Free Software Foundation, Inc.,
17# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18#
19
20AC_PREREQ([2.60])
21AC_INIT([mp3unicode], [1.2.1])
22AM_INIT_AUTOMAKE([${PACKAGE_NAME}], [${PACKAGE_VERSION}])
23AM_CONFIG_HEADER([config.h])
24AC_CONFIG_SRCDIR([mp3unicode.cpp])
25
26AC_CANONICAL_HOST
27
28AC_ARG_WITH(
29	[cygwin-native],
30	[AC_HELP_STRING([--with-cygwin-native], [Compile native win32])],
31	,
32	[with_cygwin_native="no"]
33)
34
35test -z "${WIN32}" && WIN32="no"
36test -z "${CYGWIN}" && CYGWIN="no"
37case "${host}" in
38	*-mingw*)
39		WIN32="yes"
40	;;
41	*-winnt*)
42		WIN32="yes"
43	;;
44	*-cygwin*)
45		AC_MSG_CHECKING([cygwin mode to use])
46		CYGWIN="yes"
47		if test "${with_cygwin_native}" = "yes"; then
48			AC_MSG_RESULT([Using native win32])
49			CPPFLAGS="${CFLAGS} -mno-cygwin"
50			WIN32="yes"
51		else
52			AC_MSG_RESULT([Using cygwin])
53		fi
54	;;
55	*)
56	;;
57esac
58
59AC_PROG_CC
60AC_PROG_CXX
61AC_PROG_LN_S
62AC_PROG_INSTALL
63PKG_PROG_PKG_CONFIG
64AC_ARG_VAR([M4], [m4 utility])
65AC_CHECK_PROGS([M4], [m4])
66AC_ARG_VAR([XSLTPROC], [xsltproc utility])
67AC_CHECK_PROGS([XSLTPROC], [xsltproc]) # Required only for svn package
68
69AC_ARG_VAR([MAN2HTML], [tr utility])
70AC_CHECK_PROGS([MAN2HTML], [man2html])
71if test "${WIN32}" = "yes"; then
72	test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32])
73fi
74
75AC_ARG_ENABLE(
76	[strict],
77	[AS_HELP_STRING([--enable-strict],[enable strict compile mode @<:@disabled@:>@])],
78	,
79	[enable_strict="no"]
80)
81
82AC_ARG_ENABLE(
83	[pedantic],
84	[AC_HELP_STRING([--enable-pedantic], [Enable pedantic compiler warnings, will not generate a working executable (debugging option)])],
85	,
86	[enable_pedantic="no"]
87)
88
89PKG_CHECK_MODULES([TAGLIB], [taglib >= 1.4],, [AC_MSG_ERROR([Cannot locate taglib])])
90CPPFLAGS="${CPPFLAGS} ${TAGLIB_CFLAGS}"
91LIBS="${LIBS} ${TAGLIB_LIBS}"
92
93AC_ARG_VAR([ICONV_CFLAGS], [C compiler flags for iconv])
94AC_ARG_VAR([ICONV_LIBS], [linker flags for iconv])
95CPPFLAGS="${CPPFLAGS} ${ICONV_CFLAGS}"
96LIBS="${LIBS} ${ICONV_LIBS}"
97
98if test "${enable_pedantic}" = "yes"; then
99	enable_strict="yes";
100	CXXFLAGS="${CXXFLAGS} -pedantic"
101fi
102if test "${enable_strict}" = "yes"; then
103	CXXFLAGS="${CXXFLAGS} -Wall -Wextra"
104fi
105
106AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
107AC_CONFIG_FILES([
108	Makefile
109	distro/Makefile
110	distro/rpm/Makefile
111	distro/rpm/mp3unicode.spec
112	distro/debian/Makefile
113])
114AC_OUTPUT
115