1dnl Process this file with autoconf to produce a configure script.
2
3
4AC_INIT(tagtool, 0.12.3)
5AM_INIT_AUTOMAKE(${PACKAGE_NAME}, ${PACKAGE_VERSION})
6
7AC_CONFIG_SRCDIR([src/main.c])
8AM_CONFIG_HEADER(config.h)
9AM_MAINTAINER_MODE
10
11SPEC_RELEASE="1"
12AC_SUBST(SPEC_RELEASE)
13
14
15dnl Command line options
16AC_ARG_ENABLE(mp3,
17	AC_HELP_STRING([--disable-mp3], [Disable MP3 support (if enabled, id3lib is required)]),
18	[enable_mp3=no;  disable_mp3_reason="(disabled)"],
19	[enable_mp3=yes])
20
21AC_ARG_ENABLE(vorbis,
22	AC_HELP_STRING([--disable-vorbis], [Disable Ogg Vorbis support (if enabled, libvorbis is required)]),
23	[enable_vorbis=no;  disable_vorbis_reason="(disabled)"],
24	[enable_vorbis=yes])
25
26if test "$enable_mp3" = "no" && test "$enable_vorbis" = "no"; then
27	AC_MSG_ERROR([At least one of 'mp3' or 'vorbis' must be enabled. Try './configure --help' for a list of options.])
28fi;
29
30
31dnl Checks for programs.
32AC_PROG_CC
33AC_PROG_AWK
34AC_PROG_INSTALL
35AC_PROG_LN_S
36AC_PROG_MAKE_SET
37
38dnl Checks for libraries and header files
39AC_HEADER_DIRENT
40AC_HEADER_STDC
41AC_CHECK_HEADERS([stdlib.h string.h unistd.h langinfo.h],,
42	[AC_MSG_ERROR([Missing necessary header files.])])
43
44dnl Use gnuregex in FreeBSD
45OSTYPE=`uname -s`
46if test "$OSTYPE" = "FreeBSD"; then
47	AC_CHECK_HEADERS([gnuregex.h gnu/regex.h])
48	AC_CHECK_LIB(gnuregex, main,,
49		[AC_MSG_ERROR([Missing required library])])
50fi;
51
52
53dnl Check for gtk and related libraries
54PKG_CHECK_MODULES(GTK, [glib-2.0 >= 2.12.0
55		       gtk+-2.0 >= 2.8.0
56		       libglade-2.0 >= 2.6.0])
57AC_SUBST(GTK_CFLAGS)
58AC_SUBST(GTK_LIBS)
59
60
61dnl Check for libid3 and libvorbis
62if test "$enable_mp3" = "yes"; then
63	AC_CHECK_HEADERS([id3.h],,
64		[enable_mp3=no;  disable_mp3_reason="(missing id3lib headers)"])
65fi;
66if test "$enable_mp3" = "yes"; then
67	dnl Fix missing link dependencies in libid3.so  (some distros have fixed
68	dnl this in their own libid3 packages, others haven't...)
69	SAVE_LDFLAGS=$LDFLAGS
70	LDFLAGS="-lstdc++ -lz $LDFLAGS"
71
72	AC_CHECK_LIB(id3, main,,
73		[enable_mp3=no;  disable_mp3_reason="(missing id3 library)"])
74	AC_CHECK_LIB(id3, ID3FrameInfo_LongName,,
75		[AC_DEFINE(LIBID3_MISSING_ID3FRAMEINFO, 1, [Define to 1 if the ID3FrameInfo_* functions are missing from libid3])])
76
77	if test "$enable_mp3" = "no"; then
78		LDFLAGS=$SAVE_LDFLAGS
79	fi;
80fi;
81
82if test "$enable_vorbis" = "yes"; then
83	AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h vorbis/vorbisfile.h],,
84		[enable_vorbis=no;  disable_vorbis_reason="(missing vorbis headers)"])
85fi;
86if test "$enable_vorbis" = "yes"; then
87	AC_CHECK_LIB(vorbis, main,,
88		[enable_vorbis=no;  disable_vorbis_reason="(missing vorbis library)"])
89fi;
90if test "$enable_vorbis" = "yes"; then
91	AC_CHECK_LIB(vorbisfile, main,,
92		[enable_vorbis=no;  disable_vorbis_reason="(missing vorbisfile library)"])
93fi;
94
95AM_CONDITIONAL(ENABLE_MP3,    test "$enable_mp3" = "yes")
96AM_CONDITIONAL(ENABLE_VORBIS, test "$enable_vorbis" = "yes")
97
98if test "$enable_mp3" = "no" && test "$enable_vorbis" = "no"; then
99	AC_MSG_RESULT([
100No MP3 support $disable_mp3_reason
101No Ogg Vorbis support $disable_vorbis_reason
102])
103	AC_MSG_ERROR([Neither MP3 or Vorbis support is being built. Cannot continue.])
104fi;
105
106
107dnl Checks for typedefs, structures, and compiler characteristics.
108AC_C_CONST
109AC_TYPE_MODE_T
110AC_TYPE_SIZE_T
111
112dnl Checks for library functions.
113AC_FUNC_STAT
114AC_FUNC_FNMATCH
115AC_FUNC_STRCOLL
116AC_FUNC_STRTOD
117AC_CHECK_FUNCS([strcasecmp nl_langinfo regcomp],,
118	[AC_MSG_ERROR([Missing necessary functions.])])
119
120
121dnl Internationalization
122
123AC_PROG_INTLTOOL([0.30])
124GETTEXT_PACKAGE=tagtool
125AC_SUBST(GETTEXT_PACKAGE)
126AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
127ALL_LINGUAS="pt fr cs es it en_GB de bg lt ua ru pl sv nl pt_BR"
128AM_GLIB_GNU_GETTEXT
129dnl AM_GNU_GETTEXT([external])
130
131
132dnl Define useful directories
133
134AM_GLIB_DEFINE_LOCALEDIR(LOCALEDIR)
135
136
137dnl Output
138
139AC_CONFIG_FILES([
140	data/Makefile
141	pixmaps/Makefile
142	po/Makefile.in
143	src/Makefile
144	Makefile
145	tagtool.spec
146])
147dnl	help/Makefile
148dnl	help/C/Makefile
149AC_OUTPUT
150
151
152AC_MSG_RESULT([
153Configuration information:
154
155  MP3 support:         $enable_mp3  $disable_mp3_reason
156  Ogg Vorbis support:  $enable_vorbis  $disable_vorbis_reason
157
158Now run 'make' to compile $PACKAGE_NAME
159])
160