update: added update_global_init() and update_global_finish()
[mpd-mk/metyl.git] / configure.ac
blob95dac9bd9cc3064695ce45df1d328479abf89f37
1 AC_PREREQ(2.60)
2 AC_INIT(mpd, 0.14~beta1, musicpd-dev-team@lists.sourceforge.net)
3 AC_CONFIG_SRCDIR([src/main.c])
4 AM_INIT_AUTOMAKE([foreign 1.9 dist-bzip2])
5 AM_CONFIG_HEADER(config.h)
6 AC_CONFIG_MACRO_DIR([m4])
8 AC_SUBST(MPD_LIBS)
9 AC_SUBST(MPD_CFLAGS)
11 AC_PROG_CC_C99
12 AC_PROG_INSTALL
13 AC_PROG_MAKE_SET
15 AC_DEFINE(PROTOCOL_VERSION, "0.14.0", [The mpd protocol version])
17 MPD_LIBS=""
18 MPD_CFLAGS=""
20 if test -z "$prefix" || test "x$prefix" = xNONE; then
21         local_lib=
22         local_include=
24         # aren't autotools supposed to be smart enough to figure this out?  oh
25         # well, the git-core Makefile managed to do some of the work for us :)
26         case "$host_os" in
27         darwin*)
28                 local_lib='/sw/lib /opt/local/lib'
29                 local_include='/sw/include /opt/local/include'
30                 ;;
31         freebsd* | openbsd*)
32                 local_lib=/usr/local/lib
33                 local_include=/usr/local/include
34                 ;;
35         netbsd*)
36                 local_lib=/usr/pkg/lib
37                 local_include=/usr/pkg/include
38                 LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/pkg/lib"
39                 ;;
40         esac
42         for d in $local_lib; do
43                 if test -d "$d"; then
44                         LDFLAGS="$LDFLAGS -L$d"
45                         break
46                 fi
47         done
48         for d in $local_include; do
49                 if test -d "$d"; then
50                         CFLAGS="$CFLAGS -I$d"
51                         break
52                 fi
53         done
57 dnl
58 dnl build options
59 dnl
61 AC_ARG_ENABLE(werror,
62         AS_HELP_STRING([--enable-werror],
63                 [Treat warnings as errors (default: disabled)]),
64         ENABLE_WERROR=$enableval,
65         ENABLE_WERROR=no)
67 AC_ARG_ENABLE(debug,
68         AS_HELP_STRING([--enable-debug],
69                 [Enable debugging (default: disabled)]),
70         ENABLE_DEBUG=$enableval,
71         ENABLE_DEBUG=no)
73 AC_ARG_ENABLE(gprof,
74         AS_HELP_STRING([--enable-gprof],
75                 [Enable profiling via gprof (default: disabled)]),
76         ENABLE_GPROF=$enableval,
77         ENABLE_GPROF=no)
80 dnl
81 dnl protocol options
82 dnl
84 AC_ARG_ENABLE(ipv6,
85         AS_HELP_STRING([--disable-ipv6],
86                 [disable IPv6 support (default: enable)]),
87         [enable_ipv6=$enableval],
88         [enable_ipv6=yes])
90 AC_ARG_ENABLE(tcp,
91         AS_HELP_STRING([--disable-tcp],
92                 [disable support for clients connecting via TCP (default: enable)]),
93         [enable_tcp=$enableval],
94         [enable_tcp=yes])
96 AC_ARG_ENABLE(un,
97         AS_HELP_STRING([--enable-un],
98                 [enable support for clients connecting via unix domain sockets (default: disable)]),
99         [enable_un=$enableval],
100         [enable_un=yes])
104 dnl input options
107 AC_ARG_ENABLE(curl,
108         AS_HELP_STRING([--disable-curl],
109                 [enable support obtaining song data via HTTP (default: enable)]),
110         [enable_curl=$enableval],
111         [enable_curl=yes])
115 dnl audio output plugins
118 AC_ARG_ENABLE(ao,
119         AS_HELP_STRING([--enable-ao],
120                 [enable support for libao (default: disable)]),
121         enable_ao=$enableval,
122         enable_ao=no)
124 AC_ARG_ENABLE(shout_ogg,
125         AS_HELP_STRING([--disable-shout_ogg],
126                 [disable support for ogg streaming through shout (default: enable)]),
127         [enable_shout_ogg=$enableval],
128         [enable_shout_ogg=yes])
130 AC_ARG_ENABLE(shout_mp3,
131         AS_HELP_STRING([--disable-shout_mp3],
132                 [disable support for mp3 streaming through shout (default: enable)]),
133         [enable_shout_mp3=$enableval],
134         [enable_shout_mp3=yes])
136 AC_ARG_ENABLE(oss,
137         AS_HELP_STRING([--disable-oss],
138                 [disable OSS support (default: enable)]),
139         enable_oss=$enableval,
140         enable_oss=yes)
142 AC_ARG_ENABLE(alsa,
143         AS_HELP_STRING([--disable-alsa],
144                 [disable ALSA support (default: enable)]),
145         enable_alsa=$enableval,
146         enable_alsa=yes)
148 AC_ARG_ENABLE(jack,
149         AS_HELP_STRING([--disable-jack],
150                 [disable jack support (default: enable)]),
151         enable_jack=$enableval,
152         enable_jack=yes)
154 AC_ARG_ENABLE(pulse,
155         AS_HELP_STRING([--disable-pulse],
156                 [disable support for the PulseAudio sound server (default: enable)]),
157         enable_pulse=$enableval,
158         enable_pulse=yes)
160 AC_ARG_ENABLE(fifo,
161         AS_HELP_STRING([--disable-fifo],
162                 [disable support for writing audio to a FIFO (default: enable)]),
163         enable_fifo=$enableval,
164         enable_fifo=yes)
166 AC_ARG_ENABLE(mvp,
167         AS_HELP_STRING([--enable-mvp],
168                 [enable support for Hauppauge Media MVP (default: disable)]),
169         enable_mvp=$enableval,
170         enable_mvp=no)
174 dnl decoder plugins
177 AC_ARG_ENABLE(oggvorbis,
178         AS_HELP_STRING([--disable-oggvorbis],
179                 [disable Ogg Vorbis support (default: enable)]),
180         enable_oggvorbis=$enableval,
181         enable_oggvorbis=yes)
183 AC_ARG_ENABLE(oggflac,
184         AS_HELP_STRING([--disable-oggflac],
185                 [disable OggFLAC support (default: enable)]),
186         enable_oggflac=$enableval,
187         enable_oggflac=yes)
189 AC_ARG_ENABLE(flac,
190         AS_HELP_STRING([--disable-flac],
191                 [disable flac support (default: enable)]),
192         enable_flac=$enableval,
193         enable_flac=yes)
195 AC_ARG_ENABLE(mp3,
196         AS_HELP_STRING([--disable-mp3],
197                 [disable mp3 support (default: enable)]),
198         enable_mp3=$enableval,
199         enable_mp3=yes)
201 AC_ARG_ENABLE(lame,
202         AS_HELP_STRING([--disable-lame],
203                 [disable lame support (default: enable)]),
204         enable_lame=$enableval,
205         enable_lame=yes)
207 AC_ARG_ENABLE(aac,
208         AS_HELP_STRING([--disable-aac],
209                 [disable AAC support (default: enable)]),
210         enable_aac=$enableval,
211         enable_aac=yes)
213 AC_ARG_ENABLE(audiofile,
214         AS_HELP_STRING([--disable-audiofile],
215                 [disable audiofile support, disables wave support (default: enable)]),
216         enable_audiofile=$enableval,
217         enable_audiofile=yes)
219 AC_ARG_ENABLE(mod,
220         AS_HELP_STRING([--enable-mod],
221                 [enable MOD support (default: disable)]),
222         enable_mod=$enableval,
223         enable_mod=yes)
225 AC_ARG_ENABLE(mpc,
226         AS_HELP_STRING([--disable-mpc],
227                 [disable musepack (MPC) support (default: enable)]),
228         enable_mpc=$enableval,
229         enable_mpc=yes)
231 AC_ARG_ENABLE(wavpack,
232         AS_HELP_STRING([--disable-wavpack],
233                 [disable WavPack support (default: enable)]),
234         enable_wavpack=$enableval,
235         enable_wavpack=yes)
237 AC_ARG_ENABLE(ffmpeg,
238         AS_HELP_STRING([--disable-ffmpeg],
239                 [enable FFMPEG support (default: enable)]),
240         enable_ffmpeg=$enableval,
241         enable_ffmpeg=yes)
243 AC_ARG_ENABLE(id3,
244         AS_HELP_STRING([--disable-id3],
245                 [disable id3 support (default: enable)]),
246         enable_id3=$enableval,
247         enable_id3=yes)
249 AC_ARG_ENABLE(lsr,
250         AS_HELP_STRING([--disable-lsr],
251                 [disable libsamplerate support (default: enable)]),
252         enable_lsr=$enableval,
253         enable_lsr=yes)
256 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",)
257 AC_ARG_WITH(tremor-libraries,[  --with-tremor-libraries=DIR Directory where Tremor library is installed (optional)], tremor_libraries="$withval", tremor_libraries="")
258 AC_ARG_WITH(tremor-includes,[  --with-tremor-includes=DIR  Directory where Tremor header files are installed (optional)], tremor_includes="$withval", tremor_includes="")
260 AC_ARG_WITH(faad,[  --with-faad=PFX             Prefix where faad2 is installed], faad_prefix="$withval", faad_prefix="")
261 AC_ARG_WITH(faad-libraries,[  --with-faad-libraries=DIR   Directory where faad2 library is installed (optional)], faad_libraries="$withval", faad_libraries="")
262 AC_ARG_WITH(faad-includes,[  --with-faad-includes=DIR    Directory where faad2 header files are installed (optional)], faad_includes="$withval", faad_includes="")
263 AC_ARG_WITH(zeroconf,[[  --with-zeroconf=[auto|avahi|bonjour|no]    Enable zeroconf backend (default=auto)]], with_zeroconf="$withval", with_zeroconf="auto")
265 AC_C_BIGENDIAN
267 AC_CHECK_HEADER(sys/inttypes.h,AC_DEFINE(HAVE_SYS_INTTYPES_H,1,[Define if sys/inttypes.h present]),)
269 AC_CHECK_LIB(socket,socket,MPD_LIBS="$MPD_LIBS -lsocket",)
270 AC_CHECK_LIB(nsl,gethostbyname,MPD_LIBS="$MPD_LIBS -lnsl",)
272 AC_CHECK_LIB(m,exp,MPD_LIBS="$MPD_LIBS -lm",)
273 AC_CHECK_FUNCS(setenv)
275 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.4 gthread-2.0],,
276                   [AC_MSG_ERROR([glib-2.4 is required])])
278 dnl doesn't work for systems that don't have CODESET like OpenBSD
279 dnl AC_CHECK_HEADER(langinfo.h,[enable_langinfo=yes;AC_DEFINE(HAVE_LANGINFO,1,[Define if nl_langinfo.h is present])],enable_langinfo=no)
280 AM_LANGINFO_CODESET
281 AC_CHECK_HEADER(locale.h,[enable_locale=yes;AC_DEFINE(HAVE_LOCALE,1,[Define if locale.h is present])],enable_locale=no)
283 ACX_PTHREAD([CC="$PTHREAD_CC"
284              LIBS="$PTHREAD_LIBS $LIBS"
285              CFLAGS="$PTHREAD_CFLAGS $CFLAGS"])
287 if test x$enable_tcp = xno; then
288         # if we don't support TCP, we don't need IPv6 either
289         enable_ipv6=no
292 if test x$enable_ipv6 = xyes; then
293         AC_MSG_CHECKING(for ipv6)
294         AC_EGREP_CPP([AP_maGiC_VALUE],
295         [
296 #include <sys/types.h>
297 #include <sys/socket.h>
298 #include <netdb.h>
299 #ifdef PF_INET6
300 #ifdef AF_INET6
301 AP_maGiC_VALUE
302 #endif
303 #endif
304         ],
305         AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 support present])
306         AC_MSG_RESULT([yes]),
307         AC_MSG_RESULT([no])
311 if test x$enable_tcp = xyes; then
312         AC_DEFINE(HAVE_TCP, 1, [Define if TCP socket support is enabled])
315 if test x$enable_un = xyes; then
316         AC_DEFINE(HAVE_UN, 1, [Define if unix domain socket support is enabled])
317         STRUCT_UCRED
320 enable_osx=no
321 case $host in
322         *-darwin*)
323                 AC_DEFINE(HAVE_OSX, 1, [Define for compiling OS X support])
324                 MPD_LIBS="$MPD_LIBS -framework AudioUnit -framework CoreServices"
325                 enable_osx=yes ;;
326 esac
328 AM_CONDITIONAL(HAVE_OSX, test x$enable_osx = xyes)
330 if test x$enable_curl = xyes; then
331         PKG_CHECK_MODULES(CURL, [libcurl],
332                 AC_DEFINE(HAVE_CURL, 1, [Define when libcurl is used for HTTP streaming]),
333                 enable_curl=no)
335 AM_CONDITIONAL(HAVE_CURL, test x$enable_curl = xyes)
337 if test x$enable_shout_ogg = xyes || test x$enable_shout_mp3 = xyes; then
338         enable_shout=yes
339         PKG_CHECK_MODULES([SHOUT], [shout],
340                 AC_DEFINE(HAVE_SHOUT, 1, [Define to enable libshout support]),
341                 enable_shout=no)
344 if test x$enable_shout_ogg = xyes; then
345         if test x$enable_oggvorbis = xno; then
346                 AC_MSG_WARN([disabling ogg shout streaming support because vorbis is not enabled])
347                 enable_shout_ogg=no
348         fi
349         if test x$use_tremor = xyes; then
350                 AC_MSG_WARN([disabling ogg shout streaming support because tremor does not support vorbis encoding])
351                 enable_shout_ogg=no
352         fi
353         if test x$enable_shout = xno; then
354                 AC_MSG_WARN([disabling ogg shout streaming support because libshout is not found])
355                 enable_shout_ogg=no
356         fi
357         if test x$enable_shout_ogg = xyes; then
358                 PKG_CHECK_MODULES(VORBISENC, [vorbisenc],
359                         AC_DEFINE(HAVE_SHOUT_OGG, 1, [Define to enable ogg streaming support]),
360                         enable_shout_ogg=no)
361         fi
364 if test x$enable_shout_mp3 = xyes; then
365         if test x$enable_lame = xno; then
366                 AC_MSG_WARN([disabling mp3 shout streaming support because lame is not enabled])
367                 enable_shout_mp3=no
368         fi
369         if test x$enable_shout = xno; then
370                 AC_MSG_WARN([disabling mp3 shout streaming support because libshout is not found])
371                 enable_shout_mp3=no
372         fi
373         if test x$enable_shout_mp3 = xyes; then
374                 AC_DEFINE(HAVE_SHOUT_MP3, 1, [Define to enable mp3 streaming support])
375         fi
378 AM_CONDITIONAL(HAVE_SHOUT, test x$enable_shout = xyes)
379 AM_CONDITIONAL(HAVE_SHOUT_OGG, test x$enable_shout_ogg = xyes)
380 AM_CONDITIONAL(HAVE_SHOUT_MP3, test x$enable_shout_mp3 = xyes)
382 if test x$enable_ao = xyes; then
383         PKG_CHECK_MODULES(AO, [ao],
384                 AC_DEFINE(HAVE_AO, 1, [Define to play with ao]),
385                 enable_ao=no)
388 AM_CONDITIONAL(HAVE_AO, test x$enable_ao = xyes)
390 if test x$enable_oss = xyes; then
391         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])
394 AM_CONDITIONAL(HAVE_OSS, test x$enable_oss = xyes)
396 PKG_PROG_PKG_CONFIG
398 if test x$enable_pulse = xyes; then
399         PKG_CHECK_MODULES([PULSE], [libpulse-simple],
400                           [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",
401                           [enable_pulse=no;AC_MSG_WARN([PulseAudio not found -- disabling])])
404 AM_CONDITIONAL(HAVE_PULSE, test x$enable_pulse = xyes)
406 if test x$enable_lsr = xyes; then
407         PKG_CHECK_MODULES([SAMPLERATE], [samplerate >= 0.0.15],
408                           [enable_lsr=yes;AC_DEFINE([HAVE_LIBSAMPLERATE], 1, [Define to enable libsamplerate])] MPD_LIBS="$MPD_LIBS $SAMPLERATE_LIBS" MPD_CFLAGS="$MPD_CFLAGS $SAMPLERATE_CFLAGS",
409                           [enable_lsr=no;AC_MSG_WARN([libsamplerate not found -- disabling])])
412 if test x$enable_lsr = xyes; then
413         PKG_CHECK_MODULES([SAMPLERATE_013], [samplerate >= 0.1.3],,
414                 [AC_DEFINE([HAVE_LIBSAMPLERATE_NOINT], 1, [libsamplerate doesn't provide src_int_to_float_array() (<0.1.3)])])
417 AM_CONDITIONAL(HAVE_LIBSAMPLERATE, test x$enable_lsr = xyes)
419 if test x$enable_fifo = xyes; then
420         AC_CHECK_FUNC([mkfifo],
421                       [enable_fifo=yes;AC_DEFINE([HAVE_FIFO], 1, [Define to enable support for writing audio to a FIFO])],
422                       [enable_fifo=no;AC_MSG_WARN([mkfifo not found -- disabling support for writing audio to a FIFO])])
425 AM_CONDITIONAL(HAVE_FIFO, test x$enable_fifo = xyes)
427 if test x$enable_mvp = xyes; then
428    AC_DEFINE(HAVE_MVP,1,[Define to enable Hauppauge Media MVP support])
431 AM_CONDITIONAL(HAVE_MVP, test x$enable_mvp = xyes)
433 if test x$enable_alsa = xyes; then
434         PKG_CHECK_MODULES(ALSA, [alsa >= 0.9.0],
435                 AC_DEFINE(HAVE_ALSA, 1, [Define to enable ALSA support]),
436                 enable_alsa=no)
439 AM_CONDITIONAL(HAVE_ALSA, test x$enable_alsa = xyes)
441 if test x$enable_jack = xyes; then
442         PKG_CHECK_MODULES([JACK], [jack >= 0.4],
443                           [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",
444                           [enable_jack=no;AC_MSG_WARN([JACK not found -- disabling])])
447 AM_CONDITIONAL(HAVE_JACK, test x$enable_jack = xyes)
449 if test x$enable_id3 = xyes; then
450         PKG_CHECK_MODULES([ID3TAG], [id3tag],
451                 AC_DEFINE(HAVE_ID3TAG, 1, [Define to use id3tag]),
452                 enable_id3=no)
455 AM_CONDITIONAL(HAVE_ID3TAG, test x$enable_id3 = xyes)
457 if test x$enable_mp3 = xyes; then
458         PKG_CHECK_MODULES([MAD], [mad],
459                 AC_DEFINE(HAVE_MAD, 1, [Define to use libmad]),
460                 enable_mp3=no)
463 AM_CONDITIONAL(HAVE_MAD, test x$enable_mp3 = xyes)
465 if test x$enable_lame = xyes; then
466         AM_PATH_LAME([MPD_LIBS="$MPD_LIBS $LAME_LIBS" MPD_CFLAGS="$MPD_CFLAGS $LAME_CFLAGS"],
467                      [enable_lame=no;AC_MSG_WARN(You need lame -- disabling lame support)])
471 if test x$enable_mpc = xyes; then
472         if test "x$mpcdec_libraries" != "x" ; then
473                 MPCDEC_LIBS="-L$mpcdec_libraries"
474         elif test "x$mpcdec_prefix" != "x" ; then
475                 MPCDEC_LIBS="-L$mpcdec_prefix/lib"
476         fi
478         MPCDEC_LIBS="$MPCDEC_LIBS -lmpcdec"
480         if test "x$mpcdec_includes" != "x" ; then
481                 MPCDEC_CFLAGS="-I$mpcdec_includes"
482         elif test "x$mpcdec_prefix" != "x" ; then
483                 MPCDEC_CFLAGS="-I$mpcdec_prefix/include"
484         fi
486         oldcflags=$CFLAGS
487         oldlibs=$LIBS
488         oldcppflags=$CPPFLAGS
489         CFLAGS="$CFLAGS $MPD_CFLAGS $MPCDEC_CFLAGS -I."
490         LIBS="$LIBS $MPD_LIBS $MPCDEC_LIBS"
491         CPPFLAGS=$CFLAGS
492         AC_CHECK_HEADER(mpcdec/mpcdec.h,,enable_mpc=no)
493         if test x$enable_mpc = xyes; then
494                 AC_CHECK_LIB(mpcdec,main,[MPD_LIBS="$MPD_LIBS $MPCDEC_LIBS";MPD_CFLAGS="$MPD_CFLAGS $MPCDEC_CFLAGS";],enable_mpc=no)
495         fi
496         if test x$enable_mpc = xyes; then
497                 AC_DEFINE(HAVE_MPCDEC,1,[Define to use libmpcdec for MPC decoding])
498         else
499                 AC_MSG_WARN([mpcdec lib needed for MPC support -- disabling MPC support])
500         fi
501         CFLAGS=$oldcflags
502         LIBS=$oldlibs
503         CPPFLAGS=$oldcppflags
506 AM_CONDITIONAL(HAVE_MPCDEC, test x$enable_mpc = xyes)
508 if test x$enable_wavpack = xyes; then
509         PKG_CHECK_MODULES([WAVPACK], [wavpack],
510                           [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",
511                           [enable_wavpack=no;AC_MSG_WARN([WavPack not found -- disabling])])
514 AM_CONDITIONAL(HAVE_WAVPACK, test x$enable_wavpack = xyes)
516 if test x$enable_aac = xyes; then
517         if test "x$faad_libraries" != "x" ; then
518                 FAAD_LIBS="-L$faad_libraries"
519         elif test "x$faad_prefix" != "x" ; then
520                 FAAD_LIBS="-L$faad_prefix/lib"
521         fi
523         FAAD_LIBS="$FAAD_LIBS -lfaad"
525         if test "x$faad_includes" != "x" ; then
526                 FAAD_CFLAGS="-I$faad_includes"
527         elif test "x$faad_prefix" != "x" ; then
528                 FAAD_CFLAGS="-I$faad_prefix/include"
529         fi
531         oldcflags=$CFLAGS
532         oldlibs=$LIBS
533         oldcppflags=$CPPFLAGS
534         CFLAGS="$CFLAGS $MPD_CFLAGS $FAAD_CFLAGS -I."
535         LIBS="$LIBS $MPD_LIBS $FAAD_LIBS"
536         CPPFLAGS=$CFLAGS
537         AC_CHECK_HEADER(faad.h,,enable_aac=no)
538         if test x$enable_aac = xyes; then
539                 AC_CHECK_DECL(FAAD2_VERSION,,enable_aac=no,[#include <faad.h>])
540         fi
541         if test x$enable_aac = xyes; then
542                 AC_CHECK_DECL(faacDecInit2,,enable_aac=no,[#include <faad.h>])
543         fi
544         if test x$enable_aac = xyes; then
545                 AC_CHECK_LIB(faad,faacDecInit2,[MPD_LIBS="$MPD_LIBS $FAAD_LIBS";MPD_CFLAGS="$MPD_CFLAGS $FAAD_CFLAGS"],enable_aac=no)
546                 if test x$enable_aac = xno; then
547                         enable_aac=yes
548                         AC_CHECK_LIB(faad,NeAACDecInit2,[MPD_LIBS="$MPD_LIBS $FAAD_LIBS";MPD_CFLAGS="$MPD_CFLAGS $FAAD_CFLAGS"],enable_aac=no)
549                 fi
550         fi
551         if test x$enable_aac = xyes; then
552                 AC_MSG_CHECKING(that FAAD2 uses buffer and bufferlen)
553                 AC_COMPILE_IFELSE([
554 #include <faad.h>
556 int main() {
557         char buffer;
558         long bufferlen = 0;
559         faacDecHandle decoder;
560         faacDecFrameInfo frameInfo;
561         faacDecConfigurationPtr config;
562         unsigned char channels;
563         long sampleRate;
564         mp4AudioSpecificConfig mp4ASC;
566         decoder = faacDecOpen();
567         config = faacDecGetCurrentConfiguration(decoder);
568         config->outputFormat = FAAD_FMT_16BIT;
569         faacDecSetConfiguration(decoder,config);
570         AudioSpecificConfig(&buffer, bufferlen, &mp4ASC);
571         faacDecInit(decoder,&buffer,bufferlen,&sampleRate,&channels);
572         faacDecInit2(decoder,&buffer,bufferlen,&sampleRate,&channels);
573         faacDecDecode(decoder,&frameInfo,&buffer,bufferlen);
575         return 0;
577 ],[AC_MSG_RESULT(yes);AC_DEFINE(HAVE_FAAD_BUFLEN_FUNCS,1,[Define if FAAD2 uses buflen in function calls])],[AC_MSG_RESULT(no);
578                 AC_MSG_CHECKING(that FAAD2 can even be used)
579                 AC_COMPILE_IFELSE([
580 #include <faad.h>
582 int main() {
583         char buffer;
584         faacDecHandle decoder;
585         faacDecFrameInfo frameInfo;
586         faacDecConfigurationPtr config;
587         unsigned char channels;
588         long sampleRate;
589         long bufferlen = 0;
590         unsigned long dummy1_32;
591         unsigned char dummy2_8, dummy3_8, dummy4_8, dummy5_8, dummy6_8,
592                                 dummy7_8, dummy8_8;
594         decoder = faacDecOpen();
595         config = faacDecGetCurrentConfiguration(decoder);
596         config->outputFormat = FAAD_FMT_16BIT;
597         faacDecSetConfiguration(decoder,config);
598         AudioSpecificConfig(&buffer,&dummy1_32,&dummy2_8,
599                                 &dummy3_8,&dummy4_8,&dummy5_8,
600                                 &dummy6_8,&dummy7_8,&dummy8_8);
601         faacDecInit(decoder,&buffer,&sampleRate,&channels);
602         faacDecInit2(decoder,&buffer,bufferlen,&sampleRate,&channels);
603         faacDecDecode(decoder,&frameInfo,&buffer);
604         faacDecClose(decoder);
606         return 0;
608 ],AC_MSG_RESULT(yes),[AC_MSG_RESULT(no);enable_aac=no])
609                 ])
610         fi
611         if test x$enable_aac = xyes; then
612                 AC_CHECK_TYPES(mp4AudioSpecificConfig,,,[#include <faad.h>])
613                 AC_CHECK_MEMBERS([faacDecConfiguration.downMatrix,faacDecConfiguration.dontUpSampleImplicitSBR,faacDecFrameInfo.samplerate],,,[#include <faad.h>])
614                 AC_DEFINE(HAVE_FAAD,1,[Define to use FAAD2 for AAC decoding])
615         else
616                 AC_MSG_WARN([faad2 lib needed for MP4/AAC support -- disabling MP4/AAC support])
617         fi
618         CFLAGS=$oldcflags
619         LIBS=$oldlibs
620         CPPFLAGS=$oldcppflags
623 AM_CONDITIONAL(HAVE_FAAD, test x$enable_aac = xyes)
625 if test x$enable_aac = xyes; then
626         oldcflags=$CFLAGS
627         oldlibs=$LIBS
628         oldcppflags=$CPPFLAGS
629         CFLAGS="$CFLAGS $MPD_CFLAGS $FAAD_CFLAGS -Werror"
630         LIBS="$LIBS $MPD_LIBS $FAAD_LIBS"
631         CPPFLAGS=$CFLAGS
633         AC_MSG_CHECKING(for broken libfaad headers)
634         AC_COMPILE_IFELSE([
635 #include <faad.h>
636 #include <stddef.h>
637 #include <stdint.h>
639 int main() {
640         unsigned char channels;
641         uint32_t sample_rate;
643         faacDecInit2(NULL, NULL, 0, &sample_rate, &channels);
644         return 0;
646         ],
647                 [AC_MSG_RESULT(correct)],
648                 [AC_MSG_RESULT(broken);
649                 AC_DEFINE(HAVE_FAAD_LONG, 1, [Define if faad.h uses the broken "unsigned long" pointers])])
651         CFLAGS=$oldcflags
652         LIBS=$oldlibs
653         CPPFLAGS=$oldcppflags
656 if test x$enable_aac = xyes; then
657         enable_mp4=yes
658         MP4FF_LIBS="-lmp4ff"
660         oldcflags=$CFLAGS
661         oldlibs=$LIBS
662         oldcppflags=$CPPFLAGS
663         CFLAGS="$CFLAGS $FAAD_CFLAGS"
664         LIBS="$LIBS $MP4FF_LIBS"
665         CPPFLAGS=$CFLAGS
667         AC_CHECK_HEADER(mp4ff.h,,enable_mp4=no)
669         if test x$enable_mp4 = xyes; then
670                 AC_CHECK_LIB(mp4ff,mp4ff_open_read,,enable_mp4=no)
671         fi
673         if test x$enable_mp4 = xyes; then
674                 AC_SUBST(MP4FF_LIBS)
675                 AC_DEFINE(HAVE_MP4, 1, [Define to use FAAD2+mp4ff for MP4 decoding])
676         else
677                 AC_MSG_WARN([libmp4ff needed for MP4 support -- disabling MP4 support])
678                 unset MP4FF_LIBS
679         fi
681         CFLAGS=$oldcflags
682         LIBS=$oldlibs
683         CPPFLAGS=$oldcppflags
686 AM_CONDITIONAL(HAVE_MP4, test x$enable_mp4 = xyes)
688 if test x$use_tremor = xyes; then
689         if test "x$tremor_libraries" != "x" ; then
690                 TREMOR_LIBS="-L$tremor_libraries"
691         elif test "x$tremor_prefix" != "x" ; then
692                 TREMOR_LIBS="-L$tremor_prefix/lib"
693         fi
694         TREMOR_LIBS="$TREMOR_LIBS -lvorbisidec"
695         if test "x$tremor_includes" != "x" ; then
696                 TREMOR_CFLAGS="-I$tremor_includes"
697         elif test "x$tremor_prefix" != "x" ; then
698                 TREMOR_CFLAGS="-I$tremor_prefix/include"
699         fi
700         ac_save_CFLAGS="$CFLAGS"
701         ac_save_LIBS="$LIBS"
702         CFLAGS="$CFLAGS $TREMOR_CFLAGS"
703         LIBS="$LIBS $TREMOR_LIBS"
704         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]))
705         if test x$enable_oggvorbis = xno; then
706                 CFLAGS="$ac_save_CFLAGS"
707                 LIBS="$ac_save_LIBS"
708         fi
709 elif test x$enable_oggvorbis = xyes; then
710         PKG_CHECK_MODULES(OGGVORBIS, [ogg vorbis vorbisfile],
711                 AC_DEFINE(HAVE_OGGVORBIS, 1, [Define for Ogg Vorbis support]),
712                 enable_oggvorbis=no)
715 AM_CONDITIONAL(HAVE_OGGVORBIS, test x$enable_oggvorbis = xyes)
717 if test x$use_tremor = xyes; then
718         AC_DEFINE(HAVE_TREMOR,1,[Define to use tremor (libvorbisidec) for ogg support])
719         if test x$enable_oggflac = xyes; then
720                 AC_MSG_WARN([disabling OggFLAC support because it is incompatible with tremor])
721                 enable_oggflac=no
722         fi
725 if test x$enable_flac = xyes; then
726         PKG_CHECK_MODULES(FLAC, [flac >= 1.1],
727                 AC_DEFINE(HAVE_FLAC, 1, [Define for FLAC support]),
728                 enable_flac=no)
730         oldcflags="$CFLAGS"
731         oldlibs="$LIBS"
732         CFLAGS="$CFLAGS $FLAC_CFLAGS"
733         LIBS="$LIBS $FLAC_LIBS"
734         if test x$enable_flac = xyes && test x$enable_oggflac = xyes; then
735                 AC_CHECK_DECL(FLAC_API_SUPPORTS_OGG_FLAC,
736                               [enable_oggflac=flac], [],
737                               [#include <FLAC/export.h>])
738         fi
739         CFLAGS="$oldcflags"
740         LIBS="$oldlibs"
743 AM_CONDITIONAL(HAVE_FLAC, test x$enable_flac = xyes)
745 if test x$enable_oggflac = xyes; then
746         oldmpdcflags="$MPD_CFLAGS"
747         oldmpdlibs="$MPD_LIBS"
748         AM_PATH_LIBOGGFLAC(MPD_LIBS="$MPD_LIBS $LIBOGGFLAC_LIBS" MPD_CFLAGS="$MPD_CFLAGS $LIBOGGFLAC_CFLAGS",enable_oggflac=no)
751 if test x$enable_oggflac = xyes; then
752         AC_DEFINE(HAVE_OGGFLAC,1,[Define for OggFLAC support])
755 AM_CONDITIONAL(HAVE_OGGFLAC, test x$enable_oggflac = xyes)
757 AM_CONDITIONAL(HAVE_FLAC_COMMON, test x$enable_flac = xyes || test x$enable_oggflac = xyes)
758 AM_CONDITIONAL(HAVE_OGG_COMMON, test x$enable_oggvorbis = xyes || test x$enable_oggflac = xyes || test x$enable_flac = xyes)
760 if test x$enable_audiofile = xyes; then
761         PKG_CHECK_MODULES(AUDIOFILE, [audiofile >= 0.1.7],
762                 AC_DEFINE(HAVE_AUDIOFILE, 1, [Define for audiofile support]),
763                 enable_audiofile=no)
766 AM_CONDITIONAL(HAVE_AUDIOFILE, test x$enable_audiofile = xyes)
768 if test x$enable_mod = xyes; then
769         AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config)
770         if test x$LIBMIKMOD_CONFIG != x ; then
771                 AC_SUBST(LIBMIKMOD_CFLAGS, `$LIBMIKMOD_CONFIG --cflags`)
772                 AC_SUBST(LIBMIKMOD_LIBS, `$LIBMIKMOD_CONFIG --libs`)
773                 AC_DEFINE(HAVE_MIKMOD, 1, [Define for mikmod support])
774         else
775                 enable_mod=no
776         fi
779 AM_CONDITIONAL(HAVE_MIKMOD, test x$enable_mod = xyes)
781 if test x$enable_ffmpeg = xyes; then
782         PKG_CHECK_MODULES(FFMPEG, [libavformat libavcodec libavutil],
783                 AC_DEFINE(HAVE_FFMPEG, 1, [Define for FFMPEG support]),
784                 enable_ffmpeg=no)
787 if test x$enable_ffmpeg = xyes; then
788         old_LIBS=$LIBS
789         LIBS="$LIBS $FFMPEG_LIBS"
790         AC_CHECK_LIB(avcodec, avcodec_decode_audio2,,
791                 enable_ffmpeg=no)
792         LIBS=$old_LIBS
795 if test x$enable_ffmpeg = xyes; then
796         # prior to ffmpeg svn12865, you had to specify include files
797         # without path prefix
798         old_CPPCFLAGS=$CPPFLAGS
799         CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS"
800         AC_CHECK_HEADER(libavcodec/avcodec.h,,
801                 AC_DEFINE(OLD_FFMPEG_INCLUDES, 1,
802                         [Define if avcodec.h instead of libavcodec/avcodec.h should be included]))
803         CPPCFLAGS=$old_CPPFLAGS
806 AM_CONDITIONAL(HAVE_FFMPEG, test x$enable_ffmpeg = xyes)
808 case $with_zeroconf in
809 no|avahi|bonjour)
810         ;;
812         with_zeroconf=auto
813         ;;
814 esac
816 if test x$with_zeroconf != xno; then
817         if test x$with_zeroconf = xavahi || test x$with_zeroconf = xauto; then
818                 PKG_CHECK_MODULES([AVAHI], [avahi-client],
819                                   [found_avahi=1;AC_DEFINE([HAVE_AVAHI], 1, [Define to enable Avahi Zeroconf support])]
820                                   MPD_LIBS="$MPD_LIBS $AVAHI_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AVAHI_CFLAGS",
821                                   [found_avahi=0])
822         fi
824         if test x$found_avahi = x1; then
825                 with_zeroconf=avahi
826         elif test x$with_zeroconf = xavahi; then
827                 AC_MSG_ERROR([Avahi support requested but not found])
828         fi
830         if test x$with_zeroconf = xbonjour || test x$with_zeroconf = xauto; then
831                 AC_CHECK_HEADER(dns_sd.h,
832                                 [found_bonjour=1;AC_DEFINE([HAVE_BONJOUR], 1, [Define to enable Bonjour Zeroconf support])],
833                                 [found_bonjour=0])
834                 AC_CHECK_LIB(dns_sd, DNSServiceRegister,
835                              MPD_LIBS="$MPD_LIBS -ldns_sd")
836         fi
838         if test x$found_bonjour = x1; then
839                 with_zeroconf=bonjour
840         elif test x$with_zeroconf = xbonjour; then
841                 AC_MSG_ERROR([Bonjour support requested but not found])
842         fi
844         if test x$with_zeroconf = xauto; then
845                 AC_MSG_WARN([No supported Zeroconf backend found, disabling Zeroconf])
846                 with_zeroconf=no
847         else
848                 AC_DEFINE([HAVE_ZEROCONF], 1, [Define to enable Zeroconf support])
849         fi
852 AM_CONDITIONAL(HAVE_ZEROCONF, test x$with_zeroconf != xno)
856 dnl Documentation
859 AC_MSG_CHECKING([for xmlto (DocBook processing)])
860 AC_PATH_PROG(XMLTO, xmlto)
861 if test x$XMLTO != x; then
862         AC_SUBST(XMLTO)
863         AC_MSG_RESULT($XMLTO)
864 else
865         AC_MSG_RESULT(no)
868 AM_CONDITIONAL(HAVE_XMLTO, test x$XMLTO != x)
872 dnl build options
875 if test "x$ENABLE_WERROR" = xyes; then
876         MPD_CFLAGS="$MPD_CFLAGS -Werror -pedantic-errors"
879 #if test "x$ENABLE_DEBUG" = xno; then
880         # don't set NDEBUG for now, until MPD is stable
881         #MPD_CFLAGS="$MPD_CFLAGS -DNDEBUG"
884 if test "x$ENABLE_GPROF" = xyes; then
885         MPD_CFLAGS="$MPD_CFLAGS -pg"
890 dnl CFLAGS
893 if test x$GCC = xyes
894 then
895         MPD_CHECK_FLAG([-Wall])
896         MPD_CHECK_FLAG([-Wextra])
897         MPD_CHECK_FLAG([-Wno-deprecated-declarations])
898         MPD_CHECK_FLAG([-Wmissing-prototypes])
899         MPD_CHECK_FLAG([-Wdeclaration-after-statement])
900         MPD_CHECK_FLAG([-Wshadow])
901         MPD_CHECK_FLAG([-Wpointer-arith])
902         MPD_CHECK_FLAG([-Wstrict-prototypes])
903         MPD_CHECK_FLAG([-Wcast-qual])
904         MPD_CHECK_FLAG([-Wwrite-strings])
905         MPD_CHECK_FLAG([-pedantic])
910 dnl generate files
914 AC_OUTPUT(doc/Makefile src/Makefile Makefile)
918 dnl pretty-print result
921 echo ""
922 echo "########### MPD CONFIGURATION ############"
923 echo ""
925 echo " Client Support:"
926 if test x$enable_tcp = xyes; then
927         echo " TCP support ...................enabled"
928 else
929         echo " TCP support ...................disabled"
932 if test x$enable_ipv6 = xyes; then
933         echo " IPv6 support ..................enabled"
934 else
935         echo " IPv6 support ..................disabled"
938 if test x$enable_un = xyes; then
939         echo " Unix domain socket support ....enabled"
940 else
941         echo " Unix domain socket support ....disabled"
944 echo ""
947         test x$enable_tcp = xno &&
948         test x$enable_un = xno; then
949         AC_MSG_ERROR([No client interfaces configured!])
952 echo " Playback Support:"
953 if test x$enable_ao = xyes; then
954         echo " libao support .................enabled"
955 else
956         echo " libao support .................disabled"
959 if test x$enable_oss = xyes; then
960         echo " OSS support ...................enabled"
961 else
962         echo " OSS support ...................disabled"
965 if test x$enable_alsa = xyes; then
966         echo " ALSA support ..................enabled"
967 else
968         echo " ALSA support ..................disabled"
971 if test x$enable_jack = xyes; then
972         echo " JACK support ..................enabled"
973 else
974         echo " JACK support ..................disabled"
977 if test x$enable_osx = xyes; then
978         echo " OS X support ..................enabled"
979 else
980         echo " OS X support ..................disabled"
983 if test x$enable_pulse = xyes; then
984         echo " PulseAudio support ............enabled"
985 else
986         echo " PulseAudio support ............disabled"
989 if test x$enable_fifo = xyes; then
990         echo " FIFO support ..................enabled"
991 else
992         echo " FIFO support ..................disabled"
995 if test x$enable_mvp = xyes; then
996         echo " Media MVP support .............enabled"
997 else
998         echo " Media MVP support .............disabled"
1001 if test x$enable_shout_ogg = xyes; then
1002         echo " Shout ogg streaming support ...enabled"
1003 else
1004         echo " Shout ogg streaming support ...disabled"
1007 if test x$enable_shout_mp3 = xyes; then
1008         echo " Shout mp3 streaming support ...enabled"
1009 else
1010         echo " Shout mp3 streaming support ...disabled"
1013 echo ""
1015 if test x$enable_ao = xno &&
1016    test x$enable_oss = xno &&
1017    test x$enable_shout_ogg = xno &&
1018    test x$enable_shout_mp3 = xno &&
1019    test x$enable_alsa = xno &&
1020    test x$enable_osx = xno &&
1021    test x$enable_pulse = xno &&
1022    test x$enable_jack = xno &&
1023    test x$enable_fifo = xno &&
1024    test x$enable_mvp = xno; then
1025         AC_MSG_ERROR([No Audio Output types configured!])
1028 echo " File Format Support:"
1030 if test x$enable_id3 = xyes; then
1031         echo " ID3 tag support ...............enabled"
1032 else
1033         echo " ID3 tag support ...............disabled"
1036 if test x$enable_mp3 = xyes; then
1037         echo " mp3 support ...................enabled"
1038 else
1039         echo " mp3 support ...................disabled"
1042 if test x$enable_lame = xyes; then
1043         echo " lame support ..................enabled"
1044 else
1045         echo " lame support ..................disabled"
1048 if test x$enable_oggvorbis = xyes; then
1049         echo " Ogg Vorbis support ............enabled"
1050         if test x$use_tremor = xyes; then
1051                 echo "   using tremor.................yes"
1052         else
1053                 echo "   using tremor.................no"
1054         fi
1055 else
1056         echo " Ogg Vorbis support ............disabled"
1059 if test x$enable_flac = xyes; then
1060         echo " FLAC support ..................enabled"
1061 else
1062         echo " FLAC support ..................disabled"
1065 case $enable_oggflac in
1066 yes)
1067         echo " OggFLAC support ...............enabled"
1068         ;;
1069 flac)
1070         echo " OggFLAC support ...............enabled(FLAC 1.1.3)"
1071         ;;
1073         echo " OggFLAC support ...............disabled"
1074         ;;
1075 esac
1077 if test x$enable_audiofile = xyes; then
1078         echo " Wave file support .............enabled"
1079 else
1080         echo " Wave file support .............disabled"
1083 if test x$enable_aac = xyes; then
1084         echo " AAC support ...................enabled"
1085 else
1086         echo " AAC support ...................disabled"
1089 if test x$enable_mp4 = xyes; then
1090         echo " MP4 support ...................enabled"
1091 else
1092         echo " MP4 support ...................disabled"
1095 if test x$enable_mpc = xyes; then
1096         echo " Musepack (MPC) support ........enabled"
1097 else
1098         echo " Musepack (MPC) support ........disabled"
1101 if test x$enable_wavpack = xyes; then
1102         echo " WavPack support ...............enabled"
1103 else
1104         echo " WavPack support ...............disabled"
1107 if test x$enable_mod = xyes; then
1108         echo " MOD support ...................enabled"
1109 else
1110         echo " MOD support ...................disabled"
1113 if test x$enable_ffmpeg = xyes; then
1114         echo " FFMPEG support ................enabled"
1115 else
1116         echo " FFMPEG support ................disabled"
1120         test x$enable_mp3 = xno &&
1121         test x$enable_oggvorbis = xno &&
1122         test x$enable_flac = xno && 
1123         test x$enable_oggflac = xno &&
1124         test x$enable_audiofile = xno && 
1125         test x$enable_aac = xno &&
1126         test x$enable_mpc = xno &&
1127         test x$enable_wavpack = xno &&
1128         test x$enable_ffmpeg = xno &&
1129         test x$enable_mod = xno; then
1130         AC_MSG_ERROR([No input plugins supported!])
1133 echo ""
1134 echo " Other features:"
1136 if test x$enable_lsr = xyes; then
1137         echo " libsamplerate support .........enabled"
1138 else
1139         echo " libsamplerate support .........disabled"
1141                 
1143 if test x$with_zeroconf != xno; then
1144         echo " Zeroconf support ..............$with_zeroconf"
1145 else
1146         echo " Zeroconf support ..............disabled"
1149 echo ""
1150 echo "##########################################"
1151 echo ""
1152 echo "You are now ready to compile MPD"
1153 echo "Type \"make\" to compile MPD"