Add support for watching the filesystem through FSEvents.
[mpd-mirror/woggling.git] / configure.ac
blob584f45893ab352056058aeee6e4659183994104f
1 AC_PREREQ(2.60)
2 AC_INIT(mpd, 0.17~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.17.0", [The MPD protocol version])
11 dnl ---------------------------------------------------------------------------
12 dnl Programs
13 dnl ---------------------------------------------------------------------------
14 AC_PROG_CC_C99
15 AC_PROG_CXX
16 AC_PROG_RANLIB
18 HAVE_CXX=yes
19 if test x$CXX = xg++; then
20         # CXX=g++ probably means that autoconf hasn't found any C++
21         # compiler; to be sure, we check again
22         AC_PATH_PROG(CXX, $CXX, no)
23         if test x$CXX = xno; then
24                 # no, we don't have C++ - the following hack is
25                 # required because automake insists on using $(CXX)
26                 # for linking the MPD binary
27                 AC_MSG_NOTICE([Disabling C++ support])
28                 CXX="$CC"
29                 HAVE_CXX=no
30         fi
32 AM_CONDITIONAL(HAVE_CXX, test x$HAVE_CXX = xyes)
34 AC_PROG_INSTALL
35 AC_PROG_MAKE_SET
36 PKG_PROG_PKG_CONFIG
37 AC_ARG_WITH([systemdsystemunitdir],
38             AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
39             [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
40 if test "x$with_systemdsystemunitdir" != xno; then
41         AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
43 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
45 dnl ---------------------------------------------------------------------------
46 dnl Declare Variables
47 dnl ---------------------------------------------------------------------------
48 AC_SUBST(AM_CPPFLAGS,"")
49 AC_SUBST(AM_CFLAGS,"")
50 AC_SUBST(AM_CXXFLAGS,"")
52 AC_SUBST(MPD_LIBS)
53 AC_SUBST(MPD_CFLAGS)
54 MPD_LIBS=""
55 MPD_CFLAGS=""
57 dnl ---------------------------------------------------------------------------
58 dnl OS Specific Defaults
59 dnl ---------------------------------------------------------------------------
60 AC_CANONICAL_HOST
62 case "$host_os" in
63 mingw32* | windows*)
64         MPD_LIBS="$MPD_LIBS -lws2_32"
65         ;;
66 esac
68 if test -z "$prefix" || test "x$prefix" = xNONE; then
69         local_lib=
70         local_include=
72         # aren't autotools supposed to be smart enough to figure this out?  oh
73         # well, the git-core Makefile managed to do some of the work for us :)
74         case "$host_os" in
75         darwin*)
76                 local_lib='/sw/lib /opt/local/lib'
77                 local_include='/sw/include /opt/local/include'
78                 ;;
79         freebsd* | openbsd*)
80                 local_lib=/usr/local/lib
81                 local_include=/usr/local/include
82                 ;;
83         netbsd*)
84                 local_lib=/usr/pkg/lib
85                 local_include=/usr/pkg/include
86                 LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/pkg/lib"
87                 ;;
88         esac
90         for d in $local_lib; do
91                 if test -d "$d"; then
92                         LDFLAGS="$LDFLAGS -L$d"
93                         break
94                 fi
95         done
96         for d in $local_include; do
97                 if test -d "$d"; then
98                         CFLAGS="$CFLAGS -I$d"
99                         break
100                 fi
101         done
104 dnl ---------------------------------------------------------------------------
105 dnl Header/Library Checks
106 dnl ---------------------------------------------------------------------------
107 AC_CHECK_FUNCS(daemon fork syslog)
108 if test $ac_cv_func_syslog = no; then
109         # syslog is not in the default libraries.  See if it's in some other.
110         for lib in bsd socket inet; do
111                 AC_CHECK_LIB($lib, syslog,
112                         [AC_DEFINE(HAVE_SYSLOG)
113                         LIBS="$LIBS -l$lib"; break])
114         done
117 AC_CHECK_LIB(socket,socket,MPD_LIBS="$MPD_LIBS -lsocket",)
118 AC_CHECK_LIB(nsl,gethostbyname,MPD_LIBS="$MPD_LIBS -lnsl",)
120 AC_CHECK_FUNCS(pipe2 accept4)
122 AC_CHECK_LIB(m,exp,MPD_LIBS="$MPD_LIBS -lm",)
124 AC_CHECK_HEADERS(locale.h)
125 AC_CHECK_HEADERS(valgrind/memcheck.h)
127 dnl ---------------------------------------------------------------------------
128 dnl Allow tools to be specifically built
129 dnl ---------------------------------------------------------------------------
130 AC_ARG_ENABLE(alsa,
131         AS_HELP_STRING([--enable-alsa], [enable ALSA support]),,
132         [enable_alsa=auto])
134 AC_ARG_ENABLE(roar,
135         AS_HELP_STRING([--enable-roar],
136                 [enable support for RoarAudio]),,
137         [enable_roar=auto])
139 AC_ARG_ENABLE(ao,
140         AS_HELP_STRING([--enable-ao],
141                 [enable support for libao]),,
142         enable_ao=auto)
144 AC_ARG_ENABLE(audiofile,
145         AS_HELP_STRING([--enable-audiofile],
146                 [enable audiofile support (WAV and others)]),,
147         enable_audiofile=auto)
149 AC_ARG_ENABLE(bzip2,
150         AS_HELP_STRING([--enable-bzip2],
151                 [enable bzip2 archive support (default: disabled)]),,
152         enable_bzip2=no)
154 AC_ARG_ENABLE(cdio-paranoia,
155         AS_HELP_STRING([--enable-cdio-paranoia],
156                 [enable support for audio CD support]),,
157         enable_cdio_paranoia=auto)
159 AC_ARG_ENABLE(cue,
160         AS_HELP_STRING([--enable-cue],
161                 [enable support for libcue support]),,
162         enable_cue=auto)
164 AC_ARG_ENABLE(curl,
165         AS_HELP_STRING([--enable-curl],
166                 [enable support for libcurl HTTP streaming (default: auto)]),,
167         [enable_curl=auto])
169 AC_ARG_ENABLE(soup,
170         AS_HELP_STRING([--enable-soup],
171                 [enable support for libsoup HTTP streaming (default: auto)]),,
172         [enable_soup=auto])
174 AC_ARG_ENABLE(debug,
175         AS_HELP_STRING([--enable-debug],
176                 [enable debugging (default: disabled)]),,
177         enable_debug=no)
179 AC_ARG_ENABLE(documentation,
180         AS_HELP_STRING([--enable-documentation],
181                 [build documentation (default: disable)]),,
182         [enable_documentation=no])
184 AC_ARG_ENABLE(ffado,
185         AS_HELP_STRING([--enable-ffado], [enable libffado (FireWire) support]),,
186         [enable_ffado=no])
188 AC_ARG_ENABLE(ffmpeg,
189         AS_HELP_STRING([--enable-ffmpeg],
190                 [enable FFMPEG support]),,
191         enable_ffmpeg=auto)
193 AC_ARG_ENABLE(fifo,
194         AS_HELP_STRING([--disable-fifo],
195                 [disable support for writing audio to a FIFO (default: enable)]),,
196         enable_fifo=yes)
198 AC_ARG_ENABLE(flac,
199         AS_HELP_STRING([--enable-flac],
200                 [enable FLAC decoder]),,
201         enable_flac=auto)
203 AC_ARG_ENABLE(fluidsynth,
204         AS_HELP_STRING([--enable-fluidsynth],
205                 [enable MIDI support via fluidsynth (default: disable)]),,
206         enable_fluidsynth=no)
208 AC_ARG_ENABLE(fsevents,
209         AS_HELP_STRING([--enable-fsevents],
210                 [enable FSEvents automatic database update (OS X 10.5+) (default: disable)]),,
211         enable_fsevents=no)
213 AC_ARG_ENABLE(gme,
214         AS_HELP_STRING([--enable-gme],
215                 [enable Blargg's game music emulator plugin]),,
216         enable_gme=auto)
218 AC_ARG_ENABLE(gprof,
219         AS_HELP_STRING([--enable-gprof],
220                 [enable profiling via gprof (default: disabled)]),,
221         enable_gprof=no)
223 AC_ARG_ENABLE(httpd-output,
224         AS_HELP_STRING([--enable-httpd-output],
225                 [enables the HTTP server output]),,
226         [enable_httpd_output=auto])
228 AC_ARG_ENABLE(raop-output,
229         AS_HELP_STRING([--enable-raop-output],
230                 [enables the RAOP output]),,
231         [enable_raop_output=auto])
233 AC_ARG_ENABLE(id3,
234         AS_HELP_STRING([--enable-id3],
235                 [enable id3 support]),,
236         enable_id3=auto)
238 AC_ARG_ENABLE(inotify,
239         AS_HELP_STRING([--disable-inotify],
240                 [disable support Inotify automatic database update (default: enabled) ]),,
241         [enable_inotify=yes])
243 AC_ARG_ENABLE(ipv6,
244         AS_HELP_STRING([--disable-ipv6],
245                 [disable IPv6 support (default: enable)]),,
246         [enable_ipv6=yes])
248 AC_ARG_ENABLE(iso9660,
249         AS_HELP_STRING([--enable-iso9660],
250                 [enable iso9660 archive support (default: disabled)]),,
251         enable_iso9660=no)
253 AC_ARG_ENABLE(jack,
254         AS_HELP_STRING([--enable-jack],
255                 [enable jack support]),,
256         enable_jack=auto)
258 AC_SYS_LARGEFILE
260 AC_ARG_ENABLE(lastfm,
261         AS_HELP_STRING([--enable-lastfm],
262                 [enable support for last.fm radio (default: disable)]),,
263         [enable_lastfm=no])
265 AC_ARG_ENABLE(despotify,
266         AS_HELP_STRING([--enable-despotify],
267                 [enable support for despotify (default: disable)]),,
268         [enable_despotify=no])
270 AC_ARG_ENABLE(lame-encoder,
271         AS_HELP_STRING([--enable-lame-encoder],
272                 [enable the LAME mp3 encoder]),,
273         enable_lame_encoder=auto)
275 AC_ARG_ENABLE([libwrap],
276         AS_HELP_STRING([--enable-libwrap], [use libwrap]),,
277         [enable_libwrap=auto])
279 AC_ARG_ENABLE(lsr,
280         AS_HELP_STRING([--enable-lsr],
281                 [enable libsamplerate support]),,
282         enable_lsr=auto)
284 AC_ARG_ENABLE(mad,
285         AS_HELP_STRING([--enable-mad],
286                 [enable libmad mp3 decoder plugin]),,
287         enable_mad=auto)
289 AC_ARG_ENABLE(mikmod,
290         AS_HELP_STRING([--enable-mikmod],
291                 [enable the mikmod decoder (default: disable)]),,
292         enable_mikmod=no)
294 AC_ARG_ENABLE(mms,
295         AS_HELP_STRING([--enable-mms],
296                 [enable the MMS protocol with libmms]),,
297         [enable_mms=auto])
299 AC_ARG_ENABLE(modplug,
300         AS_HELP_STRING([--enable-modplug],
301                 [enable modplug decoder plugin]),,
302         enable_modplug=auto)
304 AC_ARG_ENABLE(mpc,
305         AS_HELP_STRING([--disable-mpc],
306                 [disable musepack (MPC) support (default: enable)]),,
307         enable_mpc=yes)
309 AC_ARG_ENABLE(mpg123,
310         AS_HELP_STRING([--enable-mpg123],
311                 [enable libmpg123 decoder plugin]),,
312         enable_mpg123=auto)
314 AC_ARG_ENABLE(mvp,
315         AS_HELP_STRING([--enable-mvp],
316                 [enable support for Hauppauge Media MVP (default: disable)]),,
317         enable_mvp=no)
319 AC_ARG_ENABLE(openal,
320         AS_HELP_STRING([--enable-openal],
321                 [enable OpenAL support (default: disable)]),,
322         enable_openal=no)
324 AC_ARG_ENABLE(oss,
325         AS_HELP_STRING([--disable-oss],
326                 [disable OSS support (default: enable)]),,
327         enable_oss=yes)
329 AC_ARG_ENABLE(pipe-output,
330         AS_HELP_STRING([--enable-pipe-output],
331                 [enable support for writing audio to a pipe (default: disable)]),,
332         enable_pipe_output=no)
334 AC_ARG_ENABLE(pulse,
335         AS_HELP_STRING([--enable-pulse],
336                 [enable support for the PulseAudio sound server]),,
337         enable_pulse=auto)
339 AC_ARG_ENABLE(recorder-output,
340         AS_HELP_STRING([--enable-recorder-output],
341                 [enables the recorder file output plugin (default: disable)]),,
342         [enable_recorder_output=auto])
344 AC_ARG_ENABLE(sidplay,
345         AS_HELP_STRING([--enable-sidplay],
346                 [enable C64 SID support via libsidplay2]),,
347         enable_sidplay=auto)
350 AC_ARG_ENABLE(shout,
351         AS_HELP_STRING([--enable-shout],
352                 [enables the shoutcast streaming output]),,
353         [enable_shout=auto])
355 AC_ARG_ENABLE(sndfile,
356         AS_HELP_STRING([--enable-sndfile],
357                 [enable sndfile support]),,
358         enable_sndfile=auto)
360 AC_ARG_ENABLE(solaris_output,
361         AS_HELP_STRING([--enable-solaris-output],
362                 [enables the Solaris /dev/audio output]),,
363         [enable_solaris_output=auto])
365 AC_ARG_ENABLE(sqlite,
366         AS_HELP_STRING([--enable-sqlite],
367                 [enable support for the SQLite database]),,
368         [enable_sqlite=auto])
370 AC_ARG_ENABLE(tcp,
371         AS_HELP_STRING([--disable-tcp],
372                 [disable support for clients connecting via TCP (default: enable)]),,
373         [enable_tcp=yes])
375 AC_ARG_ENABLE(test,
376         AS_HELP_STRING([--enable-test],
377                 [build the test programs (default: disabled)]),,
378         enable_test=no)
380 AC_ARG_WITH(tremor,
381         AS_HELP_STRING([--with-tremor=PFX],
382                 [use Tremor (vorbisidec) integer Ogg Vorbis decoder (with optional prefix)]),,
383         with_tremor=no)
385 AC_ARG_ENABLE(twolame-encoder,
386         AS_HELP_STRING([--enable-twolame-encoder],
387                 [enable the TwoLAME mp2 encoder]),,
388         enable_twolame_encoder=auto)
390 AC_ARG_ENABLE(un,
391         AS_HELP_STRING([--disable-un],
392                 [disable support for clients connecting via unix domain sockets (default: enable)]),,
393         [enable_un=yes])
395 AC_ARG_ENABLE(vorbis,
396         AS_HELP_STRING([--enable-vorbis],
397                 [enable Ogg Vorbis decoder]),,
398         enable_vorbis=auto)
400 AC_ARG_ENABLE(vorbis-encoder,
401         AS_HELP_STRING([--enable-vorbis-encoder],
402                 [enable the Ogg Vorbis encoder]),,
403         [enable_vorbis_encoder=auto])
405 AC_ARG_ENABLE(wave-encoder,
406         AS_HELP_STRING([--enable-wave-encoder],
407                 [enable the PCM wave encoder]),,
408         enable_wave_encoder=yes)
410 AC_ARG_ENABLE(wavpack,
411         AS_HELP_STRING([--enable-wavpack],
412                 [enable WavPack support]),,
413         enable_wavpack=auto)
415 AC_ARG_ENABLE(werror,
416         AS_HELP_STRING([--enable-werror],
417                 [treat warnings as errors (default: disabled)]),,
418         enable_werror=no)
420 AC_ARG_ENABLE(wildmidi,
421         AS_HELP_STRING([--enable-wildmidi],
422                 [enable MIDI support via wildmidi (default: disable)]),,
423         enable_wildmidi=no)
425 AC_ARG_WITH(zeroconf,
426         AS_HELP_STRING([--with-zeroconf=@<:@auto|avahi|bonjour|no@:>@],
427                 [enable zeroconf backend (default=auto)]),,
428         with_zeroconf="auto")
430 AC_ARG_ENABLE(zzip,
431         AS_HELP_STRING([--enable-zzip],
432                 [enable zip archive support (default: disabled)]),,
433         enable_zzip=no)
436 AC_ARG_WITH(tremor-libraries,
437         AS_HELP_STRING([--with-tremor-libraries=DIR],
438                 [directory where Tremor library is installed (optional)]),,
439         tremor_libraries="")
441 AC_ARG_WITH(tremor-includes,
442         AS_HELP_STRING([--with-tremor-includes=DIR],
443                 [directory where Tremor header files are installed (optional)]),,
444         tremor_includes="")
446 dnl ---------------------------------------------------------------------------
447 dnl Mandatory Libraries
448 dnl ---------------------------------------------------------------------------
449 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.12 gthread-2.0],,
450                 [AC_MSG_ERROR([GLib 2.12 is required])])
452 dnl ---------------------------------------------------------------------------
453 dnl Protocol Options
454 dnl ---------------------------------------------------------------------------
456 if test x$enable_tcp = xno; then
457         # if we don't support TCP, we don't need IPv6 either
458         enable_ipv6=no
461 if test x$enable_ipv6 = xyes; then
462         AC_MSG_CHECKING(for ipv6)
463         AC_EGREP_CPP([AP_maGiC_VALUE],
464         [
465 #include <sys/types.h>
466 #include <sys/socket.h>
467 #include <netdb.h>
468 #ifdef PF_INET6
469 #ifdef AF_INET6
470 AP_maGiC_VALUE
471 #endif
472 #endif
473         ],
474         AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 support present])
475         AC_MSG_RESULT([yes]),
476         AC_MSG_RESULT([no])
480 if test x$enable_tcp = xyes; then
481         AC_DEFINE(HAVE_TCP, 1, [Define if TCP socket support is enabled])
484 case "$host_os" in
485 mingw* | windows* | cygwin*)
486         enable_un=no
487         ;;
488 esac
490 if test x$enable_un = xyes; then
491         AC_DEFINE(HAVE_UN, 1, [Define if unix domain socket support is enabled])
492         STRUCT_UCRED
493         AC_CHECK_FUNCS(getpeereid)
496 dnl --------------------------- Post Protocol Tests ---------------------------
498         test x$enable_tcp = xno &&
499         test x$enable_un = xno; then
500         AC_MSG_ERROR([No client interfaces configured!])
503 dnl ---------------------------------------------------------------------------
504 dnl LIBC Features
505 dnl ---------------------------------------------------------------------------
506 if test x$enable_largefile != xno; then
507         AC_DEFINE([ENABLE_LARGEFILE], 1, [Define if large file support is enabled])
510 dnl ---------------------------------------------------------------------------
511 dnl Miscellaneous Libraries
512 dnl ---------------------------------------------------------------------------
514 dnl --------------------------------- FSEvents --------------------------------
516 AC_SUBST(FSEVENTS_CFLAGS,"")
517 AC_SUBST(FSEVENTS_LIBS,"")
519 if test x$enable_fsevents = xyes; then
520         AC_CHECK_HEADERS([CoreServices/CoreServices.h], [],
521                          [enable_fsevents=no])
522         if test x$enable_fsevents = xyes; then
523                 FSEVENTS_LIBS="-framework CoreFoundation"
524                 AC_DEFINE([ENABLE_FSEVENTS], 1, [Define to enable inotify support])
525         fi
527 AM_CONDITIONAL(ENABLE_FSEVENTS, test x$enable_fsevents = xyes)
529 dnl --------------------------------- inotify ---------------------------------
530 AC_CHECK_FUNCS(inotify_init inotify_init1)
532 if test x$ac_cv_func_inotify_init = xno; then
533         enable_inotify=no
536 if test x$enable_inotify = xyes; then
537         AC_DEFINE([ENABLE_INOTIFY], 1, [Define to enable inotify support])
539 AM_CONDITIONAL(ENABLE_INOTIFY, test x$enable_inotify = xyes)
541 dnl --------------------------------- libwrap ---------------------------------
542 if test x$enable_libwrap != xno; then
543         AC_CHECK_LIBWRAP(found_libwrap=yes, found_libwrap=no)
544         MPD_AUTO_RESULT(libwrap, libwrap, [libwrap not found])
547 if test x$enable_libwrap = xyes; then
548         AC_SUBST(LIBWRAP_CFLAGS)
549         AC_SUBST(LIBWRAP_LDFLAGS)
550         AC_DEFINE(HAVE_LIBWRAP, 1, [define to enable libwrap library])
553 dnl ---------------------------------------------------------------------------
554 dnl Metadata Plugins
555 dnl ---------------------------------------------------------------------------
557 dnl ---------------------------------- libcue ---------------------------------
558 MPD_AUTO_PKG(cue, CUE, [libcue],
559         [libcue parsing library], [libcue not found])
560 if test x$enable_cue = xyes; then
561         AC_DEFINE([HAVE_CUE], 1,
562                 [Define to enable libcue support])
565 AM_CONDITIONAL(HAVE_CUE, test x$enable_cue = xyes)
567 dnl -------------------------------- libid3tag --------------------------------
568 MPD_AUTO_PKG_LIB(id3, ID3TAG, id3tag, id3tag, id3_file_open, [-lid3tag -lz], [],
569         [id3tag], [libid3tag not found])
570 if test x$enable_id3 = xyes; then
571         AC_DEFINE(HAVE_ID3TAG, 1, [Define to use id3tag])
574 AM_CONDITIONAL(HAVE_ID3TAG, test x$enable_id3 = xyes)
576 dnl ---------------------------------------------------------------------------
577 dnl Autodiscovery
578 dnl ---------------------------------------------------------------------------
580 dnl --------------------------------- zeroconf --------------------------------
582 case $with_zeroconf in
583 no|bonjour)
584         enable_avahi=no
585         ;;
587 avahi)
588         enable_avahi=yes
589         ;;
592         with_zeroconf=auto
593         enable_avahi=auto
594         ;;
595 esac
597 MPD_AUTO_PKG(avahi, AVAHI, [avahi-client avahi-glib],
598         [avahi client library], [avahi client+glib not found])
599 if test x$enable_avahi = xyes; then
600         AC_DEFINE([HAVE_AVAHI], 1, [Define to enable Avahi Zeroconf support])
601         with_zeroconf=avahi
604 AM_CONDITIONAL(HAVE_AVAHI, test x$enable_avahi = xyes)
606 enable_bounjour=no
607 if test x$with_zeroconf != xno; then
608         if test x$with_zeroconf = xbonjour || test x$with_zeroconf = xauto; then
609                 AC_CHECK_HEADER(dns_sd.h,
610                         [enable_bonjour=yes;AC_DEFINE([HAVE_BONJOUR], 1, [Define to enable Bonjour Zeroconf support])])
611                 AC_CHECK_LIB(dns_sd, DNSServiceRegister,
612                         MPD_LIBS="$MPD_LIBS -ldns_sd")
613         fi
615         if test x$enable_bonjour = xyes; then
616                 with_zeroconf=bonjour
617         elif test x$with_zeroconf = xbonjour; then
618                 AC_MSG_ERROR([Bonjour support requested but not found])
619         fi
621         if test x$with_zeroconf = xauto; then
622                 AC_MSG_WARN([No supported Zeroconf backend found, disabling Zeroconf])
623                 with_zeroconf=no
624         else
625                 AC_DEFINE([HAVE_ZEROCONF], 1, [Define to enable Zeroconf support])
626         fi
629 AM_CONDITIONAL(HAVE_ZEROCONF, test x$with_zeroconf != xno)
630 AM_CONDITIONAL(HAVE_BONJOUR, test x$with_zeroconf = xbonjour)
632 dnl ---------------------------------------------------------------------------
633 dnl Sticker Database
634 dnl ---------------------------------------------------------------------------
636 dnl ---------------------------------- sqlite ---------------------------------
638 MPD_AUTO_PKG(sqlite, SQLITE, [sqlite3],
639         [SQLite database support], [sqlite not found])
640 if test x$enable_sqlite = xyes; then
641         AC_DEFINE([ENABLE_SQLITE], 1, [Define to enable sqlite database support])
644 AM_CONDITIONAL(ENABLE_SQLITE, test x$enable_sqlite = xyes)
646 dnl ---------------------------------------------------------------------------
647 dnl Converter Plugins
648 dnl ---------------------------------------------------------------------------
650 dnl ------------------------------ libsamplerate ------------------------------
651 MPD_AUTO_PKG(lsr, SAMPLERATE, [samplerate >= 0.0.15],
652         [libsamplerate resampling], [libsamplerate not found])
653 if test x$enable_lsr = xyes; then
654         AC_DEFINE([HAVE_LIBSAMPLERATE], 1,
655                 [Define to enable libsamplerate])
658 if test x$enable_lsr = xyes; then
659         PKG_CHECK_MODULES([SAMPLERATE_013],
660                 [samplerate >= 0.1.3],,
661                 [AC_DEFINE([HAVE_LIBSAMPLERATE_NOINT], 1,
662                 [libsamplerate doesn't provide src_int_to_float_array() (<0.1.3)])])
665 AM_CONDITIONAL(HAVE_LIBSAMPLERATE, test x$enable_lsr = xyes)
667 dnl ---------------------------------------------------------------------------
668 dnl Input Plugins
669 dnl ---------------------------------------------------------------------------
671 dnl ----------------------------------- CURL ----------------------------------
672 MPD_AUTO_PKG(curl, CURL, [libcurl],
673         [libcurl HTTP streaming], [libcurl not found])
674 if test x$enable_curl = xyes; then
675         AC_DEFINE(ENABLE_CURL, 1, [Define when libcurl is used for HTTP streaming])
677 AM_CONDITIONAL(ENABLE_CURL, test x$enable_curl = xyes)
679 dnl ----------------------------------- SOUP ----------------------------------
680 MPD_AUTO_PKG(soup, SOUP, [libsoup-2.4],
681         [libsoup HTTP streaming], [libsoup not found])
682 if test x$enable_soup = xyes; then
683         AC_DEFINE(ENABLE_SOUP, 1, [Define when libsoup is used for HTTP streaming])
685 AM_CONDITIONAL(ENABLE_SOUP, test x$enable_soup = xyes)
687 dnl --------------------------------- Last.FM ---------------------------------
688 if test x$enable_lastfm = xyes; then
689         if test x$enable_curl != xyes; then
690                 AC_MSG_ERROR([Cannot enable last.fm radio without curl])
691         fi
693         AC_DEFINE(ENABLE_LASTFM, 1, [Define when last.fm radio is enabled])
695 AM_CONDITIONAL(ENABLE_LASTFM, test x$enable_lastfm = xyes)
697 dnl --------------------------------- Despotify ---------------------------------
698 MPD_AUTO_PKG(despotify, DESPOTIFY, [despotify],
699         [Despotify support], [despotify not found])
700 if test x$enable_despotify = xyes; then
701         AC_DEFINE(ENABLE_DESPOTIFY, 1, [Define when despotify is enabled])
702         MPD_LIBS="$MPD_LIBS $DESPOTIFY_LIBS"
704 AM_CONDITIONAL(ENABLE_DESPOTIFY, test x$enable_despotify = xyes)
706 dnl ---------------------------------- libcue ---------------------------------
707 MPD_AUTO_PKG(cdio_paranoia, CDIO_PARANOIA, [libcdio_paranoia],
708         [libcdio_paranoia audio CD library], [libcdio_paranoia not found])
709 if test x$enable_cdio_paranoia = xyes; then
710         AC_DEFINE([ENABLE_CDIO_PARANOIA], 1,
711                 [Define to enable libcdio_paranoia support])
714 AM_CONDITIONAL(ENABLE_CDIO_PARANOIA, test x$enable_cdio_paranoia = xyes)
716 dnl ---------------------------------- libmms ---------------------------------
717 MPD_AUTO_PKG(mms, MMS, [libmms >= 0.4],
718         [libmms mms:// protocol support], [libmms not found])
719 if test x$enable_mms = xyes; then
720         AC_DEFINE(ENABLE_MMS, 1,
721                 [Define when libmms is used for the MMS protocol])
723 AM_CONDITIONAL(ENABLE_MMS, test x$enable_mms = xyes)
725 dnl ---------------------------------------------------------------------------
726 dnl Archive Plugins
727 dnl ---------------------------------------------------------------------------
729 dnl --------------------------------- iso9660 ---------------------------------
730 MPD_AUTO_PKG(iso9660, ISO9660, [libiso9660],
731         [libiso9660 archive library], [libiso9660 not found])
733 AM_CONDITIONAL(HAVE_ISO9660, test x$enable_iso9660 = xyes)
734 if test x$enable_iso9660 = xyes; then
735         AC_DEFINE(HAVE_ISO9660, 1, [Define to have ISO9660 archive support])
737         AC_PATH_PROG(MKISOFS, mkisofs, no)
738 else
739         MKISOFS="no"
742 AM_CONDITIONAL(ENABLE_ISO9660_TEST, test x$MKISOFS != xno)
744 dnl ---------------------------------- libbz2 ---------------------------------
745 if test x$enable_bzip2 = xyes; then
746         AC_CHECK_LIB(bz2, BZ2_bzDecompressInit,
747                 [MPD_LIBS="$MPD_LIBS -lbz2"],
748                 [AC_MSG_ERROR([libbz2 not found])])
751 AM_CONDITIONAL(HAVE_BZ2, test x$enable_bzip2 = xyes)
752 if test x$enable_bzip2 = xyes; then
753         AC_DEFINE(HAVE_BZ2, 1, [Define to have bz2 archive support])
755         AC_PATH_PROG(BZIP2, bzip2, no)
756 else
757         BZIP2="no"
760 AM_CONDITIONAL(ENABLE_BZIP2_TEST, test x$BZIP2 != xno)
762 dnl --------------------------------- libzzip ---------------------------------
763 MPD_AUTO_PKG(zzip, ZZIP, [zziplib >= 0.13],
764         [libzzip archive library], [libzzip not found])
766 AM_CONDITIONAL(HAVE_ZZIP, test x$enable_zzip = xyes)
767 if test x$enable_zzip = xyes; then
768         AC_DEFINE(HAVE_ZZIP, 1, [Define to have zip archive support])
770         AC_PATH_PROG(ZIP, zip, no)
771 else
772         ZIP="no"
775 AM_CONDITIONAL(ENABLE_ZZIP_TEST, test x$ZIP != xno)
777 dnl ------------------------------- Archive API -------------------------------
779         test x$enable_bzip2 = xyes ||
780         test x$enable_zzip = xyes ||
781         test x$enable_iso9660 = xyes; then
782                 enable_archive=yes
783                 AC_DEFINE(ENABLE_ARCHIVE, 1, [The archive API is available])
784 else
785         enable_archive=no
788 AM_CONDITIONAL(ENABLE_ARCHIVE, test x$enable_archive = xyes)
790 dnl ---------------------------------------------------------------------------
791 dnl Decoder Plugins
792 dnl ---------------------------------------------------------------------------
794 dnl -------------------------------- audiofile --------------------------------
795 MPD_AUTO_PKG(audiofile, AUDIOFILE, [audiofile >= 0.1.7],
796         [audiofile decoder plugin], [libaudiofile not found])
797 AM_CONDITIONAL(HAVE_AUDIOFILE, test x$enable_audiofile = xyes)
798 if test x$enable_audiofile = xyes; then
799         AC_DEFINE(HAVE_AUDIOFILE, 1, [Define for audiofile support])
802 dnl ----------------------------------- FAAD ----------------------------------
803 AM_PATH_FAAD()
805 AM_CONDITIONAL(HAVE_FAAD, test x$enable_aac = xyes)
806 AM_CONDITIONAL(HAVE_MP4, test x$enable_mp4 = xyes)
808 dnl ---------------------------------- ffmpeg ---------------------------------
809 MPD_AUTO_PKG(ffmpeg, FFMPEG, [libavformat >= 52.31 libavcodec >= 52.20 libavutil >= 49.15],
810         [ffmpeg decoder library], [libavformat+libavcodec+libavutil not found])
812 if test x$enable_ffmpeg = xyes; then
813         AC_DEFINE(HAVE_FFMPEG, 1, [Define for FFMPEG support])
816 AM_CONDITIONAL(HAVE_FFMPEG, test x$enable_ffmpeg = xyes)
818 dnl ----------------------------------- FLAC ----------------------------------
820 MPD_AUTO_PKG(flac, FLAC, [flac >= 1.1],
821         [FLAC decoder], [libFLAC not found])
823 if test x$enable_flac = xyes; then
824         AC_DEFINE(HAVE_FLAC, 1, [Define for FLAC support])
827 AM_CONDITIONAL(HAVE_FLAC, test x$enable_flac = xyes)
829 enable_flac_encoder=$enable_flac
831 dnl -------------------------------- FluidSynth -------------------------------
832 if test x$enable_fluidsynth = xyes; then
833         PKG_CHECK_MODULES(FLUIDSYNTH, [fluidsynth],
834                 AC_DEFINE(ENABLE_FLUIDSYNTH, 1, [Define for fluidsynth support]),
835                 enable_fluidsynth=no)
838 AM_CONDITIONAL(ENABLE_FLUIDSYNTH, test x$enable_fluidsynth = xyes)
840 dnl ---------------------------------- libgme ---------------------------------
841 MPD_AUTO_PKG(gme, GME, [libgme],
842         [gme decoder plugin], [libgme not found])
843 AM_CONDITIONAL(HAVE_GME, test x$enable_gme = xyes)
844 if test x$enable_gme = xyes; then
845         AC_DEFINE(HAVE_GME, 1, [Define for gme support])
848 dnl ---------------------------------- libmad ---------------------------------
849 MPD_AUTO_PKG_LIB(mad, MAD, [mad],
850         mad, mad_stream_init, [-lmad], [],
851         [libmad MP3 decoder plugin], [libmad not found])
852 if test x$enable_mad = xyes; then
853         AC_DEFINE(HAVE_MAD, 1, [Define to use libmad])
855 AM_CONDITIONAL(HAVE_MAD, test x$enable_mad = xyes)
857 enable_shout2="$enable_shout"
858 MPD_AUTO_PKG(shout, SHOUT, [shout],
859         [shout output plugin], [libshout not found])
860 if test x$enable_shout = xyes && test x$enable_shout2 = xauto; then
861         enable_shout=auto
864 dnl -------------------------------- libmpg123 --------------------------------
865 MPD_AUTO_PKG(mpg123, MPG123, [libmpg123],
866         [libmpg123 decoder plugin], [libmpg123 not found])
867 if test x$enable_mpg123 = xyes; then
868         AC_DEFINE(HAVE_MPG123, 1, [Define to use libmpg123])
870 AM_CONDITIONAL(HAVE_MPG123, test x$enable_mpg123 = xyes)
872 dnl -------------------------------- libmikmod --------------------------------
873 if test x$enable_mikmod = xyes; then
874         AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config)
875         if test x$LIBMIKMOD_CONFIG != x ; then
876                 AC_SUBST(LIBMIKMOD_CFLAGS, `$LIBMIKMOD_CONFIG --cflags`)
877                 AC_SUBST(LIBMIKMOD_LIBS, `$LIBMIKMOD_CONFIG --libs`)
878                 AC_DEFINE(ENABLE_MIKMOD_DECODER, 1, [Define for mikmod support])
879         else
880                 enable_mikmod=no
881         fi
884 AM_CONDITIONAL(ENABLE_MIKMOD_DECODER, test x$enable_mikmod = xyes)
886 dnl -------------------------------- libmodplug -------------------------------
887 found_modplug=$HAVE_CXX
888 MPD_AUTO_PRE(modplug, [modplug decoder plugin], [No C++ compiler found])
890 MPD_AUTO_PKG(modplug, MODPLUG, [libmodplug],
891         [modplug decoder plugin], [libmodplug not found])
893 if test x$enable_modplug = xyes; then
894         AC_DEFINE(HAVE_MODPLUG, 1, [Define for modplug support])
896 AM_CONDITIONAL(HAVE_MODPLUG, test x$enable_modplug = xyes)
898 dnl -------------------------------- libsndfile -------------------------------
899 dnl See above test, which may disable this.
900 MPD_AUTO_PKG(sndfile, SNDFILE, [sndfile],
901         [libsndfile decoder plugin], [libsndfile not found])
903 if test x$enable_sndfile = xyes; then
904         AC_DEFINE(ENABLE_SNDFILE, 1, [Define to enable the sndfile decoder plugin])
906 AM_CONDITIONAL(ENABLE_SNDFILE, test x$enable_sndfile = xyes)
908 dnl --------------------------------- musepack --------------------------------
909 if test x$enable_mpc = xyes; then
910         if test "x$mpcdec_libraries" != "x" ; then
911                 MPCDEC_LIBS="-L$mpcdec_libraries"
912         elif test "x$mpcdec_prefix" != "x" ; then
913                 MPCDEC_LIBS="-L$mpcdec_prefix/lib"
914         fi
916         MPCDEC_LIBS="$MPCDEC_LIBS -lmpcdec"
918         if test "x$mpcdec_includes" != "x" ; then
919                 MPCDEC_CFLAGS="-I$mpcdec_includes"
920         elif test "x$mpcdec_prefix" != "x" ; then
921                 MPCDEC_CFLAGS="-I$mpcdec_prefix/include"
922         fi
924         oldcflags=$CFLAGS
925         oldlibs=$LIBS
926         oldcppflags=$CPPFLAGS
927         CFLAGS="$CFLAGS $MPD_CFLAGS $MPCDEC_CFLAGS -I."
928         LIBS="$LIBS $MPD_LIBS $MPCDEC_LIBS"
929         CPPFLAGS=$CFLAGS
930         AC_CHECK_HEADER(mpc/mpcdec.h,
931                 old_mpcdec=no,
932                 [AC_CHECK_HEADER(mpcdec/mpcdec.h,
933                         old_mpcdec=yes,
934                         enable_mpc=no)])
935         if test x$enable_mpc = xyes; then
936                 AC_CHECK_LIB(mpcdec,main,
937                         [MPD_LIBS="$MPD_LIBS $MPCDEC_LIBS";
938                         MPD_CFLAGS="$MPD_CFLAGS $MPCDEC_CFLAGS";],
939                         enable_mpc=no)
940         fi
941         if test x$enable_mpc = xyes; then
942                 AC_DEFINE(HAVE_MPCDEC,1,
943                         [Define to use libmpcdec for MPC decoding])
944                 if test x$old_mpcdec = xyes; then
945                         AC_DEFINE(MPC_IS_OLD_API, 1,
946                                 [Define if an old pre-SV8 libmpcdec is used])
947                 fi
948         else
949                 AC_MSG_WARN([mpcdec lib needed for MPC support -- disabling MPC support])
950         fi
951         CFLAGS=$oldcflags
952         LIBS=$oldlibs
953         CPPFLAGS=$oldcppflags
956 AM_CONDITIONAL(HAVE_MPCDEC, test x$enable_mpc = xyes)
958 dnl -------------------------------- Ogg Tremor -------------------------------
959 if test x$with_tremor = xyes || test x$with_tremor = xno; then
960         enable_tremor="$with_tremor"
961 else
962         tremor_prefix="$with_tremor"
963         enable_tremor=yes
966 if test x$enable_tremor = xyes; then
967         if test "x$tremor_libraries" != "x" ; then
968                 TREMOR_LIBS="-L$tremor_libraries"
969         elif test "x$tremor_prefix" != "x" ; then
970                 TREMOR_LIBS="-L$tremor_prefix/lib"
971         fi
972         TREMOR_LIBS="$TREMOR_LIBS -lvorbisidec"
973         if test "x$tremor_includes" != "x" ; then
974                 TREMOR_CFLAGS="-I$tremor_includes"
975         elif test "x$tremor_prefix" != "x" ; then
976                 TREMOR_CFLAGS="-I$tremor_prefix/include"
977         fi
978         ac_save_CFLAGS="$CFLAGS"
979         ac_save_LIBS="$LIBS"
980         CFLAGS="$CFLAGS $TREMOR_CFLAGS"
981         LIBS="$LIBS $TREMOR_LIBS"
982         AC_CHECK_LIB(vorbisidec,ov_read,,enable_tremor=no;
983                 AC_MSG_WARN([vorbisidec lib needed for ogg support with tremor -- disabling ogg support]))
984         CFLAGS="$ac_save_CFLAGS"
985         LIBS="$ac_save_LIBS"
988 if test x$enable_tremor = xyes; then
989         AC_DEFINE(HAVE_TREMOR,1,
990                 [Define to use tremor (libvorbisidec) for ogg support])
991         AC_DEFINE(ENABLE_VORBIS_DECODER, 1, [Define for Ogg Vorbis support])
992 else
993         TREMOR_CFLAGS=
994         TREMOR_LIBS=
997 AC_SUBST(TREMOR_CFLAGS)
998 AC_SUBST(TREMOR_LIBS)
1000 dnl -------------------------------- Ogg Vorbis -------------------------------
1002 if test x$enable_tremor = xyes; then
1003         if test x$enable_vorbis = xyes; then
1004                 AC_MSG_WARN(["OggTremor detected, could not enable Vorbis."])
1005         fi
1006         enable_vorbis=no
1009 MPD_AUTO_PKG(vorbis, VORBIS, [vorbis vorbisfile ogg],
1010         [Ogg Vorbis decoder], [libvorbis not found])
1011 if test x$enable_vorbis = xyes; then
1012         AC_DEFINE(ENABLE_VORBIS_DECODER, 1, [Define for Ogg Vorbis support])
1015 AM_CONDITIONAL(ENABLE_VORBIS_DECODER, test x$enable_vorbis = xyes || test x$enable_tremor = xyes)
1017 dnl --------------------------------- sidplay ---------------------------------
1018 found_sidplay=$HAVE_CXX
1019 MPD_AUTO_PRE(sidplay, [sidplay decoder plugin], [No C++ compiler found])
1021 if test x$enable_sidplay != xno; then
1022         # we're not using pkg-config here
1023         # because libsidplay2's .pc file requires libtool
1024         AC_HAVE_LIBRARY(sidplay2, [found_sidplay=yes], [found_sidplay=no])
1025         MPD_AUTO_PRE(sidplay, [sidplay decoder plugin],
1026                 [libsidplay2 not found])
1029 if test x$enable_sidplay != xno; then
1030         # can't use AC_HAVE_LIBRARY here, because the dash in the
1031         # library name triggers an autoconf bug
1032         AC_CHECK_LIB(resid-builder, main,
1033                 [found_sidplay=yes], [found_sidplay=no])
1035         if test x$found_sidplay = xyes; then
1036                 AC_HAVE_LIBRARY(sidutils,, [found_sidplay=no])
1037         fi
1039         MPD_AUTO_RESULT(sidplay, [sidplay decoder plugin],
1040                 [libresid-builder or libsidutils not found])
1043 if test x$enable_sidplay = xyes; then
1044         AC_SUBST(SIDPLAY_LIBS,"-lsidplay2 -lresid-builder -lsidutils")
1045         AC_SUBST(SIDPLAY_CFLAGS,)
1047         AC_DEFINE(ENABLE_SIDPLAY, 1, [Define for libsidplay2 support])
1050 AM_CONDITIONAL(ENABLE_SIDPLAY, test x$enable_sidplay = xyes)
1052 dnl --------------------------------- wavpack ---------------------------------
1053 MPD_AUTO_PKG(wavpack, WAVPACK, [wavpack],
1054         [WavPack decoder plugin], [libwavpack not found])
1055 AM_CONDITIONAL(HAVE_WAVPACK, test x$enable_wavpack = xyes)
1056 if test x$enable_wavpack = xyes; then
1057         AC_DEFINE([HAVE_WAVPACK], 1, [Define to enable WavPack support])
1060 dnl --------------------------------- WildMidi --------------------------------
1061 if test x$enable_wildmidi = xyes; then
1062         oldcflags=$CFLAGS
1063         oldlibs=$LIBS
1064         oldcppflags=$CPPFLAGS
1066         AC_CHECK_LIB(WildMidi, WildMidi_Init,,
1067                 AC_MSG_ERROR([libwildmidi not found]))
1069         AC_CHECK_LIB(WildMidi, WildMidi_SampledSeek,
1070                 [AC_DEFINE(HAVE_WILDMIDI_SAMPLED_SEEK, 1,
1071                         [Defined if WildMidi_SampledSeek() is available (libwildmidi <= 0.2.2)])])
1073         CFLAGS=$oldcflags
1074         LIBS=$oldlibs
1075         CPPFLAGS=$oldcppflags
1077         AC_SUBST(WILDMIDI_LIBS,-lWildMidi)
1078         AC_SUBST(WILDMIDI_CFLAGS,)
1080         AC_DEFINE(ENABLE_WILDMIDI, 1, [Define for wildmidi support])
1083 AM_CONDITIONAL(ENABLE_WILDMIDI, test x$enable_wildmidi = xyes)
1085 dnl ------------------------ Post Decoder Plugins Tests -----------------------
1088         test x$enable_aac = xno &&
1089         test x$enable_audiofile = xno &&
1090         test x$enable_ffmpeg = xno &&
1091         test x$enable_flac = xno &&
1092         test x$enable_fluidsynth = xno &&
1093         test x$enable_mad = xno &&
1094         test x$enable_mikmod = xno; then
1095         test x$enable_modplug = xno &&
1096         test x$enable_mp4 = xno &&
1097         test x$enable_mpc = xno &&
1098         test x$enable_mpg123 = xno &&
1099         test x$enable_sidplay = xno &&
1100         test x$enable_tremor = xno &&
1101         test x$enable_vorbis = xno &&
1102         test x$enable_wavpack = xno &&
1103         test x$enable_wildmidi = xno &&
1105                 AC_MSG_ERROR([No input plugins supported!])
1108 AM_CONDITIONAL(HAVE_OGG_COMMON,
1109         test x$enable_vorbis = xyes || test x$enable_tremor = xyes || test x$enable_flac = xyes)
1111 AM_CONDITIONAL(HAVE_FLAC_COMMON,
1112           test x$enable_flac = xyes)
1114 dnl ---------------------------------------------------------------------------
1115 dnl Encoders for Streaming Audio Output Plugins
1116 dnl ---------------------------------------------------------------------------
1118 dnl ------------------------------- Encoder API -------------------------------
1119 if test x$enable_shout = xyes || \
1120         test x$enable_recorder_output = xyes || \
1121         test x$enable_httpd_output = xyes; then
1122         # at least one output using encoders is explicitly enabled
1123         need_encoder=yes
1124 elif test x$enable_shout = xauto || \
1125         test x$enable_recorder_output = xauto || \
1126         test x$enable_httpd_output = xauto; then
1127         need_encoder=auto
1128 else
1129         # all outputs using encoders are disabled
1130         need_encoder=no
1132         # don't bother to check for encoder plugins
1133         enable_vorbis_encoder=no
1134         enable_lame_encoder=no
1135         enable_twolame_encoder=no
1136         enable_wave_encoder=no
1137         enable_flac_encoder=no
1140 dnl ------------------------------- FLAC Encoder ------------------------------
1141 if test x$enable_flac_encoder = xyes; then
1142         AC_DEFINE(ENABLE_FLAC_ENCODER, 1,
1143                 [Define to enable the FLAC encoder plugin])
1145 AM_CONDITIONAL(ENABLE_FLAC_ENCODER, test x$enable_flac_encoder = xyes)
1147 dnl ---------------------------- Ogg Vorbis Encoder ---------------------------
1148 MPD_AUTO_PKG(vorbis_encoder, VORBISENC, [vorbisenc],
1149         [Ogg Vorbis encoder], [libvorbisenc not found])
1151 if test x$enable_vorbis_encoder = xyes; then
1152         AC_DEFINE(ENABLE_VORBIS_ENCODER, 1,
1153                 [Define to enable the vorbis encoder plugin])
1155 AM_CONDITIONAL(ENABLE_VORBIS_ENCODER, test x$enable_vorbis_encoder = xyes)
1157 dnl ------------------------------- LAME Encoder ------------------------------
1158 if test x$enable_lame_encoder != xno; then
1159         AC_CHECK_HEADERS(lame/lame.h,,
1160                 [AC_CHECK_HEADERS(lame.h,, using_lame=no)])
1161         AC_CHECK_LIB(mp3lame, lame_init,, using_lame=no)
1162         if test x$using_lame != xno; then
1163                 AC_DEFINE(HAVE_LAME, 1, [Define to 1 if you have lame 3.98 or greater.])
1164                 LAME_LIBS="-lmp3lame -lm"
1165                 enable_lame_encoder=yes
1166         fi
1168         if test "$enable_lame_encoder" = "yes" -a "$using_lame" = "no"; then
1169                 AC_MSG_ERROR([LAME libraries and development support files not found.])
1170         fi
1173 AC_SUBST(LAME_LIBS)
1175 if test x$enable_lame_encoder = xyes; then
1176         AC_DEFINE(ENABLE_LAME_ENCODER, 1,
1177                 [Define to enable the lame encoder plugin])
1179 AM_CONDITIONAL(ENABLE_LAME_ENCODER, test x$enable_lame_encoder = xyes)
1181 dnl ----------------------------- TwoLAME Encoder -----------------------------
1182 MPD_AUTO_PKG(twolame_encoder, TWOLAME, [twolame],
1183         [TwoLAME encoder], [libtwolame not found])
1185 if test x$enable_twolame_encoder = xyes; then
1186         AC_DEFINE(ENABLE_TWOLAME_ENCODER, 1,
1187                 [Define to enable the TwoLAME encoder plugin])
1189 AM_CONDITIONAL(ENABLE_TWOLAME_ENCODER, test x$enable_twolame_encoder = xyes)
1191 dnl ------------------------------- WAVE Encoder ------------------------------
1192 AM_CONDITIONAL(ENABLE_WAVE_ENCODER, test x$enable_wave_encoder = xyes)
1193 if test x$enable_wave_encoder = xyes; then
1194         AC_DEFINE(ENABLE_WAVE_ENCODER, 1,
1195                 [Define to enable the PCM wave encoder plugin])
1198 dnl --------------------------- encoder plugins test --------------------------
1199 if test x$enable_vorbis_encoder != xno ||
1200         test x$enable_lame_encoder != xno ||
1201         test x$enable_twolame_encoder != xno ||
1202         test x$enable_flac_encoder != xno ||
1203         test x$enable_wave_encoder != xno; then
1204         # at least one encoder plugin is enabled
1205         enable_encoder=yes
1206 else
1207         # no encoder plugin is enabled: disable the whole encoder API
1208         enable_encoder=no
1210         if test x$need_encoder = xyes; then
1211                 AC_MSG_ERROR([No encoder plugin found])
1212         fi
1215 if test x$enable_encoder = xyes; then
1216         AC_DEFINE(ENABLE_ENCODER, 1,
1217                 [Define to enable the encoder plugins])
1219 AM_CONDITIONAL(ENABLE_ENCODER, test x$enable_encoder = xyes)
1221 dnl ---------------------------------------------------------------------------
1222 dnl Audio Output Plugins
1223 dnl ---------------------------------------------------------------------------
1225 dnl ----------------------------------- ALSA ----------------------------------
1226 MPD_AUTO_PKG(alsa, ALSA, [alsa >= 0.9.0],
1227         [ALSA output plugin], [libasound not found])
1229 if test x$enable_alsa = xyes; then
1230         AC_DEFINE(HAVE_ALSA, 1, [Define to enable ALSA support])
1233 AM_CONDITIONAL(HAVE_ALSA, test x$enable_alsa = xyes)
1235 dnl ----------------------------------- ROAR ----------------------------------
1236 MPD_AUTO_PKG(roar, ROAR, [libroar >= 0.4.0],
1237         [ROAR output plugin], [libroar not found])
1239 if test x$enable_roar = xyes; then
1240         AC_DEFINE(HAVE_ROAR, 1, [Define to enable ROAR support])
1243 AM_CONDITIONAL(HAVE_ROAR, test x$enable_roar = xyes)
1245 dnl ----------------------------------- FFADO ---------------------------------
1247 MPD_AUTO_PKG(ffado, FFADO, [libffado],
1248         [libffado output plugin], [libffado not found])
1250 if test x$enable_ffado = xyes; then
1251         AC_DEFINE(ENABLE_FFADO_OUTPUT, 1, [Define to enable the libffado output plugin])
1254 AM_CONDITIONAL(ENABLE_FFADO_OUTPUT, test x$enable_ffado = xyes)
1256 dnl ----------------------------------- FIFO ----------------------------------
1257 if test x$enable_fifo = xyes; then
1258         AC_CHECK_FUNC([mkfifo],
1259                 [enable_fifo=yes;AC_DEFINE([HAVE_FIFO], 1,
1260                         [Define to enable support for writing audio to a FIFO])],
1261                 [enable_fifo=no;AC_MSG_WARN([mkfifo not found -- disabling support for writing audio to a FIFO])])
1264 AM_CONDITIONAL(HAVE_FIFO, test x$enable_fifo = xyes)
1266 dnl ------------------------------- HTTPD Output ------------------------------
1267 if test x$enable_httpd_output = xauto; then
1268         # handle HTTPD auto-detection: disable if no encoder is
1269         # available
1270         if test x$enable_encoder = xyes; then
1271                 enable_httpd_output=yes
1272         else
1273                 AC_MSG_WARN([No encoder plugin -- disabling the HTTP output plugin])
1274                 enable_httpd_output=no
1275         fi
1278 if test x$enable_httpd_output = xyes; then
1279         AC_DEFINE(ENABLE_HTTPD_OUTPUT, 1, [Define to enable the HTTP server output])
1281 AM_CONDITIONAL(ENABLE_HTTPD_OUTPUT, test x$enable_httpd_output = xyes)
1283 dnl ----------------------------------- JACK ----------------------------------
1284 MPD_AUTO_PKG(jack, JACK, [jack >= 0.100],
1285         [JACK output plugin], [libjack not found])
1286 if test x$enable_jack = xyes; then
1287         AC_DEFINE([HAVE_JACK], 1, [Define to enable JACK support])
1290 if test x$enable_jack = xyes; then
1291         # check whether jack_set_info_function() is available
1292         old_LIBS=$LIBS
1293         LIBS="$LIBS $JACK_LIBS"
1295         AC_CHECK_FUNCS(jack_set_info_function)
1297         LIBS=$old_LIBS
1300 AM_CONDITIONAL(HAVE_JACK, test x$enable_jack = xyes)
1302 dnl ---------------------------------- libao ----------------------------------
1303 MPD_AUTO_PKG(ao, AO, [ao],
1304         [libao output plugin], [libao not found])
1305 if test x$enable_ao = xyes; then
1306         AC_DEFINE(HAVE_AO, 1, [Define to play with ao])
1309 AM_CONDITIONAL(HAVE_AO, test x$enable_ao = xyes)
1311 dnl ----------------------------------- MVP -----------------------------------
1312 if test x$enable_mvp = xyes; then
1313    AC_DEFINE(HAVE_MVP,1,[Define to enable Hauppauge Media MVP support])
1316 AM_CONDITIONAL(HAVE_MVP, test x$enable_mvp = xyes)
1318 dnl ---------------------------------- OpenAL ---------------------------------
1319 AC_SUBST(OPENAL_CFLAGS,"")
1320 AC_SUBST(OPENAL_LIBS,"")
1322 if test x$enable_openal = xyes; then
1323         if test x$enable_osx = xyes; then
1324                 AC_CHECK_HEADERS([OpenAL/al.h OpenAL/alc.h], [], [enable_openal=no])
1325                 if test x$enable_openal = xyes; then
1326                         OPENAL_LIBS="-framework OpenAL"
1327                         AC_DEFINE(HAVE_OPENAL, 1, [Define for OpenAL support])
1328                 else
1329                         AC_MSG_WARN(OpenAL headers not found -- disabling OpenAL support)
1330                 fi
1331         else
1332                 PKG_CHECK_MODULES([OPENAL], [openal],
1333                         AC_DEFINE(HAVE_OPENAL, 1, [Define for OpenAL support]),
1334                         enable_openal=no)
1335         fi
1338 AM_CONDITIONAL(HAVE_OPENAL, test x$enable_openal = xyes)
1340 dnl ---------------------------- Open Sound System ----------------------------
1341 if test x$enable_oss = xyes; then
1342         AC_CHECK_HEADER(sys/soundcard.h,
1343                 [enable_oss=yes;AC_DEFINE(HAVE_OSS,1,[Define to enable OSS])],
1344                 [AC_MSG_WARN(Soundcard headers not found -- disabling OSS support);
1345                         enable_oss=no])
1348 AM_CONDITIONAL(HAVE_OSS, test x$enable_oss = xyes)
1350 dnl ----------------------------------- OSX -----------------------------------
1351 enable_osx=no
1352 case "$host_os" in
1353         darwin*)
1354                 AC_DEFINE(HAVE_OSX, 1, [Define for compiling OS X support])
1355                 MPD_LIBS="$MPD_LIBS -framework AudioUnit -framework CoreAudio -framework CoreServices"
1356                 enable_osx=yes ;;
1357 esac
1359 AM_CONDITIONAL(HAVE_OSX, test x$enable_osx = xyes)
1361 dnl ------------------------------- Pipe Output -------------------------------
1362 if test x$enable_pipe_output = xyes; then
1363         AC_DEFINE([ENABLE_PIPE_OUTPUT], 1,
1364                 [Define to enable support for writing audio to a pipe])
1366 AM_CONDITIONAL(ENABLE_PIPE_OUTPUT, test x$enable_pipe_output = xyes)
1368 dnl -------------------------------- PulseAudio -------------------------------
1369 MPD_AUTO_PKG(pulse, PULSE, [libpulse],
1370         [PulseAudio output plugin], [libpulse not found])
1371 if test x$enable_pulse = xyes; then
1372         AC_DEFINE([HAVE_PULSE], 1,
1373                 [Define to enable PulseAudio support])
1376 AM_CONDITIONAL(HAVE_PULSE, test x$enable_pulse = xyes)
1378 dnl --------------------------------- Recorder --------------------------------
1379 if test x$enable_recorder_output = xauto; then
1380         # handle recorder auto-detection: disable if no encoder is
1381         # available
1382         if test x$enable_encoder = xyes; then
1383                 enable_recorder_output=yes
1384         else
1385                 AC_MSG_WARN([No encoder plugin -- disabling the recorder output plugin])
1386                 enable_recorder_output=no
1387         fi
1390 if test x$enable_recorder_output = xyes; then
1391         AC_DEFINE(ENABLE_RECORDER_OUTPUT, 1, [Define to enable the recorder output])
1393 AM_CONDITIONAL(ENABLE_RECORDER_OUTPUT, test x$enable_recorder_output = xyes)
1395 dnl -------------------------------- SHOUTcast --------------------------------
1396 if test x$enable_shout = xauto; then
1397         # handle shout auto-detection: disable if no encoder is
1398         # available
1399         if test x$enable_encoder = xyes; then
1400                 enable_shout=yes
1401         else
1402                 AC_MSG_WARN([No encoder plugin -- disabling the shout output plugin])
1403                 enable_shout=no
1404         fi
1407 if test x$enable_shout = xyes; then
1408         AC_DEFINE(HAVE_SHOUT, 1, [Define to enable the shoutcast output])
1410 AM_CONDITIONAL(HAVE_SHOUT, test x$enable_shout = xyes)
1412 dnl --------------------------------- Solaris ---------------------------------
1414 if test x$enable_solaris_output = xauto; then
1415         case "$host_os" in
1416         solaris*)
1417                 enable_solaris_output=yes
1418                 ;;
1420         *)
1421                 enable_solaris_output=no
1422                 ;;
1423         esac
1426 if test x$enable_solaris_output = xyes; then
1427         AC_DEFINE(ENABLE_SOLARIS_OUTPUT, 1, [Define to enable Solaris /dev/audio support])
1430 AM_CONDITIONAL(ENABLE_SOLARIS_OUTPUT, test x$enable_solaris_output = xyes)
1432 dnl --------------------------------- RAOP ------------------------------------
1434 MPD_AUTO_PKG(raop_output, OPENSSL, [openssl],
1435         [RAOP output], [OpenSSL not found])
1437 if test x$enable_raop_output = xyes; then
1438         AC_DEFINE(ENABLE_RAOP_OUTPUT, 1, [Define for compiling RAOP support])
1441 AM_CONDITIONAL(ENABLE_RAOP_OUTPUT, test x$enable_raop_output = xyes)
1443 dnl --------------------------------- WinMM ---------------------------------
1445 case "$host_os" in
1446         mingw32* | windows*)
1447                 AC_DEFINE(ENABLE_WINMM_OUTPUT, 1, [Define to enable WinMM support])
1448                 enable_winmm_output=yes
1449                 MPD_LIBS="$MPD_LIBS -lwinmm"
1450                 ;;
1452         *)
1453                 enable_winmm_output=no
1454                 ;;
1455 esac
1457 AM_CONDITIONAL(ENABLE_WINMM_OUTPUT, test x$enable_winmm_output = xyes)
1459 dnl --------------------- Post Audio Output Plugins Tests ---------------------
1461         test x$enable_alsa = xno &&
1462         test x$enable_roar = xno &&
1463         test x$enable_ao = xno &&
1464         test x$enable_ffado = xno &&
1465         test x$enable_fifo = xno &&
1466         test x$enable_httpd_output = xno &&
1467         test x$enable_jack = xno &&
1468         test x$enable_mvp = xno; then
1469         test x$enable_openal = xno &&
1470         test x$enable_oss = xno &&
1471         test x$enable_osx = xno &&
1472         test x$enable_raop_output = xno &&
1473         test x$enable_pipe_output = xno &&
1474         test x$enable_pulse = xno &&
1475         test x$enable_recorder_output = xno &&
1476         test x$enable_shout = xno &&
1477         test x$enable_solaris_output = xno &&
1478         test x$enable_winmm_output = xno &&
1480                 AC_MSG_ERROR([No Audio Output types configured!])
1483 dnl ---------------------------------------------------------------------------
1484 dnl Documentation
1485 dnl ---------------------------------------------------------------------------
1486 if test x$enable_documentation = xyes; then
1487         AC_PATH_PROG(XMLTO, xmlto)
1488         AC_SUBST(XMLTO)
1489         AM_CONDITIONAL(HAVE_XMLTO, test x$XMLTO != x)
1491         AC_PATH_PROG(DOXYGEN, doxygen)
1492         if test x$DOXYGEN = x; then
1493                 AC_MSG_ERROR([doxygen not found])
1494         fi
1496         AC_SUBST(DOXYGEN)
1497 else
1498         AM_CONDITIONAL(HAVE_XMLTO, false)
1501 AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)
1503 dnl ---------------------------------------------------------------------------
1504 dnl test suite
1505 dnl ---------------------------------------------------------------------------
1506 AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes)
1508 dnl ---------------------------------------------------------------------------
1509 dnl CFLAGS
1510 dnl ---------------------------------------------------------------------------
1512 dnl ---------------------------------- debug ----------------------------------
1513 if test "x$enable_debug" = xno; then
1514         AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG"
1517 dnl ----------------------------------- GCC -----------------------------------
1518 if test x$GCC = xyes
1519 then
1520         MPD_CHECK_FLAG([-Wall])
1521         MPD_CHECK_FLAG([-Wextra])
1522         MPD_CHECK_FLAG([-Wmissing-prototypes])
1523         MPD_CHECK_FLAG([-Wshadow])
1524         MPD_CHECK_FLAG([-Wpointer-arith])
1525         MPD_CHECK_FLAG([-Wstrict-prototypes])
1526         MPD_CHECK_FLAG([-Wcast-qual])
1527         MPD_CHECK_FLAG([-Wwrite-strings])
1528         MPD_CHECK_FLAG([-pedantic])
1531 dnl ------------------------------ gprof profiler -----------------------------
1532 if test "x$enable_gprof" = xyes; then
1533         MPD_CFLAGS="$MPD_CFLAGS -pg"
1534         MPD_LIBS="$MPD_LIBS -pg"
1537 dnl ---------------------------- warnings as errors ---------------------------
1538 if test "x$enable_werror" = xyes; then
1539         AM_CFLAGS="$AM_CFLAGS -Werror -pedantic-errors"
1540         AM_CXXFLAGS="$AM_CXXFLAGS -Werror"
1543 dnl ---------------------------------------------------------------------------
1544 dnl Pretty-Print Results
1545 dnl ---------------------------------------------------------------------------
1546 echo ''
1547 echo '########### MPD CONFIGURATION ############'
1549 printf '\nArchive support:\n\t'
1550 results(bzip2,[bzip2])
1551 results(iso9660,[ISO9660])
1552 results(zzip,[ZIP])
1554 if test x$with_zeroconf != xno; then
1555         printf '\nAutodiscovery support:\n\t'
1556         results(avahi, [Avahi])
1557         results(bonjour, [Bonjour])
1560 printf '\nClient support:\n\t'
1561 results(ipv6, "IPv6")
1562 results(tcp, "TCP")
1563 results(un,[UNIX Domain Sockets])
1565 printf '\nFile format support:\n\t'
1566 results(aac, [AAC])
1567 results(sidplay, [C64 SID])
1568 results(ffmpeg, [FFMPEG])
1569 results(flac, [FLAC])
1570 results(fluidsynth, [FluidSynth])
1571 results(gme, [GME])
1572 results(sndfile, [libsndfile])
1573 printf '\n\t'
1574 results(mikmod, [MikMod])
1575 results(modplug, [MODPLUG])
1576 results(mad, [MAD])
1577 results(mpg123, [MPG123])
1578 results(mp4, [MP4])
1579 results(mpc, [Musepack])
1580 printf '\n\t'
1581 results(tremor, [OggTremor])
1582 results(vorbis, [OggVorbis])
1583 results(audiofile, [WAVE])
1584 results(wavpack, [WavPack])
1585 results(wildmidi, [WildMidi])
1587 printf '\nOther features:\n\t'
1588 results(fsevents, [FSEvents])
1589 results(lsr, [libsamplerate])
1590 results(inotify, [inotify])
1591 results(sqlite, [SQLite])
1593 printf '\nMetadata support:\n\t'
1594 results(cue,[cue])
1595 results(id3,[ID3])
1597 printf '\nPlayback support:\n\t'
1598 results(alsa,ALSA)
1599 results(roar,ROAR)
1600 results(ffado,FFADO)
1601 results(fifo,FIFO)
1602 results(recorder_output,[File Recorder])
1603 results(httpd_output,[HTTP Daemon])
1604 results(raop_output, [RAOP])
1605 results(jack,[JACK])
1606 results(ao,[libao])
1607 results(oss,[OSS])
1608 printf '\n\t'
1609 results(openal,[OpenAL])
1610 results(osx, [OS X])
1611 results(pipe_output, [Pipeline])
1612 results(pulse, [PulseAudio])
1613 results(mvp, [Media MVP])
1614 results(shout, [SHOUTcast])
1615 printf '\n\t'
1616 results(solaris_output, [Solaris])
1617 results(winmm_output, [WinMM])
1620         test x$enable_shout = xyes ||
1621         test x$enable_recorder = xyes ||
1622         test x$enable_httpd_output = xyes; then
1623                 printf '\nStreaming encoder support:\n\t'
1624                 results(flac_encoder, [FLAC])
1625                 results(lame_encoder, [LAME])
1626                 results(vorbis_encoder, [Ogg Vorbis])
1627                 results(twolame_encoder, [TwoLAME])
1628                 results(wave_encoder, [WAVE])
1631 printf '\nStreaming support:\n\t'
1632 results(curl,[CURL])
1633 results(soup, [SOUP])
1634 results(lastfm,[Last.FM])
1635 results(mms,[MMS])
1636 results(cdio_paranoia, [CDIO_PARANOIA])
1637 results(despotify,[Despotify])
1639 printf '\n\n##########################################\n\n'
1641 echo 'Generating files needed for compilation'
1643 dnl ---------------------------------------------------------------------------
1644 dnl Generate files
1645 dnl ---------------------------------------------------------------------------
1646 AC_OUTPUT(Makefile)
1647 AC_OUTPUT(doc/doxygen.conf)
1648 AC_OUTPUT(mpd.service)
1650 echo 'MPD is ready for compilation, type "make" to begin.'