mpd version 0.16
[mpd-mk.git] / configure.ac
blobc57862bf9b1bec04ff1d7a9c87a292d223d9d509
1 AC_PREREQ(2.60)
2 AC_INIT(mpd, 0.16, 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(ffado,
159         AS_HELP_STRING([--enable-ffado], [enable libffado (FireWire) support]),,
160         [enable_ffado=auto])
162 AC_ARG_ENABLE(ffmpeg,
163         AS_HELP_STRING([--enable-ffmpeg],
164                 [enable FFMPEG support]),,
165         enable_ffmpeg=auto)
167 AC_ARG_ENABLE(fifo,
168         AS_HELP_STRING([--disable-fifo],
169                 [disable support for writing audio to a FIFO (default: enable)]),,
170         enable_fifo=yes)
172 AC_ARG_ENABLE(flac,
173         AS_HELP_STRING([--disable-flac],
174                 [disable flac support (default: enable)]),,
175         enable_flac=yes)
177 AC_ARG_ENABLE(fluidsynth,
178         AS_HELP_STRING([--enable-fluidsynth],
179                 [enable MIDI support via fluidsynth (default: disable)]),,
180         enable_fluidsynth=no)
182 AC_ARG_ENABLE(gme,
183         AS_HELP_STRING([--enable-gme],
184                 [enable Blargg's game music emulator plugin]),,
185         enable_gme=auto)
187 AC_ARG_ENABLE(gprof,
188         AS_HELP_STRING([--enable-gprof],
189                 [enable profiling via gprof (default: disabled)]),,
190         enable_gprof=no)
192 AC_ARG_ENABLE(httpd-output,
193         AS_HELP_STRING([--enable-httpd-output],
194                 [enables the HTTP server output]),,
195         [enable_httpd_output=auto])
197 AC_ARG_ENABLE(id3,
198         AS_HELP_STRING([--disable-id3],
199                 [disable id3 support (default: enable)]),,
200         enable_id3=yes)
202 AC_ARG_ENABLE(inotify,
203         AS_HELP_STRING([--disable-inotify],
204                 [disable support Inotify automatic database update (default: enabled) ]),,
205         [enable_inotify=yes])
207 AC_ARG_ENABLE(ipv6,
208         AS_HELP_STRING([--disable-ipv6],
209                 [disable IPv6 support (default: enable)]),,
210         [enable_ipv6=yes])
212 AC_ARG_ENABLE(iso9660,
213         AS_HELP_STRING([--enable-iso9660],
214                 [enable iso9660 archive support (default: disabled)]),,
215         enable_iso9660=no)
217 AC_ARG_ENABLE(jack,
218         AS_HELP_STRING([--enable-jack],
219                 [enable jack support]),,
220         enable_jack=auto)
222 AC_SYS_LARGEFILE
224 AC_ARG_ENABLE(lastfm,
225         AS_HELP_STRING([--enable-lastfm],
226                 [enable support for last.fm radio (default: disable)]),,
227         [enable_lastfm=no])
229 AC_ARG_ENABLE(lame-encoder,
230         AS_HELP_STRING([--enable-lame-encoder],
231                 [enable the LAME mp3 encoder]),,
232         enable_lame_encoder=auto)
234 AC_ARG_ENABLE([libwrap],
235         AS_HELP_STRING([--enable-libwrap], [use libwrap]),,
236         [enable_libwrap=auto])
238 AC_ARG_ENABLE(lsr,
239         AS_HELP_STRING([--enable-lsr],
240                 [enable libsamplerate support]),,
241         enable_lsr=auto)
243 AC_ARG_ENABLE(mad,
244         AS_HELP_STRING([--enable-mad],
245                 [enable libmad mp3 decoder plugin]),,
246         enable_mad=auto)
248 AC_ARG_ENABLE(mikmod,
249         AS_HELP_STRING([--enable-mikmod],
250                 [enable the mikmod decoder (default: disable)]),,
251         enable_mikmod=no)
253 AC_ARG_ENABLE(mms,
254         AS_HELP_STRING([--enable-mms],
255                 [enable the MMS protocol with libmms]),,
256         [enable_mms=auto])
258 AC_ARG_ENABLE(modplug,
259         AS_HELP_STRING([--enable-modplug],
260                 [enable modplug decoder plugin]),,
261         enable_modplug=auto)
263 AC_ARG_ENABLE(mpc,
264         AS_HELP_STRING([--disable-mpc],
265                 [disable musepack (MPC) support (default: enable)]),,
266         enable_mpc=yes)
268 AC_ARG_ENABLE(mpg123,
269         AS_HELP_STRING([--enable-mpg123],
270                 [enable libmpg123 decoder plugin]),,
271         enable_mpg123=auto)
273 AC_ARG_ENABLE(mvp,
274         AS_HELP_STRING([--enable-mvp],
275                 [enable support for Hauppauge Media MVP (default: disable)]),,
276         enable_mvp=no)
278 AC_ARG_ENABLE(oggflac,
279         AS_HELP_STRING([--disable-oggflac],
280                 [disable OggFLAC support (default: enable)]),,
281         enable_oggflac=yes)
283 AC_ARG_ENABLE(openal,
284         AS_HELP_STRING([--enable-openal],
285                 [enable OpenAL support (default: disable)]),,
286         enable_openal=no)
288 AC_ARG_ENABLE(oss,
289         AS_HELP_STRING([--disable-oss],
290                 [disable OSS support (default: enable)]),,
291         enable_oss=yes)
293 AC_ARG_ENABLE(pipe-output,
294         AS_HELP_STRING([--enable-pipe-output],
295                 [enable support for writing audio to a pipe (default: disable)]),,
296         enable_pipe_output=no)
298 AC_ARG_ENABLE(pulse,
299         AS_HELP_STRING([--enable-pulse],
300                 [enable support for the PulseAudio sound server]),,
301         enable_pulse=auto)
303 AC_ARG_ENABLE(recorder-output,
304         AS_HELP_STRING([--enable-recorder-output],
305                 [enables the recorder file output plugin (default: disable)]),,
306         [enable_recorder_output=auto])
308 AC_ARG_ENABLE(sidplay,
309         AS_HELP_STRING([--enable-sidplay],
310                 [enable C64 SID support via libsidplay2]),,
311         enable_sidplay=auto)
314 AC_ARG_ENABLE(shout,
315         AS_HELP_STRING([--enable-shout],
316                 [enables the shoutcast streaming output]),,
317         [enable_shout=auto])
319 AC_ARG_ENABLE(sndfile,
320         AS_HELP_STRING([--enable-sndfile],
321                 [enable sndfile support]),,
322         enable_sndfile=auto)
324 AC_ARG_ENABLE(sqlite,
325         AS_HELP_STRING([--enable-sqlite],
326                 [enable support for the SQLite database]),,
327         [enable_sqlite=auto])
329 AC_ARG_ENABLE(tcp,
330         AS_HELP_STRING([--disable-tcp],
331                 [disable support for clients connecting via TCP (default: enable)]),,
332         [enable_tcp=yes])
334 AC_ARG_ENABLE(test,
335         AS_HELP_STRING([--enable-test],
336                 [build the test programs (default: disabled)]),,
337         enable_test=no)
339 AC_ARG_WITH(tremor,
340         AS_HELP_STRING([--with-tremor=PFX],
341                 [use Tremor (vorbisidec) integer Ogg Vorbis decoder (with optional prefix)]),,
342         with_tremor=no)
344 AC_ARG_ENABLE(twolame-encoder,
345         AS_HELP_STRING([--enable-twolame-encoder],
346                 [enable the TwoLAME mp2 encoder]),,
347         enable_twolame_encoder=auto)
349 AC_ARG_ENABLE(un,
350         AS_HELP_STRING([--disable-un],
351                 [disable support for clients connecting via unix domain sockets (default: enable)]),,
352         [enable_un=yes])
354 AC_ARG_ENABLE(vorbis,
355         AS_HELP_STRING([--disable-vorbis],
356                 [disable Ogg Vorbis support (default: enable)]),,
357         enable_vorbis=yes)
359 AC_ARG_ENABLE(vorbis-encoder,
360         AS_HELP_STRING([--enable-vorbis-encoder],
361                 [enable the Ogg Vorbis encoder]),,
362         [enable_vorbis_encoder=auto])
364 AC_ARG_ENABLE(wave-encoder,
365         AS_HELP_STRING([--enable-wave-encoder],
366                 [enable the PCM wave encoder]),,
367         enable_wave_encoder=yes)
369 AC_ARG_ENABLE(wavpack,
370         AS_HELP_STRING([--enable-wavpack],
371                 [enable WavPack support]),,
372         enable_wavpack=auto)
374 AC_ARG_ENABLE(werror,
375         AS_HELP_STRING([--enable-werror],
376                 [treat warnings as errors (default: disabled)]),,
377         enable_werror=no)
379 AC_ARG_ENABLE(wildmidi,
380         AS_HELP_STRING([--enable-wildmidi],
381                 [enable MIDI support via wildmidi (default: disable)]),,
382         enable_wildmidi=no)
384 AC_ARG_WITH(zeroconf,
385         AS_HELP_STRING([--with-zeroconf=@<:@auto|avahi|bonjour|no@:>@],
386                 [enable zeroconf backend (default=auto)]),,
387         with_zeroconf="auto")
389 AC_ARG_ENABLE(zzip,
390         AS_HELP_STRING([--enable-zzip],
391                 [enable zip archive support (default: disabled)]),,
392         enable_zzip=no)
395 AC_ARG_WITH(tremor-libraries,
396         AS_HELP_STRING([--with-tremor-libraries=DIR],
397                 [directory where Tremor library is installed (optional)]),,
398         tremor_libraries="")
400 AC_ARG_WITH(tremor-includes,
401         AS_HELP_STRING([--with-tremor-includes=DIR],
402                 [directory where Tremor header files are installed (optional)]),,
403         tremor_includes="")
405 dnl ---------------------------------------------------------------------------
406 dnl Mandatory Libraries
407 dnl ---------------------------------------------------------------------------
408 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.12 gthread-2.0],,
409                 [AC_MSG_ERROR([GLib 2.12 is required])])
411 dnl ---------------------------------------------------------------------------
412 dnl Protocol Options
413 dnl ---------------------------------------------------------------------------
415 if test x$enable_tcp = xno; then
416         # if we don't support TCP, we don't need IPv6 either
417         enable_ipv6=no
420 if test x$enable_ipv6 = xyes; then
421         AC_MSG_CHECKING(for ipv6)
422         AC_EGREP_CPP([AP_maGiC_VALUE],
423         [
424 #include <sys/types.h>
425 #include <sys/socket.h>
426 #include <netdb.h>
427 #ifdef PF_INET6
428 #ifdef AF_INET6
429 AP_maGiC_VALUE
430 #endif
431 #endif
432         ],
433         AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 support present])
434         AC_MSG_RESULT([yes]),
435         AC_MSG_RESULT([no])
439 if test x$enable_tcp = xyes; then
440         AC_DEFINE(HAVE_TCP, 1, [Define if TCP socket support is enabled])
443 case "$host_os" in
444 mingw* | windows* | cygwin*)
445         enable_un=no
446         ;;
447 esac
449 if test x$enable_un = xyes; then
450         AC_DEFINE(HAVE_UN, 1, [Define if unix domain socket support is enabled])
451         STRUCT_UCRED
452         AC_CHECK_FUNCS(getpeereid)
455 dnl --------------------------- Post Protocol Tests ---------------------------
457         test x$enable_tcp = xno &&
458         test x$enable_un = xno; then
459         AC_MSG_ERROR([No client interfaces configured!])
462 dnl ---------------------------------------------------------------------------
463 dnl LIBC Features
464 dnl ---------------------------------------------------------------------------
465 if test x$enable_largefile != xno; then
466         AC_DEFINE([ENABLE_LARGEFILE], 1, [Define if large file support is enabled])
469 dnl ---------------------------------------------------------------------------
470 dnl Miscellaneous Libraries
471 dnl ---------------------------------------------------------------------------
473 dnl --------------------------------- inotify ---------------------------------
474 AC_CHECK_FUNCS(inotify_init inotify_init1)
476 if test x$ac_cv_func_inotify_init = xno; then
477         enable_inotify=no
480 if test x$enable_inotify = xyes; then
481         AC_DEFINE([ENABLE_INOTIFY], 1, [Define to enable inotify support])
483 AM_CONDITIONAL(ENABLE_INOTIFY, test x$enable_inotify = xyes)
485 dnl --------------------------------- libwrap ---------------------------------
486 if test x$enable_libwrap != xno; then
487         AC_CHECK_LIBWRAP(found_libwrap=yes, found_libwrap=no)
488         MPD_AUTO_RESULT(libwrap, libwrap, [libwrap not found])
491 if test x$enable_libwrap = xyes; then
492         AC_SUBST(LIBWRAP_CFLAGS)
493         AC_SUBST(LIBWRAP_LDFLAGS)
494         AC_DEFINE(HAVE_LIBWRAP, 1, [define to enable libwrap library])
497 dnl ---------------------------------------------------------------------------
498 dnl Metadata Plugins
499 dnl ---------------------------------------------------------------------------
501 dnl ---------------------------------- libcue ---------------------------------
502 MPD_AUTO_PKG(cue, CUE, [libcue],
503         [libcue parsing library], [libcue not found])
504 if test x$enable_cue = xyes; then
505         AC_DEFINE([HAVE_CUE], 1,
506                 [Define to enable libcue support])
509 AM_CONDITIONAL(HAVE_CUE, test x$enable_cue = xyes)
511 dnl -------------------------------- libid3tag --------------------------------
512 if test x$enable_id3 = xyes; then
513         PKG_CHECK_MODULES([ID3TAG], [id3tag],,
514                 AC_CHECK_LIB(id3tag, id3_file_open,
515                         [ID3TAG_LIBS="-lid3tag -lz" ID3TAG_CFLAGS=""],
516                         enable_id3=no))
519 if test x$enable_id3 = xyes; then
520         AC_DEFINE(HAVE_ID3TAG, 1, [Define to use id3tag])
523 AM_CONDITIONAL(HAVE_ID3TAG, test x$enable_id3 = xyes)
525 dnl ---------------------------------------------------------------------------
526 dnl Autodiscovery
527 dnl ---------------------------------------------------------------------------
529 dnl --------------------------------- zeroconf --------------------------------
531 case $with_zeroconf in
532 no|avahi|bonjour)
533         ;;
535         with_zeroconf=auto
536         ;;
537 esac
539 if test x$with_zeroconf != xno; then
540         if test x$with_zeroconf = xavahi || test x$with_zeroconf = xauto; then
541                 PKG_CHECK_MODULES([AVAHI], [avahi-client avahi-glib],
542                          [found_avahi=1;AC_DEFINE([HAVE_AVAHI], 1, [Define to enable Avahi Zeroconf support])]
543                          MPD_LIBS="$MPD_LIBS $AVAHI_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AVAHI_CFLAGS",
544                          [found_avahi=0])
545         fi
547         if test x$found_avahi = x1; then
548                 with_zeroconf=avahi
549         elif test x$with_zeroconf = xavahi; then
550                 AC_MSG_ERROR([Avahi support requested but not found])
551         fi
553         if test x$with_zeroconf = xbonjour || test x$with_zeroconf = xauto; then
554                 AC_CHECK_HEADER(dns_sd.h,
555                         [found_bonjour=1;AC_DEFINE([HAVE_BONJOUR], 1, [Define to enable Bonjour Zeroconf support])],
556                         [found_bonjour=0])
557                 AC_CHECK_LIB(dns_sd, DNSServiceRegister,
558                         MPD_LIBS="$MPD_LIBS -ldns_sd")
559         fi
561         if test x$found_bonjour = x1; then
562                 with_zeroconf=bonjour
563         elif test x$with_zeroconf = xbonjour; then
564                 AC_MSG_ERROR([Bonjour support requested but not found])
565         fi
567         if test x$with_zeroconf = xauto; then
568                 AC_MSG_WARN([No supported Zeroconf backend found, disabling Zeroconf])
569                 with_zeroconf=no
570         else
571                 AC_DEFINE([HAVE_ZEROCONF], 1, [Define to enable Zeroconf support])
572         fi
575 AM_CONDITIONAL(HAVE_ZEROCONF, test x$with_zeroconf != xno)
576 AM_CONDITIONAL(HAVE_AVAHI, test x$with_zeroconf = xavahi)
577 AM_CONDITIONAL(HAVE_BONJOUR, test x$with_zeroconf = xbonjour)
579 dnl ---------------------------------------------------------------------------
580 dnl Sticker Database
581 dnl ---------------------------------------------------------------------------
583 dnl ---------------------------------- sqlite ---------------------------------
585 MPD_AUTO_PKG(sqlite, SQLITE, [sqlite3],
586         [SQLite database support], [sqlite not found])
587 if test x$enable_sqlite = xyes; then
588         AC_DEFINE([ENABLE_SQLITE], 1, [Define to enable sqlite database support])
591 AM_CONDITIONAL(ENABLE_SQLITE, test x$enable_sqlite = xyes)
593 dnl ---------------------------------------------------------------------------
594 dnl Converter Plugins
595 dnl ---------------------------------------------------------------------------
597 dnl ------------------------------ libsamplerate ------------------------------
598 MPD_AUTO_PKG(lsr, SAMPLERATE, [samplerate >= 0.0.15],
599         [libsamplerate resampling], [libsamplerate not found])
600 if test x$enable_lsr = xyes; then
601         AC_DEFINE([HAVE_LIBSAMPLERATE], 1,
602                 [Define to enable libsamplerate])
605 if test x$enable_lsr = xyes; then
606         PKG_CHECK_MODULES([SAMPLERATE_013],
607                 [samplerate >= 0.1.3],,
608                 [AC_DEFINE([HAVE_LIBSAMPLERATE_NOINT], 1,
609                 [libsamplerate doesn't provide src_int_to_float_array() (<0.1.3)])])
612 AM_CONDITIONAL(HAVE_LIBSAMPLERATE, test x$enable_lsr = xyes)
614 dnl ---------------------------------------------------------------------------
615 dnl Input Plugins
616 dnl ---------------------------------------------------------------------------
618 dnl ----------------------------------- CURL ----------------------------------
619 MPD_AUTO_PKG(curl, CURL, [libcurl],
620         [libcurl HTTP streaming], [libcurl not found])
621 if test x$enable_curl = xyes; then
622         AC_DEFINE(ENABLE_CURL, 1, [Define when libcurl is used for HTTP streaming])
624 AM_CONDITIONAL(ENABLE_CURL, test x$enable_curl = xyes)
626 dnl --------------------------------- Last.FM ---------------------------------
627 if test x$enable_lastfm = xyes; then
628         if test x$enable_curl != xyes; then
629                 AC_MSG_ERROR([Cannot enable last.fm radio without curl])
630         fi
632         AC_DEFINE(ENABLE_LASTFM, 1, [Define when last.fm radio is enabled])
634 AM_CONDITIONAL(ENABLE_LASTFM, test x$enable_lastfm = xyes)
636 dnl ---------------------------------- libogg ---------------------------------
637 if test x$with_tremor == xno || test -z $with_tremor; then
638         PKG_CHECK_MODULES(OGG, [ogg], enable_ogg=yes, enable_ogg=no)
641 dnl ---------------------------------- libmms ---------------------------------
642 MPD_AUTO_PKG(mms, MMS, [libmms >= 0.4],
643         [libmms mms:// protocol support], [libmms not found])
644 if test x$enable_mms = xyes; then
645         AC_DEFINE(ENABLE_MMS, 1,
646                 [Define when libmms is used for the MMS protocol])
648 AM_CONDITIONAL(ENABLE_MMS, test x$enable_mms = xyes)
650 dnl ---------------------------------------------------------------------------
651 dnl Archive Plugins
652 dnl ---------------------------------------------------------------------------
654 dnl --------------------------------- iso9660 ---------------------------------
655 MPD_AUTO_PKG(iso9660, ISO9660, [libiso9660],
656         [libiso9660 archive library], [libiso9660 not found])
658 AM_CONDITIONAL(HAVE_ISO9660, test x$enable_iso9660 = xyes)
659 if test x$enable_iso9660 = xyes; then
660         AC_DEFINE(HAVE_ISO9660, 1, [Define to have ISO9660 archive support])
662         AC_PATH_PROG(MKISOFS, mkisofs, no)
663 else
664         MKISOFS="no"
667 AM_CONDITIONAL(ENABLE_ISO9660_TEST, test x$MKISOFS != xno)
669 dnl ---------------------------------- libbz2 ---------------------------------
670 if test x$enable_bzip2 = xyes; then
671         AC_CHECK_LIB(bz2, BZ2_bzDecompressInit,
672                 [MPD_LIBS="$MPD_LIBS -lbz2"],
673                 [AC_MSG_ERROR([libbz2 not found])])
676 AM_CONDITIONAL(HAVE_BZ2, test x$enable_bzip2 = xyes)
677 if test x$enable_bzip2 = xyes; then
678         AC_DEFINE(HAVE_BZ2, 1, [Define to have bz2 archive support])
680         AC_PATH_PROG(BZIP2, bzip2, no)
681 else
682         BZIP2="no"
685 AM_CONDITIONAL(ENABLE_BZIP2_TEST, test x$BZIP2 != xno)
687 dnl --------------------------------- libzzip ---------------------------------
688 MPD_AUTO_PKG(zzip, ZZIP, [zziplib >= 0.13],
689         [libzzip archive library], [libzzip not found])
691 AM_CONDITIONAL(HAVE_ZZIP, test x$enable_zzip = xyes)
692 if test x$enable_zzip = xyes; then
693         AC_DEFINE(HAVE_ZZIP, 1, [Define to have zip archive support])
695         AC_PATH_PROG(ZIP, zip, no)
696 else
697         ZIP="no"
700 AM_CONDITIONAL(ENABLE_ZZIP_TEST, test x$ZIP != xno)
702 dnl ------------------------------- Archive API -------------------------------
704         test x$enable_bzip2 = xyes ||
705         test x$enable_zzip = xyes ||
706         test x$enable_iso9660 = xyes; then
707                 enable_archive=yes
708                 AC_DEFINE(ENABLE_ARCHIVE, 1, [The archive API is available])
709 else
710         enable_archive=no
713 AM_CONDITIONAL(ENABLE_ARCHIVE, test x$enable_archive = xyes)
715 dnl ---------------------------------------------------------------------------
716 dnl Decoder Plugins
717 dnl ---------------------------------------------------------------------------
719 dnl -------------------------------- audiofile --------------------------------
720 MPD_AUTO_PKG(audiofile, AUDIOFILE, [audiofile >= 0.1.7],
721         [audiofile decoder plugin], [libaudiofile not found])
722 AM_CONDITIONAL(HAVE_AUDIOFILE, test x$enable_audiofile = xyes)
723 if test x$enable_audiofile = xyes; then
724         AC_DEFINE(HAVE_AUDIOFILE, 1, [Define for audiofile support])
727 dnl ----------------------------------- FAAD ----------------------------------
728 AM_PATH_FAAD()
730 AM_CONDITIONAL(HAVE_FAAD, test x$enable_aac = xyes)
731 AM_CONDITIONAL(HAVE_MP4, test x$enable_mp4 = xyes)
733 dnl ---------------------------------- ffmpeg ---------------------------------
734 MPD_AUTO_PKG(ffmpeg, FFMPEG, [libavformat >= 52 libavcodec >= 51 libavutil >= 49],
735         [ffmpeg decoder library], [libavformat+libavcodec+libavutil not found])
737 if test x$enable_ffmpeg = xyes; then
738         # prior to ffmpeg svn12865, you had to specify include files
739         # without path prefix
740         old_CPPCFLAGS=$CPPFLAGS
741         CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS"
742         AC_CHECK_HEADER(libavcodec/avcodec.h,,
743                 AC_DEFINE(OLD_FFMPEG_INCLUDES, 1,
744                         [Define if avcodec.h instead of libavcodec/avcodec.h should be included]))
745         CPPCFLAGS=$old_CPPFLAGS
748 if test x$enable_ffmpeg = xyes; then
749         AC_DEFINE(HAVE_FFMPEG, 1, [Define for FFMPEG support])
752 AM_CONDITIONAL(HAVE_FFMPEG, test x$enable_ffmpeg = xyes)
754 dnl ----------------------------------- FLAC ----------------------------------
755 if test x$enable_flac = xyes; then
756         PKG_CHECK_MODULES(FLAC, [flac >= 1.1],
757                 AC_DEFINE(HAVE_FLAC, 1, [Define for FLAC support]),
758                 enable_flac=no)
760         oldcflags="$CFLAGS"
761         oldlibs="$LIBS"
762         CFLAGS="$CFLAGS $FLAC_CFLAGS"
763         LIBS="$LIBS $FLAC_LIBS"
764         if test x$enable_flac = xyes && test x$enable_oggflac = xyes; then
765                 AC_CHECK_DECL(FLAC_API_SUPPORTS_OGG_FLAC,
766                         [enable_oggflac=flac], [],
767                         [#include <FLAC/export.h>])
768         fi
769         CFLAGS="$oldcflags"
770         LIBS="$oldlibs"
772         if test x$enable_oggflac = xflac; then
773                 if test x$enable_ogg = xyes; then
774                         FLAC_LIBS="${FLAC_LIBS} -logg"
775                 else
776                         enable_oggflac=yes
777                         AC_MSG_WARN("FLAC has the ogg API built in, but couldn't find ogg. Disabling oggflac.")
778                 fi
779         fi
782 AM_CONDITIONAL(HAVE_FLAC, test x$enable_flac = xyes)
784 enable_flac_encoder=$enable_flac
786 dnl -------------------------------- FluidSynth -------------------------------
787 if test x$enable_fluidsynth = xyes; then
788         PKG_CHECK_MODULES(FLUIDSYNTH, [fluidsynth],
789                 AC_DEFINE(ENABLE_FLUIDSYNTH, 1, [Define for fluidsynth support]),
790                 enable_fluidsynth=no)
793 AM_CONDITIONAL(ENABLE_FLUIDSYNTH, test x$enable_fluidsynth = xyes)
795 dnl ---------------------------------- libgme ---------------------------------
796 MPD_AUTO_PKG(gme, GME, [libgme],
797         [gme decoder plugin], [libgme not found])
798 AM_CONDITIONAL(HAVE_GME, test x$enable_gme = xyes)
799 if test x$enable_gme = xyes; then
800         AC_DEFINE(HAVE_GME, 1, [Define for gme support])
803 dnl ---------------------------------- libmad ---------------------------------
804 MPD_AUTO_PKG(mad, MAD, [mad],
805         [libmad MP3 decoder plugin], [libmad not found])
806 if test x$enable_mad = xyes; then
807         AC_DEFINE(HAVE_MAD, 1, [Define to use libmad])
809 AM_CONDITIONAL(HAVE_MAD, test x$enable_mad = xyes)
811 enable_shout2="$enable_shout"
812 MPD_AUTO_PKG(shout, SHOUT, [shout],
813         [shout output plugin], [libshout not found])
814 if test x$enable_shout = xyes && test x$enable_shout2 = xauto; then
815         enable_shout=auto
818 dnl -------------------------------- libmpg123 --------------------------------
819 MPD_AUTO_PKG(mpg123, MPG123, [libmpg123],
820         [libmpg123 decoder plugin], [libmpg123 not found])
821 if test x$enable_mpg123 = xyes; then
822         AC_DEFINE(HAVE_MPG123, 1, [Define to use libmpg123])
824 AM_CONDITIONAL(HAVE_MPG123, test x$enable_mpg123 = xyes)
826 dnl -------------------------------- libmikmod --------------------------------
827 if test x$enable_mikmod = xyes; then
828         AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config)
829         if test x$LIBMIKMOD_CONFIG != x ; then
830                 AC_SUBST(LIBMIKMOD_CFLAGS, `$LIBMIKMOD_CONFIG --cflags`)
831                 AC_SUBST(LIBMIKMOD_LIBS, `$LIBMIKMOD_CONFIG --libs`)
832                 AC_DEFINE(ENABLE_MIKMOD_DECODER, 1, [Define for mikmod support])
833         else
834                 enable_mikmod=no
835         fi
838 AM_CONDITIONAL(ENABLE_MIKMOD_DECODER, test x$enable_mikmod = xyes)
840 dnl -------------------------------- libmodplug -------------------------------
841 found_modplug=$HAVE_CXX
842 MPD_AUTO_PRE(modplug, [modplug decoder plugin], [No C++ compiler found])
844 MPD_AUTO_PKG(modplug, MODPLUG, [libmodplug],
845         [modplug decoder plugin], [libmodplug not found])
847 if test x$enable_modplug = xyes; then
848         AC_DEFINE(HAVE_MODPLUG, 1, [Define for modplug support])
850 AM_CONDITIONAL(HAVE_MODPLUG, test x$enable_modplug = xyes)
852 dnl --------------------------- sndfile/modplug test --------------------------
853 if test x$enable_sndfile = xauto && test x$enable_modplug = xyes; then
854         dnl If modplug is enabled, enable sndfile only if explicitly
855         dnl requested - modplug's modplug/sndfile.h is known to
856         dnl conflict with libsndfile's sndfile.h.
857         AC_MSG_NOTICE([disabling libsndfile auto-detection, because the modplug decoder is enabled])
858         enable_sndfile=no
861 dnl -------------------------------- libsndfile -------------------------------
862 dnl See above test, which may disable this.
863 MPD_AUTO_PKG(sndfile, SNDFILE, [sndfile],
864         [libsndfile decoder plugin], [libsndfile not found])
866 if test x$enable_sndfile = xyes; then
867         AC_DEFINE(ENABLE_SNDFILE, 1, [Define to enable the sndfile decoder plugin])
869 AM_CONDITIONAL(ENABLE_SNDFILE, test x$enable_sndfile = xyes)
871 dnl --------------------------------- musepack --------------------------------
872 if test x$enable_mpc = xyes; then
873         if test "x$mpcdec_libraries" != "x" ; then
874                 MPCDEC_LIBS="-L$mpcdec_libraries"
875         elif test "x$mpcdec_prefix" != "x" ; then
876                 MPCDEC_LIBS="-L$mpcdec_prefix/lib"
877         fi
879         MPCDEC_LIBS="$MPCDEC_LIBS -lmpcdec"
881         if test "x$mpcdec_includes" != "x" ; then
882                 MPCDEC_CFLAGS="-I$mpcdec_includes"
883         elif test "x$mpcdec_prefix" != "x" ; then
884                 MPCDEC_CFLAGS="-I$mpcdec_prefix/include"
885         fi
887         oldcflags=$CFLAGS
888         oldlibs=$LIBS
889         oldcppflags=$CPPFLAGS
890         CFLAGS="$CFLAGS $MPD_CFLAGS $MPCDEC_CFLAGS -I."
891         LIBS="$LIBS $MPD_LIBS $MPCDEC_LIBS"
892         CPPFLAGS=$CFLAGS
893         AC_CHECK_HEADER(mpc/mpcdec.h,
894                 old_mpcdec=no,
895                 [AC_CHECK_HEADER(mpcdec/mpcdec.h,
896                         old_mpcdec=yes,
897                         enable_mpc=no)])
898         if test x$enable_mpc = xyes; then
899                 AC_CHECK_LIB(mpcdec,main,
900                         [MPD_LIBS="$MPD_LIBS $MPCDEC_LIBS";
901                         MPD_CFLAGS="$MPD_CFLAGS $MPCDEC_CFLAGS";],
902                         enable_mpc=no)
903         fi
904         if test x$enable_mpc = xyes; then
905                 AC_DEFINE(HAVE_MPCDEC,1,
906                         [Define to use libmpcdec for MPC decoding])
907                 if test x$old_mpcdec = xyes; then
908                         AC_DEFINE(MPC_IS_OLD_API, 1,
909                                 [Define if an old pre-SV8 libmpcdec is used])
910                 fi
911         else
912                 AC_MSG_WARN([mpcdec lib needed for MPC support -- disabling MPC support])
913         fi
914         CFLAGS=$oldcflags
915         LIBS=$oldlibs
916         CPPFLAGS=$oldcppflags
919 AM_CONDITIONAL(HAVE_MPCDEC, test x$enable_mpc = xyes)
921 dnl -------------------------------- Ogg Tremor -------------------------------
922 if test x$with_tremor = xyes || test x$with_tremor = xno; then
923         enable_tremor="$with_tremor"
924 else
925         tremor_prefix="$with_tremor"
926         enable_tremor=yes
929 if test x$enable_tremor = xyes; then
930         if test "x$tremor_libraries" != "x" ; then
931                 TREMOR_LIBS="-L$tremor_libraries"
932         elif test "x$tremor_prefix" != "x" ; then
933                 TREMOR_LIBS="-L$tremor_prefix/lib"
934         fi
935         TREMOR_LIBS="$TREMOR_LIBS -lvorbisidec"
936         if test "x$tremor_includes" != "x" ; then
937                 TREMOR_CFLAGS="-I$tremor_includes"
938         elif test "x$tremor_prefix" != "x" ; then
939                 TREMOR_CFLAGS="-I$tremor_prefix/include"
940         fi
941         ac_save_CFLAGS="$CFLAGS"
942         ac_save_LIBS="$LIBS"
943         CFLAGS="$CFLAGS $TREMOR_CFLAGS"
944         LIBS="$LIBS $TREMOR_LIBS"
945         AC_CHECK_LIB(vorbisidec,ov_read,enable_vorbis=yes,enable_vorbis=no;
946                 AC_MSG_WARN([vorbisidec lib needed for ogg support with tremor -- disabling ogg support]))
947         CFLAGS="$ac_save_CFLAGS"
948         LIBS="$ac_save_LIBS"
950         AC_DEFINE(HAVE_TREMOR,1,
951                 [Define to use tremor (libvorbisidec) for ogg support])
954 AC_SUBST(TREMOR_CFLAGS)
955 AC_SUBST(TREMOR_LIBS)
957 dnl --------------------------------- OggFLAC ---------------------------------
958 dnl OggFLAC must go after Ogg Tremor
960 if test x$enable_tremor = xyes && test x$enable_oggflac = xyes; then
961         AC_MSG_WARN([disabling OggFLAC support because it is incompatible with tremor])
962                 enable_oggflac=no
965 if test x$enable_oggflac = xyes; then
966         AC_CHECK_HEADER([OggFLAC/stream_decoder.h],, enable_oggflac=no)
969 if test x$enable_oggflac = xyes; then
970         AC_DEFINE(HAVE_OGGFLAC,1,[Define for OggFLAC support])
971         MPD_LIBS="$MPD_LIBS -lOggFLAC -lFLAC -lm"
974 AM_CONDITIONAL(HAVE_OGGFLAC, test x$enable_oggflac = xyes)
976 dnl -------------------------------- Ogg Vorbis -------------------------------
977 if test x$enable_vorbis = xyes; then
978         if test x$enable_tremor = xyes; then
979                 AC_MSG_WARN(["OggTremor detected, could not enable Vorbis."])
980                 enable_vorbis=no
981         elif test x$enable_ogg = xyes; then
982                 PKG_CHECK_MODULES(VORBIS, [vorbis vorbisfile],
983                         AC_DEFINE(ENABLE_VORBIS_DECODER, 1, [Define for Ogg Vorbis support]),
984                         enable_vorbis=no)
985         else
986                 AC_MSG_WARN(["Ogg not detected, could not enable Vorbis."])
987                 enable_vorbis=no
988         fi
991 AM_CONDITIONAL(ENABLE_VORBIS_DECODER, test x$enable_vorbis = xyes)
993 dnl --------------------------------- sidplay ---------------------------------
994 found_sidplay=$HAVE_CXX
995 MPD_AUTO_PRE(sidplay, [sidplay decoder plugin], [No C++ compiler found])
997 if test x$enable_sidplay != xno; then
998         # we're not using pkg-config here
999         # because libsidplay2's .pc file requires libtool
1000         AC_HAVE_LIBRARY(sidplay2, [found_sidplay=yes], [found_sidplay=no])
1001         MPD_AUTO_PRE(sidplay, [sidplay decoder plugin],
1002                 [libsidplay2 not found])
1005 if test x$enable_sidplay != xno; then
1006         # can't use AC_HAVE_LIBRARY here, because the dash in the
1007         # library name triggers an autoconf bug
1008         AC_CHECK_LIB(resid-builder, main,
1009                 [found_sidplay=yes], [found_sidplay=no])
1011         if test x$found_sidplay = xyes; then
1012                 AC_HAVE_LIBRARY(sidutils,, [found_sidplay=no])
1013         fi
1015         MPD_AUTO_RESULT(sidplay, [sidplay decoder plugin],
1016                 [libresid-builder or libsidutils not found])
1019 if test x$enable_sidplay = xyes; then
1020         AC_SUBST(SIDPLAY_LIBS,"-lsidplay2 -lresid-builder -lsidutils")
1021         AC_SUBST(SIDPLAY_CFLAGS,)
1023         AC_DEFINE(ENABLE_SIDPLAY, 1, [Define for libsidplay2 support])
1026 AM_CONDITIONAL(ENABLE_SIDPLAY, test x$enable_sidplay = xyes)
1028 dnl --------------------------------- wavpack ---------------------------------
1029 MPD_AUTO_PKG(wavpack, WAVPACK, [wavpack],
1030         [WavPack decoder plugin], [libwavpack not found])
1031 AM_CONDITIONAL(HAVE_WAVPACK, test x$enable_wavpack = xyes)
1032 if test x$enable_wavpack = xyes; then
1033         AC_DEFINE([HAVE_WAVPACK], 1, [Define to enable WavPack support])
1036 dnl --------------------------------- WildMidi --------------------------------
1037 if test x$enable_wildmidi = xyes; then
1038         oldcflags=$CFLAGS
1039         oldlibs=$LIBS
1040         oldcppflags=$CPPFLAGS
1042         AC_CHECK_LIB(WildMidi, WildMidi_Init,,
1043                 AC_MSG_ERROR([libwildmidi not found]))
1045         AC_CHECK_LIB(WildMidi, WildMidi_SampledSeek,
1046                 [AC_DEFINE(HAVE_WILDMIDI_SAMPLED_SEEK, 1,
1047                         [Defined if WildMidi_SampledSeek() is available (libwildmidi <= 0.2.2)])])
1049         CFLAGS=$oldcflags
1050         LIBS=$oldlibs
1051         CPPFLAGS=$oldcppflags
1053         AC_SUBST(WILDMIDI_LIBS,-lWildMidi)
1054         AC_SUBST(WILDMIDI_CFLAGS,)
1056         AC_DEFINE(ENABLE_WILDMIDI, 1, [Define for wildmidi support])
1059 AM_CONDITIONAL(ENABLE_WILDMIDI, test x$enable_wildmidi = xyes)
1061 dnl ------------------------ Post Decoder Plugins Tests -----------------------
1064         test x$enable_aac = xno &&
1065         test x$enable_audiofile = xno &&
1066         test x$enable_ffmpeg = xno &&
1067         test x$enable_flac = xno &&
1068         test x$enable_fluidsynth = xno &&
1069         test x$enable_mad = xno &&
1070         test x$enable_mikmod = xno; then
1071         test x$enable_modplug = xno &&
1072         test x$enable_mp4 = xno &&
1073         test x$enable_mpc = xno &&
1074         test x$enable_mpg123 = xno &&
1075         test x$enable_oggflac = xno &&
1076         test x$enable_sidplay = xno &&
1077         test x$enable_tremor = xno &&
1078         test x$enable_vorbis = xno &&
1079         test x$enable_wavpack = xno &&
1080         test x$enable_wildmidi = xno &&
1082                 AC_MSG_ERROR([No input plugins supported!])
1085 AM_CONDITIONAL(HAVE_OGG_COMMON,
1086           test x$enable_vorbis = xyes || test x$enable_oggflac = xyes || test x$enable_flac = xyes)
1088 AM_CONDITIONAL(HAVE_FLAC_COMMON,
1089           test x$enable_flac = xyes || test x$enable_oggflac = xyes)
1091 dnl ---------------------------------------------------------------------------
1092 dnl Encoders for Streaming Audio Output Plugins
1093 dnl ---------------------------------------------------------------------------
1095 dnl ------------------------------- Encoder API -------------------------------
1096 if test x$enable_shout = xyes || \
1097         test x$enable_recorder_output = xyes || \
1098         test x$enable_httpd_output = xyes; then
1099         # at least one output using encoders is explicitly enabled
1100         need_encoder=yes
1101 elif test x$enable_shout = xauto || \
1102         test x$enable_recorder_output = xauto || \
1103         test x$enable_httpd_output = xauto; then
1104         need_encoder=auto
1105 else
1106         # all outputs using encoders are disabled
1107         need_encoder=no
1109         # don't bother to check for encoder plugins
1110         enable_vorbis_encoder=no
1111         enable_lame_encoder=no
1112         enable_twolame_encoder=no
1113         enable_wave_encoder=no
1114         enable_flac_encoder=no
1117 dnl ------------------------------- FLAC Encoder ------------------------------
1118 if test x$enable_flac_encoder = xyes; then
1119         AC_DEFINE(ENABLE_FLAC_ENCODER, 1,
1120                 [Define to enable the FLAC encoder plugin])
1122 AM_CONDITIONAL(ENABLE_FLAC_ENCODER, test x$enable_flac_encoder = xyes)
1124 dnl ---------------------------- Ogg Vorbis Encoder ---------------------------
1125 MPD_AUTO_PKG(vorbis_encoder, VORBISENC, [vorbisenc],
1126         [Ogg Vorbis encoder], [libvorbisenc not found])
1128 if test x$enable_vorbis_encoder = xyes; then
1129         AC_DEFINE(ENABLE_VORBIS_ENCODER, 1,
1130                 [Define to enable the vorbis encoder plugin])
1132 AM_CONDITIONAL(ENABLE_VORBIS_ENCODER, test x$enable_vorbis_encoder = xyes)
1134 dnl ------------------------------- LAME Encoder ------------------------------
1135 if test x$enable_lame_encoder != xno; then
1136         AC_CHECK_HEADERS(lame/lame.h,,
1137                 [AC_CHECK_HEADERS(lame.h,, using_lame=no)])
1138         AC_CHECK_LIB(mp3lame, lame_init,, using_lame=no)
1139         if test x$using_lame != xno; then
1140                 AC_DEFINE(HAVE_LAME, 1, [Define to 1 if you have lame 3.98 or greater.])
1141                 LAME_LIBS="-lmp3lame -lm"
1142                 enable_lame_encoder=yes
1143         fi
1145         if test "$enable_lame_encoder" = "yes" -a "$using_lame" = "no"; then
1146                 AC_MSG_ERROR([LAME libraries and development support files not found.])
1147         fi
1150 AC_SUBST(LAME_LIBS)
1152 if test x$enable_lame_encoder = xyes; then
1153         AC_DEFINE(ENABLE_LAME_ENCODER, 1,
1154                 [Define to enable the lame encoder plugin])
1156 AM_CONDITIONAL(ENABLE_LAME_ENCODER, test x$enable_lame_encoder = xyes)
1158 dnl ----------------------------- TwoLAME Encoder -----------------------------
1159 MPD_AUTO_PKG(twolame_encoder, TWOLAME, [twolame],
1160         [TwoLAME encoder], [libtwolame not found])
1162 if test x$enable_twolame_encoder = xyes; then
1163         AC_DEFINE(ENABLE_TWOLAME_ENCODER, 1,
1164                 [Define to enable the TwoLAME encoder plugin])
1166 AM_CONDITIONAL(ENABLE_TWOLAME_ENCODER, test x$enable_twolame_encoder = xyes)
1168 dnl ------------------------------- WAVE Encoder ------------------------------
1169 AM_CONDITIONAL(ENABLE_WAVE_ENCODER, test x$enable_wave_encoder = xyes)
1170 if test x$enable_wave_encoder = xyes; then
1171         AC_DEFINE(ENABLE_WAVE_ENCODER, 1,
1172                 [Define to enable the PCM wave encoder plugin])
1175 dnl --------------------------- encoder plugins test --------------------------
1176 if test x$enable_vorbis_encoder != xno ||
1177         test x$enable_lame_encoder != xno ||
1178         test x$enable_twolame_encoder != xno ||
1179         test x$enable_flac_encoder != xno ||
1180         test x$enable_wave_encoder != xno; then
1181         # at least one encoder plugin is enabled
1182         enable_encoder=yes
1183 else
1184         # no encoder plugin is enabled: disable the whole encoder API
1185         enable_encoder=no
1187         if test x$need_encoder = xyes; then
1188                 AC_MSG_ERROR([No encoder plugin found])
1189         fi
1192 if test x$enable_encoder = xyes; then
1193         AC_DEFINE(ENABLE_ENCODER, 1,
1194                 [Define to enable the encoder plugins])
1196 AM_CONDITIONAL(ENABLE_ENCODER, test x$enable_encoder = xyes)
1198 dnl ---------------------------------------------------------------------------
1199 dnl Audio Output Plugins
1200 dnl ---------------------------------------------------------------------------
1202 dnl ----------------------------------- ALSA ----------------------------------
1203 MPD_AUTO_PKG(alsa, ALSA, [alsa >= 0.9.0],
1204         [ALSA output plugin], [libasound not found])
1206 if test x$enable_alsa = xyes; then
1207         AC_DEFINE(HAVE_ALSA, 1, [Define to enable ALSA support])
1210 AM_CONDITIONAL(HAVE_ALSA, test x$enable_alsa = xyes)
1212 dnl ----------------------------------- FFADO ---------------------------------
1214 MPD_AUTO_PKG(ffado, FFADO, [libffado],
1215         [libffado output plugin], [libffado not found])
1217 if test x$enable_ffado = xyes; then
1218         AC_DEFINE(ENABLE_FFADO_OUTPUT, 1, [Define to enable the libffado output plugin])
1221 AM_CONDITIONAL(ENABLE_FFADO_OUTPUT, test x$enable_ffado = xyes)
1223 dnl ----------------------------------- FIFO ----------------------------------
1224 if test x$enable_fifo = xyes; then
1225         AC_CHECK_FUNC([mkfifo],
1226                 [enable_fifo=yes;AC_DEFINE([HAVE_FIFO], 1,
1227                         [Define to enable support for writing audio to a FIFO])],
1228                 [enable_fifo=no;AC_MSG_WARN([mkfifo not found -- disabling support for writing audio to a FIFO])])
1231 AM_CONDITIONAL(HAVE_FIFO, test x$enable_fifo = xyes)
1233 dnl ------------------------------- HTTPD Output ------------------------------
1234 if test x$enable_httpd_output = xauto; then
1235         # handle HTTPD auto-detection: disable if no encoder is
1236         # available
1237         if test x$enable_encoder = xyes; then
1238                 enable_httpd_output=yes
1239         else
1240                 AC_MSG_WARN([No encoder plugin -- disabling the HTTP output plugin])
1241                 enable_httpd_output=no
1242         fi
1245 if test x$enable_httpd_output = xyes; then
1246         AC_DEFINE(ENABLE_HTTPD_OUTPUT, 1, [Define to enable the HTTP server output])
1248 AM_CONDITIONAL(ENABLE_HTTPD_OUTPUT, test x$enable_httpd_output = xyes)
1250 dnl ----------------------------------- JACK ----------------------------------
1251 MPD_AUTO_PKG(jack, JACK, [jack >= 0.100],
1252         [JACK output plugin], [libjack not found])
1253 if test x$enable_jack = xyes; then
1254         AC_DEFINE([HAVE_JACK], 1, [Define to enable JACK support])
1257 if test x$enable_jack = xyes; then
1258         # check whether jack_set_info_function() is available
1259         old_LIBS=$LIBS
1260         LIBS="$LIBS $JACK_LIBS"
1262         AC_CHECK_FUNCS(jack_set_info_function)
1264         LIBS=$old_LIBS
1267 AM_CONDITIONAL(HAVE_JACK, test x$enable_jack = xyes)
1269 dnl ---------------------------------- libao ----------------------------------
1270 MPD_AUTO_PKG(ao, AO, [ao],
1271         [libao output plugin], [libao not found])
1272 if test x$enable_ao = xyes; then
1273         AC_DEFINE(HAVE_AO, 1, [Define to play with ao])
1276 AM_CONDITIONAL(HAVE_AO, test x$enable_ao = xyes)
1278 dnl ----------------------------------- MVP -----------------------------------
1279 if test x$enable_mvp = xyes; then
1280    AC_DEFINE(HAVE_MVP,1,[Define to enable Hauppauge Media MVP support])
1283 AM_CONDITIONAL(HAVE_MVP, test x$enable_mvp = xyes)
1285 dnl ---------------------------------- OpenAL ---------------------------------
1286 AC_SUBST(OPENAL_CFLAGS,"")
1287 AC_SUBST(OPENAL_LIBS,"")
1289 if test x$enable_openal = xyes; then
1290         if test x$enable_osx = xyes; then
1291                 AC_CHECK_HEADERS([OpenAL/al.h OpenAL/alc.h], [], [enable_openal=no])
1292                 if test x$enable_openal = xyes; then
1293                         OPENAL_LIBS="-framework OpenAL"
1294                         AC_DEFINE(HAVE_OPENAL, 1, [Define for OpenAL support])
1295                 else
1296                         AC_MSG_WARN(OpenAL headers not found -- disabling OpenAL support)
1297                 fi
1298         else
1299                 PKG_CHECK_MODULES([OPENAL], [openal],
1300                         AC_DEFINE(HAVE_OPENAL, 1, [Define for OpenAL support]),
1301                         enable_openal=no)
1302         fi
1305 AM_CONDITIONAL(HAVE_OPENAL, test x$enable_openal = xyes)
1307 dnl ---------------------------- Open Sound System ----------------------------
1308 if test x$enable_oss = xyes; then
1309         AC_CHECK_HEADER(sys/soundcard.h,
1310                 [enable_oss=yes;AC_DEFINE(HAVE_OSS,1,[Define to enable OSS])],
1311                 [AC_MSG_WARN(Soundcard headers not found -- disabling OSS support);
1312                         enable_oss=no])
1315 AM_CONDITIONAL(HAVE_OSS, test x$enable_oss = xyes)
1317 dnl ----------------------------------- OSX -----------------------------------
1318 enable_osx=no
1319 case "$host_os" in
1320         darwin*)
1321                 AC_DEFINE(HAVE_OSX, 1, [Define for compiling OS X support])
1322                 MPD_LIBS="$MPD_LIBS -framework AudioUnit -framework CoreServices"
1323                 enable_osx=yes ;;
1324 esac
1326 AM_CONDITIONAL(HAVE_OSX, test x$enable_osx = xyes)
1328 dnl ------------------------------- Pipe Output -------------------------------
1329 if test x$enable_pipe_output = xyes; then
1330         AC_DEFINE([ENABLE_PIPE_OUTPUT], 1,
1331                 [Define to enable support for writing audio to a pipe])
1333 AM_CONDITIONAL(ENABLE_PIPE_OUTPUT, test x$enable_pipe_output = xyes)
1335 dnl -------------------------------- PulseAudio -------------------------------
1336 MPD_AUTO_PKG(pulse, PULSE, [libpulse],
1337         [PulseAudio output plugin], [libpulse not found])
1338 if test x$enable_pulse = xyes; then
1339         AC_DEFINE([HAVE_PULSE], 1,
1340                 [Define to enable PulseAudio support])
1343 AM_CONDITIONAL(HAVE_PULSE, test x$enable_pulse = xyes)
1345 dnl --------------------------------- Recorder --------------------------------
1346 if test x$enable_recorder_output = xauto; then
1347         # handle recorder auto-detection: disable if no encoder is
1348         # available
1349         if test x$enable_encoder = xyes; then
1350                 enable_recorder_output=yes
1351         else
1352                 AC_MSG_WARN([No encoder plugin -- disabling the recorder output plugin])
1353                 enable_recorder_output=no
1354         fi
1357 if test x$enable_recorder_output = xyes; then
1358         AC_DEFINE(ENABLE_RECORDER_OUTPUT, 1, [Define to enable the recorder output])
1360 AM_CONDITIONAL(ENABLE_RECORDER_OUTPUT, test x$enable_recorder_output = xyes)
1362 dnl -------------------------------- SHOUTcast --------------------------------
1363 if test x$enable_shout = xauto; then
1364         # handle shout auto-detection: disable if no encoder is
1365         # available
1366         if test x$enable_encoder = xyes; then
1367                 enable_shout=yes
1368         else
1369                 AC_MSG_WARN([No encoder plugin -- disabling the shout output plugin])
1370                 enable_shout=no
1371         fi
1374 if test x$enable_shout = xyes; then
1375         AC_DEFINE(HAVE_SHOUT, 1, [Define to enable the shoutcast output])
1377 AM_CONDITIONAL(HAVE_SHOUT, test x$enable_shout = xyes)
1379 dnl --------------------------------- Solaris ---------------------------------
1380 case "$host_os" in
1381         solaris*)
1382                 AC_DEFINE(ENABLE_SOLARIS_OUTPUT, 1, [Define to enable Solaris /dev/audio support])
1383                 enable_solaris_output=yes
1384                 ;;
1386         *)
1387                 enable_solaris_output=no
1388                 ;;
1389 esac
1391 AM_CONDITIONAL(ENABLE_SOLARIS_OUTPUT, test x$enable_solaris_output = xyes)
1393 dnl --------------------------------- WinMM ---------------------------------
1395 case "$host_os" in
1396         mingw32* | windows*)
1397                 AC_DEFINE(ENABLE_WINMM_OUTPUT, 1, [Define to enable WinMM support])
1398                 enable_winmm_output=yes
1399                 MPD_LIBS="$MPD_LIBS -lwinmm"
1400                 ;;
1402         *)
1403                 enable_winmm_output=no
1404                 ;;
1405 esac
1407 AM_CONDITIONAL(ENABLE_WINMM_OUTPUT, test x$enable_winmm_output = xyes)
1409 dnl --------------------- Post Audio Output Plugins Tests ---------------------
1411         test x$enable_alsa = xno &&
1412         test x$enable_ao = xno &&
1413         test x$enable_ffado = xno &&
1414         test x$enable_fifo = xno &&
1415         test x$enable_httpd_output = xno &&
1416         test x$enable_jack = xno &&
1417         test x$enable_mvp = xno; then
1418         test x$enable_openal = xno &&
1419         test x$enable_oss = xno &&
1420         test x$enable_osx = xno &&
1421         test x$enable_pipe_output = xno &&
1422         test x$enable_pulse = xno &&
1423         test x$enable_recorder_output = xno &&
1424         test x$enable_shout = xno &&
1425         test x$enable_solaris_output = xno &&
1426         test x$enable_winmm_output = xno &&
1428                 AC_MSG_ERROR([No Audio Output types configured!])
1431 dnl ---------------------------------------------------------------------------
1432 dnl Documentation
1433 dnl ---------------------------------------------------------------------------
1434 if test x$enable_documentation = xyes; then
1435         AC_PATH_PROG(XMLTO, xmlto)
1436         AC_SUBST(XMLTO)
1437         AM_CONDITIONAL(HAVE_XMLTO, test x$XMLTO != x)
1439         AC_PATH_PROG(DOXYGEN, doxygen)
1440         if test x$DOXYGEN = x; then
1441                 AC_MSG_ERROR([doxygen not found])
1442         fi
1444         AC_SUBST(DOXYGEN)
1445 else
1446         AM_CONDITIONAL(HAVE_XMLTO, false)
1449 AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)
1451 dnl ---------------------------------------------------------------------------
1452 dnl test suite
1453 dnl ---------------------------------------------------------------------------
1454 AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes)
1456 dnl ---------------------------------------------------------------------------
1457 dnl CFLAGS
1458 dnl ---------------------------------------------------------------------------
1460 dnl ---------------------------------- debug ----------------------------------
1461 #if test "x$enable_debug" = xno; then
1462         # don't set NDEBUG for now, until MPD is stable
1463         #AM_CFLAGS="$AM_CFLAGS -DNDEBUG"
1466 dnl ----------------------------------- GCC -----------------------------------
1467 if test x$GCC = xyes
1468 then
1469         MPD_CHECK_FLAG([-Wall])
1470         MPD_CHECK_FLAG([-Wextra])
1471         MPD_CHECK_FLAG([-Wno-deprecated-declarations])
1472         MPD_CHECK_FLAG([-Wmissing-prototypes])
1473         MPD_CHECK_FLAG([-Wshadow])
1474         MPD_CHECK_FLAG([-Wpointer-arith])
1475         MPD_CHECK_FLAG([-Wstrict-prototypes])
1476         MPD_CHECK_FLAG([-Wcast-qual])
1477         MPD_CHECK_FLAG([-Wwrite-strings])
1478         MPD_CHECK_FLAG([-pedantic])
1481 dnl ------------------------------ gprof profiler -----------------------------
1482 if test "x$enable_gprof" = xyes; then
1483         MPD_CFLAGS="$MPD_CFLAGS -pg"
1484         MPD_LIBS="$MPD_LIBS -pg"
1487 dnl ---------------------------- warnings as errors ---------------------------
1488 if test "x$enable_werror" = xyes; then
1489         AM_CFLAGS="$AM_CFLAGS -Werror -pedantic-errors"
1492 dnl ---------------------------------------------------------------------------
1493 dnl Pretty-Print Results
1494 dnl ---------------------------------------------------------------------------
1495 echo ''
1496 echo '########### MPD CONFIGURATION ############'
1498 echo -ne '\nArchive support:\n\t'
1499 results(bzip2,[bzip2])
1500 results(iso9660,[ISO9660])
1501 results(zzip,[ZIP])
1503 if test x$with_zeroconf != xno; then
1504         echo -ne '\nAutodiscovery support:\n\t'
1505         results(avahi, [Avahi])
1506         results(bonjour, [Bonjour])
1509 echo -ne '\nClient support:\n\t'
1510 results(ipv6, "IPv6")
1511 results(tcp, "TCP")
1512 results(un,[UNIX Domain Sockets])
1514 echo -ne '\nFile format support:\n\t'
1515 results(aac, [AAC])
1516 results(sidplay, [C64 SID])
1517 results(ffmpeg, [FFMPEG])
1518 results(flac, [FLAC])
1519 results(fluidsynth, [FluidSynth])
1520 results(gme, [GME])
1521 results(sndfile, [libsndfile])
1522 echo -ne '\n\t'
1523 results(mikmod, [MikMod])
1524 results(modplug, [MODPLUG])
1525 results(mad, [MAD])
1526 results(mpg123, [MPG123])
1527 results(mp4, [MP4])
1528 results(mpc, [Musepack])
1529 results(oggflac, [OggFLAC], flac)
1530 echo -ne '\n\t'
1531 results(tremor, [OggTremor])
1532 results(vorbis, [OggVorbis])
1533 results(audiofile, [WAVE])
1534 results(wavpack, [WavPack])
1535 results(wildmidi, [WildMidi])
1537 echo -en '\nOther features:\n\t'
1538 results(lsr, [libsamplerate])
1539 results(inotify, [inotify])
1540 results(sqlite, [SQLite])
1542 echo -en '\nMetadata support:\n\t'
1543 results(cue,[cue])
1544 results(id3,[ID3])
1546 echo -en '\nPlayback support:\n\t'
1547 results(alsa,ALSA)
1548 results(ffado,FFADO)
1549 results(fifo,FIFO)
1550 results(recorder_output,[File Recorder])
1551 results(httpd_output,[HTTP Daemon])
1552 results(jack,[JACK])
1553 results(ao,[libao])
1554 results(oss,[OSS])
1555 echo -ne '\n\t'
1556 results(openal,[OpenAL])
1557 results(osx, [OS X])
1558 results(pipe_output, [Pipeline])
1559 results(pulse, [PulseAudio])
1560 results(mvp, [Media MVP])
1561 results(shout, [SHOUTcast])
1562 echo -ne '\n\t'
1563 results(solaris, [Solaris])
1564 results(winmm_output, [WinMM])
1567         test x$enable_shout = xyes ||
1568         test x$enable_recorder = xyes ||
1569         test x$enable_httpd_output = xyes; then
1570                 echo -en '\nStreaming encoder support:\n\t'
1571                 results(flac_encoder, [FLAC])
1572                 results(lame_encoder, [LAME])
1573                 results(vorbis_encoder, [Ogg Vorbis])
1574                 results(twolame_encoder, [TwoLAME])
1575                 results(wave_encoder, [WAVE])
1578 echo -en '\nStreaming support:\n\t'
1579 results(curl,[CURL])
1580 results(lastfm,[Last.FM])
1581 results(mms,[MMS])
1583 echo -ne '\n\n##########################################\n\n'
1585 if test x$enable_sndfile = xyes && test x$enable_modplug = xyes; then
1586         AC_MSG_WARN([compilation may fail, because libmodplug conflicts with libsndfile])
1587         AC_MSG_WARN([libmodplug ships modplug/sndfile.h, which hides libsndfile's sndfile.h])
1590 echo -ne 'Generating files needed for compilation\n'
1592 dnl ---------------------------------------------------------------------------
1593 dnl Generate files
1594 dnl ---------------------------------------------------------------------------
1595 AC_OUTPUT(Makefile)
1597 echo 'MPD is ready for compilation, type "make" to begin.'