configure.ac: Fix a couple of syntax errors created by the moves.
[mpd-mk.git] / configure.ac
blob8606da0d767f42745a1bf696a37adb407d4af18c
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(gme,
179         AS_HELP_STRING([--enable-gme],
180                 [enable Blargg's game music emulator plugin]),,
181         enable_gme=auto)
183 AC_ARG_ENABLE(gprof,
184         AS_HELP_STRING([--enable-gprof],
185                 [enable profiling via gprof (default: disabled)]),,
186         enable_gprof=no)
188 AC_ARG_ENABLE(httpd-output,
189         AS_HELP_STRING([--enable-httpd-output],
190                 [enables the HTTP server output]),,
191         [enable_httpd_output=auto])
193 AC_ARG_ENABLE(id3,
194         AS_HELP_STRING([--disable-id3],
195                 [disable id3 support (default: enable)]),,
196         enable_id3=yes)
198 AC_ARG_ENABLE(inotify,
199         AS_HELP_STRING([--disable-inotify],
200                 [disable support Inotify automatic database update (default: enabled) ]),,
201         [enable_inotify=yes])
203 AC_ARG_ENABLE(ipv6,
204         AS_HELP_STRING([--disable-ipv6],
205                 [disable IPv6 support (default: enable)]),,
206         [enable_ipv6=yes])
208 AC_ARG_ENABLE(iso9660,
209         AS_HELP_STRING([--enable-iso9660],
210                 [enable iso9660 archive support (default: disabled)]),,
211         enable_iso9660=no)
213 AC_ARG_ENABLE(jack,
214         AS_HELP_STRING([--enable-jack],
215                 [enable jack support]),,
216         enable_jack=auto)
218 AC_SYS_LARGEFILE
220 AC_ARG_ENABLE(lastfm,
221         AS_HELP_STRING([--enable-lastfm],
222                 [enable support for last.fm radio (default: disable)]),,
223         [enable_lastfm=no])
225 AC_ARG_ENABLE(lame-encoder,
226         AS_HELP_STRING([--enable-lame-encoder],
227                 [enable the LAME mp3 encoder]),,
228         enable_lame_encoder=auto)
230 AC_ARG_ENABLE([libwrap],
231         AS_HELP_STRING([--enable-libwrap], [use libwrap]),,
232         [enable_libwrap=auto])
234 AC_ARG_ENABLE(lsr,
235         AS_HELP_STRING([--enable-lsr],
236                 [enable libsamplerate support]),,
237         enable_lsr=auto)
239 AC_ARG_ENABLE(mad,
240         AS_HELP_STRING([--enable-mad],
241                 [enable libmad mp3 decoder plugin]),,
242         enable_mad=auto)
244 AC_ARG_ENABLE(mikmod,
245         AS_HELP_STRING([--enable-mikmod],
246                 [enable the mikmod decoder (default: disable)]),,
247         enable_mikmod=no)
249 AC_ARG_ENABLE(mms,
250         AS_HELP_STRING([--enable-mms],
251                 [enable the MMS protocol with libmms]),,
252         [enable_mms=auto])
254 AC_ARG_ENABLE(modplug,
255         AS_HELP_STRING([--enable-modplug],
256                 [enable modplug decoder plugin]),,
257         enable_modplug=auto)
259 AC_ARG_ENABLE(mpc,
260         AS_HELP_STRING([--disable-mpc],
261                 [disable musepack (MPC) support (default: enable)]),,
262         enable_mpc=yes)
264 AC_ARG_ENABLE(mpg123,
265         AS_HELP_STRING([--enable-mpg123],
266                 [enable libmpg123 decoder plugin]),,
267         enable_mpg123=auto)
269 AC_ARG_ENABLE(mvp,
270         AS_HELP_STRING([--enable-mvp],
271                 [enable support for Hauppauge Media MVP (default: disable)]),,
272         enable_mvp=no)
274 AC_ARG_ENABLE(oggflac,
275         AS_HELP_STRING([--disable-oggflac],
276                 [disable OggFLAC support (default: enable)]),,
277         enable_oggflac=yes)
279 AC_ARG_ENABLE(openal,
280         AS_HELP_STRING([--enable-openal],
281                 [enable OpenAL support (default: disable)]),,
282         enable_openal=no)
284 AC_ARG_ENABLE(oss,
285         AS_HELP_STRING([--disable-oss],
286                 [disable OSS support (default: enable)]),,
287         enable_oss=yes)
289 AC_ARG_ENABLE(pipe-output,
290         AS_HELP_STRING([--enable-pipe-output],
291                 [enable support for writing audio to a pipe (default: disable)]),,
292         enable_pipe_output=no)
294 AC_ARG_ENABLE(pulse,
295         AS_HELP_STRING([--enable-pulse],
296                 [enable support for the PulseAudio sound server]),,
297         enable_pulse=auto)
299 AC_ARG_ENABLE(recorder-output,
300         AS_HELP_STRING([--enable-recorder-output],
301                 [enables the recorder file output plugin (default: disable)]),,
302         [enable_recorder_output=auto])
304 AC_ARG_ENABLE(sidplay,
305         AS_HELP_STRING([--enable-sidplay],
306                 [enable C64 SID support via libsidplay2]),,
307         enable_sidplay=auto)
310 AC_ARG_ENABLE(shout,
311         AS_HELP_STRING([--enable-shout],
312                 [enables the shoutcast streaming output]),,
313         [enable_shout=auto])
315 AC_ARG_ENABLE(sndfile,
316         AS_HELP_STRING([--enable-sndfile],
317                 [enable sndfile support]),,
318         enable_sndfile=auto)
320 AC_ARG_ENABLE(sqlite,
321         AS_HELP_STRING([--enable-sqlite],
322                 [enable support for the SQLite database]),,
323         [enable_sqlite=auto])
325 AC_ARG_ENABLE(tcp,
326         AS_HELP_STRING([--disable-tcp],
327                 [disable support for clients connecting via TCP (default: enable)]),,
328         [enable_tcp=yes])
330 AC_ARG_ENABLE(test,
331         AS_HELP_STRING([--enable-test],
332                 [build the test programs (default: disabled)]),,
333         enable_test=no)
335 AC_ARG_WITH(tremor,
336         AS_HELP_STRING([--with-tremor=PFX],
337                 [use Tremor (vorbisidec) integer Ogg Vorbis decoder (with optional prefix)]),,
338         with_tremor=no)
340 AC_ARG_ENABLE(twolame-encoder,
341         AS_HELP_STRING([--enable-twolame-encoder],
342                 [enable the TwoLAME mp2 encoder]),,
343         enable_twolame_encoder=auto)
345 AC_ARG_ENABLE(un,
346         AS_HELP_STRING([--disable-un],
347                 [disable support for clients connecting via unix domain sockets (default: enable)]),,
348         [enable_un=yes])
350 AC_ARG_ENABLE(vorbis,
351         AS_HELP_STRING([--disable-vorbis],
352                 [disable Ogg Vorbis support (default: enable)]),,
353         enable_vorbis=yes)
355 AC_ARG_ENABLE(vorbis-encoder,
356         AS_HELP_STRING([--enable-vorbis-encoder],
357                 [enable the Ogg Vorbis encoder]),,
358         [enable_vorbis_encoder=auto])
360 AC_ARG_ENABLE(wave-encoder,
361         AS_HELP_STRING([--enable-wave-encoder],
362                 [enable the PCM wave encoder]),,
363         enable_wave_encoder=yes)
365 AC_ARG_ENABLE(wavpack,
366         AS_HELP_STRING([--enable-wavpack],
367                 [enable WavPack support]),,
368         enable_wavpack=auto)
370 AC_ARG_ENABLE(werror,
371         AS_HELP_STRING([--enable-werror],
372                 [treat warnings as errors (default: disabled)]),,
373         enable_werror=no)
375 AC_ARG_ENABLE(wildmidi,
376         AS_HELP_STRING([--enable-wildmidi],
377                 [enable MIDI support via wildmidi (default: disable)]),,
378         enable_wildmidi=no)
380 AC_ARG_WITH(zeroconf,
381         AS_HELP_STRING([--with-zeroconf=@<:@auto|avahi|bonjour|no@:>@],
382                 [enable zeroconf backend (default=auto)]),,
383         with_zeroconf="auto")
385 AC_ARG_ENABLE(zzip,
386         AS_HELP_STRING([--enable-zzip],
387                 [enable zip archive support (default: disabled)]),,
388         enable_zzip=no)
391 AC_ARG_WITH(tremor-libraries,
392         AS_HELP_STRING([--with-tremor-libraries=DIR],
393                 [directory where Tremor library is installed (optional)]),,
394         tremor_libraries="")
396 AC_ARG_WITH(tremor-includes,
397         AS_HELP_STRING([--with-tremor-includes=DIR],
398                 [directory where Tremor header files are installed (optional)]),,
399         tremor_includes="")
401 dnl ---------------------------------------------------------------------------
402 dnl Mandatory Libraries
403 dnl ---------------------------------------------------------------------------
404 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.12 gthread-2.0],,
405                 [AC_MSG_ERROR([GLib 2.12 is required])])
407 dnl ---------------------------------------------------------------------------
408 dnl Protocol Options
409 dnl ---------------------------------------------------------------------------
411 if test x$enable_tcp = xno; then
412         # if we don't support TCP, we don't need IPv6 either
413         enable_ipv6=no
416 if test x$enable_ipv6 = xyes; then
417         AC_MSG_CHECKING(for ipv6)
418         AC_EGREP_CPP([AP_maGiC_VALUE],
419         [
420 #include <sys/types.h>
421 #include <sys/socket.h>
422 #include <netdb.h>
423 #ifdef PF_INET6
424 #ifdef AF_INET6
425 AP_maGiC_VALUE
426 #endif
427 #endif
428         ],
429         AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 support present])
430         AC_MSG_RESULT([yes]),
431         AC_MSG_RESULT([no])
435 if test x$enable_tcp = xyes; then
436         AC_DEFINE(HAVE_TCP, 1, [Define if TCP socket support is enabled])
439 case "$host_os" in
440 mingw* | windows*)
441         enable_un=no
442         ;;
443 esac
445 if test x$enable_un = xyes; then
446         AC_DEFINE(HAVE_UN, 1, [Define if unix domain socket support is enabled])
447         STRUCT_UCRED
450 dnl --------------------------- Post Protocol Tests ---------------------------
452         test x$enable_tcp = xno &&
453         test x$enable_un = xno; then
454         AC_MSG_ERROR([No client interfaces configured!])
457 dnl ---------------------------------------------------------------------------
458 dnl LIBC Features
459 dnl ---------------------------------------------------------------------------
460 if test x$enable_largefile != xno; then
461         AC_DEFINE([ENABLE_LARGEFILE], 1, [Define if large file support is enabled])
464 dnl ---------------------------------------------------------------------------
465 dnl Miscellaneous Libraries
466 dnl ---------------------------------------------------------------------------
468 dnl --------------------------------- inotify ---------------------------------
469 AC_CHECK_FUNCS(inotify_init inotify_init1)
471 if test x$ac_cv_func_inotify_init = xno; then
472         enable_inotify=no
475 if test x$enable_inotify = xyes; then
476         AC_DEFINE([ENABLE_INOTIFY], 1, [Define to enable inotify support])
478 AM_CONDITIONAL(ENABLE_INOTIFY, test x$enable_inotify = xyes)
480 dnl --------------------------------- libwrap ---------------------------------
481 if test x$enable_libwrap != xno; then
482         AC_CHECK_LIBWRAP(found_libwrap=yes, found_libwrap=no)
483         MPD_AUTO_RESULT(libwrap, libwrap, [libwrap not found])
486 if test x$enable_libwrap = xyes; then
487         AC_SUBST(LIBWRAP_CFLAGS)
488         AC_SUBST(LIBWRAP_LDFLAGS)
489         AC_DEFINE(HAVE_LIBWRAP, 1, [define to enable libwrap library])
492 dnl ---------------------------------------------------------------------------
493 dnl Metadata Plugins
494 dnl ---------------------------------------------------------------------------
496 dnl ---------------------------------- libcue ---------------------------------
497 MPD_AUTO_PKG(cue, CUE, [libcue],
498         [libcue parsing library], [libcue not found])
499 if test x$enable_cue = xyes; then
500         AC_DEFINE([HAVE_CUE], 1,
501                 [Define to enable libcue support])
504 AM_CONDITIONAL(HAVE_CUE, test x$enable_cue = xyes)
506 dnl -------------------------------- libid3tag --------------------------------
507 if test x$enable_id3 = xyes; then
508         PKG_CHECK_MODULES([ID3TAG], [id3tag],,
509                 AC_CHECK_LIB(id3tag, id3_file_open,
510                         [ID3TAG_LIBS="-lid3tag -lz" ID3TAG_CFLAGS=""],
511                         enable_id3=no))
514 if test x$enable_id3 = xyes; then
515         AC_DEFINE(HAVE_ID3TAG, 1, [Define to use id3tag])
518 AM_CONDITIONAL(HAVE_ID3TAG, test x$enable_id3 = xyes)
520 dnl ---------------------------------------------------------------------------
521 dnl Autodiscovery
522 dnl ---------------------------------------------------------------------------
524 dnl --------------------------------- zeroconf --------------------------------
526 case $with_zeroconf in
527 no|avahi|bonjour)
528         ;;
530         with_zeroconf=auto
531         ;;
532 esac
534 if test x$with_zeroconf != xno; then
535         if test x$with_zeroconf = xavahi || test x$with_zeroconf = xauto; then
536                 PKG_CHECK_MODULES([AVAHI], [avahi-client avahi-glib],
537                          [found_avahi=1;AC_DEFINE([HAVE_AVAHI], 1, [Define to enable Avahi Zeroconf support])]
538                          MPD_LIBS="$MPD_LIBS $AVAHI_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AVAHI_CFLAGS",
539                          [found_avahi=0])
540         fi
542         if test x$found_avahi = x1; then
543                 with_zeroconf=avahi
544         elif test x$with_zeroconf = xavahi; then
545                 AC_MSG_ERROR([Avahi support requested but not found])
546         fi
548         if test x$with_zeroconf = xbonjour || test x$with_zeroconf = xauto; then
549                 AC_CHECK_HEADER(dns_sd.h,
550                         [found_bonjour=1;AC_DEFINE([HAVE_BONJOUR], 1, [Define to enable Bonjour Zeroconf support])],
551                         [found_bonjour=0])
552                 AC_CHECK_LIB(dns_sd, DNSServiceRegister,
553                         MPD_LIBS="$MPD_LIBS -ldns_sd")
554         fi
556         if test x$found_bonjour = x1; then
557                 with_zeroconf=bonjour
558         elif test x$with_zeroconf = xbonjour; then
559                 AC_MSG_ERROR([Bonjour support requested but not found])
560         fi
562         if test x$with_zeroconf = xauto; then
563                 AC_MSG_WARN([No supported Zeroconf backend found, disabling Zeroconf])
564                 with_zeroconf=no
565         else
566                 AC_DEFINE([HAVE_ZEROCONF], 1, [Define to enable Zeroconf support])
567         fi
570 AM_CONDITIONAL(HAVE_ZEROCONF, test x$with_zeroconf != xno)
571 AM_CONDITIONAL(HAVE_AVAHI, test x$with_zeroconf = xavahi)
572 AM_CONDITIONAL(HAVE_BONJOUR, test x$with_zeroconf = xbonjour)
574 dnl ---------------------------------------------------------------------------
575 dnl Sticker Database
576 dnl ---------------------------------------------------------------------------
578 dnl ---------------------------------- sqlite ---------------------------------
580 MPD_AUTO_PKG(sqlite, SQLITE, [sqlite3],
581         [SQLite database support], [sqlite not found])
582 if test x$enable_sqlite = xyes; then
583         AC_DEFINE([ENABLE_SQLITE], 1, [Define to enable sqlite database support])
586 AM_CONDITIONAL(ENABLE_SQLITE, test x$enable_sqlite = xyes)
588 dnl ---------------------------------------------------------------------------
589 dnl Converter Plugins
590 dnl ---------------------------------------------------------------------------
592 dnl ------------------------------ libsamplerate ------------------------------
593 MPD_AUTO_PKG(lsr, SAMPLERATE, [samplerate >= 0.0.15],
594         [libsamplerate resampling], [libsamplerate not found])
595 if test x$enable_lsr = xyes; then
596         AC_DEFINE([HAVE_LIBSAMPLERATE], 1,
597                 [Define to enable libsamplerate])
600 if test x$enable_lsr = xyes; then
601         PKG_CHECK_MODULES([SAMPLERATE_013],
602                 [samplerate >= 0.1.3],,
603                 [AC_DEFINE([HAVE_LIBSAMPLERATE_NOINT], 1,
604                 [libsamplerate doesn't provide src_int_to_float_array() (<0.1.3)])])
607 AM_CONDITIONAL(HAVE_LIBSAMPLERATE, test x$enable_lsr = xyes)
609 dnl ---------------------------------------------------------------------------
610 dnl Input Plugins
611 dnl ---------------------------------------------------------------------------
613 dnl ----------------------------------- CURL ----------------------------------
614 MPD_AUTO_PKG(curl, CURL, [libcurl],
615         [libcurl HTTP streaming], [libcurl not found])
616 if test x$enable_curl = xyes; then
617         AC_DEFINE(ENABLE_CURL, 1, [Define when libcurl is used for HTTP streaming])
619 AM_CONDITIONAL(ENABLE_CURL, test x$enable_curl = xyes)
621 dnl --------------------------------- Last.FM ---------------------------------
622 if test x$enable_lastfm = xyes; then
623         if test x$enable_curl != xyes; then
624                 AC_MSG_ERROR([Cannot enable last.fm radio without curl])
625         fi
627         AC_DEFINE(ENABLE_LASTFM, 1, [Define when last.fm radio is enabled])
629 AM_CONDITIONAL(ENABLE_LASTFM, test x$enable_lastfm = xyes)
631 dnl ---------------------------------- libmms ---------------------------------
632 MPD_AUTO_PKG(mms, MMS, [libmms >= 0.4],
633         [libmms mms:// protocol support], [libmms not found])
634 if test x$enable_mms = xyes; then
635         AC_DEFINE(ENABLE_MMS, 1,
636                 [Define when libmms is used for the MMS protocol])
638 AM_CONDITIONAL(ENABLE_MMS, test x$enable_mms = xyes)
640 dnl ---------------------------------------------------------------------------
641 dnl Archive Plugins
642 dnl ---------------------------------------------------------------------------
644 dnl --------------------------------- iso9660 ---------------------------------
645 MPD_AUTO_PKG(iso9660, ISO9660, [libiso9660],
646         [libiso9660 archive library], [libiso9660 not found])
648 AM_CONDITIONAL(HAVE_ISO9660, test x$enable_iso9660 = xyes)
649 if test x$enable_iso9660 = xyes; then
650         AC_DEFINE(HAVE_ISO9660, 1, [Define to have ISO9660 archive support])
652         AC_PATH_PROG(MKISOFS, mkisofs, no)
653 else
654         MKISOFS="no"
657 AM_CONDITIONAL(ENABLE_ISO9660_TEST, test x$MKISOFS != xno)
659 dnl ---------------------------------- libbz2 ---------------------------------
660 if test x$enable_bzip2 = xyes; then
661         AC_CHECK_LIB(bz2, BZ2_bzDecompressInit,
662                 [MPD_LIBS="$MPD_LIBS -lbz2"],
663                 [AC_MSG_ERROR([libbz2 not found])])
666 AM_CONDITIONAL(HAVE_BZ2, test x$enable_bzip2 = xyes)
667 if test x$enable_bzip2 = xyes; then
668         AC_DEFINE(HAVE_BZ2, 1, [Define to have bz2 archive support])
670         AC_PATH_PROG(BZIP2, bzip2, no)
671 else
672         BZIP2="no"
675 AM_CONDITIONAL(ENABLE_BZIP2_TEST, test x$BZIP2 != xno)
677 dnl --------------------------------- libzzip ---------------------------------
678 MPD_AUTO_PKG(zzip, ZZIP, [zziplib >= 0.13],
679         [libzzip archive library], [libzzip not found])
681 AM_CONDITIONAL(HAVE_ZZIP, test x$enable_zzip = xyes)
682 if test x$enable_zzip = xyes; then
683         AC_DEFINE(HAVE_ZZIP, 1, [Define to have zip archive support])
685         AC_PATH_PROG(ZIP, zip, no)
686 else
687         ZIP="no"
690 AM_CONDITIONAL(ENABLE_ZZIP_TEST, test x$ZIP != xno)
692 dnl ------------------------------- Archive API -------------------------------
694         test x$enable_bzip2 = xyes ||
695         test x$enable_zzip = xyes ||
696         test x$enable_iso9660 = xyes; then
697                 enable_archive=yes
698                 AC_DEFINE(ENABLE_ARCHIVE, 1, [The archive API is available])
699 else
700         enable_archive=no
703 AM_CONDITIONAL(ENABLE_ARCHIVE, test x$enable_archive = xyes)
705 dnl ---------------------------------------------------------------------------
706 dnl Decoder Plugins
707 dnl ---------------------------------------------------------------------------
709 dnl -------------------------------- audiofile --------------------------------
710 MPD_AUTO_PKG(audiofile, AUDIOFILE, [audiofile >= 0.1.7],
711         [audiofile decoder plugin], [libaudiofile not found])
712 AM_CONDITIONAL(HAVE_AUDIOFILE, test x$enable_audiofile = xyes)
713 if test x$enable_audiofile = xyes; then
714         AC_DEFINE(HAVE_AUDIOFILE, 1, [Define for audiofile support])
717 dnl ----------------------------------- FAAD ----------------------------------
718 AM_PATH_FAAD()
720 AM_CONDITIONAL(HAVE_FAAD, test x$enable_aac = xyes)
721 AM_CONDITIONAL(HAVE_MP4, test x$enable_mp4 = xyes)
723 dnl ---------------------------------- ffmpeg ---------------------------------
724 MPD_AUTO_PKG(ffmpeg, FFMPEG, [libavformat libavcodec libavutil],
725         [ffmpeg decoder library], [libavformat+libavcodec+libavutil not found])
727 if test x$enable_ffmpeg = xyes; then
728         old_LIBS=$LIBS
729         LIBS="$LIBS $FFMPEG_LIBS"
730         AC_CHECK_LIB(avcodec, avcodec_decode_audio2,,
731                 enable_ffmpeg=no)
732         LIBS=$old_LIBS
735 if test x$enable_ffmpeg = xyes; then
736         # prior to ffmpeg svn12865, you had to specify include files
737         # without path prefix
738         old_CPPCFLAGS=$CPPFLAGS
739         CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS"
740         AC_CHECK_HEADER(libavcodec/avcodec.h,,
741                 AC_DEFINE(OLD_FFMPEG_INCLUDES, 1,
742                         [Define if avcodec.h instead of libavcodec/avcodec.h should be included]))
743         CPPCFLAGS=$old_CPPFLAGS
746 if test x$enable_ffmpeg = xyes; then
747         AC_DEFINE(HAVE_FFMPEG, 1, [Define for FFMPEG support])
750 AM_CONDITIONAL(HAVE_FFMPEG, test x$enable_ffmpeg = xyes)
752 dnl ----------------------------------- FLAC ----------------------------------
753 if test x$enable_flac = xyes; then
754         PKG_CHECK_MODULES(FLAC, [flac >= 1.1],
755                 AC_DEFINE(HAVE_FLAC, 1, [Define for FLAC support]),
756                 enable_flac=no)
758         oldcflags="$CFLAGS"
759         oldlibs="$LIBS"
760         CFLAGS="$CFLAGS $FLAC_CFLAGS"
761         LIBS="$LIBS $FLAC_LIBS"
762         if test x$enable_flac = xyes && test x$enable_oggflac = xyes; then
763                 AC_CHECK_DECL(FLAC_API_SUPPORTS_OGG_FLAC,
764                         [enable_oggflac=flac], [],
765                         [#include <FLAC/export.h>])
766         fi
767         CFLAGS="$oldcflags"
768         LIBS="$oldlibs"
771 AM_CONDITIONAL(HAVE_FLAC, test x$enable_flac = xyes)
773 enable_flac_encoder=$enable_flac
775 dnl -------------------------------- FluidSynth -------------------------------
776 if test x$enable_fluidsynth = xyes; then
777         PKG_CHECK_MODULES(FLUIDSYNTH, [fluidsynth],
778                 AC_DEFINE(ENABLE_FLUIDSYNTH, 1, [Define for fluidsynth support]),
779                 enable_fluidsynth=no)
782 AM_CONDITIONAL(ENABLE_FLUIDSYNTH, test x$enable_fluidsynth = xyes)
784 dnl ---------------------------------- libgme ---------------------------------
785 MPD_AUTO_PKG(gme, GME, [libgme],
786         [gme decoder plugin], [libgme not found])
787 AM_CONDITIONAL(HAVE_GME, test x$enable_gme = xyes)
788 if test x$enable_gme = xyes; then
789         AC_DEFINE(HAVE_GME, 1, [Define for gme support])
792 dnl ---------------------------------- libmad ---------------------------------
793 MPD_AUTO_PKG(mad, MAD, [mad],
794         [libmad MP3 decoder plugin], [libmad not found])
795 if test x$enable_mad = xyes; then
796         AC_DEFINE(HAVE_MAD, 1, [Define to use libmad])
798 AM_CONDITIONAL(HAVE_MAD, test x$enable_mad = xyes)
800 enable_shout2="$enable_shout"
801 MPD_AUTO_PKG(shout, SHOUT, [shout],
802         [shout output plugin], [libshout not found])
803 if test x$enable_shout = xyes && test x$enable_shout2 = xauto; then
804         enable_shout=auto
807 dnl -------------------------------- libmpg123 --------------------------------
808 MPD_AUTO_PKG(mpg123, MPG123, [libmpg123],
809         [libmpg123 decoder plugin], [libmpg123 not found])
810 if test x$enable_mpg123 = xyes; then
811         AC_DEFINE(HAVE_MPG123, 1, [Define to use libmpg123])
813 AM_CONDITIONAL(HAVE_MPG123, test x$enable_mpg123 = xyes)
815 dnl -------------------------------- libmikmod --------------------------------
816 if test x$enable_mikmod = xyes; then
817         AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config)
818         if test x$LIBMIKMOD_CONFIG != x ; then
819                 AC_SUBST(LIBMIKMOD_CFLAGS, `$LIBMIKMOD_CONFIG --cflags`)
820                 AC_SUBST(LIBMIKMOD_LIBS, `$LIBMIKMOD_CONFIG --libs`)
821                 AC_DEFINE(ENABLE_MIKMOD_DECODER, 1, [Define for mikmod support])
822         else
823                 enable_mikmod=no
824         fi
827 AM_CONDITIONAL(ENABLE_MIKMOD_DECODER, test x$enable_mikmod = xyes)
829 dnl -------------------------------- libmodplug -------------------------------
830 found_modplug=$HAVE_CXX
831 MPD_AUTO_PRE(modplug, [modplug decoder plugin], [No C++ compiler found])
833 MPD_AUTO_PKG(modplug, MODPLUG, [libmodplug],
834         [modplug decoder plugin], [libmodplug not found])
836 if test x$enable_modplug = xyes; then
837         AC_DEFINE(HAVE_MODPLUG, 1, [Define for modplug support])
839 AM_CONDITIONAL(HAVE_MODPLUG, test x$enable_modplug = xyes)
841 dnl --------------------------- sndfile/modplug test --------------------------
842 if test x$enable_sndfile = xauto && test x$enable_modplug = xyes; then
843         dnl If modplug is enabled, enable sndfile only if explicitly
844         dnl requested - modplug's modplug/sndfile.h is known to
845         dnl conflict with libsndfile's sndfile.h.
846         AC_MSG_NOTICE([disabling libsndfile auto-detection, because the modplug decoder is enabled])
847         enable_sndfile=no
850 dnl -------------------------------- libsndfile -------------------------------
851 dnl See above test, which may disable this.
852 MPD_AUTO_PKG(sndfile, SNDFILE, [sndfile],
853         [libsndfile decoder plugin], [libsndfile not found])
855 if test x$enable_sndfile = xyes; then
856         AC_DEFINE(ENABLE_SNDFILE, 1, [Define to enable the sndfile decoder plugin])
858 AM_CONDITIONAL(ENABLE_SNDFILE, test x$enable_sndfile = xyes)
860 dnl --------------------------------- musepack --------------------------------
861 if test x$enable_mpc = xyes; then
862         if test "x$mpcdec_libraries" != "x" ; then
863                 MPCDEC_LIBS="-L$mpcdec_libraries"
864         elif test "x$mpcdec_prefix" != "x" ; then
865                 MPCDEC_LIBS="-L$mpcdec_prefix/lib"
866         fi
868         MPCDEC_LIBS="$MPCDEC_LIBS -lmpcdec"
870         if test "x$mpcdec_includes" != "x" ; then
871                 MPCDEC_CFLAGS="-I$mpcdec_includes"
872         elif test "x$mpcdec_prefix" != "x" ; then
873                 MPCDEC_CFLAGS="-I$mpcdec_prefix/include"
874         fi
876         oldcflags=$CFLAGS
877         oldlibs=$LIBS
878         oldcppflags=$CPPFLAGS
879         CFLAGS="$CFLAGS $MPD_CFLAGS $MPCDEC_CFLAGS -I."
880         LIBS="$LIBS $MPD_LIBS $MPCDEC_LIBS"
881         CPPFLAGS=$CFLAGS
882         AC_CHECK_HEADER(mpc/mpcdec.h,
883                 old_mpcdec=no,
884                 [AC_CHECK_HEADER(mpcdec/mpcdec.h,
885                         old_mpcdec=yes,
886                         enable_mpc=no)])
887         if test x$enable_mpc = xyes; then
888                 AC_CHECK_LIB(mpcdec,main,
889                         [MPD_LIBS="$MPD_LIBS $MPCDEC_LIBS";
890                         MPD_CFLAGS="$MPD_CFLAGS $MPCDEC_CFLAGS";],
891                         enable_mpc=no)
892         fi
893         if test x$enable_mpc = xyes; then
894                 AC_DEFINE(HAVE_MPCDEC,1,
895                         [Define to use libmpcdec for MPC decoding])
896                 if test x$old_mpcdec = xyes; then
897                         AC_DEFINE(MPC_IS_OLD_API, 1,
898                                 [Define if an old pre-SV8 libmpcdec is used])
899                 fi
900         else
901                 AC_MSG_WARN([mpcdec lib needed for MPC support -- disabling MPC support])
902         fi
903         CFLAGS=$oldcflags
904         LIBS=$oldlibs
905         CPPFLAGS=$oldcppflags
908 AM_CONDITIONAL(HAVE_MPCDEC, test x$enable_mpc = xyes)
910 dnl -------------------------------- Ogg Tremor -------------------------------
911 if test x$with_tremor = xyes || test x$with_tremor = xno; then
912         use_tremor="$with_tremor"
913 else
914         tremor_prefix="$with_tremor"
915         use_tremor=yes
918 if test x$use_tremor = xyes; then
919         if test "x$tremor_libraries" != "x" ; then
920                 TREMOR_LIBS="-L$tremor_libraries"
921         elif test "x$tremor_prefix" != "x" ; then
922                 TREMOR_LIBS="-L$tremor_prefix/lib"
923         fi
924         TREMOR_LIBS="$TREMOR_LIBS -lvorbisidec"
925         if test "x$tremor_includes" != "x" ; then
926                 TREMOR_CFLAGS="-I$tremor_includes"
927         elif test "x$tremor_prefix" != "x" ; then
928                 TREMOR_CFLAGS="-I$tremor_prefix/include"
929         fi
930         ac_save_CFLAGS="$CFLAGS"
931         ac_save_LIBS="$LIBS"
932         CFLAGS="$CFLAGS $TREMOR_CFLAGS"
933         LIBS="$LIBS $TREMOR_LIBS"
934         AC_CHECK_LIB(vorbisidec,ov_read,enable_vorbis=yes,enable_vorbis=no;
935                 AC_MSG_WARN([vorbisidec lib needed for ogg support with tremor -- disabling ogg support]))
936         CFLAGS="$ac_save_CFLAGS"
937         LIBS="$ac_save_LIBS"
939         AC_DEFINE(HAVE_TREMOR,1,
940                 [Define to use tremor (libvorbisidec) for ogg support])
943 AC_SUBST(TREMOR_CFLAGS)
944 AC_SUBST(TREMOR_LIBS)
946 dnl --------------------------------- OggFLAC ---------------------------------
947 dnl OggFLAC must go after Ogg Tremor
949 if test x$use_tremor = xyes && test $xenable_oggflac = xyes; then
950         AC_MSG_WARN([disabling OggFLAC support because it is incompatible with tremor])
951                 enable_oggflac=no
954 if test x$enable_oggflac = xyes; then   
955         oldmpdcflags="$MPD_CFLAGS"
956         oldmpdlibs="$MPD_LIBS"
957         AM_PATH_LIBOGGFLAC(MPD_LIBS="$MPD_LIBS $LIBOGGFLAC_LIBS"
958                                 MPD_CFLAGS="$MPD_CFLAGS $LIBOGGFLAC_CFLAGS",
959                            enable_oggflac=no)
962 if test x$enable_oggflac = xyes; then
963         AC_DEFINE(HAVE_OGGFLAC,1,[Define for OggFLAC support])
966 AM_CONDITIONAL(HAVE_OGGFLAC, test x$enable_oggflac = xyes)
968 dnl -------------------------------- Ogg Vorbis -------------------------------
969 if test x$enable_tremor != xyes && test x$enable_vorbis = xyes; then
970         PKG_CHECK_MODULES(VORBIS, [ogg vorbis vorbisfile],
971                 
974 if test x$enable_vorbis = xyes; then
975         AC_DEFINE(ENABLE_VORBIS_DECODER, 1, [Define for Ogg Vorbis support]),
976                         enable_vorbis=no)
979 AM_CONDITIONAL(ENABLE_VORBIS_DECODER, test x$enable_vorbis = xyes)
981 dnl --------------------------------- sidplay ---------------------------------
982 found_sidplay=$HAVE_CXX
983 MPD_AUTO_PRE(sidplay, [sidplay decoder plugin], [No C++ compiler found])
985 if test x$enable_sidplay != xno; then
986         # we're not using pkg-config here
987         # because libsidplay2's .pc file requires libtool
988         AC_HAVE_LIBRARY(sidplay2, [found_sidplay=yes], [found_sidplay=no])
989         MPD_AUTO_PRE(sidplay, [sidplay decoder plugin],
990                 [libsidplay2 not found])
993 if test x$enable_sidplay != xno; then
994         # can't use AC_HAVE_LIBRARY here, because the dash in the
995         # library name triggers an autoconf bug
996         AC_CHECK_LIB(resid-builder, main,
997                 [found_sidplay=yes], [found_sidplay=no])
999         if test x$found_sidplay = xyes; then
1000                 AC_HAVE_LIBRARY(sidutils,, [found_sidplay=no])
1001         fi
1003         MPD_AUTO_RESULT(sidplay, [sidplay decoder plugin],
1004                 [libresid-builder or libsidutils not found])
1007 if test x$enable_sidplay = xyes; then
1008         AC_SUBST(SIDPLAY_LIBS,"-lsidplay2 -lresid-builder -lsidutils")
1009         AC_SUBST(SIDPLAY_CFLAGS,)
1011         AC_DEFINE(ENABLE_SIDPLAY, 1, [Define for libsidplay2 support])
1014 AM_CONDITIONAL(ENABLE_SIDPLAY, test x$enable_sidplay = xyes)
1016 dnl --------------------------------- wavpack ---------------------------------
1017 MPD_AUTO_PKG(wavpack, WAVPACK, [wavpack],
1018         [WavPack decoder plugin], [libwavpack not found])
1019 AM_CONDITIONAL(HAVE_WAVPACK, test x$enable_wavpack = xyes)
1020 if test x$enable_wavpack = xyes; then
1021         AC_DEFINE([HAVE_WAVPACK], 1, [Define to enable WavPack support])
1024 dnl --------------------------------- WildMidi --------------------------------
1025 if test x$enable_wildmidi = xyes; then
1026         oldcflags=$CFLAGS
1027         oldlibs=$LIBS
1028         oldcppflags=$CPPFLAGS
1030         AC_CHECK_LIB(WildMidi, WildMidi_Init,,
1031                 AC_MSG_ERROR([libwildmidi not found]))
1033         CFLAGS=$oldcflags
1034         LIBS=$oldlibs
1035         CPPFLAGS=$oldcppflags
1037         AC_SUBST(WILDMIDI_LIBS,-lWildMidi)
1038         AC_SUBST(WILDMIDI_CFLAGS,)
1040         AC_DEFINE(ENABLE_WILDMIDI, 1, [Define for wildmidi support])
1043 AM_CONDITIONAL(ENABLE_WILDMIDI, test x$enable_wildmidi = xyes)
1045 dnl ------------------------ Post Decoder Plugins Tests -----------------------
1048         test x$enable_aac = xno &&
1049         test x$enable_audiofile = xno &&
1050         test x$enable_ffmpeg = xno &&
1051         test x$enable_flac = xno &&
1052         test x$enable_fluidsynth = xno &&
1053         test x$enable_mad = xno &&
1054         test x$enable_mikmod = xno; then
1055         test x$enable_modplug = xno &&
1056         test x$enable_mp4 = xno &&
1057         test x$enable_mpc = xno &&
1058         test x$enable_mpg123 = xno &&
1059         test x$enable_oggflac = xno &&
1060         test x$enable_sidplay = xno &&
1061         test x$enable_vorbis = xno &&
1062         test x$enable_wavpack = xno &&
1063         test x$enable_wildmidi = xno &&
1065                 AC_MSG_ERROR([No input plugins supported!])
1068 AM_CONDITIONAL(HAVE_OGG_COMMON,
1069           test x$enable_vorbis = xyes || test x$enable_oggflac = xyes || test x$enable_flac = xyes)
1071 AM_CONDITIONAL(HAVE_FLAC_COMMON,
1072           test x$enable_flac = xyes || test x$enable_oggflac = xyes)
1075 dnl ---------------------------------------------------------------------------
1076 dnl Audio Output Plugins
1077 dnl ---------------------------------------------------------------------------
1079 dnl ----------------------------------- ALSA ----------------------------------
1080 MPD_AUTO_PKG(alsa, ALSA, [alsa >= 0.9.0],
1081         [ALSA output plugin], [libasound not found])
1083 if test x$enable_alsa = xyes; then
1084         AC_DEFINE(HAVE_ALSA, 1, [Define to enable ALSA support])
1087 AM_CONDITIONAL(HAVE_ALSA, test x$enable_alsa = xyes)
1089 dnl ----------------------------------- FIFO ----------------------------------
1090 if test x$enable_fifo = xyes; then
1091         AC_CHECK_FUNC([mkfifo],
1092                 [enable_fifo=yes;AC_DEFINE([HAVE_FIFO], 1,
1093                         [Define to enable support for writing audio to a FIFO])],
1094                 [enable_fifo=no;AC_MSG_WARN([mkfifo not found -- disabling support for writing audio to a FIFO])])
1097 AM_CONDITIONAL(HAVE_FIFO, test x$enable_fifo = xyes)
1099 dnl ------------------------------- HTTPD Output ------------------------------
1100 if test x$enable_httpd_output = xauto; then
1101         # handle HTTPD auto-detection: disable if no encoder is
1102         # available
1103         if test x$enable_encoder = xyes; then
1104                 enable_httpd_output=yes
1105         else
1106                 AC_MSG_WARN([No encoder plugin -- disabling the HTTP output plugin])
1107                 enable_httpd_output=no
1108         fi
1111 if test x$enable_httpd_output = xyes; then
1112         AC_DEFINE(ENABLE_HTTPD_OUTPUT, 1, [Define to enable the HTTP server output])
1114 AM_CONDITIONAL(ENABLE_HTTPD_OUTPUT, test x$enable_httpd_output = xyes)
1116 dnl ----------------------------------- JACK ----------------------------------
1117 MPD_AUTO_PKG(jack, JACK, [jack >= 0.100],
1118         [JACK output plugin], [libjack not found])
1119 if test x$enable_jack = xyes; then
1120         AC_DEFINE([HAVE_JACK], 1, [Define to enable JACK support])
1123 if test x$enable_jack = xyes; then
1124         # check whether jack_set_info_function() is available
1125         old_LIBS=$LIBS
1126         LIBS="$LIBS $JACK_LIBS"
1128         AC_CHECK_FUNCS(jack_set_info_function)
1130         LIBS=$old_LIBS
1133 AM_CONDITIONAL(HAVE_JACK, test x$enable_jack = xyes)
1135 dnl ---------------------------------- libao ----------------------------------
1136 MPD_AUTO_PKG(ao, AO, [ao],
1137         [libao output plugin], [libao not found])
1138 if test x$enable_ao = xyes; then
1139         AC_DEFINE(HAVE_AO, 1, [Define to play with ao])
1142 AM_CONDITIONAL(HAVE_AO, test x$enable_ao = xyes)
1144 dnl ----------------------------------- MVP -----------------------------------
1145 if test x$enable_mvp = xyes; then
1146    AC_DEFINE(HAVE_MVP,1,[Define to enable Hauppauge Media MVP support])
1149 AM_CONDITIONAL(HAVE_MVP, test x$enable_mvp = xyes)
1151 dnl ---------------------------------- OpenAL ---------------------------------
1152 AC_SUBST(OPENAL_CFLAGS,"")
1153 AC_SUBST(OPENAL_LIBS,"")
1155 if test x$enable_openal = xyes; then
1156         if test x$enable_osx = xyes; then
1157                 AC_CHECK_HEADERS([OpenAL/al.h OpenAL/alc.h], [], [enable_openal=no])
1158                 if test x$enable_openal = xyes; then
1159                         OPENAL_LIBS="-framework OpenAL"
1160                         AC_DEFINE(HAVE_OPENAL, 1, [Define for OpenAL support])
1161                 else
1162                         AC_MSG_WARN(OpenAL headers not found -- disabling OpenAL support)
1163                 fi
1164         else
1165                 PKG_CHECK_MODULES([OPENAL], [openal],
1166                         AC_DEFINE(HAVE_OPENAL, 1, [Define for OpenAL support]),
1167                         enable_openal=no)
1168         fi
1171 AM_CONDITIONAL(HAVE_OPENAL, test x$enable_openal = xyes)
1173 dnl ---------------------------- Open Sound System ----------------------------
1174 if test x$enable_oss = xyes; then
1175         AC_CHECK_HEADER(sys/soundcard.h,
1176                 [enable_oss=yes;AC_DEFINE(HAVE_OSS,1,[Define to enable OSS])],
1177                 [AC_MSG_WARN(Soundcard headers not found -- disabling OSS support);
1178                         enable_oss=no])
1181 AM_CONDITIONAL(HAVE_OSS, test x$enable_oss = xyes)
1183 dnl ----------------------------------- OSX -----------------------------------
1184 enable_osx=no
1185 case "$host_os" in
1186         darwin*)
1187                 AC_DEFINE(HAVE_OSX, 1, [Define for compiling OS X support])
1188                 MPD_LIBS="$MPD_LIBS -framework AudioUnit -framework CoreServices"
1189                 enable_osx=yes ;;
1190 esac
1192 AM_CONDITIONAL(HAVE_OSX, test x$enable_osx = xyes)
1194 dnl ------------------------------- Pipe Output -------------------------------
1195 if test x$enable_pipe_output = xyes; then
1196         AC_DEFINE([ENABLE_PIPE_OUTPUT], 1,
1197                 [Define to enable support for writing audio to a pipe])
1199 AM_CONDITIONAL(ENABLE_PIPE_OUTPUT, test x$enable_pipe_output = xyes)
1201 dnl -------------------------------- PulseAudio -------------------------------
1202 MPD_AUTO_PKG(pulse, PULSE, [libpulse],
1203         [PulseAudio output plugin], [libpulse not found])
1204 if test x$enable_pulse = xyes; then
1205         AC_DEFINE([HAVE_PULSE], 1,
1206                 [Define to enable PulseAudio support])
1209 AM_CONDITIONAL(HAVE_PULSE, test x$enable_pulse = xyes)
1211 dnl --------------------------------- Recorder --------------------------------
1212 if test x$enable_recorder_output = xauto; then
1213         # handle recorder auto-detection: disable if no encoder is
1214         # available
1215         if test x$enable_encoder = xyes; then
1216                 enable_recorder_output=yes
1217         else
1218                 AC_MSG_WARN([No encoder plugin -- disabling the recorder output plugin])
1219                 enable_recorder_output=no
1220         fi
1223 if test x$enable_recorder_output = xyes; then
1224         AC_DEFINE(ENABLE_RECORDER_OUTPUT, 1, [Define to enable the recorder output])
1226 AM_CONDITIONAL(ENABLE_RECORDER_OUTPUT, test x$enable_recorder_output = xyes)
1228 dnl -------------------------------- SHOUTcast --------------------------------
1229 if test x$enable_shout = xauto; then
1230         # handle shout auto-detection: disable if no encoder is
1231         # available
1232         if test x$enable_encoder = xyes; then
1233                 enable_shout=yes
1234         else
1235                 AC_MSG_WARN([No encoder plugin -- disabling the shout output plugin])
1236                 enable_shout=no
1237         fi
1240 if test x$enable_shout = xyes; then
1241         AC_DEFINE(HAVE_SHOUT, 1, [Define to enable the shoutcast output])
1243 AM_CONDITIONAL(HAVE_SHOUT, test x$enable_shout = xyes)
1245 dnl --------------------------------- Solaris ---------------------------------
1246 case "$host_os" in
1247         solaris*)
1248                 AC_DEFINE(ENABLE_SOLARIS_OUTPUT, 1, [Define to enable Solaris /dev/audio support])
1249                 enable_solaris_output=yes
1250                 ;;
1252         *)
1253                 enable_solaris_output=no
1254                 ;;
1255 esac
1257 AM_CONDITIONAL(ENABLE_SOLARIS_OUTPUT, test x$enable_solaris_output = xyes)
1259 dnl --------------------- Post Audio Output Plugins Tests ---------------------
1261         test x$enable_alsa = xno &&
1262         test x$enable_ao = xno &&
1263         test x$enable_fifo = xno &&
1264         test x$enable_httpd_output = xno &&
1265         test x$enable_jack = xno &&
1266         test x$enable_mvp = xno; then
1267         test x$enable_openal = xno &&
1268         test x$enable_oss = xno &&
1269         test x$enable_osx = xno &&
1270         test x$enable_pipe_output = xno &&
1271         test x$enable_pulse = xno &&
1272         test x$enable_recorder_output = xno &&
1273         test x$enable_shout = xno &&
1274         test x$enable_solaris_output = xno &&
1276                 AC_MSG_ERROR([No Audio Output types configured!])
1279 dnl ---------------------------------------------------------------------------
1280 dnl Encoders for Streaming Audio Output Plugins
1281 dnl ---------------------------------------------------------------------------
1283 dnl ------------------------------- Encoder API -------------------------------
1284 if test x$enable_shout = xyes || \
1285         test x$enable_recorder_output = xyes || \
1286         test x$enable_httpd_output = xyes; then
1287         # at least one output using encoders is explicitly enabled
1288         need_encoder=yes
1289 elif test x$enable_shout = xauto || \
1290         test x$enable_recorder_output = xauto || \
1291         test x$enable_httpd_output = xauto; then
1292         need_encoder=auto
1293 else
1294         # all outputs using encoders are disabled
1295         need_encoder=no
1297         # don't bother to check for encoder plugins
1298         enable_vorbis_encoder=no
1299         enable_lame_encoder=no
1300         enable_twolame_encoder=no
1301         enable_wave_encoder=no
1302         enable_flac_encoder=no
1305 dnl ------------------------------- FLAC Encoder ------------------------------
1306 if test x$enable_flac_encoder = xyes; then
1307         AC_DEFINE(ENABLE_FLAC_ENCODER, 1,
1308                 [Define to enable the FLAC encoder plugin])
1310 AM_CONDITIONAL(ENABLE_FLAC_ENCODER, test x$enable_flac_encoder = xyes)
1312 dnl ---------------------------- Ogg Vorbis Encoder ---------------------------
1313 MPD_AUTO_PKG(vorbis_encoder, VORBISENC, [vorbisenc],
1314         [Ogg Vorbis encoder], [libvorbisenc not found])
1316 dnl ------------------------------- LAME Encoder ------------------------------
1317 if test x$enable_vorbis_encoder = xyes; then
1318         AC_DEFINE(ENABLE_VORBIS_ENCODER, 1,
1319                 [Define to enable the vorbis encoder plugin])
1321 AM_CONDITIONAL(ENABLE_VORBIS_ENCODER, test x$enable_vorbis_encoder = xyes)
1323 if test x$enable_lame_encoder != xno; then
1324         AC_CHECK_HEADERS(lame/lame.h,,
1325                 [AC_CHECK_HEADERS(lame.h,, using_lame=no)])
1326         AC_CHECK_LIB(mp3lame, lame_init,, using_lame=no)
1327         if test x$using_lame != xno; then
1328                 AC_DEFINE(HAVE_LAME, 1, [Define to 1 if you have lame 3.98 or greater.])
1329                 LAME_LIBS="-lmp3lame -lm"
1330                 enable_lame_encoder=yes
1331         fi
1333         if test "$enable_lame_encoder" = "yes" -a "$using_lame" = "no"; then
1334                 AC_MSG_ERROR([LAME libraries and development support files not found.])
1335         fi
1338 AC_SUBST(LAME_LIBS)
1340 if test x$enable_lame_encoder = xyes; then
1341         AC_DEFINE(ENABLE_LAME_ENCODER, 1,
1342                 [Define to enable the lame encoder plugin])
1344 AM_CONDITIONAL(ENABLE_LAME_ENCODER, test x$enable_lame_encoder = xyes)
1346 dnl ----------------------------- TwoLAME Encoder -----------------------------
1347 MPD_AUTO_PKG(twolame_encoder, TWOLAME, [twolame],
1348         [TwoLAME encoder], [libtwolame not found])
1350 if test x$enable_twolame_encoder = xyes; then
1351         AC_DEFINE(ENABLE_TWOLAME_ENCODER, 1,
1352                 [Define to enable the TwoLAME encoder plugin])
1354 AM_CONDITIONAL(ENABLE_TWOLAME_ENCODER, test x$enable_twolame_encoder = xyes)
1356 dnl ------------------------------- WAVE Encoder ------------------------------
1357 AM_CONDITIONAL(ENABLE_WAVE_ENCODER, test x$enable_wave_encoder = xyes)
1358 if test x$enable_wave_encoder = xyes; then
1359         AC_DEFINE(ENABLE_WAVE_ENCODER, 1,
1360                 [Define to enable the PCM wave encoder plugin])
1363 dnl --------------------------- encoder plugins test --------------------------
1364 if test x$enable_vorbis_encoder != xno ||
1365         test x$enable_lame_encoder != xno ||
1366         test x$enable_twolame_encoder != xno ||
1367         test x$enable_flac_encoder != xno ||
1368         test x$enable_wave_encoder != xno; then
1369         # at least one encoder plugin is enabled
1370         enable_encoder=yes
1371 else
1372         # no encoder plugin is enabled: disable the whole encoder API
1373         enable_encoder=no
1375         if test x$need_encoder = xyes; then
1376                 AC_MSG_ERROR([No encoder plugin found])
1377         fi
1380 if test x$enable_encoder = xyes; then
1381         AC_DEFINE(ENABLE_ENCODER, 1,
1382                 [Define to enable the encoder plugins])
1384 AM_CONDITIONAL(ENABLE_ENCODER, test x$enable_encoder = xyes)
1386 dnl ---------------------------------------------------------------------------
1387 dnl Documentation
1388 dnl ---------------------------------------------------------------------------
1389 if test x$enable_documentation = xyes; then
1390         AC_PATH_PROG(XMLTO, xmlto)
1391         AC_SUBST(XMLTO)
1392         AM_CONDITIONAL(HAVE_XMLTO, test x$XMLTO != x)
1394         AC_PATH_PROG(DOXYGEN, doxygen)
1395         if test x$DOXYGEN = x; then
1396                 AC_MSG_ERROR([doxygen not found])
1397         fi
1399         AC_SUBST(DOXYGEN)
1400 else
1401         AM_CONDITIONAL(HAVE_XMLTO, false)
1404 AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)
1406 dnl ---------------------------------------------------------------------------
1407 dnl test suite
1408 dnl ---------------------------------------------------------------------------
1409 AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes)
1411 dnl ---------------------------------------------------------------------------
1412 dnl CFLAGS
1413 dnl ---------------------------------------------------------------------------
1415 dnl ---------------------------------- debug ----------------------------------
1416 #if test "x$enable_debug" = xno; then
1417         # don't set NDEBUG for now, until MPD is stable
1418         #AM_CFLAGS="$AM_CFLAGS -DNDEBUG"
1421 dnl ----------------------------------- GCC -----------------------------------
1422 if test x$GCC = xyes
1423 then
1424         MPD_CHECK_FLAG([-Wall])
1425         MPD_CHECK_FLAG([-Wextra])
1426         MPD_CHECK_FLAG([-Wno-deprecated-declarations])
1427         MPD_CHECK_FLAG([-Wmissing-prototypes])
1428         MPD_CHECK_FLAG([-Wshadow])
1429         MPD_CHECK_FLAG([-Wpointer-arith])
1430         MPD_CHECK_FLAG([-Wstrict-prototypes])
1431         MPD_CHECK_FLAG([-Wcast-qual])
1432         MPD_CHECK_FLAG([-Wwrite-strings])
1433         MPD_CHECK_FLAG([-pedantic])
1436 dnl ------------------------------ gprof profiler -----------------------------
1437 if test "x$enable_gprof" = xyes; then
1438         MPD_CFLAGS="$MPD_CFLAGS -pg"
1439         MPD_LIBS="$MPD_LIBS -pg"
1442 dnl ---------------------------- warnings as errors ---------------------------
1443 if test "x$enable_werror" = xyes; then
1444         AM_CFLAGS="$AM_CFLAGS -Werror -pedantic-errors"
1447 dnl ---------------------------------------------------------------------------
1448 dnl Pretty-Print Results
1449 dnl ---------------------------------------------------------------------------
1450 echo ''
1451 echo '########### MPD CONFIGURATION ############'
1453 echo -ne '\nArchive support:\n\t'
1454 results(bzip2,[bzip2])
1455 results(iso9660,[ISO9660])
1456 results(zzip,[ZIP])
1458 if test x$with_zeroconf != xno; then
1459         echo -ne '\nAutodiscovery support:\n\t'
1460         results(avahi, [Avahi])
1461         results(bonjour, [Bonjour])
1464 echo -ne '\nClient support:\n\t'
1465 results(ipv6, "IPv6")
1466 results(tcp, "TCP")
1467 results(un,[UNIX Domain Sockets])
1469 echo -ne '\nFile format support:\n\t'
1470 results(aac, [AAC])
1471 results(sidplay, [C64 SID])
1472 results(ffmpeg, [FFMPEG])
1473 results(flac, [FLAC])
1474 results(fluidsynth, [FluidSynth])
1475 results(gme, [GME])
1476 results(sndfile, [libsndfile])
1477 echo -ne '\n\t'
1478 results(mikmod, [MikMod])
1479 results(modplug, [MODPLUG])
1480 results(mad, [MAD])
1481 results(mpg123, [MPG123])
1482 results(mp4, [MP4])
1483 results(mpc, [Musepack])
1484 results(oggflac, [OggFLAC])
1485 echo -ne '\n\t'
1486 results(with_tremor, [OggTremor])
1487 results(vorbis, [OggVorbis])
1488 results(audiofile, [WAVE])
1489 results(wavpack, [WavPack])
1490 results(wildmidi, [WildMidi])
1492 echo -en '\nOther features:\n\t'
1493 results(lsr, [libsamplerate])
1494 results(inotify, [inotify])
1496 echo -en '\nMetadata support:\n\t'
1497 results(cue,[cue])
1498 results(id3,[ID3])
1500 echo -en '\nPlayback support:\n\t'
1501 results(alsa,ALSA)
1502 results(fifo,FIFO)
1503 results(recorder_output,[File Recorder])
1504 results(httpd_output,[HTTP Daemon])
1505 results(jack,[JACK])
1506 results(ao,[libao])
1507 results(oss,[OSS])
1508 echo -ne '\n\t'
1509 results(openal,[OpenAL])
1510 results(osx, [OS X])
1511 results(pipe_output, [Pipeline])
1512 results(pulse, [PulseAudio])
1513 results(mvp, [Media MVP])
1514 results(shout, [SHOUTcast])
1515 echo -ne '\n\t'
1516 results(solaris, [Solaris])
1519         test x$enable_shout = xyes ||
1520         test x$enable_recorder = xyes ||
1521         test x$enable_httpd_output = xyes; then
1522                 echo -en '\nStreaming encoder support:\n\t'
1523                 results(flac_encoder, [FLAC])
1524                 results(lame_encoder, [LAME])
1525                 results(vorbis_encoder, [Ogg Vorbis])
1526                 results(twolame_encoder, [TwoLAME])
1527                 results(wave_encoder, [WAVE])
1530 echo -en '\nStreaming support:\n\t'
1531 results(curl,[CURL])
1532 results(lastfm,[Last.FM])
1533 results(mms,[MMS])
1535 echo -ne '\n\n##########################################\n\n'
1537 if test x$enable_sndfile = xyes && test x$enable_modplug = xyes; then
1538         AC_MSG_WARN([compilation may fail, because libmodplug conflicts with libsndfile])
1539         AC_MSG_WARN([libmodplug ships modplug/sndfile.h, which hides libsndfile's sndfile.h])
1542 echo -ne 'Generating files needed for compilation\n'
1544 dnl ---------------------------------------------------------------------------
1545 dnl Generate files
1546 dnl ---------------------------------------------------------------------------
1547 AC_OUTPUT(Makefile)
1549 echo 'MPD is ready for compilation, type "make" to begin.'