configure.ac: Move sndfile/modplug conflict test to Decoder Plugins, add header.
[mpd-mk.git] / configure.ac
blobf399e6d5ee6694948b85f8d7a22326b1d190b09b
1 AC_PREREQ(2.60)
2 AC_INIT(mpd, 0.16~git, musicpd-dev-team@lists.sourceforge.net)
3 AC_CONFIG_SRCDIR([src/main.c])
4 AM_INIT_AUTOMAKE([foreign 1.10 dist-bzip2 subdir-objects])
5 AM_CONFIG_HEADER(config.h)
6 AC_CONFIG_MACRO_DIR([m4])
8 AC_DEFINE(PROTOCOL_VERSION, "0.16.0", [The MPD protocol version])
11 dnl ---------------------------------------------------------------------------
12 dnl Programs
13 dnl ---------------------------------------------------------------------------
14 AC_PROG_CC_C99
15 AC_PROG_CXX
17 HAVE_CXX=yes
18 if test x$CXX = xg++; then
19         # CXX=g++ probably means that autoconf hasn't found any C++
20         # compiler; to be sure, we check again
21         AC_PATH_PROG(CXX, $CXX, no)
22         if test x$CXX = xno; then
23                 # no, we don't have C++ - the following hack is
24                 # required because automake insists on using $(CXX)
25                 # for linking the MPD binary
26                 AC_MSG_NOTICE([Disabling C++ support])
27                 CXX="$CC"
28                 HAVE_CXX=no
29         fi
32 AC_PROG_INSTALL
33 AC_PROG_MAKE_SET
34 PKG_PROG_PKG_CONFIG
36 dnl ---------------------------------------------------------------------------
37 dnl Declare Variables
38 dnl ---------------------------------------------------------------------------
39 AC_SUBST(AM_CFLAGS,"")
41 AC_SUBST(MPD_LIBS)
42 AC_SUBST(MPD_CFLAGS)
43 MPD_LIBS=""
44 MPD_CFLAGS=""
46 dnl ---------------------------------------------------------------------------
47 dnl OS Specific Defaults
48 dnl ---------------------------------------------------------------------------
49 AC_CANONICAL_HOST
51 case "$host_os" in
52 mingw32* | windows*)
53         MPD_LIBS="$MPD_LIBS -lws2_32"
54         ;;
55 esac
57 if test -z "$prefix" || test "x$prefix" = xNONE; then
58         local_lib=
59         local_include=
61         # aren't autotools supposed to be smart enough to figure this out?  oh
62         # well, the git-core Makefile managed to do some of the work for us :)
63         case "$host_os" in
64         darwin*)
65                 local_lib='/sw/lib /opt/local/lib'
66                 local_include='/sw/include /opt/local/include'
67                 ;;
68         freebsd* | openbsd*)
69                 local_lib=/usr/local/lib
70                 local_include=/usr/local/include
71                 ;;
72         netbsd*)
73                 local_lib=/usr/pkg/lib
74                 local_include=/usr/pkg/include
75                 LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/pkg/lib"
76                 ;;
77         esac
79         for d in $local_lib; do
80                 if test -d "$d"; then
81                         LDFLAGS="$LDFLAGS -L$d"
82                         break
83                 fi
84         done
85         for d in $local_include; do
86                 if test -d "$d"; then
87                         CFLAGS="$CFLAGS -I$d"
88                         break
89                 fi
90         done
93 dnl ---------------------------------------------------------------------------
94 dnl Header/Library Checks
95 dnl ---------------------------------------------------------------------------
96 AC_CHECK_FUNCS(daemon fork syslog)
97 if test $ac_cv_func_syslog = no; then
98         # syslog is not in the default libraries.  See if it's in some other.
99         for lib in bsd socket inet; do
100                 AC_CHECK_LIB($lib, syslog,
101                         [AC_DEFINE(HAVE_SYSLOG)
102                         LIBS="$LIBS -l$lib"; break])
103         done
106 AC_CHECK_LIB(socket,socket,MPD_LIBS="$MPD_LIBS -lsocket",)
107 AC_CHECK_LIB(nsl,gethostbyname,MPD_LIBS="$MPD_LIBS -lnsl",)
109 AC_CHECK_FUNCS(pipe2 accept4)
111 AC_CHECK_LIB(m,exp,MPD_LIBS="$MPD_LIBS -lm",)
113 AC_CHECK_HEADERS(locale.h)
114 AC_CHECK_HEADERS(valgrind/memcheck.h)
116 dnl ---------------------------------------------------------------------------
117 dnl Allow tools to be specifically built
118 dnl ---------------------------------------------------------------------------
119 AC_ARG_ENABLE(alsa,
120         AS_HELP_STRING([--enable-alsa], [enable ALSA support]),,
121         [enable_alsa=auto])
123 AC_ARG_ENABLE(ao,
124         AS_HELP_STRING([--enable-ao],
125                 [enable support for libao]),,
126         enable_ao=auto)
128 AC_ARG_ENABLE(audiofile,
129         AS_HELP_STRING([--enable-audiofile],
130                 [enable audiofile support (WAV and others)]),,
131         enable_audiofile=auto)
133 AC_ARG_ENABLE(bzip2,
134         AS_HELP_STRING([--enable-bzip2],
135                 [enable bzip2 archive support (default: disabled)]),,
136         enable_bzip2=no)
138 AC_ARG_ENABLE(cue,
139         AS_HELP_STRING([--enable-cue],
140                 [enable support for libcue support]),,
141         enable_cue=auto)
143 AC_ARG_ENABLE(curl,
144         AS_HELP_STRING([--enable-curl],
145                 [enable support for libcurl HTTP streaming (default: auto)]),,
146         [enable_curl=auto])
148 AC_ARG_ENABLE(debug,
149         AS_HELP_STRING([--enable-debug],
150                 [enable debugging (default: disabled)]),,
151         enable_debug=no)
153 AC_ARG_ENABLE(documentation,
154         AS_HELP_STRING([--enable-documentation],
155                 [build documentation (default: disable)]),,
156         [enable_documentation=no])
158 AC_ARG_ENABLE(ffmpeg,
159         AS_HELP_STRING([--enable-ffmpeg],
160                 [enable FFMPEG support]),,
161         enable_ffmpeg=auto)
163 AC_ARG_ENABLE(fifo,
164         AS_HELP_STRING([--disable-fifo],
165                 [disable support for writing audio to a FIFO (default: enable)]),,
166         enable_fifo=yes)
168 AC_ARG_ENABLE(flac,
169         AS_HELP_STRING([--disable-flac],
170                 [disable flac support (default: enable)]),,
171         enable_flac=yes)
173 AC_ARG_ENABLE(fluidsynth,
174         AS_HELP_STRING([--enable-fluidsynth],
175                 [enable MIDI support via fluidsynth (default: disable)]),,
176         enable_fluidsynth=no)
178 AC_ARG_ENABLE(gprof,
179         AS_HELP_STRING([--enable-gprof],
180                 [enable profiling via gprof (default: disabled)]),,
181         enable_gprof=no)
183 AC_ARG_ENABLE(httpd-output,
184         AS_HELP_STRING([--enable-httpd-output],
185                 [enables the HTTP server output]),,
186         [enable_httpd_output=auto])
188 AC_ARG_ENABLE(id3,
189         AS_HELP_STRING([--disable-id3],
190                 [disable id3 support (default: enable)]),,
191         enable_id3=yes)
193 AC_ARG_ENABLE(inotify,
194         AS_HELP_STRING([--disable-inotify],
195                 [disable support Inotify automatic database update (default: enabled) ]),,
196         [enable_inotify=yes])
198 AC_ARG_ENABLE(ipv6,
199         AS_HELP_STRING([--disable-ipv6],
200                 [disable IPv6 support (default: enable)]),,
201         [enable_ipv6=yes])
203 AC_ARG_ENABLE(iso9660,
204         AS_HELP_STRING([--enable-iso9660],
205                 [enable iso9660 archive support (default: disabled)]),,
206         enable_iso9660=no)
208 AC_ARG_ENABLE(jack,
209         AS_HELP_STRING([--enable-jack],
210                 [enable jack support]),,
211         enable_jack=auto)
213 AC_SYS_LARGEFILE
215 AC_ARG_ENABLE(lastfm,
216         AS_HELP_STRING([--enable-lastfm],
217                 [enable support for last.fm radio (default: disable)]),,
218         [enable_lastfm=no])
220 AC_ARG_ENABLE(lame-encoder,
221         AS_HELP_STRING([--enable-lame-encoder],
222                 [enable the LAME mp3 encoder]),,
223         enable_lame_encoder=auto)
225 AC_ARG_ENABLE([libwrap],
226         AS_HELP_STRING([--enable-libwrap], [use libwrap]),,
227         [enable_libwrap=auto])
229 AC_ARG_ENABLE(lsr,
230         AS_HELP_STRING([--enable-lsr],
231                 [enable libsamplerate support]),,
232         enable_lsr=auto)
234 AC_ARG_ENABLE(mad,
235         AS_HELP_STRING([--enable-mad],
236                 [enable libmad mp3 decoder plugin]),,
237         enable_mad=auto)
239 AC_ARG_ENABLE(mikmod,
240         AS_HELP_STRING([--enable-mikmod],
241                 [enable the mikmod decoder (default: disable)]),,
242         enable_mikmod=no)
244 AC_ARG_ENABLE(mms,
245         AS_HELP_STRING([--enable-mms],
246                 [enable the MMS protocol with libmms]),,
247         [enable_mms=auto])
249 AC_ARG_ENABLE(modplug,
250         AS_HELP_STRING([--enable-modplug],
251                 [enable modplug decoder plugin]),,
252         enable_modplug=auto)
254 AC_ARG_ENABLE(mpc,
255         AS_HELP_STRING([--disable-mpc],
256                 [disable musepack (MPC) support (default: enable)]),,
257         enable_mpc=yes)
259 AC_ARG_ENABLE(mpg123,
260         AS_HELP_STRING([--enable-mpg123],
261                 [enable libmpg123 decoder plugin]),,
262         enable_mpg123=auto)
264 AC_ARG_ENABLE(mvp,
265         AS_HELP_STRING([--enable-mvp],
266                 [enable support for Hauppauge Media MVP (default: disable)]),,
267         enable_mvp=no)
269 AC_ARG_ENABLE(oggflac,
270         AS_HELP_STRING([--disable-oggflac],
271                 [disable OggFLAC support (default: enable)]),,
272         enable_oggflac=yes)
274 AC_ARG_ENABLE(openal,
275         AS_HELP_STRING([--enable-openal],
276                 [enable OpenAL support (default: disable)]),,
277         enable_openal=no)
279 AC_ARG_ENABLE(oss,
280         AS_HELP_STRING([--disable-oss],
281                 [disable OSS support (default: enable)]),,
282         enable_oss=yes)
284 AC_ARG_ENABLE(pipe-output,
285         AS_HELP_STRING([--enable-pipe-output],
286                 [enable support for writing audio to a pipe (default: disable)]),,
287         enable_pipe_output=no)
289 AC_ARG_ENABLE(pulse,
290         AS_HELP_STRING([--enable-pulse],
291                 [enable support for the PulseAudio sound server]),,
292         enable_pulse=auto)
294 AC_ARG_ENABLE(recorder-output,
295         AS_HELP_STRING([--enable-recorder-output],
296                 [enables the recorder file output plugin (default: disable)]),,
297         [enable_recorder_output=auto])
299 AC_ARG_ENABLE(sidplay,
300         AS_HELP_STRING([--enable-sidplay],
301                 [enable C64 SID support via libsidplay2]),,
302         enable_sidplay=auto)
305 AC_ARG_ENABLE(shout,
306         AS_HELP_STRING([--enable-shout],
307                 [enables the shoutcast streaming output]),,
308         [enable_shout=auto])
310 AC_ARG_ENABLE(sndfile,
311         AS_HELP_STRING([--enable-sndfile],
312                 [enable sndfile support]),,
313         enable_sndfile=auto)
315 AC_ARG_ENABLE(sqlite,
316         AS_HELP_STRING([--enable-sqlite],
317                 [enable support for the SQLite database]),,
318         [enable_sqlite=auto])
320 AC_ARG_ENABLE(tcp,
321         AS_HELP_STRING([--disable-tcp],
322                 [disable support for clients connecting via TCP (default: enable)]),,
323         [enable_tcp=yes])
325 AC_ARG_ENABLE(test,
326         AS_HELP_STRING([--enable-test],
327                 [build the test programs (default: disabled)]),,
328         enable_test=no)
330 AC_ARG_WITH(tremor,
331         AS_HELP_STRING([--with-tremor=PFX],
332                 [use Tremor (vorbisidec) integer Ogg Vorbis decoder (with optional prefix)]),,
333         with_tremor=no)
335 AC_ARG_ENABLE(twolame-encoder,
336         AS_HELP_STRING([--enable-twolame-encoder],
337                 [enable the TwoLAME mp2 encoder]),,
338         enable_twolame_encoder=auto)
340 AC_ARG_ENABLE(un,
341         AS_HELP_STRING([--disable-un],
342                 [disable support for clients connecting via unix domain sockets (default: enable)]),,
343         [enable_un=yes])
345 AC_ARG_ENABLE(vorbis,
346         AS_HELP_STRING([--disable-vorbis],
347                 [disable Ogg Vorbis support (default: enable)]),,
348         enable_vorbis=yes)
350 AC_ARG_ENABLE(vorbis-encoder,
351         AS_HELP_STRING([--enable-vorbis-encoder],
352                 [enable the Ogg Vorbis encoder]),,
353         [enable_vorbis_encoder=auto])
355 AC_ARG_ENABLE(wave-encoder,
356         AS_HELP_STRING([--enable-wave-encoder],
357                 [enable the PCM wave encoder]),,
358         enable_wave_encoder=yes)
360 AC_ARG_ENABLE(wavpack,
361         AS_HELP_STRING([--enable-wavpack],
362                 [enable WavPack support]),,
363         enable_wavpack=auto)
365 AC_ARG_ENABLE(werror,
366         AS_HELP_STRING([--enable-werror],
367                 [treat warnings as errors (default: disabled)]),,
368         enable_werror=no)
370 AC_ARG_ENABLE(wildmidi,
371         AS_HELP_STRING([--enable-wildmidi],
372                 [enable MIDI support via wildmidi (default: disable)]),,
373         enable_wildmidi=no)
375 AC_ARG_WITH(zeroconf,
376         AS_HELP_STRING([--with-zeroconf=@<:@auto|avahi|bonjour|no@:>@],
377                 [enable zeroconf backend (default=auto)]),,
378         with_zeroconf="auto")
380 AC_ARG_ENABLE(zzip,
381         AS_HELP_STRING([--enable-zzip],
382                 [enable zip archive support (default: disabled)]),,
383         enable_zzip=no)
386 AC_ARG_WITH(tremor-libraries,
387         AS_HELP_STRING([--with-tremor-libraries=DIR],
388                 [directory where Tremor library is installed (optional)]),,
389         tremor_libraries="")
391 AC_ARG_WITH(tremor-includes,
392         AS_HELP_STRING([--with-tremor-includes=DIR],
393                 [directory where Tremor header files are installed (optional)]),,
394         tremor_includes="")
396 dnl ---------------------------------------------------------------------------
397 dnl Mandatory Libraries
398 dnl ---------------------------------------------------------------------------
399 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.12 gthread-2.0],,
400                 [AC_MSG_ERROR([GLib 2.12 is required])])
402 dnl ---------------------------------------------------------------------------
403 dnl Protocol Options
404 dnl ---------------------------------------------------------------------------
406 if test x$enable_tcp = xno; then
407         # if we don't support TCP, we don't need IPv6 either
408         enable_ipv6=no
411 if test x$enable_ipv6 = xyes; then
412         AC_MSG_CHECKING(for ipv6)
413         AC_EGREP_CPP([AP_maGiC_VALUE],
414         [
415 #include <sys/types.h>
416 #include <sys/socket.h>
417 #include <netdb.h>
418 #ifdef PF_INET6
419 #ifdef AF_INET6
420 AP_maGiC_VALUE
421 #endif
422 #endif
423         ],
424         AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 support present])
425         AC_MSG_RESULT([yes]),
426         AC_MSG_RESULT([no])
430 if test x$enable_tcp = xyes; then
431         AC_DEFINE(HAVE_TCP, 1, [Define if TCP socket support is enabled])
434 case "$host_os" in
435 mingw* | windows*)
436         enable_un=no
437         ;;
438 esac
440 if test x$enable_un = xyes; then
441         AC_DEFINE(HAVE_UN, 1, [Define if unix domain socket support is enabled])
442         STRUCT_UCRED
445 dnl ---------------------------------------------------------------------------
446 dnl LIBC Features
447 dnl ---------------------------------------------------------------------------
448 if test x$enable_largefile != xno; then
449         AC_DEFINE([ENABLE_LARGEFILE], 1, [Define if large file support is enabled])
452 dnl ---------------------------------------------------------------------------
453 dnl Miscellaneous Libraries
454 dnl ---------------------------------------------------------------------------
456 dnl --------------------------------- inotify ---------------------------------
457 AC_CHECK_FUNCS(inotify_init inotify_init1)
459 if test x$ac_cv_func_inotify_init = xno; then
460         enable_inotify=no
463 if test x$enable_inotify = xyes; then
464         AC_DEFINE([ENABLE_INOTIFY], 1, [Define to enable inotify support])
466 AM_CONDITIONAL(ENABLE_INOTIFY, test x$enable_inotify = xyes)
468 dnl --------------------------------- libwrap ---------------------------------
469 if test x$enable_libwrap != xno; then
470         AC_CHECK_LIBWRAP(found_libwrap=yes, found_libwrap=no)
471         MPD_AUTO_RESULT(libwrap, libwrap, [libwrap not found])
474 if test x$enable_libwrap = xyes; then
475         AC_SUBST(LIBWRAP_CFLAGS)
476         AC_SUBST(LIBWRAP_LDFLAGS)
477         AC_DEFINE(HAVE_LIBWRAP, 1, [define to enable libwrap library])
480 dnl ---------------------------------------------------------------------------
481 dnl Metadata Plugins
482 dnl ---------------------------------------------------------------------------
484 dnl ---------------------------------- libcue ---------------------------------
485 MPD_AUTO_PKG(cue, CUE, [libcue],
486         [libcue parsing library], [libcue not found])
487 if test x$enable_cue = xyes; then
488         AC_DEFINE([HAVE_CUE], 1,
489                 [Define to enable libcue support])
492 AM_CONDITIONAL(HAVE_CUE, test x$enable_cue = xyes)
494 dnl -------------------------------- libid3tag --------------------------------
495 if test x$enable_id3 = xyes; then
496         PKG_CHECK_MODULES([ID3TAG], [id3tag],,
497                 AC_CHECK_LIB(id3tag, id3_file_open,
498                         [ID3TAG_LIBS="-lid3tag -lz" ID3TAG_CFLAGS=""],
499                         enable_id3=no))
502 if test x$enable_id3 = xyes; then
503         AC_DEFINE(HAVE_ID3TAG, 1, [Define to use id3tag])
506 AM_CONDITIONAL(HAVE_ID3TAG, test x$enable_id3 = xyes)
508 dnl ---------------------------------------------------------------------------
509 dnl Autodiscovery
510 dnl ---------------------------------------------------------------------------
512 dnl --------------------------------- zeroconf --------------------------------
514 case $with_zeroconf in
515 no|avahi|bonjour)
516         ;;
518         with_zeroconf=auto
519         ;;
520 esac
522 if test x$with_zeroconf != xno; then
523         if test x$with_zeroconf = xavahi || test x$with_zeroconf = xauto; then
524                 PKG_CHECK_MODULES([AVAHI], [avahi-client avahi-glib],
525                          [found_avahi=1;AC_DEFINE([HAVE_AVAHI], 1, [Define to enable Avahi Zeroconf support])]
526                          MPD_LIBS="$MPD_LIBS $AVAHI_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AVAHI_CFLAGS",
527                          [found_avahi=0])
528         fi
530         if test x$found_avahi = x1; then
531                 with_zeroconf=avahi
532         elif test x$with_zeroconf = xavahi; then
533                 AC_MSG_ERROR([Avahi support requested but not found])
534         fi
536         if test x$with_zeroconf = xbonjour || test x$with_zeroconf = xauto; then
537                 AC_CHECK_HEADER(dns_sd.h,
538                         [found_bonjour=1;AC_DEFINE([HAVE_BONJOUR], 1, [Define to enable Bonjour Zeroconf support])],
539                         [found_bonjour=0])
540                 AC_CHECK_LIB(dns_sd, DNSServiceRegister,
541                         MPD_LIBS="$MPD_LIBS -ldns_sd")
542         fi
544         if test x$found_bonjour = x1; then
545                 with_zeroconf=bonjour
546         elif test x$with_zeroconf = xbonjour; then
547                 AC_MSG_ERROR([Bonjour support requested but not found])
548         fi
550         if test x$with_zeroconf = xauto; then
551                 AC_MSG_WARN([No supported Zeroconf backend found, disabling Zeroconf])
552                 with_zeroconf=no
553         else
554                 AC_DEFINE([HAVE_ZEROCONF], 1, [Define to enable Zeroconf support])
555         fi
558 AM_CONDITIONAL(HAVE_ZEROCONF, test x$with_zeroconf != xno)
559 AM_CONDITIONAL(HAVE_AVAHI, test x$with_zeroconf = xavahi)
560 AM_CONDITIONAL(HAVE_BONJOUR, test x$with_zeroconf = xbonjour)
562 dnl ---------------------------------------------------------------------------
563 dnl Sticker Database
564 dnl ---------------------------------------------------------------------------
566 dnl ---------------------------------- sqlite ---------------------------------
568 MPD_AUTO_PKG(sqlite, SQLITE, [sqlite3],
569         [SQLite database support], [sqlite not found])
570 if test x$enable_sqlite = xyes; then
571         AC_DEFINE([ENABLE_SQLITE], 1, [Define to enable sqlite database support])
574 AM_CONDITIONAL(ENABLE_SQLITE, test x$enable_sqlite = xyes)
576 dnl ---------------------------------------------------------------------------
577 dnl Converter Plugins
578 dnl ---------------------------------------------------------------------------
580 dnl ------------------------------ libsamplerate ------------------------------
581 MPD_AUTO_PKG(lsr, SAMPLERATE, [samplerate >= 0.0.15],
582         [libsamplerate resampling], [libsamplerate not found])
583 if test x$enable_lsr = xyes; then
584         AC_DEFINE([HAVE_LIBSAMPLERATE], 1,
585                 [Define to enable libsamplerate])
588 if test x$enable_lsr = xyes; then
589         PKG_CHECK_MODULES([SAMPLERATE_013],
590                 [samplerate >= 0.1.3],,
591                 [AC_DEFINE([HAVE_LIBSAMPLERATE_NOINT], 1,
592                 [libsamplerate doesn't provide src_int_to_float_array() (<0.1.3)])])
595 AM_CONDITIONAL(HAVE_LIBSAMPLERATE, test x$enable_lsr = xyes)
597 dnl ---------------------------------------------------------------------------
598 dnl Input Plugins
599 dnl ---------------------------------------------------------------------------
601 dnl ----------------------------------- CURL ----------------------------------
602 MPD_AUTO_PKG(curl, CURL, [libcurl],
603         [libcurl HTTP streaming], [libcurl not found])
604 if test x$enable_curl = xyes; then
605         AC_DEFINE(ENABLE_CURL, 1, [Define when libcurl is used for HTTP streaming])
607 AM_CONDITIONAL(ENABLE_CURL, test x$enable_curl = xyes)
609 dnl --------------------------------- Last.FM ---------------------------------
610 if test x$enable_lastfm = xyes; then
611         if test x$enable_curl != xyes; then
612                 AC_MSG_ERROR([Cannot enable last.fm radio without curl])
613         fi
615         AC_DEFINE(ENABLE_LASTFM, 1, [Define when last.fm radio is enabled])
617 AM_CONDITIONAL(ENABLE_LASTFM, test x$enable_lastfm = xyes)
619 dnl ---------------------------------- libmms ---------------------------------
620 MPD_AUTO_PKG(mms, MMS, [libmms >= 0.4],
621         [libmms mms:// protocol support], [libmms not found])
622 if test x$enable_mms = xyes; then
623         AC_DEFINE(ENABLE_MMS, 1,
624                 [Define when libmms is used for the MMS protocol])
626 AM_CONDITIONAL(ENABLE_MMS, test x$enable_mms = xyes)
628 dnl ---------------------------------------------------------------------------
629 dnl Archive Plugins
630 dnl ---------------------------------------------------------------------------
632 dnl --------------------------------- iso9660 ---------------------------------
633 MPD_AUTO_PKG(iso9660, ISO9660, [libiso9660],
634         [libiso9660 archive library], [libiso9660 not found])
636 AM_CONDITIONAL(HAVE_ISO9660, test x$enable_iso9660 = xyes)
637 if test x$enable_iso9660 = xyes; then
638         AC_DEFINE(HAVE_ISO9660, 1, [Define to have ISO9660 archive support])
640         AC_PATH_PROG(MKISOFS, mkisofs, no)
641 else
642         MKISOFS="no"
645 AM_CONDITIONAL(ENABLE_ISO9660_TEST, test x$MKISOFS != xno)
647 dnl ---------------------------------- libbz2 ---------------------------------
648 if test x$enable_bzip2 = xyes; then
649         AC_CHECK_LIB(bz2, BZ2_bzDecompressInit,
650                 [MPD_LIBS="$MPD_LIBS -lbz2"],
651                 [AC_MSG_ERROR([libbz2 not found])])
654 AM_CONDITIONAL(HAVE_BZ2, test x$enable_bzip2 = xyes)
655 if test x$enable_bzip2 = xyes; then
656         AC_DEFINE(HAVE_BZ2, 1, [Define to have bz2 archive support])
658         AC_PATH_PROG(BZIP2, bzip2, no)
659 else
660         BZIP2="no"
663 AM_CONDITIONAL(ENABLE_BZIP2_TEST, test x$BZIP2 != xno)
665 dnl --------------------------------- libzzip ---------------------------------
666 MPD_AUTO_PKG(zzip, ZZIP, [zziplib >= 0.13],
667         [libzzip archive library], [libzzip not found])
669 AM_CONDITIONAL(HAVE_ZZIP, test x$enable_zzip = xyes)
670 if test x$enable_zzip = xyes; then
671         AC_DEFINE(HAVE_ZZIP, 1, [Define to have zip archive support])
673         AC_PATH_PROG(ZIP, zip, no)
674 else
675         ZIP="no"
678 AM_CONDITIONAL(ENABLE_ZZIP_TEST, test x$ZIP != xno)
680 dnl ------------------------------- Archive API -------------------------------
682         test x$enable_bzip2 = xyes ||
683         test x$enable_zzip = xyes ||
684         test x$enable_iso9660 = xyes; then
685                 enable_archive=yes
686                 AC_DEFINE(ENABLE_ARCHIVE, 1, [The archive API is available])
687 else
688         enable_archive=no
691 AM_CONDITIONAL(ENABLE_ARCHIVE, test x$enable_archive = xyes)
695 dnl metadata
700 dnl decoder plugins
704 dnl ###
705 dnl MAD mp3 decoder
706 dnl ###
716 AC_ARG_ENABLE(gme,
717         AS_HELP_STRING([--enable-gme],
718                 [enable Blargg's game music emulator plugin]),,
719         enable_gme=auto)
721 MPD_AUTO_PKG(gme, GME, [libgme],
722         [gme decoder plugin], [libgme not found])
723 AM_CONDITIONAL(HAVE_GME, test x$enable_gme = xyes)
724 if test x$enable_gme = xyes; then
725         AC_DEFINE(HAVE_GME, 1, [Define for gme support])
728 AC_ARG_ENABLE(mpc,
729         AS_HELP_STRING([--disable-mpc],
730                 [disable musepack (MPC) support (default: enable)]),,
731         enable_mpc=yes)
733 AC_ARG_ENABLE(oggflac,
734         AS_HELP_STRING([--disable-oggflac],
735                 [disable OggFLAC support (default: enable)]),,
736         enable_oggflac=yes)
738 AC_ARG_ENABLE(vorbis,
739         AS_HELP_STRING([--disable-vorbis],
740                 [disable Ogg Vorbis support (default: enable)]),,
741         enable_vorbis=yes)
743 AC_ARG_ENABLE(sndfile,
744         AS_HELP_STRING([--enable-sndfile],
745                 [enable sndfile support]),,
746         enable_sndfile=auto)
748 if test x$enable_sndfile = xauto && test x$enable_modplug = xyes; then
749         dnl If modplug is enabled, enable sndfile only if explicitly
750         dnl requested - modplug's modplug/sndfile.h is known to
751         dnl conflict with libsndfile's sndfile.h.
752         AC_MSG_NOTICE([disabling libsndfile auto-detection, because the modplug decoder is enabled])
753         enable_sndfile=no
756 MPD_AUTO_PKG(sndfile, SNDFILE, [sndfile],
757         [libsndfile decoder plugin], [libsndfile not found])
758 AM_CONDITIONAL(ENABLE_SNDFILE, test x$enable_sndfile = xyes)
759 if test x$enable_sndfile = xyes; then
760         AC_DEFINE(ENABLE_SNDFILE, 1, [Define to enable the sndfile decoder plugin])
764 dnl ###
765 dnl Ogg Tremor
766 dnl ###
768 if test x$with_tremor = xyes || test x$with_tremor = xno; then
769         use_tremor="$with_tremor"
770 else
771         tremor_prefix="$with_tremor"
772         use_tremor=yes
775 found_sidplay=$HAVE_CXX
776 MPD_AUTO_PRE(sidplay, [sidplay decoder plugin], [No C++ compiler found])
778 if test x$enable_sidplay != xno; then
779         # we're not using pkg-config here
780         # because libsidplay2's .pc file requires libtool
781         AC_HAVE_LIBRARY(sidplay2, [found_sidplay=yes], [found_sidplay=no])
782         MPD_AUTO_PRE(sidplay, [sidplay decoder plugin],
783                 [libsidplay2 not found])
786 if test x$enable_sidplay != xno; then
787         # can't use AC_HAVE_LIBRARY here, because the dash in the
788         # library name triggers an autoconf bug
789         AC_CHECK_LIB(resid-builder, main,
790                 [found_sidplay=yes], [found_sidplay=no])
792         if test x$found_sidplay = xyes; then
793                 AC_HAVE_LIBRARY(sidutils,, [found_sidplay=no])
794         fi
796         MPD_AUTO_RESULT(sidplay, [sidplay decoder plugin],
797                 [libresid-builder or libsidutils not found])
800 if test x$enable_sidplay = xyes; then
801         AC_SUBST(SIDPLAY_LIBS,"-lsidplay2 -lresid-builder -lsidutils")
802         AC_SUBST(SIDPLAY_CFLAGS,)
804         AC_DEFINE(ENABLE_SIDPLAY, 1, [Define for libsidplay2 support])
807 AM_CONDITIONAL(ENABLE_SIDPLAY, test x$enable_sidplay = xyes)
809 MPD_AUTO_PKG(wavpack, WAVPACK, [wavpack],
810         [WavPack decoder plugin], [libwavpack not found])
811 AM_CONDITIONAL(HAVE_WAVPACK, test x$enable_wavpack = xyes)
812 if test x$enable_wavpack = xyes; then
813         AC_DEFINE([HAVE_WAVPACK], 1, [Define to enable WavPack support])
818 dnl ---------------------------------------------------------------------------
819 dnl Encoders for Streaming Audio Output Plugins
820 dnl ---------------------------------------------------------------------------
822 dnl ---------------------------------------------------------------------------
823 dnl Audio Output Plugins (Nonstreaming)
824 dnl ---------------------------------------------------------------------------
826 dnl ----------------------------------- ALSA ----------------------------------
827 MPD_AUTO_PKG(alsa, ALSA, [alsa >= 0.9.0],
828         [ALSA output plugin], [libasound not found])
830 if test x$enable_alsa = xyes; then
831         AC_DEFINE(HAVE_ALSA, 1, [Define to enable ALSA support])
834 AM_CONDITIONAL(HAVE_ALSA, test x$enable_alsa = xyes)
836 dnl ----------------------------------- FIFO ----------------------------------
837 if test x$enable_fifo = xyes; then
838         AC_CHECK_FUNC([mkfifo],
839                 [enable_fifo=yes;AC_DEFINE([HAVE_FIFO], 1,
840                         [Define to enable support for writing audio to a FIFO])],
841                 [enable_fifo=no;AC_MSG_WARN([mkfifo not found -- disabling support for writing audio to a FIFO])])
844 AM_CONDITIONAL(HAVE_FIFO, test x$enable_fifo = xyes)
846 dnl ----------------------------------- JACK ----------------------------------
847 MPD_AUTO_PKG(jack, JACK, [jack >= 0.100],
848         [JACK output plugin], [libjack not found])
849 if test x$enable_jack = xyes; then
850         AC_DEFINE([HAVE_JACK], 1, [Define to enable JACK support])
853 if test x$enable_jack = xyes; then
854         # check whether jack_set_info_function() is available
855         old_LIBS=$LIBS
856         LIBS="$LIBS $JACK_LIBS"
858         AC_CHECK_FUNCS(jack_set_info_function)
860         LIBS=$old_LIBS
863 AM_CONDITIONAL(HAVE_JACK, test x$enable_jack = xyes)
865 dnl ---------------------------------- libao ----------------------------------
866 MPD_AUTO_PKG(ao, AO, [ao],
867         [libao output plugin], [libao not found])
868 if test x$enable_ao = xyes; then
869         AC_DEFINE(HAVE_AO, 1, [Define to play with ao])
872 AM_CONDITIONAL(HAVE_AO, test x$enable_ao = xyes)
874 dnl ---------------------------------- OpenAL ---------------------------------
875 AC_SUBST(OPENAL_CFLAGS,"")
876 AC_SUBST(OPENAL_LIBS,"")
878 if test x$enable_openal = xyes; then
879         if test x$enable_osx = xyes; then
880                 AC_CHECK_HEADERS([OpenAL/al.h OpenAL/alc.h], [], [enable_openal=no])
881                 if test x$enable_openal = xyes; then
882                         OPENAL_LIBS="-framework OpenAL"
883                         AC_DEFINE(HAVE_OPENAL, 1, [Define for OpenAL support])
884                 else
885                         AC_MSG_WARN(OpenAL headers not found -- disabling OpenAL support)
886                 fi
887         else
888                 PKG_CHECK_MODULES([OPENAL], [openal],
889                         AC_DEFINE(HAVE_OPENAL, 1, [Define for OpenAL support]),
890                         enable_openal=no)
891         fi
894 AM_CONDITIONAL(HAVE_OPENAL, test x$enable_openal = xyes)
896 dnl ---------------------------- Open Sound System ----------------------------
897 if test x$enable_oss = xyes; then
898         AC_CHECK_HEADER(sys/soundcard.h,
899                 [enable_oss=yes;AC_DEFINE(HAVE_OSS,1,[Define to enable OSS])],
900                 [AC_MSG_WARN(Soundcard headers not found -- disabling OSS support);
901                         enable_oss=no])
904 AM_CONDITIONAL(HAVE_OSS, test x$enable_oss = xyes)
906 dnl ----------------------------------- OSX -----------------------------------
907 enable_osx=no
908 case "$host_os" in
909         darwin*)
910                 AC_DEFINE(HAVE_OSX, 1, [Define for compiling OS X support])
911                 MPD_LIBS="$MPD_LIBS -framework AudioUnit -framework CoreServices"
912                 enable_osx=yes ;;
913 esac
915 AM_CONDITIONAL(HAVE_OSX, test x$enable_osx = xyes)
917 dnl ------------------------------- Pipe Output -------------------------------
918 if test x$enable_pipe_output = xyes; then
919         AC_DEFINE([ENABLE_PIPE_OUTPUT], 1,
920                 [Define to enable support for writing audio to a pipe])
922 AM_CONDITIONAL(ENABLE_PIPE_OUTPUT, test x$enable_pipe_output = xyes)
924 dnl -------------------------------- PulseAudio -------------------------------
925 MPD_AUTO_PKG(pulse, PULSE, [libpulse],
926         [PulseAudio output plugin], [libpulse not found])
927 if test x$enable_pulse = xyes; then
928         AC_DEFINE([HAVE_PULSE], 1,
929                 [Define to enable PulseAudio support])
932 AM_CONDITIONAL(HAVE_PULSE, test x$enable_pulse = xyes)
934 dnl ----------------------------------- MVP -----------------------------------
935 if test x$enable_mvp = xyes; then
936    AC_DEFINE(HAVE_MVP,1,[Define to enable Hauppauge Media MVP support])
939 AM_CONDITIONAL(HAVE_MVP, test x$enable_mvp = xyes)
941 dnl --------------------------------- Solaris ---------------------------------
942 case "$host_os" in
943         solaris*)
944                 AC_DEFINE(ENABLE_SOLARIS_OUTPUT, 1, [Define to enable Solaris /dev/audio support])
945                 enable_solaris_output=yes
946                 ;;
948         *)
949                 enable_solaris_output=no
950                 ;;
951 esac
953 AM_CONDITIONAL(ENABLE_SOLARIS_OUTPUT, test x$enable_solaris_output = xyes)
955 dnl ---------------------------------------------------------------------------
956 dnl Decoder Plugins
957 dnl ---------------------------------------------------------------------------
959 dnl -------------------------------- audiofile --------------------------------
960 MPD_AUTO_PKG(audiofile, AUDIOFILE, [audiofile >= 0.1.7],
961         [audiofile decoder plugin], [libaudiofile not found])
962 AM_CONDITIONAL(HAVE_AUDIOFILE, test x$enable_audiofile = xyes)
963 if test x$enable_audiofile = xyes; then
964         AC_DEFINE(HAVE_AUDIOFILE, 1, [Define for audiofile support])
967 dnl ----------------------------------- FAAD ----------------------------------
968 AM_PATH_FAAD()
970 AM_CONDITIONAL(HAVE_FAAD, test x$enable_aac = xyes)
971 AM_CONDITIONAL(HAVE_MP4, test x$enable_mp4 = xyes)
973 dnl ----------------------------------- FLAC ----------------------------------
974 if test x$enable_flac = xyes; then
975         PKG_CHECK_MODULES(FLAC, [flac >= 1.1],
976                 AC_DEFINE(HAVE_FLAC, 1, [Define for FLAC support]),
977                 enable_flac=no)
979         oldcflags="$CFLAGS"
980         oldlibs="$LIBS"
981         CFLAGS="$CFLAGS $FLAC_CFLAGS"
982         LIBS="$LIBS $FLAC_LIBS"
983         if test x$enable_flac = xyes && test x$enable_oggflac = xyes; then
984                 AC_CHECK_DECL(FLAC_API_SUPPORTS_OGG_FLAC,
985                         [enable_oggflac=flac], [],
986                         [#include <FLAC/export.h>])
987         fi
988         CFLAGS="$oldcflags"
989         LIBS="$oldlibs"
992 AM_CONDITIONAL(HAVE_FLAC, test x$enable_flac = xyes)
994 enable_flac_encoder=$enable_flac
996 dnl -------------------------------- FluidSynth -------------------------------
997 if test x$enable_fluidsynth = xyes; then
998         PKG_CHECK_MODULES(FLUIDSYNTH, [fluidsynth],
999                 AC_DEFINE(ENABLE_FLUIDSYNTH, 1, [Define for fluidsynth support]),
1000                 enable_fluidsynth=no)
1003 AM_CONDITIONAL(ENABLE_FLUIDSYNTH, test x$enable_fluidsynth = xyes)
1005 dnl ---------------------------------- libmad ---------------------------------
1006 MPD_AUTO_PKG(mad, MAD, [mad],
1007         [libmad MP3 decoder plugin], [libmad not found])
1008 if test x$enable_mad = xyes; then
1009         AC_DEFINE(HAVE_MAD, 1, [Define to use libmad])
1011 AM_CONDITIONAL(HAVE_MAD, test x$enable_mad = xyes)
1013 enable_shout2="$enable_shout"
1014 MPD_AUTO_PKG(shout, SHOUT, [shout],
1015         [shout output plugin], [libshout not found])
1016 if test x$enable_shout = xyes && test x$enable_shout2 = xauto; then
1017         enable_shout=auto
1020 dnl -------------------------------- libmpg123 --------------------------------
1021 MPD_AUTO_PKG(mpg123, MPG123, [libmpg123],
1022         [libmpg123 decoder plugin], [libmpg123 not found])
1023 if test x$enable_mpg123 = xyes; then
1024         AC_DEFINE(HAVE_MPG123, 1, [Define to use libmpg123])
1026 AM_CONDITIONAL(HAVE_MPG123, test x$enable_mpg123 = xyes)
1028 dnl -------------------------------- libmikmod --------------------------------
1029 if test x$enable_mikmod = xyes; then
1030         AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config)
1031         if test x$LIBMIKMOD_CONFIG != x ; then
1032                 AC_SUBST(LIBMIKMOD_CFLAGS, `$LIBMIKMOD_CONFIG --cflags`)
1033                 AC_SUBST(LIBMIKMOD_LIBS, `$LIBMIKMOD_CONFIG --libs`)
1034                 AC_DEFINE(ENABLE_MIKMOD_DECODER, 1, [Define for mikmod support])
1035         else
1036                 enable_mikmod=no
1037         fi
1040 AM_CONDITIONAL(ENABLE_MIKMOD_DECODER, test x$enable_mikmod = xyes)
1042 dnl -------------------------------- libmodplug -------------------------------
1043 found_modplug=$HAVE_CXX
1044 MPD_AUTO_PRE(modplug, [modplug decoder plugin], [No C++ compiler found])
1046 MPD_AUTO_PKG(modplug, MODPLUG, [libmodplug],
1047         [modplug decoder plugin], [libmodplug not found])
1049 if test x$enable_modplug = xyes; then
1050         AC_DEFINE(HAVE_MODPLUG, 1, [Define for modplug support])
1052 AM_CONDITIONAL(HAVE_MODPLUG, test x$enable_modplug = xyes)
1054 dnl --------------------------- sndfile/modplug test --------------------------
1055 if test x$enable_sndfile = xauto && test x$enable_modplug = xyes; then
1056         dnl If modplug is enabled, enable sndfile only if explicitly
1057         dnl requested - modplug's modplug/sndfile.h is known to
1058         dnl conflict with libsndfile's sndfile.h.
1059         AC_MSG_NOTICE([disabling libsndfile auto-detection, because the modplug decoder is enabled])
1060         enable_sndfile=no
1064 if test x$enable_mpc = xyes; then
1065         if test "x$mpcdec_libraries" != "x" ; then
1066                 MPCDEC_LIBS="-L$mpcdec_libraries"
1067         elif test "x$mpcdec_prefix" != "x" ; then
1068                 MPCDEC_LIBS="-L$mpcdec_prefix/lib"
1069         fi
1071         MPCDEC_LIBS="$MPCDEC_LIBS -lmpcdec"
1073         if test "x$mpcdec_includes" != "x" ; then
1074                 MPCDEC_CFLAGS="-I$mpcdec_includes"
1075         elif test "x$mpcdec_prefix" != "x" ; then
1076                 MPCDEC_CFLAGS="-I$mpcdec_prefix/include"
1077         fi
1079         oldcflags=$CFLAGS
1080         oldlibs=$LIBS
1081         oldcppflags=$CPPFLAGS
1082         CFLAGS="$CFLAGS $MPD_CFLAGS $MPCDEC_CFLAGS -I."
1083         LIBS="$LIBS $MPD_LIBS $MPCDEC_LIBS"
1084         CPPFLAGS=$CFLAGS
1085         AC_CHECK_HEADER(mpc/mpcdec.h,
1086                 old_mpcdec=no,
1087                 [AC_CHECK_HEADER(mpcdec/mpcdec.h,
1088                         old_mpcdec=yes,
1089                         enable_mpc=no)])
1090         if test x$enable_mpc = xyes; then
1091                 AC_CHECK_LIB(mpcdec,main,
1092                         [MPD_LIBS="$MPD_LIBS $MPCDEC_LIBS";
1093                         MPD_CFLAGS="$MPD_CFLAGS $MPCDEC_CFLAGS";],
1094                         enable_mpc=no)
1095         fi
1096         if test x$enable_mpc = xyes; then
1097                 AC_DEFINE(HAVE_MPCDEC,1,
1098                         [Define to use libmpcdec for MPC decoding])
1099                 if test x$old_mpcdec = xyes; then
1100                         AC_DEFINE(MPC_IS_OLD_API, 1,
1101                                 [Define if an old pre-SV8 libmpcdec is used])
1102                 fi
1103         else
1104                 AC_MSG_WARN([mpcdec lib needed for MPC support -- disabling MPC support])
1105         fi
1106         CFLAGS=$oldcflags
1107         LIBS=$oldlibs
1108         CPPFLAGS=$oldcppflags
1111 AM_CONDITIONAL(HAVE_MPCDEC, test x$enable_mpc = xyes)
1115 if test x$use_tremor = xyes; then
1116         if test "x$tremor_libraries" != "x" ; then
1117                 TREMOR_LIBS="-L$tremor_libraries"
1118         elif test "x$tremor_prefix" != "x" ; then
1119                 TREMOR_LIBS="-L$tremor_prefix/lib"
1120         fi
1121         TREMOR_LIBS="$TREMOR_LIBS -lvorbisidec"
1122         if test "x$tremor_includes" != "x" ; then
1123                 TREMOR_CFLAGS="-I$tremor_includes"
1124         elif test "x$tremor_prefix" != "x" ; then
1125                 TREMOR_CFLAGS="-I$tremor_prefix/include"
1126         fi
1127         ac_save_CFLAGS="$CFLAGS"
1128         ac_save_LIBS="$LIBS"
1129         CFLAGS="$CFLAGS $TREMOR_CFLAGS"
1130         LIBS="$LIBS $TREMOR_LIBS"
1131         AC_CHECK_LIB(vorbisidec,ov_read,enable_vorbis=yes,enable_vorbis=no;
1132                 AC_MSG_WARN([vorbisidec lib needed for ogg support with tremor -- disabling ogg support]))
1133         CFLAGS="$ac_save_CFLAGS"
1134         LIBS="$ac_save_LIBS"
1135         if test x$enable_vorbis = xyes; then
1136                 AC_DEFINE(ENABLE_VORBIS_DECODER, 1, [Define for Ogg Vorbis support])
1137         fi
1138 elif test x$enable_vorbis = xyes; then
1139         PKG_CHECK_MODULES(VORBIS, [ogg vorbis vorbisfile],
1140                 AC_DEFINE(ENABLE_VORBIS_DECODER, 1, [Define for Ogg Vorbis support]),
1141                 enable_vorbis=no)
1144 AM_CONDITIONAL(ENABLE_VORBIS_DECODER, test x$enable_vorbis = xyes)
1146 if test x$use_tremor = xyes; then
1147         AC_DEFINE(HAVE_TREMOR,1,
1148                 [Define to use tremor (libvorbisidec) for ogg support])
1149         if test x$enable_oggflac = xyes; then
1150                 AC_MSG_WARN([disabling OggFLAC support because it is incompatible with tremor])
1151                 enable_oggflac=no
1152         fi
1155 AC_SUBST(TREMOR_CFLAGS)
1156 AC_SUBST(TREMOR_LIBS)
1160 if test x$enable_oggflac = xyes; then
1161         oldmpdcflags="$MPD_CFLAGS"
1162         oldmpdlibs="$MPD_LIBS"
1163         AM_PATH_LIBOGGFLAC(MPD_LIBS="$MPD_LIBS $LIBOGGFLAC_LIBS"
1164                                 MPD_CFLAGS="$MPD_CFLAGS $LIBOGGFLAC_CFLAGS",
1165                            enable_oggflac=no)
1168 if test x$enable_oggflac = xyes; then
1169         AC_DEFINE(HAVE_OGGFLAC,1,[Define for OggFLAC support])
1172 AM_CONDITIONAL(HAVE_OGGFLAC, test x$enable_oggflac = xyes)
1174 AM_CONDITIONAL(HAVE_FLAC_COMMON,
1175           test x$enable_flac = xyes || test x$enable_oggflac = xyes)
1176 AM_CONDITIONAL(HAVE_OGG_COMMON,
1177           test x$enable_vorbis = xyes || test x$enable_oggflac = xyes || test x$enable_flac = xyes)
1179 MPD_AUTO_PKG(ffmpeg, FFMPEG, [libavformat libavcodec libavutil],
1180         [ffmpeg decoder library], [libavformat+libavcodec+libavutil not found])
1182 if test x$enable_ffmpeg = xyes; then
1183         old_LIBS=$LIBS
1184         LIBS="$LIBS $FFMPEG_LIBS"
1185         AC_CHECK_LIB(avcodec, avcodec_decode_audio2,,
1186                 enable_ffmpeg=no)
1187         LIBS=$old_LIBS
1190 if test x$enable_ffmpeg = xyes; then
1191         # prior to ffmpeg svn12865, you had to specify include files
1192         # without path prefix
1193         old_CPPCFLAGS=$CPPFLAGS
1194         CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS"
1195         AC_CHECK_HEADER(libavcodec/avcodec.h,,
1196                 AC_DEFINE(OLD_FFMPEG_INCLUDES, 1,
1197                         [Define if avcodec.h instead of libavcodec/avcodec.h should be included]))
1198         CPPCFLAGS=$old_CPPFLAGS
1201 if test x$enable_ffmpeg = xyes; then
1202         AC_DEFINE(HAVE_FFMPEG, 1, [Define for FFMPEG support])
1205 AM_CONDITIONAL(HAVE_FFMPEG, test x$enable_ffmpeg = xyes)
1209 if test x$enable_wildmidi = xyes; then
1210         oldcflags=$CFLAGS
1211         oldlibs=$LIBS
1212         oldcppflags=$CPPFLAGS
1214         AC_CHECK_LIB(WildMidi, WildMidi_Init,,
1215                 AC_MSG_ERROR([libwildmidi not found]))
1217         CFLAGS=$oldcflags
1218         LIBS=$oldlibs
1219         CPPFLAGS=$oldcppflags
1221         AC_SUBST(WILDMIDI_LIBS,-lWildMidi)
1222         AC_SUBST(WILDMIDI_CFLAGS,)
1224         AC_DEFINE(ENABLE_WILDMIDI, 1, [Define for wildmidi support])
1227 AM_CONDITIONAL(ENABLE_WILDMIDI, test x$enable_wildmidi = xyes)
1231 dnl Encoder API and shout/httpd output plugin
1234 if test x$enable_shout = xyes || \
1235         test x$enable_recorder_output = xyes || \
1236         test x$enable_httpd_output = xyes; then
1237         # at least one output using encoders is explicitly enabled
1238         need_encoder=yes
1239 elif test x$enable_shout = xauto || \
1240         test x$enable_recorder_output = xauto || \
1241         test x$enable_httpd_output = xauto; then
1242         need_encoder=auto
1243 else
1244         # all outputs using encoders are disabled
1245         need_encoder=no
1247         # don't bother to check for encoder plugins
1248         enable_vorbis_encoder=no
1249         enable_lame_encoder=no
1250         enable_twolame_encoder=no
1251         enable_wave_encoder=no
1252         enable_flac_encoder=no
1255 MPD_AUTO_PKG(vorbis_encoder, VORBISENC, [vorbisenc],
1256         [Ogg Vorbis encoder], [libvorbisenc not found])
1258 if test x$enable_lame_encoder != xno; then
1259         AC_CHECK_HEADERS(lame/lame.h,,
1260                 [AC_CHECK_HEADERS(lame.h,, using_lame=no)])
1261         AC_CHECK_LIB(mp3lame, lame_init,, using_lame=no)
1262         if test x$using_lame != xno; then
1263                 AC_DEFINE(HAVE_LAME, 1, [Define to 1 if you have lame 3.98 or greater.])
1264                 LAME_LIBS="-lmp3lame -lm"
1265                 enable_lame_encoder=yes
1266         fi
1268         if test "$enable_lame_encoder" = "yes" -a "$using_lame" = "no"; then
1269                 AC_MSG_ERROR([LAME libraries and development support files not found.])
1270         fi
1273 AC_SUBST(LAME_LIBS)
1275 MPD_AUTO_PKG(twolame_encoder, TWOLAME, [twolame],
1276         [TwoLAME encoder], [libtwolame not found])
1278 if test x$enable_vorbis_encoder != xno ||
1279         test x$enable_lame_encoder != xno ||
1280         test x$enable_twolame_encoder != xno ||
1281         test x$enable_flac_encoder != xno ||
1282         test x$enable_wave_encoder != xno; then
1283         # at least one encoder plugin is enabled
1284         enable_encoder=yes
1285 else
1286         # no encoder plugin is enabled: disable the whole encoder API
1287         enable_encoder=no
1289         if test x$need_encoder = xyes; then
1290                 AC_MSG_ERROR([No encoder plugin found])
1291         fi
1295 if test x$enable_shout = xauto; then
1296         # handle shout auto-detection: disable if no encoder is
1297         # available
1298         if test x$enable_encoder = xyes; then
1299                 enable_shout=yes
1300         else
1301                 AC_MSG_WARN([No encoder plugin -- disabling the shout output plugin])
1302                 enable_shout=no
1303         fi
1306 if test x$enable_recorder_output = xauto; then
1307         # handle recorder auto-detection: disable if no encoder is
1308         # available
1309         if test x$enable_encoder = xyes; then
1310                 enable_recorder_output=yes
1311         else
1312                 AC_MSG_WARN([No encoder plugin -- disabling the recorder output plugin])
1313                 enable_recorder_output=no
1314         fi
1317 if test x$enable_httpd_output = xauto; then
1318         # handle HTTPD auto-detection: disable if no encoder is
1319         # available
1320         if test x$enable_encoder = xyes; then
1321                 enable_httpd_output=yes
1322         else
1323                 AC_MSG_WARN([No encoder plugin -- disabling the HTTP output plugin])
1324                 enable_httpd_output=no
1325         fi
1328 AM_CONDITIONAL(HAVE_SHOUT, test x$enable_shout = xyes)
1329 if test x$enable_shout = xyes; then
1330         AC_DEFINE(HAVE_SHOUT, 1, [Define to enable the shoutcast output])
1333 AM_CONDITIONAL(ENABLE_RECORDER_OUTPUT, test x$enable_recorder_output = xyes)
1334 if test x$enable_recorder_output = xyes; then
1335         AC_DEFINE(ENABLE_RECORDER_OUTPUT, 1, [Define to enable the recorder output])
1338 AM_CONDITIONAL(ENABLE_HTTPD_OUTPUT, test x$enable_httpd_output = xyes)
1339 if test x$enable_httpd_output = xyes; then
1340         AC_DEFINE(ENABLE_HTTPD_OUTPUT, 1, [Define to enable the HTTP server output])
1343 AM_CONDITIONAL(ENABLE_ENCODER, test x$enable_encoder = xyes)
1344 if test x$enable_encoder = xyes; then
1345         AC_DEFINE(ENABLE_ENCODER, 1,
1346                 [Define to enable the encoder plugins])
1349 AM_CONDITIONAL(ENABLE_VORBIS_ENCODER, test x$enable_vorbis_encoder = xyes)
1350 if test x$enable_vorbis_encoder = xyes; then
1351         AC_DEFINE(ENABLE_VORBIS_ENCODER, 1,
1352                 [Define to enable the vorbis encoder plugin])
1355 AM_CONDITIONAL(ENABLE_LAME_ENCODER, test x$enable_lame_encoder = xyes)
1356 if test x$enable_lame_encoder = xyes; then
1357         AC_DEFINE(ENABLE_LAME_ENCODER, 1,
1358                 [Define to enable the lame encoder plugin])
1361 AM_CONDITIONAL(ENABLE_TWOLAME_ENCODER, test x$enable_twolame_encoder = xyes)
1362 if test x$enable_twolame_encoder = xyes; then
1363         AC_DEFINE(ENABLE_TWOLAME_ENCODER, 1,
1364                 [Define to enable the TwoLAME encoder plugin])
1367 AM_CONDITIONAL(ENABLE_WAVE_ENCODER, test x$enable_wave_encoder = xyes)
1368 if test x$enable_wave_encoder = xyes; then
1369         AC_DEFINE(ENABLE_WAVE_ENCODER, 1,
1370                 [Define to enable the PCM wave encoder plugin])
1373 AM_CONDITIONAL(ENABLE_FLAC_ENCODER, test x$enable_flac_encoder = xyes)
1374 if test x$enable_flac_encoder = xyes; then
1375         AC_DEFINE(ENABLE_FLAC_ENCODER, 1,
1376                 [Define to enable the FLAC encoder plugin])
1379 dnl ---------------------------------------------------------------------------
1380 dnl Documentation
1381 dnl ---------------------------------------------------------------------------
1384 if test x$enable_documentation = xyes; then
1385         AC_PATH_PROG(XMLTO, xmlto)
1386         AC_SUBST(XMLTO)
1387         AM_CONDITIONAL(HAVE_XMLTO, test x$XMLTO != x)
1389         AC_PATH_PROG(DOXYGEN, doxygen)
1390         if test x$DOXYGEN = x; then
1391                 AC_MSG_ERROR([doxygen not found])
1392         fi
1394         AC_SUBST(DOXYGEN)
1395 else
1396         AM_CONDITIONAL(HAVE_XMLTO, false)
1399 AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)
1403 dnl build options
1407 if test "x$enable_werror" = xyes; then
1408         AM_CFLAGS="$AM_CFLAGS -Werror -pedantic-errors"
1411 #if test "x$enable_debug" = xno; then
1412         # don't set NDEBUG for now, until MPD is stable
1413         #AM_CFLAGS="$AM_CFLAGS -DNDEBUG"
1416 if test "x$enable_gprof" = xyes; then
1417         MPD_CFLAGS="$MPD_CFLAGS -pg"
1418         MPD_LIBS="$MPD_LIBS -pg"
1421 dnl ---------------------------------------------------------------------------
1422 dnl test suite
1423 dnl ---------------------------------------------------------------------------
1424 AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes)
1426 dnl ---------------------------------------------------------------------------
1427 dnl CFLAGS
1428 dnl ---------------------------------------------------------------------------
1429 if test x$GCC = xyes
1430 then
1431         MPD_CHECK_FLAG([-Wall])
1432         MPD_CHECK_FLAG([-Wextra])
1433         MPD_CHECK_FLAG([-Wno-deprecated-declarations])
1434         MPD_CHECK_FLAG([-Wmissing-prototypes])
1435         MPD_CHECK_FLAG([-Wshadow])
1436         MPD_CHECK_FLAG([-Wpointer-arith])
1437         MPD_CHECK_FLAG([-Wstrict-prototypes])
1438         MPD_CHECK_FLAG([-Wcast-qual])
1439         MPD_CHECK_FLAG([-Wwrite-strings])
1440         MPD_CHECK_FLAG([-pedantic])
1443 dnl ---------------------------------------------------------------------------
1444 dnl Pretty-Print Results
1445 dnl ---------------------------------------------------------------------------
1446 echo ""
1447 echo "########### MPD CONFIGURATION ############"
1448 echo ""
1450 echo " Client Support:"
1451 if test x$enable_ipv6 = xyes; then
1452         echo " IPv6 support ..................enabled"
1453 else
1454         echo " IPv6 support ..................disabled"
1457 if test x$enable_tcp = xyes; then
1458         echo " TCP support ...................enabled"
1459 else
1460         echo " TCP support ...................disabled"
1463 if test x$enable_un = xyes; then
1464         echo " Unix domain socket support ....enabled"
1465 else
1466         echo " Unix domain socket support ....disabled"
1469 echo ""
1472         test x$enable_tcp = xno &&
1473         test x$enable_un = xno; then
1474         AC_MSG_ERROR([No client interfaces configured!])
1477 echo " Playback Support:"
1478 if test x$enable_alsa = xyes; then
1479         echo " ALSA support ..................enabled"
1480 else
1481         echo " ALSA support ..................disabled"
1484 if test x$enable_fifo = xyes; then
1485         echo " FIFO support ..................enabled"
1486 else
1487         echo " FIFO support ..................disabled"
1490 if test x$enable_recorder_output = xyes; then
1491         echo " File Recorder support .........enabled"
1492 else
1493         echo " File Recorder support .........disabled"
1496 if test x$enable_httpd_output = xyes; then
1497         echo " HTTP daemon support ...........enabled"
1498 else
1499         echo " HTTP daemon support ...........disabled"
1502 if test x$enable_jack = xyes; then
1503         echo " JACK support ..................enabled"
1504 else
1505         echo " JACK support ..................disabled"
1508 if test x$enable_ao = xyes; then
1509         echo " libao support .................enabled"
1510 else
1511         echo " libao support .................disabled"
1514 if test x$enable_oss = xyes; then
1515         echo " OSS support ...................enabled"
1516 else
1517         echo " OSS support ...................disabled"
1520 if test x$enable_openal = xyes; then
1521         echo " OpenAL support ................enabled"
1522 else
1523         echo " OpenAL support ................disabled"
1526 if test x$enable_osx = xyes; then
1527         echo " OS X support ..................enabled"
1528 else
1529         echo " OS X support ..................disabled"
1532 if test x$enable_pipe_output = xyes; then
1533         echo " Pipeline output support .......enabled"
1534 else
1535         echo " Pipeline output support .......disabled"
1538 if test x$enable_pulse = xyes; then
1539         echo " PulseAudio support ............enabled"
1540 else
1541         echo " PulseAudio support ............disabled"
1544 if test x$enable_mvp = xyes; then
1545         echo " Media MVP support .............enabled"
1546 else
1547         echo " Media MVP support .............disabled"
1550 if test x$enable_shout = xyes; then
1551         echo " SHOUTcast support .............enabled"
1552 else
1553         echo " SHOUTcast support .............disabled"
1556 if test x$enable_solaris_output = xyes; then
1557         echo " Solaris /dev/audio support ....enabled"
1558 else
1559         echo " Solaris /dev/audio support ....disabled"
1562 echo ""
1565         test x$enable_ao = xno &&
1566         test x$enable_oss = xno &&
1567         test x$enable_openal = xno &&
1568         test x$enable_shout = xno &&
1569         test x$enable_recorder_output = xno &&
1570         test x$enable_httpd_output = xno &&
1571         test x$enable_solaris_output = xno &&
1572         test x$enable_alsa = xno &&
1573         test x$enable_osx = xno &&
1574         test x$enable_pulse = xno &&
1575         test x$enable_jack = xno &&
1576         test x$enable_fifo = xno &&
1577         test x$enable_pipe_output = xno &&
1578         test x$enable_mvp = xno; then
1579                 AC_MSG_ERROR([No Audio Output types configured!])
1583         test x$enable_shout = xyes ||
1584         test x$enable_recorder = xyes ||
1585         test x$enable_httpd_output = xyes; then
1586                 echo " Streaming Encoder Support:"
1587                 if test x$enable_lame_encoder = xyes; then
1588                         echo " LAME mp3 encoder ..............enabled"
1589                 else
1590                         echo " LAME mp3 encoder ..............disabled"
1591                 fi
1593                 if test x$enable_vorbis_encoder = xyes; then
1594                         echo " Ogg Vorbis encoder ............enabled"
1595                 else
1596                         echo " Ogg Vorbis encoder ............disabled"
1597                 fi
1599                 if test x$enable_twolame_encoder = xyes; then
1600                         echo " TwoLAME mp3 encoder ...........enabled"
1601                 else
1602                         echo " TwoLAME mp3 encoder ...........disabled"
1603                 fi
1605                 if test x$enable_flac_encoder = xyes; then
1606                         echo " FLAC encoder ..................enabled"
1607                 else
1608                         echo " FLAC encoder ..................disabled"
1609                 fi
1611                 if test x$enable_wave_encoder = xyes; then
1612                         echo " PCM wave encoder ..............enabled"
1613                 else
1614                         echo " PCM wave encoder ..............disabled"
1615                 fi
1617                 echo ""
1620 echo " File Format Support:"
1622 if test x$enable_aac = xyes; then
1623         echo " AAC support ...................enabled"
1624 else
1625         echo " AAC support ...................disabled"
1628 if test x$enable_sidplay = xyes; then
1629         echo " C64 SID support ...............enabled"
1630 else
1631         echo " C64 SID support ...............disabled"
1634 if test x$enable_ffmpeg = xyes; then
1635         echo " FFMPEG support ................enabled"
1636 else
1637         echo " FFMPEG support ................disabled"
1640 if test x$enable_flac = xyes; then
1641         echo " FLAC support ..................enabled"
1642 else
1643         echo " FLAC support ..................disabled"
1646 if test x$enable_fluidsynth = xyes; then
1647         echo " fluidsynth MIDI support .......enabled"
1648 else
1649         echo " fluidsynth MIDI support .......disabled"
1652 if test x$enable_mikmod = xyes; then
1653         echo " MikMod support ................enabled"
1654 else
1655         echo " MikMod support ................disabled"
1658 if test x$enable_modplug = xyes; then
1659         echo " MODPLUG support ...............enabled"
1660 else
1661         echo " MODPLUG support ...............disabled"
1664 if test x$enable_gme = xyes; then
1665         echo " GME support ....................enabled"
1666 else
1667         echo " GME support ...................disabled"
1670 if test x$enable_mad = xyes; then
1671         echo " MAD mp3 decoder support .......enabled"
1672 else
1673         echo " MAD mp3 decoder support .......disabled"
1676 if test x$enable_mpg123 = xyes; then
1677         echo " libmpg123 decoder support .....enabled"
1678 else
1679         echo " libmpg123 decoder support .....disabled"
1682 if test x$enable_mp4 = xyes; then
1683         echo " MP4 support ...................enabled"
1684 else
1685         echo " MP4 support ...................disabled"
1688 if test x$enable_mpc = xyes; then
1689         echo " Musepack (MPC) support ........enabled"
1690 else
1691         echo " Musepack (MPC) support ........disabled"
1694 case $enable_oggflac in
1695 yes)
1696         echo " OggFLAC support ...............enabled"
1697         ;;
1698 flac)
1699         echo " OggFLAC support ...............enabled(FLAC 1.1.3)"
1700         ;;
1702         echo " OggFLAC support ...............disabled"
1703         ;;
1704 esac
1706 if test x$enable_vorbis = xyes; then
1707         echo " Ogg Vorbis support ............enabled"
1708         if test x$use_tremor = xyes; then
1709                 echo "   using tremor.................yes"
1710         else
1711                 echo "   using tremor.................no"
1712         fi
1713 else
1714         echo " Ogg Vorbis support ............disabled"
1717 if test x$enable_sndfile = xyes; then
1718         echo " libsndfile ....................enabled"
1719 else
1720         echo " libsndfile ....................disabled"
1723 if test x$enable_audiofile = xyes; then
1724         echo " Wave file support .............enabled"
1725 else
1726         echo " Wave file support .............disabled"
1729 if test x$enable_wavpack = xyes; then
1730         echo " WavPack support ...............enabled"
1731 else
1732         echo " WavPack support ...............disabled"
1735 if test x$enable_wildmidi = xyes; then
1736         echo " wildmidi MIDI support .........enabled"
1737 else
1738         echo " wildmidi MIDI support .........disabled"
1744         test x$enable_mad = xno &&
1745         test x$enable_mpg123 = xno &&
1746         test x$enable_vorbis = xno &&
1747         test x$enable_flac = xno && 
1748         test x$enable_oggflac = xno &&
1749         test x$enable_audiofile = xno && 
1750         test x$enable_aac = xno &&
1751         test x$enable_mpc = xno &&
1752         test x$enable_wavpack = xno &&
1753         test x$enable_ffmpeg = xno &&
1754         test x$enable_modplug = xno &&
1755         test x$enable_sidplay = xno &&
1756         test x$enable_gme = xno &&
1757         test x$enable_fluidsynth = xno &&
1758         test x$enable_wildmidi = xno &&
1759         test x$enable_mp4 = xno &&
1760         test x$enable_mikmod = xno; then
1761                 AC_MSG_ERROR([No input plugins supported!])
1764 echo ""
1765 echo " Archive support:"
1767 if test x$enable_bzip2 = xyes; then
1768         echo " BZ2 archives support ..........enabled"
1769 else
1770         echo " BZ2 archives support ..........disabled"
1773 if test x$enable_iso9660 = xyes; then
1774         echo " ISO 9660 archives support .....enabled"
1775 else
1776         echo " ISO 9660 archives support .....disabled"
1779 if test x$enable_zzip = xyes; then
1780         echo " ZIP archives support ..........enabled"
1781 else
1782         echo " ZIP archives support ..........disabled"
1785 echo ""
1786 echo " Streaming support:"
1788 if test x$enable_lastfm = xyes; then
1789         echo " last.fm radio support .........enabled"
1790 else
1791         echo " last.fm radio support .........disabled"
1794 if test x$enable_curl = xyes; then
1795         echo " libcurl support (streaming) ...enabled"
1796 else
1797         echo " libcurl support (streaming) ...disabled"
1800 if test x$enable_mms = xyes; then
1801         echo " libmms support ................enabled"
1802 else
1803         echo " libmms support ................disabled"
1806 echo ""
1807 echo " Other features:"
1809 if test x$enable_id3 = xyes; then
1810         echo " ID3 tag support ...............enabled"
1811 else
1812         echo " ID3 tag support ...............disabled"
1815 if test x$enable_lsr = xyes; then
1816         echo " libsamplerate support .........enabled"
1817 else
1818         echo " libsamplerate support .........disabled"
1821 if test x$with_zeroconf != xno; then
1822         echo " Zeroconf support ..............$with_zeroconf"
1823 else
1824         echo " Zeroconf support ..............disabled"
1827 if test x$enable_cue = xyes; then
1828         echo " libcue support ................enabled"
1829 else
1830         echo " libcue support ................disabled"
1833 if test x$enable_inotify = xyes; then
1834         echo " Inotify support (autoupdate) ..enabled"
1835 else
1836         echo " Inotify support (autoupdate) ..disabled"
1839 echo ""
1840 echo "##########################################"
1841 echo ""
1843 if test x$enable_sndfile = xyes && test x$enable_modplug = xyes; then
1844         AC_MSG_WARN([compilation may fail, because libmodplug conflicts with libsndfile])
1845         AC_MSG_WARN([libmodplug ships modplug/sndfile.h, which hides libsndfile's sndfile.h])
1848 echo "Generating needed files for compilation"
1849 echo ""
1852 dnl generate files
1855 AC_OUTPUT(Makefile)
1857 echo ""
1859 echo "You are now ready to compile MPD"
1860 echo "Type \"make\" to compile MPD"