mpd version 0.16~alpha1
[mpd-mk.git] / configure.ac
blobe706a72e76a3090227d6b28892a3fc8812ee5ca0
1 AC_PREREQ(2.60)
2 AC_INIT(mpd, 0.16~alpha1, musicpd-dev-team@lists.sourceforge.net)
3 AC_CONFIG_SRCDIR([src/main.c])
4 AM_INIT_AUTOMAKE([foreign 1.10 dist-bzip2 subdir-objects])
5 AM_CONFIG_HEADER(config.h)
6 AC_CONFIG_MACRO_DIR([m4])
8 AC_DEFINE(PROTOCOL_VERSION, "0.16.0", [The MPD protocol version])
11 dnl ---------------------------------------------------------------------------
12 dnl Programs
13 dnl ---------------------------------------------------------------------------
14 AC_PROG_CC_C99
15 AC_PROG_CXX
17 HAVE_CXX=yes
18 if test x$CXX = xg++; then
19         # CXX=g++ probably means that autoconf hasn't found any C++
20         # compiler; to be sure, we check again
21         AC_PATH_PROG(CXX, $CXX, no)
22         if test x$CXX = xno; then
23                 # no, we don't have C++ - the following hack is
24                 # required because automake insists on using $(CXX)
25                 # for linking the MPD binary
26                 AC_MSG_NOTICE([Disabling C++ support])
27                 CXX="$CC"
28                 HAVE_CXX=no
29         fi
32 AC_PROG_INSTALL
33 AC_PROG_MAKE_SET
34 PKG_PROG_PKG_CONFIG
36 dnl ---------------------------------------------------------------------------
37 dnl Declare Variables
38 dnl ---------------------------------------------------------------------------
39 AC_SUBST(AM_CFLAGS,"")
41 AC_SUBST(MPD_LIBS)
42 AC_SUBST(MPD_CFLAGS)
43 MPD_LIBS=""
44 MPD_CFLAGS=""
46 dnl ---------------------------------------------------------------------------
47 dnl OS Specific Defaults
48 dnl ---------------------------------------------------------------------------
49 AC_CANONICAL_HOST
51 case "$host_os" in
52 mingw32* | windows*)
53         MPD_LIBS="$MPD_LIBS -lws2_32"
54         ;;
55 esac
57 if test -z "$prefix" || test "x$prefix" = xNONE; then
58         local_lib=
59         local_include=
61         # aren't autotools supposed to be smart enough to figure this out?  oh
62         # well, the git-core Makefile managed to do some of the work for us :)
63         case "$host_os" in
64         darwin*)
65                 local_lib='/sw/lib /opt/local/lib'
66                 local_include='/sw/include /opt/local/include'
67                 ;;
68         freebsd* | openbsd*)
69                 local_lib=/usr/local/lib
70                 local_include=/usr/local/include
71                 ;;
72         netbsd*)
73                 local_lib=/usr/pkg/lib
74                 local_include=/usr/pkg/include
75                 LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/pkg/lib"
76                 ;;
77         esac
79         for d in $local_lib; do
80                 if test -d "$d"; then
81                         LDFLAGS="$LDFLAGS -L$d"
82                         break
83                 fi
84         done
85         for d in $local_include; do
86                 if test -d "$d"; then
87                         CFLAGS="$CFLAGS -I$d"
88                         break
89                 fi
90         done
93 dnl ---------------------------------------------------------------------------
94 dnl Header/Library Checks
95 dnl ---------------------------------------------------------------------------
96 AC_CHECK_FUNCS(daemon fork syslog)
97 if test $ac_cv_func_syslog = no; then
98         # syslog is not in the default libraries.  See if it's in some other.
99         for lib in bsd socket inet; do
100                 AC_CHECK_LIB($lib, syslog,
101                         [AC_DEFINE(HAVE_SYSLOG)
102                         LIBS="$LIBS -l$lib"; break])
103         done
106 AC_CHECK_LIB(socket,socket,MPD_LIBS="$MPD_LIBS -lsocket",)
107 AC_CHECK_LIB(nsl,gethostbyname,MPD_LIBS="$MPD_LIBS -lnsl",)
109 AC_CHECK_FUNCS(pipe2 accept4)
111 AC_CHECK_LIB(m,exp,MPD_LIBS="$MPD_LIBS -lm",)
113 AC_CHECK_HEADERS(locale.h)
114 AC_CHECK_HEADERS(valgrind/memcheck.h)
116 dnl ---------------------------------------------------------------------------
117 dnl Allow tools to be specifically built
118 dnl ---------------------------------------------------------------------------
119 AC_ARG_ENABLE(alsa,
120         AS_HELP_STRING([--enable-alsa], [enable ALSA support]),,
121         [enable_alsa=auto])
123 AC_ARG_ENABLE(ao,
124         AS_HELP_STRING([--enable-ao],
125                 [enable support for libao]),,
126         enable_ao=auto)
128 AC_ARG_ENABLE(audiofile,
129         AS_HELP_STRING([--enable-audiofile],
130                 [enable audiofile support (WAV and others)]),,
131         enable_audiofile=auto)
133 AC_ARG_ENABLE(bzip2,
134         AS_HELP_STRING([--enable-bzip2],
135                 [enable bzip2 archive support (default: disabled)]),,
136         enable_bzip2=no)
138 AC_ARG_ENABLE(cue,
139         AS_HELP_STRING([--enable-cue],
140                 [enable support for libcue support]),,
141         enable_cue=auto)
143 AC_ARG_ENABLE(curl,
144         AS_HELP_STRING([--enable-curl],
145                 [enable support for libcurl HTTP streaming (default: auto)]),,
146         [enable_curl=auto])
148 AC_ARG_ENABLE(debug,
149         AS_HELP_STRING([--enable-debug],
150                 [enable debugging (default: disabled)]),,
151         enable_debug=no)
153 AC_ARG_ENABLE(documentation,
154         AS_HELP_STRING([--enable-documentation],
155                 [build documentation (default: disable)]),,
156         [enable_documentation=no])
158 AC_ARG_ENABLE(ffmpeg,
159         AS_HELP_STRING([--enable-ffmpeg],
160                 [enable FFMPEG support]),,
161         enable_ffmpeg=auto)
163 AC_ARG_ENABLE(fifo,
164         AS_HELP_STRING([--disable-fifo],
165                 [disable support for writing audio to a FIFO (default: enable)]),,
166         enable_fifo=yes)
168 AC_ARG_ENABLE(flac,
169         AS_HELP_STRING([--disable-flac],
170                 [disable flac support (default: enable)]),,
171         enable_flac=yes)
173 AC_ARG_ENABLE(fluidsynth,
174         AS_HELP_STRING([--enable-fluidsynth],
175                 [enable MIDI support via fluidsynth (default: disable)]),,
176         enable_fluidsynth=no)
178 AC_ARG_ENABLE(gme,
179         AS_HELP_STRING([--enable-gme],
180                 [enable Blargg's game music emulator plugin]),,
181         enable_gme=auto)
183 AC_ARG_ENABLE(gprof,
184         AS_HELP_STRING([--enable-gprof],
185                 [enable profiling via gprof (default: disabled)]),,
186         enable_gprof=no)
188 AC_ARG_ENABLE(httpd-output,
189         AS_HELP_STRING([--enable-httpd-output],
190                 [enables the HTTP server output]),,
191         [enable_httpd_output=auto])
193 AC_ARG_ENABLE(id3,
194         AS_HELP_STRING([--disable-id3],
195                 [disable id3 support (default: enable)]),,
196         enable_id3=yes)
198 AC_ARG_ENABLE(inotify,
199         AS_HELP_STRING([--disable-inotify],
200                 [disable support Inotify automatic database update (default: enabled) ]),,
201         [enable_inotify=yes])
203 AC_ARG_ENABLE(ipv6,
204         AS_HELP_STRING([--disable-ipv6],
205                 [disable IPv6 support (default: enable)]),,
206         [enable_ipv6=yes])
208 AC_ARG_ENABLE(iso9660,
209         AS_HELP_STRING([--enable-iso9660],
210                 [enable iso9660 archive support (default: disabled)]),,
211         enable_iso9660=no)
213 AC_ARG_ENABLE(jack,
214         AS_HELP_STRING([--enable-jack],
215                 [enable jack support]),,
216         enable_jack=auto)
218 AC_SYS_LARGEFILE
220 AC_ARG_ENABLE(lastfm,
221         AS_HELP_STRING([--enable-lastfm],
222                 [enable support for last.fm radio (default: disable)]),,
223         [enable_lastfm=no])
225 AC_ARG_ENABLE(lame-encoder,
226         AS_HELP_STRING([--enable-lame-encoder],
227                 [enable the LAME mp3 encoder]),,
228         enable_lame_encoder=auto)
230 AC_ARG_ENABLE([libwrap],
231         AS_HELP_STRING([--enable-libwrap], [use libwrap]),,
232         [enable_libwrap=auto])
234 AC_ARG_ENABLE(lsr,
235         AS_HELP_STRING([--enable-lsr],
236                 [enable libsamplerate support]),,
237         enable_lsr=auto)
239 AC_ARG_ENABLE(mad,
240         AS_HELP_STRING([--enable-mad],
241                 [enable libmad mp3 decoder plugin]),,
242         enable_mad=auto)
244 AC_ARG_ENABLE(mikmod,
245         AS_HELP_STRING([--enable-mikmod],
246                 [enable the mikmod decoder (default: disable)]),,
247         enable_mikmod=no)
249 AC_ARG_ENABLE(mms,
250         AS_HELP_STRING([--enable-mms],
251                 [enable the MMS protocol with libmms]),,
252         [enable_mms=auto])
254 AC_ARG_ENABLE(modplug,
255         AS_HELP_STRING([--enable-modplug],
256                 [enable modplug decoder plugin]),,
257         enable_modplug=auto)
259 AC_ARG_ENABLE(mpc,
260         AS_HELP_STRING([--disable-mpc],
261                 [disable musepack (MPC) support (default: enable)]),,
262         enable_mpc=yes)
264 AC_ARG_ENABLE(mpg123,
265         AS_HELP_STRING([--enable-mpg123],
266                 [enable libmpg123 decoder plugin]),,
267         enable_mpg123=auto)
269 AC_ARG_ENABLE(mvp,
270         AS_HELP_STRING([--enable-mvp],
271                 [enable support for Hauppauge Media MVP (default: disable)]),,
272         enable_mvp=no)
274 AC_ARG_ENABLE(oggflac,
275         AS_HELP_STRING([--disable-oggflac],
276                 [disable OggFLAC support (default: enable)]),,
277         enable_oggflac=yes)
279 AC_ARG_ENABLE(openal,
280         AS_HELP_STRING([--enable-openal],
281                 [enable OpenAL support (default: disable)]),,
282         enable_openal=no)
284 AC_ARG_ENABLE(oss,
285         AS_HELP_STRING([--disable-oss],
286                 [disable OSS support (default: enable)]),,
287         enable_oss=yes)
289 AC_ARG_ENABLE(pipe-output,
290         AS_HELP_STRING([--enable-pipe-output],
291                 [enable support for writing audio to a pipe (default: disable)]),,
292         enable_pipe_output=no)
294 AC_ARG_ENABLE(pulse,
295         AS_HELP_STRING([--enable-pulse],
296                 [enable support for the PulseAudio sound server]),,
297         enable_pulse=auto)
299 AC_ARG_ENABLE(recorder-output,
300         AS_HELP_STRING([--enable-recorder-output],
301                 [enables the recorder file output plugin (default: disable)]),,
302         [enable_recorder_output=auto])
304 AC_ARG_ENABLE(sidplay,
305         AS_HELP_STRING([--enable-sidplay],
306                 [enable C64 SID support via libsidplay2]),,
307         enable_sidplay=auto)
310 AC_ARG_ENABLE(shout,
311         AS_HELP_STRING([--enable-shout],
312                 [enables the shoutcast streaming output]),,
313         [enable_shout=auto])
315 AC_ARG_ENABLE(sndfile,
316         AS_HELP_STRING([--enable-sndfile],
317                 [enable sndfile support]),,
318         enable_sndfile=auto)
320 AC_ARG_ENABLE(sqlite,
321         AS_HELP_STRING([--enable-sqlite],
322                 [enable support for the SQLite database]),,
323         [enable_sqlite=auto])
325 AC_ARG_ENABLE(tcp,
326         AS_HELP_STRING([--disable-tcp],
327                 [disable support for clients connecting via TCP (default: enable)]),,
328         [enable_tcp=yes])
330 AC_ARG_ENABLE(test,
331         AS_HELP_STRING([--enable-test],
332                 [build the test programs (default: disabled)]),,
333         enable_test=no)
335 AC_ARG_WITH(tremor,
336         AS_HELP_STRING([--with-tremor=PFX],
337                 [use Tremor (vorbisidec) integer Ogg Vorbis decoder (with optional prefix)]),,
338         with_tremor=no)
340 AC_ARG_ENABLE(twolame-encoder,
341         AS_HELP_STRING([--enable-twolame-encoder],
342                 [enable the TwoLAME mp2 encoder]),,
343         enable_twolame_encoder=auto)
345 AC_ARG_ENABLE(un,
346         AS_HELP_STRING([--disable-un],
347                 [disable support for clients connecting via unix domain sockets (default: enable)]),,
348         [enable_un=yes])
350 AC_ARG_ENABLE(vorbis,
351         AS_HELP_STRING([--disable-vorbis],
352                 [disable Ogg Vorbis support (default: enable)]),,
353         enable_vorbis=yes)
355 AC_ARG_ENABLE(vorbis-encoder,
356         AS_HELP_STRING([--enable-vorbis-encoder],
357                 [enable the Ogg Vorbis encoder]),,
358         [enable_vorbis_encoder=auto])
360 AC_ARG_ENABLE(wave-encoder,
361         AS_HELP_STRING([--enable-wave-encoder],
362                 [enable the PCM wave encoder]),,
363         enable_wave_encoder=yes)
365 AC_ARG_ENABLE(wavpack,
366         AS_HELP_STRING([--enable-wavpack],
367                 [enable WavPack support]),,
368         enable_wavpack=auto)
370 AC_ARG_ENABLE(werror,
371         AS_HELP_STRING([--enable-werror],
372                 [treat warnings as errors (default: disabled)]),,
373         enable_werror=no)
375 AC_ARG_ENABLE(wildmidi,
376         AS_HELP_STRING([--enable-wildmidi],
377                 [enable MIDI support via wildmidi (default: disable)]),,
378         enable_wildmidi=no)
380 AC_ARG_WITH(zeroconf,
381         AS_HELP_STRING([--with-zeroconf=@<:@auto|avahi|bonjour|no@:>@],
382                 [enable zeroconf backend (default=auto)]),,
383         with_zeroconf="auto")
385 AC_ARG_ENABLE(zzip,
386         AS_HELP_STRING([--enable-zzip],
387                 [enable zip archive support (default: disabled)]),,
388         enable_zzip=no)
391 AC_ARG_WITH(tremor-libraries,
392         AS_HELP_STRING([--with-tremor-libraries=DIR],
393                 [directory where Tremor library is installed (optional)]),,
394         tremor_libraries="")
396 AC_ARG_WITH(tremor-includes,
397         AS_HELP_STRING([--with-tremor-includes=DIR],
398                 [directory where Tremor header files are installed (optional)]),,
399         tremor_includes="")
401 dnl ---------------------------------------------------------------------------
402 dnl Mandatory Libraries
403 dnl ---------------------------------------------------------------------------
404 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.12 gthread-2.0],,
405                 [AC_MSG_ERROR([GLib 2.12 is required])])
407 dnl ---------------------------------------------------------------------------
408 dnl Protocol Options
409 dnl ---------------------------------------------------------------------------
411 if test x$enable_tcp = xno; then
412         # if we don't support TCP, we don't need IPv6 either
413         enable_ipv6=no
416 if test x$enable_ipv6 = xyes; then
417         AC_MSG_CHECKING(for ipv6)
418         AC_EGREP_CPP([AP_maGiC_VALUE],
419         [
420 #include <sys/types.h>
421 #include <sys/socket.h>
422 #include <netdb.h>
423 #ifdef PF_INET6
424 #ifdef AF_INET6
425 AP_maGiC_VALUE
426 #endif
427 #endif
428         ],
429         AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 support present])
430         AC_MSG_RESULT([yes]),
431         AC_MSG_RESULT([no])
435 if test x$enable_tcp = xyes; then
436         AC_DEFINE(HAVE_TCP, 1, [Define if TCP socket support is enabled])
439 case "$host_os" in
440 mingw* | windows*)
441         enable_un=no
442         ;;
443 esac
445 if test x$enable_un = xyes; then
446         AC_DEFINE(HAVE_UN, 1, [Define if unix domain socket support is enabled])
447         STRUCT_UCRED
448         AC_CHECK_FUNCS(getpeereid)
451 dnl --------------------------- Post Protocol Tests ---------------------------
453         test x$enable_tcp = xno &&
454         test x$enable_un = xno; then
455         AC_MSG_ERROR([No client interfaces configured!])
458 dnl ---------------------------------------------------------------------------
459 dnl LIBC Features
460 dnl ---------------------------------------------------------------------------
461 if test x$enable_largefile != xno; then
462         AC_DEFINE([ENABLE_LARGEFILE], 1, [Define if large file support is enabled])
465 dnl ---------------------------------------------------------------------------
466 dnl Miscellaneous Libraries
467 dnl ---------------------------------------------------------------------------
469 dnl --------------------------------- inotify ---------------------------------
470 AC_CHECK_FUNCS(inotify_init inotify_init1)
472 if test x$ac_cv_func_inotify_init = xno; then
473         enable_inotify=no
476 if test x$enable_inotify = xyes; then
477         AC_DEFINE([ENABLE_INOTIFY], 1, [Define to enable inotify support])
479 AM_CONDITIONAL(ENABLE_INOTIFY, test x$enable_inotify = xyes)
481 dnl --------------------------------- libwrap ---------------------------------
482 if test x$enable_libwrap != xno; then
483         AC_CHECK_LIBWRAP(found_libwrap=yes, found_libwrap=no)
484         MPD_AUTO_RESULT(libwrap, libwrap, [libwrap not found])
487 if test x$enable_libwrap = xyes; then
488         AC_SUBST(LIBWRAP_CFLAGS)
489         AC_SUBST(LIBWRAP_LDFLAGS)
490         AC_DEFINE(HAVE_LIBWRAP, 1, [define to enable libwrap library])
493 dnl ---------------------------------------------------------------------------
494 dnl Metadata Plugins
495 dnl ---------------------------------------------------------------------------
497 dnl ---------------------------------- libcue ---------------------------------
498 MPD_AUTO_PKG(cue, CUE, [libcue],
499         [libcue parsing library], [libcue not found])
500 if test x$enable_cue = xyes; then
501         AC_DEFINE([HAVE_CUE], 1,
502                 [Define to enable libcue support])
505 AM_CONDITIONAL(HAVE_CUE, test x$enable_cue = xyes)
507 dnl -------------------------------- libid3tag --------------------------------
508 if test x$enable_id3 = xyes; then
509         PKG_CHECK_MODULES([ID3TAG], [id3tag],,
510                 AC_CHECK_LIB(id3tag, id3_file_open,
511                         [ID3TAG_LIBS="-lid3tag -lz" ID3TAG_CFLAGS=""],
512                         enable_id3=no))
515 if test x$enable_id3 = xyes; then
516         AC_DEFINE(HAVE_ID3TAG, 1, [Define to use id3tag])
519 AM_CONDITIONAL(HAVE_ID3TAG, test x$enable_id3 = xyes)
521 dnl ---------------------------------------------------------------------------
522 dnl Autodiscovery
523 dnl ---------------------------------------------------------------------------
525 dnl --------------------------------- zeroconf --------------------------------
527 case $with_zeroconf in
528 no|avahi|bonjour)
529         ;;
531         with_zeroconf=auto
532         ;;
533 esac
535 if test x$with_zeroconf != xno; then
536         if test x$with_zeroconf = xavahi || test x$with_zeroconf = xauto; then
537                 PKG_CHECK_MODULES([AVAHI], [avahi-client avahi-glib],
538                          [found_avahi=1;AC_DEFINE([HAVE_AVAHI], 1, [Define to enable Avahi Zeroconf support])]
539                          MPD_LIBS="$MPD_LIBS $AVAHI_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AVAHI_CFLAGS",
540                          [found_avahi=0])
541         fi
543         if test x$found_avahi = x1; then
544                 with_zeroconf=avahi
545         elif test x$with_zeroconf = xavahi; then
546                 AC_MSG_ERROR([Avahi support requested but not found])
547         fi
549         if test x$with_zeroconf = xbonjour || test x$with_zeroconf = xauto; then
550                 AC_CHECK_HEADER(dns_sd.h,
551                         [found_bonjour=1;AC_DEFINE([HAVE_BONJOUR], 1, [Define to enable Bonjour Zeroconf support])],
552                         [found_bonjour=0])
553                 AC_CHECK_LIB(dns_sd, DNSServiceRegister,
554                         MPD_LIBS="$MPD_LIBS -ldns_sd")
555         fi
557         if test x$found_bonjour = x1; then
558                 with_zeroconf=bonjour
559         elif test x$with_zeroconf = xbonjour; then
560                 AC_MSG_ERROR([Bonjour support requested but not found])
561         fi
563         if test x$with_zeroconf = xauto; then
564                 AC_MSG_WARN([No supported Zeroconf backend found, disabling Zeroconf])
565                 with_zeroconf=no
566         else
567                 AC_DEFINE([HAVE_ZEROCONF], 1, [Define to enable Zeroconf support])
568         fi
571 AM_CONDITIONAL(HAVE_ZEROCONF, test x$with_zeroconf != xno)
572 AM_CONDITIONAL(HAVE_AVAHI, test x$with_zeroconf = xavahi)
573 AM_CONDITIONAL(HAVE_BONJOUR, test x$with_zeroconf = xbonjour)
575 dnl ---------------------------------------------------------------------------
576 dnl Sticker Database
577 dnl ---------------------------------------------------------------------------
579 dnl ---------------------------------- sqlite ---------------------------------
581 MPD_AUTO_PKG(sqlite, SQLITE, [sqlite3],
582         [SQLite database support], [sqlite not found])
583 if test x$enable_sqlite = xyes; then
584         AC_DEFINE([ENABLE_SQLITE], 1, [Define to enable sqlite database support])
587 AM_CONDITIONAL(ENABLE_SQLITE, test x$enable_sqlite = xyes)
589 dnl ---------------------------------------------------------------------------
590 dnl Converter Plugins
591 dnl ---------------------------------------------------------------------------
593 dnl ------------------------------ libsamplerate ------------------------------
594 MPD_AUTO_PKG(lsr, SAMPLERATE, [samplerate >= 0.0.15],
595         [libsamplerate resampling], [libsamplerate not found])
596 if test x$enable_lsr = xyes; then
597         AC_DEFINE([HAVE_LIBSAMPLERATE], 1,
598                 [Define to enable libsamplerate])
601 if test x$enable_lsr = xyes; then
602         PKG_CHECK_MODULES([SAMPLERATE_013],
603                 [samplerate >= 0.1.3],,
604                 [AC_DEFINE([HAVE_LIBSAMPLERATE_NOINT], 1,
605                 [libsamplerate doesn't provide src_int_to_float_array() (<0.1.3)])])
608 AM_CONDITIONAL(HAVE_LIBSAMPLERATE, test x$enable_lsr = xyes)
610 dnl ---------------------------------------------------------------------------
611 dnl Input Plugins
612 dnl ---------------------------------------------------------------------------
614 dnl ----------------------------------- CURL ----------------------------------
615 MPD_AUTO_PKG(curl, CURL, [libcurl],
616         [libcurl HTTP streaming], [libcurl not found])
617 if test x$enable_curl = xyes; then
618         AC_DEFINE(ENABLE_CURL, 1, [Define when libcurl is used for HTTP streaming])
620 AM_CONDITIONAL(ENABLE_CURL, test x$enable_curl = xyes)
622 dnl --------------------------------- Last.FM ---------------------------------
623 if test x$enable_lastfm = xyes; then
624         if test x$enable_curl != xyes; then
625                 AC_MSG_ERROR([Cannot enable last.fm radio without curl])
626         fi
628         AC_DEFINE(ENABLE_LASTFM, 1, [Define when last.fm radio is enabled])
630 AM_CONDITIONAL(ENABLE_LASTFM, test x$enable_lastfm = xyes)
632 dnl ---------------------------------- libogg ---------------------------------
633 PKG_CHECK_MODULES(OGG, [ogg], enable_ogg=yes, enable_ogg=no)
635 dnl ---------------------------------- libmms ---------------------------------
636 MPD_AUTO_PKG(mms, MMS, [libmms >= 0.4],
637         [libmms mms:// protocol support], [libmms not found])
638 if test x$enable_mms = xyes; then
639         AC_DEFINE(ENABLE_MMS, 1,
640                 [Define when libmms is used for the MMS protocol])
642 AM_CONDITIONAL(ENABLE_MMS, test x$enable_mms = xyes)
644 dnl ---------------------------------------------------------------------------
645 dnl Archive Plugins
646 dnl ---------------------------------------------------------------------------
648 dnl --------------------------------- iso9660 ---------------------------------
649 MPD_AUTO_PKG(iso9660, ISO9660, [libiso9660],
650         [libiso9660 archive library], [libiso9660 not found])
652 AM_CONDITIONAL(HAVE_ISO9660, test x$enable_iso9660 = xyes)
653 if test x$enable_iso9660 = xyes; then
654         AC_DEFINE(HAVE_ISO9660, 1, [Define to have ISO9660 archive support])
656         AC_PATH_PROG(MKISOFS, mkisofs, no)
657 else
658         MKISOFS="no"
661 AM_CONDITIONAL(ENABLE_ISO9660_TEST, test x$MKISOFS != xno)
663 dnl ---------------------------------- libbz2 ---------------------------------
664 if test x$enable_bzip2 = xyes; then
665         AC_CHECK_LIB(bz2, BZ2_bzDecompressInit,
666                 [MPD_LIBS="$MPD_LIBS -lbz2"],
667                 [AC_MSG_ERROR([libbz2 not found])])
670 AM_CONDITIONAL(HAVE_BZ2, test x$enable_bzip2 = xyes)
671 if test x$enable_bzip2 = xyes; then
672         AC_DEFINE(HAVE_BZ2, 1, [Define to have bz2 archive support])
674         AC_PATH_PROG(BZIP2, bzip2, no)
675 else
676         BZIP2="no"
679 AM_CONDITIONAL(ENABLE_BZIP2_TEST, test x$BZIP2 != xno)
681 dnl --------------------------------- libzzip ---------------------------------
682 MPD_AUTO_PKG(zzip, ZZIP, [zziplib >= 0.13],
683         [libzzip archive library], [libzzip not found])
685 AM_CONDITIONAL(HAVE_ZZIP, test x$enable_zzip = xyes)
686 if test x$enable_zzip = xyes; then
687         AC_DEFINE(HAVE_ZZIP, 1, [Define to have zip archive support])
689         AC_PATH_PROG(ZIP, zip, no)
690 else
691         ZIP="no"
694 AM_CONDITIONAL(ENABLE_ZZIP_TEST, test x$ZIP != xno)
696 dnl ------------------------------- Archive API -------------------------------
698         test x$enable_bzip2 = xyes ||
699         test x$enable_zzip = xyes ||
700         test x$enable_iso9660 = xyes; then
701                 enable_archive=yes
702                 AC_DEFINE(ENABLE_ARCHIVE, 1, [The archive API is available])
703 else
704         enable_archive=no
707 AM_CONDITIONAL(ENABLE_ARCHIVE, test x$enable_archive = xyes)
709 dnl ---------------------------------------------------------------------------
710 dnl Decoder Plugins
711 dnl ---------------------------------------------------------------------------
713 dnl -------------------------------- audiofile --------------------------------
714 MPD_AUTO_PKG(audiofile, AUDIOFILE, [audiofile >= 0.1.7],
715         [audiofile decoder plugin], [libaudiofile not found])
716 AM_CONDITIONAL(HAVE_AUDIOFILE, test x$enable_audiofile = xyes)
717 if test x$enable_audiofile = xyes; then
718         AC_DEFINE(HAVE_AUDIOFILE, 1, [Define for audiofile support])
721 dnl ----------------------------------- FAAD ----------------------------------
722 AM_PATH_FAAD()
724 AM_CONDITIONAL(HAVE_FAAD, test x$enable_aac = xyes)
725 AM_CONDITIONAL(HAVE_MP4, test x$enable_mp4 = xyes)
727 dnl ---------------------------------- ffmpeg ---------------------------------
728 MPD_AUTO_PKG(ffmpeg, FFMPEG, [libavformat libavcodec libavutil],
729         [ffmpeg decoder library], [libavformat+libavcodec+libavutil not found])
731 if test x$enable_ffmpeg = xyes; then
732         old_LIBS=$LIBS
733         LIBS="$LIBS $FFMPEG_LIBS"
734         AC_CHECK_LIB(avcodec, avcodec_decode_audio2,,
735                 enable_ffmpeg=no)
736         LIBS=$old_LIBS
739 if test x$enable_ffmpeg = xyes; then
740         # prior to ffmpeg svn12865, you had to specify include files
741         # without path prefix
742         old_CPPCFLAGS=$CPPFLAGS
743         CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS"
744         AC_CHECK_HEADER(libavcodec/avcodec.h,,
745                 AC_DEFINE(OLD_FFMPEG_INCLUDES, 1,
746                         [Define if avcodec.h instead of libavcodec/avcodec.h should be included]))
747         CPPCFLAGS=$old_CPPFLAGS
750 if test x$enable_ffmpeg = xyes; then
751         AC_DEFINE(HAVE_FFMPEG, 1, [Define for FFMPEG support])
754 AM_CONDITIONAL(HAVE_FFMPEG, test x$enable_ffmpeg = xyes)
756 dnl ----------------------------------- FLAC ----------------------------------
757 if test x$enable_flac = xyes; then
758         PKG_CHECK_MODULES(FLAC, [flac >= 1.1],
759                 AC_DEFINE(HAVE_FLAC, 1, [Define for FLAC support]),
760                 enable_flac=no)
762         oldcflags="$CFLAGS"
763         oldlibs="$LIBS"
764         CFLAGS="$CFLAGS $FLAC_CFLAGS"
765         LIBS="$LIBS $FLAC_LIBS"
766         if test x$enable_flac = xyes && test x$enable_oggflac = xyes; then
767                 AC_CHECK_DECL(FLAC_API_SUPPORTS_OGG_FLAC,
768                         [enable_oggflac=flac], [],
769                         [#include <FLAC/export.h>])
770         fi
771         CFLAGS="$oldcflags"
772         LIBS="$oldlibs"
774         if test x$enable_oggflac = xflac; then
775                 if test x$enable_ogg = xyes; then
776                         FLAC_LIBS="${FLAC_LIBS} -logg"
777                 else
778                         enable_oggflac=yes
779                         AC_MSG_WARN("FLAC has the ogg API built in, but couldn't find ogg. Disabling oggflac.")
780                 fi
781         fi
784 AM_CONDITIONAL(HAVE_FLAC, test x$enable_flac = xyes)
786 enable_flac_encoder=$enable_flac
788 dnl -------------------------------- FluidSynth -------------------------------
789 if test x$enable_fluidsynth = xyes; then
790         PKG_CHECK_MODULES(FLUIDSYNTH, [fluidsynth],
791                 AC_DEFINE(ENABLE_FLUIDSYNTH, 1, [Define for fluidsynth support]),
792                 enable_fluidsynth=no)
795 AM_CONDITIONAL(ENABLE_FLUIDSYNTH, test x$enable_fluidsynth = xyes)
797 dnl ---------------------------------- libgme ---------------------------------
798 MPD_AUTO_PKG(gme, GME, [libgme],
799         [gme decoder plugin], [libgme not found])
800 AM_CONDITIONAL(HAVE_GME, test x$enable_gme = xyes)
801 if test x$enable_gme = xyes; then
802         AC_DEFINE(HAVE_GME, 1, [Define for gme support])
805 dnl ---------------------------------- libmad ---------------------------------
806 MPD_AUTO_PKG(mad, MAD, [mad],
807         [libmad MP3 decoder plugin], [libmad not found])
808 if test x$enable_mad = xyes; then
809         AC_DEFINE(HAVE_MAD, 1, [Define to use libmad])
811 AM_CONDITIONAL(HAVE_MAD, test x$enable_mad = xyes)
813 enable_shout2="$enable_shout"
814 MPD_AUTO_PKG(shout, SHOUT, [shout],
815         [shout output plugin], [libshout not found])
816 if test x$enable_shout = xyes && test x$enable_shout2 = xauto; then
817         enable_shout=auto
820 dnl -------------------------------- libmpg123 --------------------------------
821 MPD_AUTO_PKG(mpg123, MPG123, [libmpg123],
822         [libmpg123 decoder plugin], [libmpg123 not found])
823 if test x$enable_mpg123 = xyes; then
824         AC_DEFINE(HAVE_MPG123, 1, [Define to use libmpg123])
826 AM_CONDITIONAL(HAVE_MPG123, test x$enable_mpg123 = xyes)
828 dnl -------------------------------- libmikmod --------------------------------
829 if test x$enable_mikmod = xyes; then
830         AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config)
831         if test x$LIBMIKMOD_CONFIG != x ; then
832                 AC_SUBST(LIBMIKMOD_CFLAGS, `$LIBMIKMOD_CONFIG --cflags`)
833                 AC_SUBST(LIBMIKMOD_LIBS, `$LIBMIKMOD_CONFIG --libs`)
834                 AC_DEFINE(ENABLE_MIKMOD_DECODER, 1, [Define for mikmod support])
835         else
836                 enable_mikmod=no
837         fi
840 AM_CONDITIONAL(ENABLE_MIKMOD_DECODER, test x$enable_mikmod = xyes)
842 dnl -------------------------------- libmodplug -------------------------------
843 found_modplug=$HAVE_CXX
844 MPD_AUTO_PRE(modplug, [modplug decoder plugin], [No C++ compiler found])
846 MPD_AUTO_PKG(modplug, MODPLUG, [libmodplug],
847         [modplug decoder plugin], [libmodplug not found])
849 if test x$enable_modplug = xyes; then
850         AC_DEFINE(HAVE_MODPLUG, 1, [Define for modplug support])
852 AM_CONDITIONAL(HAVE_MODPLUG, test x$enable_modplug = xyes)
854 dnl --------------------------- sndfile/modplug test --------------------------
855 if test x$enable_sndfile = xauto && test x$enable_modplug = xyes; then
856         dnl If modplug is enabled, enable sndfile only if explicitly
857         dnl requested - modplug's modplug/sndfile.h is known to
858         dnl conflict with libsndfile's sndfile.h.
859         AC_MSG_NOTICE([disabling libsndfile auto-detection, because the modplug decoder is enabled])
860         enable_sndfile=no
863 dnl -------------------------------- libsndfile -------------------------------
864 dnl See above test, which may disable this.
865 MPD_AUTO_PKG(sndfile, SNDFILE, [sndfile],
866         [libsndfile decoder plugin], [libsndfile not found])
868 if test x$enable_sndfile = xyes; then
869         AC_DEFINE(ENABLE_SNDFILE, 1, [Define to enable the sndfile decoder plugin])
871 AM_CONDITIONAL(ENABLE_SNDFILE, test x$enable_sndfile = xyes)
873 dnl --------------------------------- musepack --------------------------------
874 if test x$enable_mpc = xyes; then
875         if test "x$mpcdec_libraries" != "x" ; then
876                 MPCDEC_LIBS="-L$mpcdec_libraries"
877         elif test "x$mpcdec_prefix" != "x" ; then
878                 MPCDEC_LIBS="-L$mpcdec_prefix/lib"
879         fi
881         MPCDEC_LIBS="$MPCDEC_LIBS -lmpcdec"
883         if test "x$mpcdec_includes" != "x" ; then
884                 MPCDEC_CFLAGS="-I$mpcdec_includes"
885         elif test "x$mpcdec_prefix" != "x" ; then
886                 MPCDEC_CFLAGS="-I$mpcdec_prefix/include"
887         fi
889         oldcflags=$CFLAGS
890         oldlibs=$LIBS
891         oldcppflags=$CPPFLAGS
892         CFLAGS="$CFLAGS $MPD_CFLAGS $MPCDEC_CFLAGS -I."
893         LIBS="$LIBS $MPD_LIBS $MPCDEC_LIBS"
894         CPPFLAGS=$CFLAGS
895         AC_CHECK_HEADER(mpc/mpcdec.h,
896                 old_mpcdec=no,
897                 [AC_CHECK_HEADER(mpcdec/mpcdec.h,
898                         old_mpcdec=yes,
899                         enable_mpc=no)])
900         if test x$enable_mpc = xyes; then
901                 AC_CHECK_LIB(mpcdec,main,
902                         [MPD_LIBS="$MPD_LIBS $MPCDEC_LIBS";
903                         MPD_CFLAGS="$MPD_CFLAGS $MPCDEC_CFLAGS";],
904                         enable_mpc=no)
905         fi
906         if test x$enable_mpc = xyes; then
907                 AC_DEFINE(HAVE_MPCDEC,1,
908                         [Define to use libmpcdec for MPC decoding])
909                 if test x$old_mpcdec = xyes; then
910                         AC_DEFINE(MPC_IS_OLD_API, 1,
911                                 [Define if an old pre-SV8 libmpcdec is used])
912                 fi
913         else
914                 AC_MSG_WARN([mpcdec lib needed for MPC support -- disabling MPC support])
915         fi
916         CFLAGS=$oldcflags
917         LIBS=$oldlibs
918         CPPFLAGS=$oldcppflags
921 AM_CONDITIONAL(HAVE_MPCDEC, test x$enable_mpc = xyes)
923 dnl -------------------------------- Ogg Tremor -------------------------------
924 if test x$with_tremor = xyes || test x$with_tremor = xno; then
925         use_tremor="$with_tremor"
926 else
927         tremor_prefix="$with_tremor"
928         use_tremor=yes
931 if test x$use_tremor = xyes; then
932         if test "x$tremor_libraries" != "x" ; then
933                 TREMOR_LIBS="-L$tremor_libraries"
934         elif test "x$tremor_prefix" != "x" ; then
935                 TREMOR_LIBS="-L$tremor_prefix/lib"
936         fi
937         TREMOR_LIBS="$TREMOR_LIBS -lvorbisidec"
938         if test "x$tremor_includes" != "x" ; then
939                 TREMOR_CFLAGS="-I$tremor_includes"
940         elif test "x$tremor_prefix" != "x" ; then
941                 TREMOR_CFLAGS="-I$tremor_prefix/include"
942         fi
943         ac_save_CFLAGS="$CFLAGS"
944         ac_save_LIBS="$LIBS"
945         CFLAGS="$CFLAGS $TREMOR_CFLAGS"
946         LIBS="$LIBS $TREMOR_LIBS"
947         AC_CHECK_LIB(vorbisidec,ov_read,enable_vorbis=yes,enable_vorbis=no;
948                 AC_MSG_WARN([vorbisidec lib needed for ogg support with tremor -- disabling ogg support]))
949         CFLAGS="$ac_save_CFLAGS"
950         LIBS="$ac_save_LIBS"
952         AC_DEFINE(HAVE_TREMOR,1,
953                 [Define to use tremor (libvorbisidec) for ogg support])
956 AC_SUBST(TREMOR_CFLAGS)
957 AC_SUBST(TREMOR_LIBS)
959 dnl --------------------------------- OggFLAC ---------------------------------
960 dnl OggFLAC must go after Ogg Tremor
962 if test x$use_tremor = xyes && test $xenable_oggflac = xyes; then
963         AC_MSG_WARN([disabling OggFLAC support because it is incompatible with tremor])
964                 enable_oggflac=no
967 if test x$enable_oggflac = xyes; then
968         AC_CHECK_HEADER([OggFLAC/stream_decoder.h],, enable_oggflac=no)
971 if test x$enable_oggflac = xyes; then
972         AC_DEFINE(HAVE_OGGFLAC,1,[Define for OggFLAC support])
973         MPD_LIBS="$MPD_LIBS -lOggFLAC -lFLAC -lm"
976 AM_CONDITIONAL(HAVE_OGGFLAC, test x$enable_oggflac = xyes)
978 dnl -------------------------------- Ogg Vorbis -------------------------------
979 if test x$enable_tremor != xno && test x$enable_vorbis = xyes; then
980         if test x$enable_ogg = xyes; then
981                 PKG_CHECK_MODULES(VORBIS, [vorbis vorbisfile],
982                         AC_DEFINE(ENABLE_VORBIS_DECODER, 1, [Define for Ogg Vorbis support]),
983                         enable_vorbis=no)
984         else
985                 AC_MSG_WARN(["Ogg not detected, could not enable Vorbis."])
986                 enable_vorbis=no
987         fi
990 AM_CONDITIONAL(ENABLE_VORBIS_DECODER, test x$enable_vorbis = xyes)
992 dnl --------------------------------- sidplay ---------------------------------
993 found_sidplay=$HAVE_CXX
994 MPD_AUTO_PRE(sidplay, [sidplay decoder plugin], [No C++ compiler found])
996 if test x$enable_sidplay != xno; then
997         # we're not using pkg-config here
998         # because libsidplay2's .pc file requires libtool
999         AC_HAVE_LIBRARY(sidplay2, [found_sidplay=yes], [found_sidplay=no])
1000         MPD_AUTO_PRE(sidplay, [sidplay decoder plugin],
1001                 [libsidplay2 not found])
1004 if test x$enable_sidplay != xno; then
1005         # can't use AC_HAVE_LIBRARY here, because the dash in the
1006         # library name triggers an autoconf bug
1007         AC_CHECK_LIB(resid-builder, main,
1008                 [found_sidplay=yes], [found_sidplay=no])
1010         if test x$found_sidplay = xyes; then
1011                 AC_HAVE_LIBRARY(sidutils,, [found_sidplay=no])
1012         fi
1014         MPD_AUTO_RESULT(sidplay, [sidplay decoder plugin],
1015                 [libresid-builder or libsidutils not found])
1018 if test x$enable_sidplay = xyes; then
1019         AC_SUBST(SIDPLAY_LIBS,"-lsidplay2 -lresid-builder -lsidutils")
1020         AC_SUBST(SIDPLAY_CFLAGS,)
1022         AC_DEFINE(ENABLE_SIDPLAY, 1, [Define for libsidplay2 support])
1025 AM_CONDITIONAL(ENABLE_SIDPLAY, test x$enable_sidplay = xyes)
1027 dnl --------------------------------- wavpack ---------------------------------
1028 MPD_AUTO_PKG(wavpack, WAVPACK, [wavpack],
1029         [WavPack decoder plugin], [libwavpack not found])
1030 AM_CONDITIONAL(HAVE_WAVPACK, test x$enable_wavpack = xyes)
1031 if test x$enable_wavpack = xyes; then
1032         AC_DEFINE([HAVE_WAVPACK], 1, [Define to enable WavPack support])
1035 dnl --------------------------------- WildMidi --------------------------------
1036 if test x$enable_wildmidi = xyes; then
1037         oldcflags=$CFLAGS
1038         oldlibs=$LIBS
1039         oldcppflags=$CPPFLAGS
1041         AC_CHECK_LIB(WildMidi, WildMidi_Init,,
1042                 AC_MSG_ERROR([libwildmidi not found]))
1044         CFLAGS=$oldcflags
1045         LIBS=$oldlibs
1046         CPPFLAGS=$oldcppflags
1048         AC_SUBST(WILDMIDI_LIBS,-lWildMidi)
1049         AC_SUBST(WILDMIDI_CFLAGS,)
1051         AC_DEFINE(ENABLE_WILDMIDI, 1, [Define for wildmidi support])
1054 AM_CONDITIONAL(ENABLE_WILDMIDI, test x$enable_wildmidi = xyes)
1056 dnl ------------------------ Post Decoder Plugins Tests -----------------------
1059         test x$enable_aac = xno &&
1060         test x$enable_audiofile = xno &&
1061         test x$enable_ffmpeg = xno &&
1062         test x$enable_flac = xno &&
1063         test x$enable_fluidsynth = xno &&
1064         test x$enable_mad = xno &&
1065         test x$enable_mikmod = xno; then
1066         test x$enable_modplug = xno &&
1067         test x$enable_mp4 = xno &&
1068         test x$enable_mpc = xno &&
1069         test x$enable_mpg123 = xno &&
1070         test x$enable_oggflac = xno &&
1071         test x$enable_sidplay = xno &&
1072         test x$enable_vorbis = xno &&
1073         test x$enable_wavpack = xno &&
1074         test x$enable_wildmidi = xno &&
1076                 AC_MSG_ERROR([No input plugins supported!])
1079 AM_CONDITIONAL(HAVE_OGG_COMMON,
1080           test x$enable_vorbis = xyes || test x$enable_oggflac = xyes || test x$enable_flac = xyes)
1082 AM_CONDITIONAL(HAVE_FLAC_COMMON,
1083           test x$enable_flac = xyes || test x$enable_oggflac = xyes)
1085 dnl ---------------------------------------------------------------------------
1086 dnl Encoders for Streaming Audio Output Plugins
1087 dnl ---------------------------------------------------------------------------
1089 dnl ------------------------------- Encoder API -------------------------------
1090 if test x$enable_shout = xyes || \
1091         test x$enable_recorder_output = xyes || \
1092         test x$enable_httpd_output = xyes; then
1093         # at least one output using encoders is explicitly enabled
1094         need_encoder=yes
1095 elif test x$enable_shout = xauto || \
1096         test x$enable_recorder_output = xauto || \
1097         test x$enable_httpd_output = xauto; then
1098         need_encoder=auto
1099 else
1100         # all outputs using encoders are disabled
1101         need_encoder=no
1103         # don't bother to check for encoder plugins
1104         enable_vorbis_encoder=no
1105         enable_lame_encoder=no
1106         enable_twolame_encoder=no
1107         enable_wave_encoder=no
1108         enable_flac_encoder=no
1111 dnl ------------------------------- FLAC Encoder ------------------------------
1112 if test x$enable_flac_encoder = xyes; then
1113         AC_DEFINE(ENABLE_FLAC_ENCODER, 1,
1114                 [Define to enable the FLAC encoder plugin])
1116 AM_CONDITIONAL(ENABLE_FLAC_ENCODER, test x$enable_flac_encoder = xyes)
1118 dnl ---------------------------- Ogg Vorbis Encoder ---------------------------
1119 MPD_AUTO_PKG(vorbis_encoder, VORBISENC, [vorbisenc],
1120         [Ogg Vorbis encoder], [libvorbisenc not found])
1122 if test x$enable_vorbis_encoder = xyes; then
1123         AC_DEFINE(ENABLE_VORBIS_ENCODER, 1,
1124                 [Define to enable the vorbis encoder plugin])
1126 AM_CONDITIONAL(ENABLE_VORBIS_ENCODER, test x$enable_vorbis_encoder = xyes)
1128 dnl ------------------------------- LAME Encoder ------------------------------
1129 if test x$enable_lame_encoder != xno; then
1130         AC_CHECK_HEADERS(lame/lame.h,,
1131                 [AC_CHECK_HEADERS(lame.h,, using_lame=no)])
1132         AC_CHECK_LIB(mp3lame, lame_init,, using_lame=no)
1133         if test x$using_lame != xno; then
1134                 AC_DEFINE(HAVE_LAME, 1, [Define to 1 if you have lame 3.98 or greater.])
1135                 LAME_LIBS="-lmp3lame -lm"
1136                 enable_lame_encoder=yes
1137         fi
1139         if test "$enable_lame_encoder" = "yes" -a "$using_lame" = "no"; then
1140                 AC_MSG_ERROR([LAME libraries and development support files not found.])
1141         fi
1144 AC_SUBST(LAME_LIBS)
1146 if test x$enable_lame_encoder = xyes; then
1147         AC_DEFINE(ENABLE_LAME_ENCODER, 1,
1148                 [Define to enable the lame encoder plugin])
1150 AM_CONDITIONAL(ENABLE_LAME_ENCODER, test x$enable_lame_encoder = xyes)
1152 dnl ----------------------------- TwoLAME Encoder -----------------------------
1153 MPD_AUTO_PKG(twolame_encoder, TWOLAME, [twolame],
1154         [TwoLAME encoder], [libtwolame not found])
1156 if test x$enable_twolame_encoder = xyes; then
1157         AC_DEFINE(ENABLE_TWOLAME_ENCODER, 1,
1158                 [Define to enable the TwoLAME encoder plugin])
1160 AM_CONDITIONAL(ENABLE_TWOLAME_ENCODER, test x$enable_twolame_encoder = xyes)
1162 dnl ------------------------------- WAVE Encoder ------------------------------
1163 AM_CONDITIONAL(ENABLE_WAVE_ENCODER, test x$enable_wave_encoder = xyes)
1164 if test x$enable_wave_encoder = xyes; then
1165         AC_DEFINE(ENABLE_WAVE_ENCODER, 1,
1166                 [Define to enable the PCM wave encoder plugin])
1169 dnl --------------------------- encoder plugins test --------------------------
1170 if test x$enable_vorbis_encoder != xno ||
1171         test x$enable_lame_encoder != xno ||
1172         test x$enable_twolame_encoder != xno ||
1173         test x$enable_flac_encoder != xno ||
1174         test x$enable_wave_encoder != xno; then
1175         # at least one encoder plugin is enabled
1176         enable_encoder=yes
1177 else
1178         # no encoder plugin is enabled: disable the whole encoder API
1179         enable_encoder=no
1181         if test x$need_encoder = xyes; then
1182                 AC_MSG_ERROR([No encoder plugin found])
1183         fi
1186 if test x$enable_encoder = xyes; then
1187         AC_DEFINE(ENABLE_ENCODER, 1,
1188                 [Define to enable the encoder plugins])
1190 AM_CONDITIONAL(ENABLE_ENCODER, test x$enable_encoder = xyes)
1192 dnl ---------------------------------------------------------------------------
1193 dnl Audio Output Plugins
1194 dnl ---------------------------------------------------------------------------
1196 dnl ----------------------------------- ALSA ----------------------------------
1197 MPD_AUTO_PKG(alsa, ALSA, [alsa >= 0.9.0],
1198         [ALSA output plugin], [libasound not found])
1200 if test x$enable_alsa = xyes; then
1201         AC_DEFINE(HAVE_ALSA, 1, [Define to enable ALSA support])
1204 AM_CONDITIONAL(HAVE_ALSA, test x$enable_alsa = xyes)
1206 dnl ----------------------------------- FIFO ----------------------------------
1207 if test x$enable_fifo = xyes; then
1208         AC_CHECK_FUNC([mkfifo],
1209                 [enable_fifo=yes;AC_DEFINE([HAVE_FIFO], 1,
1210                         [Define to enable support for writing audio to a FIFO])],
1211                 [enable_fifo=no;AC_MSG_WARN([mkfifo not found -- disabling support for writing audio to a FIFO])])
1214 AM_CONDITIONAL(HAVE_FIFO, test x$enable_fifo = xyes)
1216 dnl ------------------------------- HTTPD Output ------------------------------
1217 if test x$enable_httpd_output = xauto; then
1218         # handle HTTPD auto-detection: disable if no encoder is
1219         # available
1220         if test x$enable_encoder = xyes; then
1221                 enable_httpd_output=yes
1222         else
1223                 AC_MSG_WARN([No encoder plugin -- disabling the HTTP output plugin])
1224                 enable_httpd_output=no
1225         fi
1228 if test x$enable_httpd_output = xyes; then
1229         AC_DEFINE(ENABLE_HTTPD_OUTPUT, 1, [Define to enable the HTTP server output])
1231 AM_CONDITIONAL(ENABLE_HTTPD_OUTPUT, test x$enable_httpd_output = xyes)
1233 dnl ----------------------------------- JACK ----------------------------------
1234 MPD_AUTO_PKG(jack, JACK, [jack >= 0.100],
1235         [JACK output plugin], [libjack not found])
1236 if test x$enable_jack = xyes; then
1237         AC_DEFINE([HAVE_JACK], 1, [Define to enable JACK support])
1240 if test x$enable_jack = xyes; then
1241         # check whether jack_set_info_function() is available
1242         old_LIBS=$LIBS
1243         LIBS="$LIBS $JACK_LIBS"
1245         AC_CHECK_FUNCS(jack_set_info_function)
1247         LIBS=$old_LIBS
1250 AM_CONDITIONAL(HAVE_JACK, test x$enable_jack = xyes)
1252 dnl ---------------------------------- libao ----------------------------------
1253 MPD_AUTO_PKG(ao, AO, [ao],
1254         [libao output plugin], [libao not found])
1255 if test x$enable_ao = xyes; then
1256         AC_DEFINE(HAVE_AO, 1, [Define to play with ao])
1259 AM_CONDITIONAL(HAVE_AO, test x$enable_ao = xyes)
1261 dnl ----------------------------------- MVP -----------------------------------
1262 if test x$enable_mvp = xyes; then
1263    AC_DEFINE(HAVE_MVP,1,[Define to enable Hauppauge Media MVP support])
1266 AM_CONDITIONAL(HAVE_MVP, test x$enable_mvp = xyes)
1268 dnl ---------------------------------- OpenAL ---------------------------------
1269 AC_SUBST(OPENAL_CFLAGS,"")
1270 AC_SUBST(OPENAL_LIBS,"")
1272 if test x$enable_openal = xyes; then
1273         if test x$enable_osx = xyes; then
1274                 AC_CHECK_HEADERS([OpenAL/al.h OpenAL/alc.h], [], [enable_openal=no])
1275                 if test x$enable_openal = xyes; then
1276                         OPENAL_LIBS="-framework OpenAL"
1277                         AC_DEFINE(HAVE_OPENAL, 1, [Define for OpenAL support])
1278                 else
1279                         AC_MSG_WARN(OpenAL headers not found -- disabling OpenAL support)
1280                 fi
1281         else
1282                 PKG_CHECK_MODULES([OPENAL], [openal],
1283                         AC_DEFINE(HAVE_OPENAL, 1, [Define for OpenAL support]),
1284                         enable_openal=no)
1285         fi
1288 AM_CONDITIONAL(HAVE_OPENAL, test x$enable_openal = xyes)
1290 dnl ---------------------------- Open Sound System ----------------------------
1291 if test x$enable_oss = xyes; then
1292         AC_CHECK_HEADER(sys/soundcard.h,
1293                 [enable_oss=yes;AC_DEFINE(HAVE_OSS,1,[Define to enable OSS])],
1294                 [AC_MSG_WARN(Soundcard headers not found -- disabling OSS support);
1295                         enable_oss=no])
1298 AM_CONDITIONAL(HAVE_OSS, test x$enable_oss = xyes)
1300 dnl ----------------------------------- OSX -----------------------------------
1301 enable_osx=no
1302 case "$host_os" in
1303         darwin*)
1304                 AC_DEFINE(HAVE_OSX, 1, [Define for compiling OS X support])
1305                 MPD_LIBS="$MPD_LIBS -framework AudioUnit -framework CoreServices"
1306                 enable_osx=yes ;;
1307 esac
1309 AM_CONDITIONAL(HAVE_OSX, test x$enable_osx = xyes)
1311 dnl ------------------------------- Pipe Output -------------------------------
1312 if test x$enable_pipe_output = xyes; then
1313         AC_DEFINE([ENABLE_PIPE_OUTPUT], 1,
1314                 [Define to enable support for writing audio to a pipe])
1316 AM_CONDITIONAL(ENABLE_PIPE_OUTPUT, test x$enable_pipe_output = xyes)
1318 dnl -------------------------------- PulseAudio -------------------------------
1319 MPD_AUTO_PKG(pulse, PULSE, [libpulse],
1320         [PulseAudio output plugin], [libpulse not found])
1321 if test x$enable_pulse = xyes; then
1322         AC_DEFINE([HAVE_PULSE], 1,
1323                 [Define to enable PulseAudio support])
1326 AM_CONDITIONAL(HAVE_PULSE, test x$enable_pulse = xyes)
1328 dnl --------------------------------- Recorder --------------------------------
1329 if test x$enable_recorder_output = xauto; then
1330         # handle recorder auto-detection: disable if no encoder is
1331         # available
1332         if test x$enable_encoder = xyes; then
1333                 enable_recorder_output=yes
1334         else
1335                 AC_MSG_WARN([No encoder plugin -- disabling the recorder output plugin])
1336                 enable_recorder_output=no
1337         fi
1340 if test x$enable_recorder_output = xyes; then
1341         AC_DEFINE(ENABLE_RECORDER_OUTPUT, 1, [Define to enable the recorder output])
1343 AM_CONDITIONAL(ENABLE_RECORDER_OUTPUT, test x$enable_recorder_output = xyes)
1345 dnl -------------------------------- SHOUTcast --------------------------------
1346 if test x$enable_shout = xauto; then
1347         # handle shout auto-detection: disable if no encoder is
1348         # available
1349         if test x$enable_encoder = xyes; then
1350                 enable_shout=yes
1351         else
1352                 AC_MSG_WARN([No encoder plugin -- disabling the shout output plugin])
1353                 enable_shout=no
1354         fi
1357 if test x$enable_shout = xyes; then
1358         AC_DEFINE(HAVE_SHOUT, 1, [Define to enable the shoutcast output])
1360 AM_CONDITIONAL(HAVE_SHOUT, test x$enable_shout = xyes)
1362 dnl --------------------------------- Solaris ---------------------------------
1363 case "$host_os" in
1364         solaris*)
1365                 AC_DEFINE(ENABLE_SOLARIS_OUTPUT, 1, [Define to enable Solaris /dev/audio support])
1366                 enable_solaris_output=yes
1367                 ;;
1369         *)
1370                 enable_solaris_output=no
1371                 ;;
1372 esac
1374 AM_CONDITIONAL(ENABLE_SOLARIS_OUTPUT, test x$enable_solaris_output = xyes)
1376 dnl --------------------------------- Solaris ---------------------------------
1378 case "$host_os" in
1379         mingw32* | windows*)
1380                 AC_DEFINE(ENABLE_WIN32_OUTPUT, 1, [Define to enable WIN32 wave support])
1381                 enable_win32_output=yes
1382                 MPD_LIBS="$MPD_LIBS -lwinmm"
1383                 ;;
1385         *)
1386                 enable_win32_output=no
1387                 ;;
1388 esac
1390 AM_CONDITIONAL(ENABLE_WIN32_OUTPUT, test x$enable_win32_output = xyes)
1392 dnl --------------------- Post Audio Output Plugins Tests ---------------------
1394         test x$enable_alsa = xno &&
1395         test x$enable_ao = xno &&
1396         test x$enable_fifo = xno &&
1397         test x$enable_httpd_output = xno &&
1398         test x$enable_jack = xno &&
1399         test x$enable_mvp = xno; then
1400         test x$enable_openal = xno &&
1401         test x$enable_oss = xno &&
1402         test x$enable_osx = xno &&
1403         test x$enable_pipe_output = xno &&
1404         test x$enable_pulse = xno &&
1405         test x$enable_recorder_output = xno &&
1406         test x$enable_shout = xno &&
1407         test x$enable_solaris_output = xno &&
1408         test x$enable_win32_output = xno &&
1410                 AC_MSG_ERROR([No Audio Output types configured!])
1413 dnl ---------------------------------------------------------------------------
1414 dnl Documentation
1415 dnl ---------------------------------------------------------------------------
1416 if test x$enable_documentation = xyes; then
1417         AC_PATH_PROG(XMLTO, xmlto)
1418         AC_SUBST(XMLTO)
1419         AM_CONDITIONAL(HAVE_XMLTO, test x$XMLTO != x)
1421         AC_PATH_PROG(DOXYGEN, doxygen)
1422         if test x$DOXYGEN = x; then
1423                 AC_MSG_ERROR([doxygen not found])
1424         fi
1426         AC_SUBST(DOXYGEN)
1427 else
1428         AM_CONDITIONAL(HAVE_XMLTO, false)
1431 AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)
1433 dnl ---------------------------------------------------------------------------
1434 dnl test suite
1435 dnl ---------------------------------------------------------------------------
1436 AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes)
1438 dnl ---------------------------------------------------------------------------
1439 dnl CFLAGS
1440 dnl ---------------------------------------------------------------------------
1442 dnl ---------------------------------- debug ----------------------------------
1443 #if test "x$enable_debug" = xno; then
1444         # don't set NDEBUG for now, until MPD is stable
1445         #AM_CFLAGS="$AM_CFLAGS -DNDEBUG"
1448 dnl ----------------------------------- GCC -----------------------------------
1449 if test x$GCC = xyes
1450 then
1451         MPD_CHECK_FLAG([-Wall])
1452         MPD_CHECK_FLAG([-Wextra])
1453         MPD_CHECK_FLAG([-Wno-deprecated-declarations])
1454         MPD_CHECK_FLAG([-Wmissing-prototypes])
1455         MPD_CHECK_FLAG([-Wshadow])
1456         MPD_CHECK_FLAG([-Wpointer-arith])
1457         MPD_CHECK_FLAG([-Wstrict-prototypes])
1458         MPD_CHECK_FLAG([-Wcast-qual])
1459         MPD_CHECK_FLAG([-Wwrite-strings])
1460         MPD_CHECK_FLAG([-pedantic])
1463 dnl ------------------------------ gprof profiler -----------------------------
1464 if test "x$enable_gprof" = xyes; then
1465         MPD_CFLAGS="$MPD_CFLAGS -pg"
1466         MPD_LIBS="$MPD_LIBS -pg"
1469 dnl ---------------------------- warnings as errors ---------------------------
1470 if test "x$enable_werror" = xyes; then
1471         AM_CFLAGS="$AM_CFLAGS -Werror -pedantic-errors"
1474 dnl ---------------------------------------------------------------------------
1475 dnl Pretty-Print Results
1476 dnl ---------------------------------------------------------------------------
1477 echo ''
1478 echo '########### MPD CONFIGURATION ############'
1480 echo -ne '\nArchive support:\n\t'
1481 results(bzip2,[bzip2])
1482 results(iso9660,[ISO9660])
1483 results(zzip,[ZIP])
1485 if test x$with_zeroconf != xno; then
1486         echo -ne '\nAutodiscovery support:\n\t'
1487         results(avahi, [Avahi])
1488         results(bonjour, [Bonjour])
1491 echo -ne '\nClient support:\n\t'
1492 results(ipv6, "IPv6")
1493 results(tcp, "TCP")
1494 results(un,[UNIX Domain Sockets])
1496 echo -ne '\nFile format support:\n\t'
1497 results(aac, [AAC])
1498 results(sidplay, [C64 SID])
1499 results(ffmpeg, [FFMPEG])
1500 results(flac, [FLAC])
1501 results(fluidsynth, [FluidSynth])
1502 results(gme, [GME])
1503 results(sndfile, [libsndfile])
1504 echo -ne '\n\t'
1505 results(mikmod, [MikMod])
1506 results(modplug, [MODPLUG])
1507 results(mad, [MAD])
1508 results(mpg123, [MPG123])
1509 results(mp4, [MP4])
1510 results(mpc, [Musepack])
1511 results(oggflac, [OggFLAC], flac)
1512 echo -ne '\n\t'
1513 results(with_tremor, [OggTremor])
1514 results(vorbis, [OggVorbis])
1515 results(audiofile, [WAVE])
1516 results(wavpack, [WavPack])
1517 results(wildmidi, [WildMidi])
1519 echo -en '\nOther features:\n\t'
1520 results(lsr, [libsamplerate])
1521 results(inotify, [inotify])
1522 results(sqlite, [SQLite])
1524 echo -en '\nMetadata support:\n\t'
1525 results(cue,[cue])
1526 results(id3,[ID3])
1528 echo -en '\nPlayback support:\n\t'
1529 results(alsa,ALSA)
1530 results(fifo,FIFO)
1531 results(recorder_output,[File Recorder])
1532 results(httpd_output,[HTTP Daemon])
1533 results(jack,[JACK])
1534 results(ao,[libao])
1535 results(oss,[OSS])
1536 echo -ne '\n\t'
1537 results(openal,[OpenAL])
1538 results(osx, [OS X])
1539 results(pipe_output, [Pipeline])
1540 results(pulse, [PulseAudio])
1541 results(mvp, [Media MVP])
1542 results(shout, [SHOUTcast])
1543 echo -ne '\n\t'
1544 results(solaris, [Solaris])
1545 results(win32_output, [WIN32 wave])
1548         test x$enable_shout = xyes ||
1549         test x$enable_recorder = xyes ||
1550         test x$enable_httpd_output = xyes; then
1551                 echo -en '\nStreaming encoder support:\n\t'
1552                 results(flac_encoder, [FLAC])
1553                 results(lame_encoder, [LAME])
1554                 results(vorbis_encoder, [Ogg Vorbis])
1555                 results(twolame_encoder, [TwoLAME])
1556                 results(wave_encoder, [WAVE])
1559 echo -en '\nStreaming support:\n\t'
1560 results(curl,[CURL])
1561 results(lastfm,[Last.FM])
1562 results(mms,[MMS])
1564 echo -ne '\n\n##########################################\n\n'
1566 if test x$enable_sndfile = xyes && test x$enable_modplug = xyes; then
1567         AC_MSG_WARN([compilation may fail, because libmodplug conflicts with libsndfile])
1568         AC_MSG_WARN([libmodplug ships modplug/sndfile.h, which hides libsndfile's sndfile.h])
1571 echo -ne 'Generating files needed for compilation\n'
1573 dnl ---------------------------------------------------------------------------
1574 dnl Generate files
1575 dnl ---------------------------------------------------------------------------
1576 AC_OUTPUT(Makefile)
1578 echo 'MPD is ready for compilation, type "make" to begin.'