Update to 6762
[qball-mpd.git] / configure.ac
blob6753dc98be6936f98d6be03573f9963f2124e1af
1 dnl AC_INIT(src/main.c)
2 dnl AM_INIT_AUTOMAKE(mpd, 0.14.0)
4 AC_PREREQ(2.60)
5 AC_INIT(mpd, 0.14.0, warren.dukes@gmail.com)
6 AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
8 AC_SUBST(MPD_LIBS)
9 AC_SUBST(MPD_CFLAGS)
10 AC_SUBST(MP4FF_LIB)
11 AC_SUBST(MP4FF_SUBDIR)
13 AC_PROG_CC
14 AM_PROG_CC_C_O
15 AC_PROG_INSTALL
16 AC_PROG_LIBTOOL
17 AC_PROG_MAKE_SET
19 AM_CONFIG_HEADER(config.h)
20 AC_DEFINE(PROTOCOL_VERSION, "0.14.0", [The mpd protocol version])
22 MPD_LIBS=""
23 MPD_CFLAGS=""
24 if test x$GCC = xyes; then
25         MPD_CFLAGS="-Wall -Wmissing-prototypes"
28 if test -z "$prefix" || test "x$prefix" = xNONE; then
29         local_lib=
30         local_include=
32         # aren't autotools supposed to be smart enough to figure this out?  oh
33         # well, the git-core Makefile managed to do some of the work for us :)
34         case "$host_os" in
35         darwin*)
36                 local_lib='/sw/lib /opt/local/lib'
37                 local_include='/sw/include /opt/local/include'
38                 ;;
39         freebsd* | openbsd*)
40                 local_lib=/usr/local/lib
41                 local_include=/usr/local/include
42                 ;;
43         netbsd*)
44                 local_lib=/usr/pkg/lib
45                 local_include=/usr/pkg/include
46                 LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/pkg/lib"
47                 ;;
48         esac
50         for d in $local_lib; do
51                 if test -d "$d"; then
52                         LDFLAGS="$LDFLAGS -L$d"
53                         break
54                 fi
55         done
56         for d in $local_include; do
57                 if test -d "$d"; then
58                         CFLAGS="$CFLAGS -I$d"
59                         break
60                 fi
61         done
64 AC_ARG_ENABLE(ao,[  --enable-ao             enable support for libao (default: disable)],[enable_ao=$enableval],[enable_ao=no])
65 AC_ARG_ENABLE(shout,[  --disable-shout         disable support for streaming through shout (default: enable)],[enable_shout=$enableval],[enable_shout=yes])
66 AC_ARG_ENABLE(iconv,[  --disable-iconv         disable iconv support (default: enable)],[enable_iconv=$enableval],[enable_iconv=yes])
67 AC_ARG_ENABLE(ipv6,[  --disable-ipv6          disable IPv6 support (default: enable)],[enable_ipv6=$enableval],[enable_ipv6=yes])
68 AC_ARG_ENABLE(oss,[  --disable-oss           disable OSS support (default: enable)],[enable_oss=$enableval],[enable_oss=yes])
69 AC_ARG_ENABLE(alsa,[  --disable-alsa          disable ALSA support (default: enable)],[enable_alsa=$enableval],[enable_alsa=yes])
70 AC_ARG_ENABLE(jack,[  --disable-jack          disable jack support (default: enable)],[enable_jack=$enableval],[enable_jack=yes])
71 AC_ARG_ENABLE(pulse,[  --disable-pulse         disable support for the PulseAudio sound server (default: enable)],[enable_pulse=$enableval],[enable_pulse=yes])
72 AC_ARG_ENABLE(fifo,[  --disable-fifo          disable support for writing audio to a FIFO (default: enable)],[enable_fifo=$enableval],[enable_fifo=yes])
73 AC_ARG_ENABLE(mvp,[  --enable-mvp            enable support for Hauppauge Media MVP (default: disable)],[enable_mvp=$enableval],[enable_mvp=no])
74 AC_ARG_ENABLE(oggvorbis,[  --disable-oggvorbis     disable Ogg Vorbis support (default: enable)],[enable_oggvorbis=$enableval],enable_oggvorbis=yes)
75 AC_ARG_ENABLE(oggflac,[  --disable-oggflac       disable OggFLAC support (default: enable)],[enable_oggflac=$enableval],enable_oggflac=yes)
76 AC_ARG_ENABLE(flac,[  --disable-flac          disable flac support (default: enable)],[enable_flac=$enableval],[enable_flac=yes])
77 AC_ARG_ENABLE(mp3,[  --disable-mp3           disable mp3 support (default: enable)],[enable_mp3=$enableval],[enable_mp3=yes])
78 AC_ARG_ENABLE(aac,[  --disable-aac           disable AAC support (default: enable)],[enable_aac=$enableval],[enable_aac=yes])
79 AC_ARG_ENABLE(audiofile,[  --disable-audiofile     disable audiofile support, disables wave support (default: enable)],[enable_audiofile=$enableval],[enable_audiofile=yes])
80 AC_ARG_ENABLE(mod,[  --enable-mod            enable MOD support (default: disable)],[enable_mod=$enableval],[enable_mod=yes])
81 AC_ARG_ENABLE(mpc,[  --disable-mpc           disable musepack (MPC) support (default: enable)],[enable_mpc=$enableval],[enable_mpc=yes])
82 AC_ARG_ENABLE(wavpack,[  --disable-wavpack       disable WavPack support (default: enable)],[enable_wavpack=$enableval],[enable_wavpack=yes])
83 AC_ARG_ENABLE(id3,[  --disable-id3           disable id3 support (default: enable)],[enable_id3=$enableval],[enable_id3=yes])
84 AC_ARG_ENABLE(lsr,[  --disable-lsr           disable libsamplerate support (default: enable)],[enable_lsr=$enableval],[enable_lsr=yes])
86 AC_ARG_WITH(tremor,[[  --with-tremor[=PFX]         Use Tremor(vorbisidec) integer Ogg-Vorbis decoder (with optional prefix)]], use_tremor=yes; test x$withval != xyes && tremor_prefix="$withval",)
87 AC_ARG_WITH(tremor-libraries,[  --with-tremor-libraries=DIR Directory where Tremor library is installed (optional)], tremor_libraries="$withval", tremor_libraries="")
88 AC_ARG_WITH(tremor-includes,[  --with-tremor-includes=DIR  Directory where Tremor header files are installed (optional)], tremor_includes="$withval", tremor_includes="")
90 AC_ARG_WITH(iconv,[  --with-iconv=PFX            Prefix where iconv is installed (optional)], iconv_prefix="$withval", iconv_prefix="")
91 AC_ARG_WITH(iconv-libraries,[  --with-iconv-libraries=DIR  Directory where libiconv library is installed (optional)], iconv_libraries="$withval", iconv_libraries="")
92 AC_ARG_WITH(iconv-includes,[  --with-iconv-includes=DIR   Directory where libiconv header files are installed (optional)], iconv_includes="$withval", iconv_includes="")
94 AC_ARG_WITH(id3tag,[  --with-id3tag=PFX           Prefix where libid3tag is installed (optional)], id3tag_prefix="$withval", id3tag_prefix="")
95 AC_ARG_WITH(id3tag-libraries,[  --with-id3tag-libraries=DIR Directory where libid3tag library is installed (optional)], id3tag_libraries="$withval", id3tag_libraries="")
96 AC_ARG_WITH(id3tag-includes,[  --with-id3tag-includes=DIR  Directory where libid3tag header files are installed (optional)], id3tag_includes="$withval", id3tag_includes="")
98 AC_ARG_WITH(mad,[  --with-mad=PFX              Prefix where libmad is installed (optional)], mad_prefix="$withval", mad_prefix="")
99 AC_ARG_WITH(mad-libraries,[  --with-mad-libraries=DIR    Directory where libmad library is installed (optional)], mad_libraries="$withval", mad_libraries="")
100 AC_ARG_WITH(mad-includes,[  --with-mad-includes=DIR     Directory where mad header files are installed (optional)], mad_includes="$withval", mad_includes="")
102 AC_ARG_WITH(faad,[  --with-faad=PFX             Prefix where faad2 is installed], faad_prefix="$withval", faad_prefix="")
103 AC_ARG_WITH(faad-libraries,[  --with-faad-libraries=DIR   Directory where faad2 library is installed (optional)], faad_libraries="$withval", faad_libraries="")
104 AC_ARG_WITH(faad-includes,[  --with-faad-includes=DIR    Directory where faad2 header files are installed (optional)], faad_includes="$withval", faad_includes="")
105 AC_ARG_WITH(zeroconf,[[  --with-zeroconf=[auto|avahi|bonjour|no]    Enable zeroconf backend (default=auto)]], with_zeroconf="$withval", with_zeroconf="auto")
107 AC_ARG_WITH(lsr,[  --with-src=PFX             Prefix where libsamplerate is installed], src_prefix="$withval", src_prefix="")
108 AC_ARG_WITH(lsr-libraries,[  --with-lsr-libraries=DIR   Directory where libsamplerate library is installed (optional)], lsr_libraries="$withval", lsr_libraries="")
109 AC_ARG_WITH(lsr-includes,[  --with-lsr-includes=DIR    Directory where libsamplerate header files are installed (optional)], lsr_includes="$withval", lsr_includes="")
111 AC_C_BIGENDIAN
113 AC_CHECK_SIZEOF(short)
114 AC_CHECK_SIZEOF(int)
115 AC_CHECK_SIZEOF(long)
116 AC_CHECK_SIZEOF(long long)
118 AC_CHECK_HEADER(sys/inttypes.h,AC_DEFINE(HAVE_SYS_INTTYPES_H,1,[Define if sys/inttypes.h present]),)
120 AC_TYPE_INT64_T
121 AC_TYPE_UINT64_T
123 AC_CHECK_LIB(socket,socket,MPD_LIBS="$MPD_LIBS -lsocket",)
124 AC_CHECK_LIB(nsl,gethostbyname,MPD_LIBS="$MPD_LIBS -lnsl",)
126 AC_CHECK_LIB(m,exp,MPD_LIBS="$MPD_LIBS -lm",)
127 AC_CHECK_FUNCS(setenv)
130 dnl doesn't work for systems that don't have CODESET like OpenBSD
131 dnl AC_CHECK_HEADER(langinfo.h,[enable_langinfo=yes;AC_DEFINE(HAVE_LANGINFO,1,[Define if nl_langinfo.h is present])],enable_langinfo=no)
132 AM_LANGINFO_CODESET
133 AC_CHECK_HEADER(locale.h,[enable_locale=yes;AC_DEFINE(HAVE_LOCALE,1,[Define if locale.h is present])],enable_locale=no)
135 if test x$enable_ipv6 = xyes; then
136         AC_MSG_CHECKING(for ipv6)
137         AC_EGREP_CPP([AP_maGiC_VALUE],
138         [
139 #include <sys/types.h>
140 #include <sys/socket.h>
141 #include <netdb.h>
142 #ifdef PF_INET6
143 #ifdef AF_INET6
144 AP_maGiC_VALUE
145 #endif
146 #endif
147         ],
148         AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 support present])
149         AC_MSG_RESULT([yes]),
150         AC_MSG_RESULT([no])
154 enable_osx=no
155 case $host in
156         *-darwin*)
157                 AC_DEFINE(HAVE_OSX, 1, [Define for compiling OS X support])
158                 MPD_LIBS="$MPD_LIBS -framework AudioUnit -framework CoreServices"
159                 enable_osx=yes ;;
160 esac
162 if test x$enable_shout = xyes; then
163         if test x$enable_oggvorbis = xno; then
164                 AC_MSG_WARN([disabling shout streaming support because vorbis is not enabled])
165                 enable_shout=no
166         fi
167         if test x$use_tremor = xyes; then
168                 AC_MSG_WARN([disabling shout streaming support because tremor does not support vorbis encoding])
169                 enable_shout=no
170         fi
173 if test x$enable_ao = xyes; then
174         XIPH_PATH_AO([AC_DEFINE(HAVE_AO, 1, [Define to play with ao]) MPD_LIBS="$MPD_LIBS $AO_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AO_CFLAGS"], enable_ao=no)
177 if test x$enable_shout = xyes; then
178         XIPH_PATH_SHOUT([AC_DEFINE(HAVE_SHOUT, 1, [Define to enable libshout support]) MPD_LIBS="$MPD_LIBS $SHOUT_LIBS" MPD_CFLAGS="$MPD_CFLAGS $SHOUT_CFLAGS"], enable_shout=no)
181 if test x$enable_oss = xyes; then
182         AC_CHECK_HEADER(sys/soundcard.h,[enable_oss=yes;AC_DEFINE(HAVE_OSS,1,[Define to enable OSS])],[AC_MSG_WARN(Soundcard headers not found -- disabling OSS support);enable_oss=no])
185 PKG_PROG_PKG_CONFIG
187 if test x$enable_pulse = xyes; then
188         PKG_CHECK_MODULES([PULSE], [libpulse-simple],
189                           [enable_pulse=yes;AC_DEFINE([HAVE_PULSE], 1, [Define to enable PulseAudio support])] MPD_LIBS="$MPD_LIBS $PULSE_LIBS" MPD_CFLAGS="$MPD_CFLAGS $PULSE_CFLAGS",
190                           [enable_pulse=no;AC_MSG_WARN([PulseAudio not found -- disabling])])
193 if test x$enable_lsr = xyes; then
194         PKG_CHECK_MODULES([SAMPLERATE], [samplerate >= 0.0.15],
195                           [enable_lsr=yes;AC_DEFINE([HAVE_LIBSAMPLERATE], 1, [Define to enable libsamplerate])] MPD_LIBS="$MPD_LIBS $SAMPLERATE_LIBS" MPD_CFLAGS="$MPD_CFLAGS $SAMPLERATE_CFLAGS",
196                           [enable_lsr=no;AC_MSG_WARN([libsamplerate not found -- disabling])])
199 if test x$enable_fifo = xyes; then
200         AC_CHECK_FUNC([mkfifo],
201                       [enable_fifo=yes;AC_DEFINE([HAVE_FIFO], 1, [Define to enable support for writing audio to a FIFO])],
202                       [enable_fifo=no;AC_MSG_WARN([mkfifo not found -- disabling support for writing audio to a FIFO])])
205 if test x$enable_mvp = xyes; then
206    AC_DEFINE(HAVE_MVP,1,[Define to enable Hauppauge Media MVP support])
209 if test x$enable_alsa = xyes; then
210         AM_PATH_ALSA(0.9.0,[AC_DEFINE(HAVE_ALSA,1,[Define to enable ALSA support]) MPD_LIBS="$MPD_LIBS $ALSA_LIBS" MPD_CFLAGS="$MPD_CFLAGS $ALSA_CFLAGS"],enable_alsa=no)
213 if test x$enable_jack = xyes; then
214         PKG_CHECK_MODULES([JACK], [jack >= 0.4],
215                           [enable_jack=yes;AC_DEFINE([HAVE_JACK], 1, [Define to enable JACK support])] MPD_LIBS="$MPD_LIBS $JACK_LIBS" MPD_CFLAGS="$MPD_CFLAGS $JACK_CFLAGS",
216                           [enable_jack=no;AC_MSG_WARN([JACK not found -- disabling])])
219 if test x$enable_iconv = xyes; then
220         if test "x$iconv_libraries" != "x" ; then
221                 ICONV_LIBS="-L$iconv_libraries"
222         elif test "x$iconv_prefix" != "x" ; then
223                 ICONV_LIBS="-L$iconv_prefix/lib"
224         fi
226         ICONV_LIBS="$ICONV_LIBS -liconv"
228         if test "x$iconv_includes" != "x" ; then
229                 ICONV_CFLAGS="-I$iconv_includes"
230         elif test "x$iconv_prefix" != "x" ; then
231                 ICONV_CFLAGS="-I$iconv_prefix/include"
232         fi
234         oldcflags=$CFLAGS
235         oldlibs=$LIBS
236         oldcppflags=$CPPFLAGS
237         CFLAGS="$CFLAGS $MPD_CFLAGS $ICONV_CFLAGS"
238         LIBS="$LIBS $MPD_LIBS $ICONV_LIBS"
239         CPPFLAGS=$CFLAGS
240         AC_CHECK_HEADER(iconv.h,MPD_CFLAGS="$MPD_CFLAGS $ICONV_CFLAGS",enable_iconv=no)
241         if test x$enable_iconv = xyes; then
242                 AC_CHECK_LIB(iconv,main,MPD_LIBS="$MPD_LIBS $ICONV_LIBS",)
243                 AC_DEFINE(HAVE_ICONV,1,[Define to use iconv])
244         fi
245         CFLAGS=$oldcflags
246         LIBS=$oldlibs
247         CPPFLAGS=$oldcppflags
250 ID3_SUBDIR=""
252 if test x$enable_id3 = xyes; then
253         if test "x$id3tag_libraries" != "x" ; then
254                 ID3TAG_LIBS="-L$id3tag_libraries"
255         elif test "x$id3tag_prefix" != "x" ; then
256                 ID3TAG_LIBS="-L$id3tag_prefix/lib"
257         fi
259         ID3TAG_LIBS="$ID3TAG_LIBS -lid3tag -lz"
261         if test "x$id3tag_includes" != "x" ; then
262                 ID3TAG_CFLAGS="-I$id3tag_includes"
263         elif test "x$id3tag_prefix" != "x" ; then
264                 ID3TAG_CFLAGS="-I$id3tag_prefix/include"
265         fi
267         ID3TAG_CFLAGS="$ID3TAG_CFLAGS"
269         oldcflags=$CFLAGS
270         oldlibs=$LIBS
271         oldcppflags=$CPPFLAGS
272         CFLAGS="$CFLAGS $MPD_CFLAGS $ID3TAG_CFLAGS"
273         LIBS="$LIBS $MPD_LIBS $ID3TAG_LIBS"
274         CPPFLAGS=$CFLAGS
275         AC_CHECK_HEADERS(id3tag.h,use_libid3tag=yes,
276                 [use_libid3tag=no])
277         if test x$use_libid3tag = xyes; then
278                 AC_CHECK_LIB(id3tag,id3_file_open,
279                         [MPD_LIBS="$MPD_LIBS $ID3TAG_LIBS";
280                         MPD_CFLAGS="$MPD_CFLAGS $ID3TAG_CFLAGS";
281                         use_libid3tag=yes],
282                         [use_libid3tag=no])
283         fi
284         CFLAGS=$oldcflags
285         LIBS=$oldlibs
286         CPPFLAGS=$oldcppflags
287         if test x$use_libid3tag = xyes; then
288                 AC_DEFINE(HAVE_ID3TAG,1,[Define to use id3tag])
289         else
290                 enable_id3=no
291         fi
294 MAD_SUBDIR=""
296 if test x$enable_mp3 = xyes; then
297         if test "x$mad_libraries" != "x" ; then
298                 MAD_LIBS="-L$mad_libraries"
299         elif test "x$mad_prefix" != "x" ; then
300                 MAD_LIBS="-L$mad_prefix/lib"
301         fi
303         MAD_LIBS="$MAD_LIBS -lmad"
305         if test "x$mad_includes" != "x" ; then
306                 MAD_CFLAGS="-I$mad_includes"
307         elif test "x$mad_prefix" != "x" ; then
308                 MAD_CFLAGS="-I$mad_prefix/include"
309         fi
311         oldcflags=$CFLAGS
312         oldlibs=$LIBS
313         oldcppflags=$CPPFLAGS
314         CFLAGS="$CFLAGS $MPD_CFLAGS $MAD_CFLAGS"
315         LIBS="$LIBS $MPD_LIBS $MAD_LIBS"
316         CPPFLAGS=$CFLAGS
317         AC_CHECK_HEADERS(mad.h,use_libmad=yes,
318                 [use_libmad=no])
319         if test x$use_libmad = xyes; then
320                 AC_CHECK_LIB(mad,mad_stream_init,[MPD_LIBS="$MPD_LIBS $MAD_LIBS";
321                         MPD_CFLAGS="$MPD_CFLAGS $MAD_CFLAGS";
322                         use_libmad=yes],[use_libmad=no])
323         fi
324         CFLAGS=$oldcflags
325         LIBS=$oldlibs
326         CPPFLAGS=$oldcppflags
327         if test x$use_libmad = xyes; then
328                 AC_DEFINE(HAVE_MAD,1,[Define to use libmad])
329         else
330                 enable_mp3=no
331         fi
334 if test x$enable_mpc = xyes; then
335         if test "x$mpcdec_libraries" != "x" ; then
336                 MPCDEC_LIBS="-L$mpcdec_libraries"
337         elif test "x$mpcdec_prefix" != "x" ; then
338                 MPCDEC_LIBS="-L$mpcdec_prefix/lib"
339         fi
341         MPCDEC_LIBS="$MPCDEC_LIBS -lmpcdec"
343         if test "x$mpcdec_includes" != "x" ; then
344                 MPCDEC_CFLAGS="-I$mpcdec_includes"
345         elif test "x$mpcdec_prefix" != "x" ; then
346                 MPCDEC_CFLAGS="-I$mpcdec_prefix/include"
347         fi
349         oldcflags=$CFLAGS
350         oldlibs=$LIBS
351         oldcppflags=$CPPFLAGS
352         CFLAGS="$CFLAGS $MPD_CFLAGS $MPCDEC_CFLAGS -I."
353         LIBS="$LIBS $MPD_LIBS $MPCDEC_LIBS"
354         CPPFLAGS=$CFLAGS
355         AC_CHECK_HEADER(mpcdec/mpcdec.h,,enable_mpc=no)
356         if test x$enable_mpc = xyes; then
357                 AC_CHECK_LIB(mpcdec,main,[MPD_LIBS="$MPD_LIBS $MPCDEC_LIBS";MPD_CFLAGS="$MPD_CFLAGS $MPCDEC_CFLAGS";],enable_mpc=no)
358         fi
359         if test x$enable_mpc = xyes; then
360                 AC_DEFINE(HAVE_MPCDEC,1,[Define to use libmpcdec for MPC decoding])
361         else
362                 AC_MSG_WARN([mpcdec lib needed for MPC support -- disabling MPC support])
363         fi
364         CFLAGS=$oldcflags
365         LIBS=$oldlibs
366         CPPFLAGS=$oldcppflags
369 if test x$enable_wavpack = xyes; then
370         PKG_CHECK_MODULES([WAVPACK], [wavpack],
371                           [enable_wavpack=yes;AC_DEFINE([HAVE_WAVPACK], 1, [Define to enable WavPack support])] MPD_LIBS="$MPD_LIBS $WAVPACK_LIBS" MPD_CFLAGS="$MPD_CFLAGS $WAVPACK_CFLAGS",
372                           [enable_wavpack=no;AC_MSG_WARN([WavPack not found -- disabling])])
375 MP4FF_SUBDIR=""
377 if test x$enable_aac = xyes; then
378         if test "x$faad_libraries" != "x" ; then
379                 FAAD_LIBS="-L$faad_libraries"
380         elif test "x$faad_prefix" != "x" ; then
381                 FAAD_LIBS="-L$faad_prefix/lib"
382         fi
384         FAAD_LIBS="$FAAD_LIBS -lfaad"
386         if test "x$faad_includes" != "x" ; then
387                 FAAD_CFLAGS="-I$faad_includes"
388         elif test "x$faad_prefix" != "x" ; then
389                 FAAD_CFLAGS="-I$faad_prefix/include"
390         fi
392         oldcflags=$CFLAGS
393         oldlibs=$LIBS
394         oldcppflags=$CPPFLAGS
395         CFLAGS="$CFLAGS $MPD_CFLAGS $FAAD_CFLAGS -I."
396         LIBS="$LIBS $MPD_LIBS $FAAD_LIBS"
397         CPPFLAGS=$CFLAGS
398         AC_CHECK_HEADER(faad.h,,enable_aac=no)
399         if test x$enable_aac = xyes; then
400                 AC_CHECK_DECL(FAAD2_VERSION,,enable_aac=no,[#include <faad.h>])
401         fi
402         if test x$enable_aac = xyes; then
403                 AC_CHECK_DECL(faacDecInit2,,enable_aac=no,[#include <faad.h>])
404         fi
405         if test x$enable_aac = xyes; then
406                 AC_CHECK_LIB(faad,faacDecInit2,[MPD_LIBS="$MPD_LIBS $FAAD_LIBS";MPD_CFLAGS="$MPD_CFLAGS $FAAD_CFLAGS";MP4FF_SUBDIR="mp4ff";MP4FF_LIB="mp4ff/libmp4ff.la"],enable_aac=no)
407                 if test x$enable_aac = xno; then
408                         enable_aac=yes
409                         AC_CHECK_LIB(faad,NeAACDecInit2,[MPD_LIBS="$MPD_LIBS $FAAD_LIBS";MPD_CFLAGS="$MPD_CFLAGS $FAAD_CFLAGS";MP4FF_SUBDIR="mp4ff";MP4FF_LIB="mp4ff/libmp4ff.la"],enable_aac=no)
410                 fi
411         fi
412         if test x$enable_aac = xyes; then
413                 AC_MSG_CHECKING(that FAAD2 uses buffer and bufferlen)
414                 AC_COMPILE_IFELSE([
415 #include <faad.h>
417 int main() {
418         char buffer;
419         long bufferlen = 0;
420         faacDecHandle decoder;
421         faacDecFrameInfo frameInfo;
422         faacDecConfigurationPtr config;
423         unsigned char channels;
424         long sampleRate;
425         mp4AudioSpecificConfig mp4ASC;
427         decoder = faacDecOpen();
428         config = faacDecGetCurrentConfiguration(decoder);
429         config->outputFormat = FAAD_FMT_16BIT;
430         faacDecSetConfiguration(decoder,config);
431         AudioSpecificConfig(&buffer, bufferlen, &mp4ASC);
432         faacDecInit(decoder,&buffer,bufferlen,&sampleRate,&channels);
433         faacDecInit2(decoder,&buffer,bufferlen,&sampleRate,&channels);
434         faacDecDecode(decoder,&frameInfo,&buffer,bufferlen);
436         return 0;
438 ],[AC_MSG_RESULT(yes);AC_DEFINE(HAVE_FAAD_BUFLEN_FUNCS,1,[Define if FAAD2 uses buflen in function calls])],[AC_MSG_RESULT(no);
439                 AC_MSG_CHECKING(that FAAD2 can even be used)
440                 AC_COMPILE_IFELSE([
441 #include <faad.h>
443 int main() {
444         char buffer;
445         faacDecHandle decoder;
446         faacDecFrameInfo frameInfo;
447         faacDecConfigurationPtr config;
448         unsigned char channels;
449         long sampleRate;
450         long bufferlen = 0;
451         unsigned long dummy1_32;
452         unsigned char dummy2_8, dummy3_8, dummy4_8, dummy5_8, dummy6_8,
453                                 dummy7_8, dummy8_8;
455         decoder = faacDecOpen();
456         config = faacDecGetCurrentConfiguration(decoder);
457         config->outputFormat = FAAD_FMT_16BIT;
458         faacDecSetConfiguration(decoder,config);
459         AudioSpecificConfig(&buffer,&dummy1_32,&dummy2_8,
460                                 &dummy3_8,&dummy4_8,&dummy5_8,
461                                 &dummy6_8,&dummy7_8,&dummy8_8);
462         faacDecInit(decoder,&buffer,&sampleRate,&channels);
463         faacDecInit2(decoder,&buffer,bufferlen,&sampleRate,&channels);
464         faacDecDecode(decoder,&frameInfo,&buffer);
465         faacDecClose(decoder);
467         return 0;
469 ],AC_MSG_RESULT(yes),[AC_MSG_RESULT(no);enable_aac=no])
470                 ])
471         fi
472         if test x$enable_aac = xyes; then
473                 AC_CHECK_TYPES(mp4AudioSpecificConfig,,,[#include <faad.h>])
474                 AC_CHECK_MEMBERS([faacDecConfiguration.downMatrix,faacDecConfiguration.dontUpSampleImplicitSBR,faacDecFrameInfo.samplerate],,,[#include <faad.h>])
475                 AC_DEFINE(HAVE_FAAD,1,[Define to use FAAD2 for AAC decoding])
476         else
477                 AC_MSG_WARN([faad2 lib needed for MP4/AAC support -- disabling MP4/AAC support])
478         fi
479         CFLAGS=$oldcflags
480         LIBS=$oldlibs
481         CPPFLAGS=$oldcppflags
484 if test x$use_tremor = xyes; then
485         if test "x$tremor_libraries" != "x" ; then
486                 TREMOR_LIBS="-L$tremor_libraries"
487         elif test "x$tremor_prefix" != "x" ; then
488                 TREMOR_LIBS="-L$tremor_prefix/lib"
489         fi
490         TREMOR_LIBS="$TREMOR_LIBS -lvorbisidec"
491         if test "x$tremor_includes" != "x" ; then
492                 TREMOR_CFLAGS="-I$tremor_includes"
493         elif test "x$tremor_prefix" != "x" ; then
494                 TREMOR_CFLAGS="-I$tremor_prefix/include"
495         fi
496         ac_save_CFLAGS="$CFLAGS"
497         ac_save_LIBS="$LIBS"
498         CFLAGS="$CFLAGS $TREMOR_CFLAGS"
499         LIBS="$LIBS $TREMOR_LIBS"
500         AC_CHECK_LIB(vorbisidec,ov_read,enable_oggvorbis=yes,enable_oggvorbis=no;AC_MSG_WARN([vorbisidec lib needed for ogg support with tremor -- disabling ogg support]))
501         if test x$enable_oggvorbis = xno; then
502                 CFLAGS="$ac_save_CFLAGS"
503                 LIBS="$ac_save_LIBS"
504         fi
505 elif test x$enable_oggvorbis = xyes; then
506         XIPH_PATH_OGG(,enable_oggvorbis=no)
507         XIPH_PATH_VORBIS(,enable_oggvorbis=no)
508         if test x$enable_oggvorbis = xyes; then
509                 MPD_LIBS="$MPD_LIBS $OGG_LIBS $VORBIS_LIBS $VORBISFILE_LIBS"
510                 MPD_CFLAGS="$MPD_CFLAGS $OGG_CFLAGS $VORBIS_CFLAGS"
512                 if test x$enable_shout = xyes; then
513                         MPD_LIBS="$MPD_LIBS $VORBISENC_LIBS"
514                         MPD_CFLAGS="$MPD_CFLAGS $VORBISFILE_CFLAGS $VORBISENC_CFLAGS"
515                 fi
516         fi
519 if test x$enable_oggvorbis = xyes; then
520         AC_DEFINE(HAVE_OGGVORBIS,1,[Define for Ogg Vorbis support])
523 if test x$use_tremor = xyes; then
524         AC_DEFINE(HAVE_TREMOR,1,[Define to use tremor (libvorbisidec) for ogg support])
525         if test x$enable_oggflac = xyes; then
526                 AC_MSG_WARN([disabling OggFLAC support because it is incompatible with tremor])
527                 enable_oggflac=no
528         fi
531 if test x$enable_flac = xyes; then
532         oldmpdcflags="$MPD_CFLAGS"
533         oldmpdlibs="$MPD_LIBS"
534         AM_PATH_LIBFLAC(MPD_LIBS="$MPD_LIBS $LIBFLAC_LIBS" MPD_CFLAGS="$MPD_CFLAGS $LIBFLAC_CFLAGS",enable_flac=no)
538 if test x$enable_flac = xyes; then
539         oldcflags="$CFLAGS"
540         oldlibs="$LIBS"
541         CFLAGS="$CFLAGS $MPD_CFLAGS"
542         LIBS="$LIBS $MPD_LIBS"
543         AC_CHECK_LIB(FLAC, FLAC__metadata_object_vorbiscomment_find_entry_from,
544                   ,[enable_flac=no;AC_MSG_WARN(You need FLAC 1.1 -- disabling flac support)])
545         if test x$enable_flac = xno; then
546                 MPD_CFLAGS="$oldmpdcflags"
547                 MPD_LIBS="$oldmpdlibs"
548         else
549                 AC_CHECK_DECL(FLAC_API_SUPPORTS_OGG_FLAC,
550                               [enable_oggflac=flac], [],
551                               [#include <FLAC/export.h>])
552         fi
553         CFLAGS="$oldcflags"
554         LIBS="$oldlibs"
558 if test x$enable_flac = xyes; then
559         AC_DEFINE(HAVE_FLAC,1,[Define for FLAC support])
563 if test x$enable_oggflac = xyes; then
564         oldmpdcflags="$MPD_CFLAGS"
565         oldmpdlibs="$MPD_LIBS"
566         AM_PATH_LIBOGGFLAC(MPD_LIBS="$MPD_LIBS $LIBOGGFLAC_LIBS" MPD_CFLAGS="$MPD_CFLAGS $LIBOGGFLAC_CFLAGS",enable_oggflac=no)
569 if test x$enable_oggflac = xyes; then
570         AC_DEFINE(HAVE_OGGFLAC,1,[Define for OggFLAC support])
574 if test x$enable_audiofile = xyes; then
575         AM_PATH_AUDIOFILE(0.1.7, MPD_LIBS="$MPD_LIBS $AUDIOFILE_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AUDIOFILE_CFLAGS",
576                 [enable_audiofile=no;AC_MSG_WARN(You need audiofile  -- disabling audiofile support)])
579 if test x$enable_audiofile = xyes; then
580         AC_DEFINE(HAVE_AUDIOFILE,1,[Define for audiofile support])
583 if test x$enable_mod = xyes; then
584         AM_PATH_LIBMIKMOD(3.1.7, MPD_CFLAGS="$MPD_CFLAGS $LIBMIKMOD_CFLAGS"
585                 MPD_LIBS="$MPD_LIBS $LIBMIKMOD_LIBS $LIBMIKMOD_LDADD", enable_mod=no)
586         if test x$enable_mod = xyes; then
587                 AC_DEFINE(HAVE_MIKMOD, 1, [Define for mikmod support])
588         fi
591 case $with_zeroconf in
592 no|avahi|bonjour)
593         ;;
595         with_zeroconf=auto
596         ;;
597 esac
599 if test x$with_zeroconf != xno; then
600         if test x$with_zeroconf = xavahi || test x$with_zeroconf = xauto; then
601                 PKG_CHECK_MODULES([AVAHI], [avahi-client],
602                                   [found_avahi=1;AC_DEFINE([HAVE_AVAHI], 1, [Define to enable Avahi Zeroconf support])]
603                                   MPD_LIBS="$MPD_LIBS $AVAHI_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AVAHI_CFLAGS",
604                                   [found_avahi=0])
605         fi
607         if test x$found_avahi = x1; then
608                 with_zeroconf=avahi
609         elif test x$with_zeroconf = xavahi; then
610                 with_zeroconf=no
611         fi
613         if test x$with_zeroconf = xbonjour || test x$with_zeroconf = xauto; then
614                 AC_CHECK_HEADER(dns_sd.h,
615                                 [found_bonjour=1;AC_DEFINE([HAVE_BONJOUR], 1, [Define to enable Bonjour Zeroconf support])],
616                                 [found_bonjour=0])
617                 AC_CHECK_LIB(dns_sd, DNSServiceRegister,
618                              MPD_LIBS="$MPD_LIBS -ldns_sd")
619         fi
621         if test x$found_bonjour = x1; then
622                 with_zeroconf=bonjour
623         elif test x$with_zeroconf = xbonjour; then
624                 with_zeroconf=no
625         fi
627         if test x$with_zeroconf = xauto || test x$with_zeroconf = xno; then
628                 AC_MSG_WARN([No supported Zeroconf backend found, disabling Zeroconf])
629                 with_zeroconf=no
630         else
631                 AC_DEFINE([HAVE_ZEROCONF], 1, [Define to enable Zeroconf support])
632         fi
635 AC_OUTPUT(src/mp4ff/Makefile doc/Makefile src/Makefile Makefile )
637 echo ""
638 echo "########### MPD CONFIGURATION ############"
639 echo ""
641 echo " Playback Support:"
642 if test x$enable_ao = xyes; then
643         echo " libao support .................enabled"
644 else
645         echo " libao support .................disabled"
648 if test x$enable_oss = xyes; then
649         echo " OSS support ...................enabled"
650 else
651         echo " OSS support ...................disabled"
654 if test x$enable_alsa = xyes; then
655         echo " ALSA support ..................enabled"
656 else
657         echo " ALSA support ..................disabled"
660 if test x$enable_jack = xyes; then
661         echo " JACK support ..................enabled"
662 else
663         echo " JACK support ..................disabled"
666 if test x$enable_osx = xyes; then
667         echo " OS X support ..................enabled"
668 else
669         echo " OS X support ..................disabled"
672 if test x$enable_pulse = xyes; then
673         echo " PulseAudio support ............enabled"
674 else
675         echo " PulseAudio support ............disabled"
678 if test x$enable_fifo = xyes; then
679         echo " FIFO support ..................enabled"
680 else
681         echo " FIFO support ..................disabled"
684 if test x$enable_mvp = xyes; then
685         echo " Media MVP support .............enabled"
686 else
687         echo " Media MVP support .............disabled"
690 if test x$enable_shout = xyes; then
691         echo " Shout streaming support .......enabled"
692 else
693         echo " Shout streaming support .......disabled"
696 echo ""
698 if test x$enable_ao = xno &&
699    test x$enable_oss = xno &&
700    test x$enable_shout = xno &&
701    test x$enable_alsa = xno &&
702    test x$enable_osx = xno &&
703    test x$enable_pulse = xno &&
704    test x$enable_jack = xno &&
705    test x$enable_fifo = xno &&
706    test x$enable_mvp = xno; then
707         AC_MSG_ERROR([No Audio Output types configured!])
710 echo " File Format Support:"
712 if test x$enable_id3 = xyes; then
713         echo " ID3 tag support ...............enabled"
714 else
715         echo " ID3 tag support ...............disabled"
718 if test x$enable_mp3 = xyes; then
719         echo " mp3 support ...................enabled"
720 else
721         echo " mp3 support ...................disabled"
724 if test x$enable_oggvorbis = xyes; then
725         echo " Ogg Vorbis support ............enabled"
726         if test x$use_tremor = xyes; then
727                 echo "   using tremor.................yes"
728         else
729                 echo "   using tremor.................no"
730         fi
731 else
732         echo " Ogg Vorbis support ............disabled"
735 if test x$enable_flac = xyes; then
736         echo " FLAC support ..................enabled"
737 else
738         echo " FLAC support ..................disabled"
741 case $enable_oggflac in
742 yes)
743         echo " OggFLAC support ...............enabled"
744         ;;
745 flac)
746         echo " OggFLAC support ...............enabled(FLAC 1.1.3)"
747         ;;
749         echo " OggFLAC support ...............disabled"
750         ;;
751 esac
753 if test x$enable_audiofile = xyes; then
754         echo " Wave file support .............enabled"
755 else
756         echo " Wave file support .............disabled"
759 if test x$enable_aac = xyes; then
760         echo " MP4/AAC support ...............enabled"
761 else
762         echo " MP4/AAC support ...............disabled"
765 if test x$enable_mpc = xyes; then
766         echo " Musepack (MPC) support ........enabled"
767 else
768         echo " Musepack (MPC) support ........disabled"
771 if test x$enable_wavpack = xyes; then
772         echo " WavPack support ...............enabled"
773 else
774         echo " WavPack support ...............disabled"
777 if test x$enable_mod = xyes; then
778         echo " MOD support ...................enabled"
779 else
780         echo " MOD support ...................disabled"
784         test x$enable_mp3 = xno &&
785         test x$enable_oggvorbis = xno &&
786         test x$enable_flac = xno && 
787         test x$enable_oggflac = xno &&
788         test x$enable_audiofile = xno && 
789         test x$enable_aac = xno &&
790         test x$enable_mpc = xno &&
791         test x$enable_wavpack = xno &&
792         test x$enable_mod = xno; then
793         AC_MSG_ERROR([No input plugins supported!])
796 echo ""
797 echo " Other features:"
799 if test x$enable_lsr = xyes; then
800         echo " libsamplerate support .........enabled"
801 else
802         echo " libsamplerate support .........disabled"
804                 
806 if test x$with_zeroconf != xno; then
807         echo " Zeroconf support ..............$with_zeroconf"
808 else
809         echo " Zeroconf support ..............disabled"
812 echo ""
813 echo "##########################################"
814 echo ""
815 echo "You are now ready to compile MPD"
816 echo "Type \"make\" to compile MPD"