input/qobuz: implement InputPlugin::scan_tags()
[mpd-mirror.git] / configure.ac
blob325eaa77efa70e9047bfeec4a52435c254741778
1 AC_PREREQ(2.60)
3 AC_INIT(mpd, 0.21, musicpd-dev-team@lists.sourceforge.net)
5 VERSION_MAJOR=0
6 VERSION_MINOR=21
7 VERSION_REVISION=0
8 VERSION_EXTRA=0
10 AC_CONFIG_SRCDIR([src/Main.cxx])
11 AC_CONFIG_AUX_DIR(build)
12 AM_INIT_AUTOMAKE([foreign 1.11 dist-xz subdir-objects])
13 AM_SILENT_RULES
14 AC_CONFIG_HEADERS(config.h)
15 AC_CONFIG_MACRO_DIR([m4])
17 AC_DEFINE(PROTOCOL_VERSION, "0.21.0", [The MPD protocol version])
19 GIT_COMMIT=`GIT_DIR="$srcdir/.git" git describe --dirty --always 2>/dev/null`
20 if test x$GIT_COMMIT != x; then
21         AC_DEFINE_UNQUOTED(GIT_COMMIT, ["$GIT_COMMIT"], [The current git commit])
24 dnl ---------------------------------------------------------------------------
25 dnl Programs
26 dnl ---------------------------------------------------------------------------
27 AC_PROG_CC_C99
28 AC_PROG_CXX
29 AC_PROG_RANLIB
31 AN_MAKEVAR([AR], [AC_PROG_AR])
32 AN_PROGRAM([ar], [AC_PROG_AR])
33 AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
34 AC_PROG_AR
36 AC_PROG_INSTALL
37 AC_PROG_MAKE_SET
38 PKG_PROG_PKG_CONFIG
39 AC_ARG_WITH([systemdsystemunitdir],
40             AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
41             [], [with_systemdsystemunitdir=no])
42 if test "x$with_systemdsystemunitdir" = xyes; then
43         AC_MSG_CHECKING(for systemd)
44         with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
45         if test -z "$with_systemdsystemunitdir"; then
46                 AC_MSG_ERROR([Failed to detect systemd])
47         fi
48         AC_MSG_RESULT([$with_systemdsystemunitdir])
50 if test "x$with_systemdsystemunitdir" != xno; then
51         AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
53 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
55 AC_ARG_WITH([systemduserunitdir],
56             AS_HELP_STRING([--with-systemduserunitdir=DIR], [Directory for systemd service files]),
57             [], [with_systemduserunitdir=no])
58 if test "x$with_systemduserunitdir" = xyes; then
59         AC_MSG_CHECKING(for systemd)
60         with_systemduserunitdir=$($PKG_CONFIG --variable=systemduserunitdir systemd)
61         if test -z "$with_systemduserunitdir"; then
62                 AC_MSG_ERROR([Failed to detect systemd])
63         fi
64         AC_MSG_RESULT([$with_systemduserunitdir])
66 if test "x$with_systemduserunitdir" != xno; then
67         AC_SUBST([systemduserunitdir], [$with_systemduserunitdir])
69 AM_CONDITIONAL(HAVE_SYSTEMD_USER, [test -n "$with_systemduserunitdir" -a "x$with_systemduserunitdir" != xno ])
71 dnl ---------------------------------------------------------------------------
72 dnl Declare Variables
73 dnl ---------------------------------------------------------------------------
74 AC_SUBST(AM_CPPFLAGS,"")
75 AC_SUBST(AM_CFLAGS,"")
76 AC_SUBST(AM_CXXFLAGS,"")
78 ## Used for the windows resource file
79 AC_SUBST(VERSION_MAJOR)
80 AC_SUBST(VERSION_MINOR)
81 AC_SUBST(VERSION_REVISION)
82 AC_SUBST(VERSION_EXTRA)
84 dnl ---------------------------------------------------------------------------
85 dnl OS Specific Defaults
86 dnl ---------------------------------------------------------------------------
87 AC_CANONICAL_HOST
89 host_is_unix=yes
90 host_is_linux=no
91 host_is_android=no
92 host_is_darwin=no
93 host_is_solaris=no
94 host_is_windows=no
96 linux_auto=no
98 case "$host_os" in
99 linux-android*)
100         host_is_android=yes
101         host_is_linux=yes
102         linux_auto=auto
103         AM_CPPFLAGS="$AM_CPPFLAGS -DANDROID"
104         ;;
106 linux*)
107         host_is_linux=yes
108         linux_auto=auto
110         dnl allow using all glibc features
111         CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
112         ;;
114 mingw32* | windows*)
115         AC_CONFIG_FILES([
116                 win32/res/mpd.rc
117         ])
118         AC_CHECK_TOOL(WINDRES, windres)
119         AM_CPPFLAGS="$AM_CPPFLAGS -DWIN32_LEAN_AND_MEAN"
120         AM_CPPFLAGS="$AM_CPPFLAGS -DWINVER=0x0600 -D_WIN32_WINNT=0x0600"
121         AM_CPPFLAGS="$AM_CPPFLAGS -DSTRICT"
122         AM_CPPFLAGS="$AM_CPPFLAGS -DUNICODE -D_UNICODE"
123         LIBS="$LIBS -lws2_32"
124         host_is_windows=yes
125         host_is_unix=no
126         ;;
128 darwin*)
129         host_is_darwin=yes
130         ;;
132 solaris*)
133         host_is_solaris=yes
134         ;;
135 haiku*)
136         AC_CHECK_TOOL(RC, rc)
137         AC_CHECK_TOOL(XRES, xres)
138         ;;
139 esac
141 AM_CONDITIONAL([ANDROID], [test x$host_is_android = xyes])
142 AM_CONDITIONAL([HAVE_WINDOWS], [test x$host_is_windows = xyes])
144 if test -z "$prefix" || test "x$prefix" = xNONE; then
145         local_lib=
146         local_include=
148         # aren't autotools supposed to be smart enough to figure this out?  oh
149         # well, the git-core Makefile managed to do some of the work for us :)
150         case "$host_os" in
151         darwin*)
152                 local_lib='/sw/lib /opt/local/lib'
153                 local_include='/sw/include /opt/local/include'
154                 ;;
155         freebsd* | openbsd*)
156                 local_lib=/usr/local/lib
157                 local_include=/usr/local/include
158                 ;;
159         netbsd*)
160                 local_lib=/usr/pkg/lib
161                 local_include=/usr/pkg/include
162                 LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/pkg/lib"
163                 ;;
164         esac
166         for d in $local_lib; do
167                 if test -d "$d"; then
168                         LDFLAGS="$LDFLAGS -L$d"
169                         break
170                 fi
171         done
172         for d in $local_include; do
173                 if test -d "$d"; then
174                         CPPFLAGS="$CPPFLAGS -I$d"
175                         break
176                 fi
177         done
180 dnl ---------------------------------------------------------------------------
181 dnl Android
182 dnl ---------------------------------------------------------------------------
184 AC_ARG_WITH([android-sdk],
185         AS_HELP_STRING([--with-android-sdk=DIR],
186                 [Directory for Android SDK]),
187                 [], [with_android_sdk=no])
189 if test x$host_is_android = xyes; then
190         if test x$with_android_sdk = xno; then
191                 AC_MSG_ERROR([Android build requires option --with-android-sdk=DIR])
192         fi
194         if ! test -x $with_android_sdk/tools/android; then
195                 AC_MSG_ERROR([Android SDK not found in $with_android_sdk])
196         fi
199 AC_SUBST(ANDROID_SDK, [$with_android_sdk])
201 dnl ---------------------------------------------------------------------------
202 dnl Language Checks
203 dnl ---------------------------------------------------------------------------
205 AX_CXX_COMPILE_STDCXX_14([noext], [mandatory])
207 dnl ---------------------------------------------------------------------------
208 dnl Header/Library Checks
209 dnl ---------------------------------------------------------------------------
211 AX_PTHREAD
212 LIBS="$PTHREAD_LIBS $LIBS"
213 AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
214 AM_CXXFLAGS="$AM_CXXFLAGS $PTHREAD_CFLAGS"
216 MPD_WITH_LIBRARY([PTHREAD],
217         [AC_CHECK_FUNCS([pthread_setname_np])])
219 AC_SEARCH_LIBS([clock_gettime], [rt])
221 AC_ARG_ENABLE(syslog,
222         AS_HELP_STRING([--enable-syslog],
223                 [enable syslog support (default: auto)]),,
224         enable_syslog=auto)
225 MPD_AUTO(syslog, [syslog support], [syslog() not available],
226         [AC_SEARCH_LIBS([syslog], [bsd socket inet],
227                 [found_syslog=yes],
228                 [found_syslog=no])])
229 if test x$enable_syslog = xyes; then
230         AC_DEFINE(HAVE_SYSLOG, 1, [Define if syslog() is available])
233 AC_SEARCH_LIBS([socket], [network socket])
234 AC_SEARCH_LIBS([gethostbyname], [nsl])
236 if test x$host_is_linux = xyes; then
237         AC_CHECK_FUNCS(pipe2 accept4 linkat)
240 AC_CHECK_FUNCS(getpwnam_r getpwuid_r)
241 AC_CHECK_FUNCS(initgroups)
242 AC_CHECK_FUNCS(fnmatch)
243 AC_CHECK_FUNCS(strndup)
244 AC_CHECK_FUNCS(strcasestr)
246 AC_CHECK_MEMBERS([struct sockaddr_in.sin_len], [], [], [[#include <netinet/in.h>]])
248 if test x$host_is_linux = xyes; then
249         MPD_OPTIONAL_FUNC(eventfd, eventfd, USE_EVENTFD)
250         MPD_OPTIONAL_FUNC(signalfd, signalfd, USE_SIGNALFD)
253 AC_SEARCH_LIBS([exp], [m],,
254         [AC_MSG_ERROR([exp() not found])])
256 AC_CHECK_HEADERS(locale.h)
258 AC_CHECK_HEADERS([sys/prctl.h], AC_CHECK_FUNCS([prctl]))
260 dnl ---------------------------------------------------------------------------
261 dnl Event loop selection
262 dnl ---------------------------------------------------------------------------
264 MPD_OPTIONAL_FUNC_NODEF(poll, poll)
266 if test x$host_is_linux = xyes; then
267         MPD_OPTIONAL_FUNC_NODEF(epoll, epoll_create1)
270 AC_ARG_WITH(pollmethod,
271         AS_HELP_STRING(
272                 [--with-pollmethod=@<:@epoll|poll|winselect|auto@:>@],
273                 [specify poll method for internal event loop (default=auto)]),,
274         [with_pollmethod=auto])
276 if test "x$with_pollmethod" = xauto; then
277         if test "x$enable_epoll" = xyes; then
278                 with_pollmethod=epoll
279         elif test "x$enable_poll" = xyes; then
280                 with_pollmethod=poll
281         elif test "x$host_is_windows" = xyes; then
282                 with_pollmethod=winselect
283         else
284                 AC_MSG_ERROR([no poll method is available for your platform])
285         fi
287 case "$with_pollmethod" in
288 epoll)
289         AC_DEFINE(USE_EPOLL, 1, [Define to poll sockets with epoll])
290         ;;
291 poll)
292         AC_DEFINE(USE_POLL, 1, [Define to poll sockets with poll])
293         ;;
294 winselect)
295         AC_DEFINE(USE_WINSELECT, 1,
296                 [Define to poll sockets with Windows select])
297         ;;
299         AC_MSG_ERROR([unknown pollmethod option: $with_pollmethod])
300 esac
302 dnl ---------------------------------------------------------------------------
303 dnl Allow tools to be specifically built
304 dnl ---------------------------------------------------------------------------
306 AC_ARG_ENABLE(database,
307         AS_HELP_STRING([--enable-database],
308                 [enable support for the music database]),,
309         enable_database=yes)
310 MPD_DEFINE_CONDITIONAL(enable_database, ENABLE_DATABASE,
311         [the music database])
312 if test x$enable_database = xyes; then
313         database_auto=auto
314 else
315         database_auto=no
318 default_enable_daemon=yes
319 if test x$host_is_android = xyes || test x$host_is_android = xyes; then
320         default_enable_daemon=no
322 AC_ARG_ENABLE(daemon,
323         AS_HELP_STRING([--enable-daemon],
324                 [enable daemonization (default: enabled)]),,
325         enable_daemon=$default_enable_daemon)
326 MPD_DEFINE_CONDITIONAL(enable_daemon, ENABLE_DAEMON, [Enable daemonization?])
328 AC_ARG_ENABLE(debug,
329         AS_HELP_STRING([--enable-debug],
330                 [enable debugging (default: disabled)]),,
331         enable_debug=no)
333 AC_ARG_ENABLE(documentation,
334         AS_HELP_STRING([--enable-documentation],
335                 [build documentation (default: disable)]),,
336         [enable_documentation=no])
338 AC_ARG_ENABLE(dsd,
339         AS_HELP_STRING([--enable-dsd],
340                 [enable DSD decoder (default: enable)]),,
341         [enable_dsd=yes])
343 AC_ARG_ENABLE(fifo,
344         AS_HELP_STRING([--disable-fifo],
345                 [disable support for writing audio to a FIFO (default: enable)]),,
346         enable_fifo=yes)
348 AC_ARG_ENABLE(httpd-output,
349         AS_HELP_STRING([--enable-httpd-output],
350                 [enables the HTTP server output]),,
351         [enable_httpd_output=auto])
353 AC_ARG_ENABLE(inotify,
354         AS_HELP_STRING([--disable-inotify],
355                 [disable support Inotify automatic database update (default: enabled) ]),,
356         [enable_inotify=yes])
358 AC_ARG_ENABLE(ipv6,
359         AS_HELP_STRING([--disable-ipv6],
360                 [disable IPv6 support (default: enable)]),,
361         [enable_ipv6=yes])
363 AC_SYS_LARGEFILE
365 AC_ARG_ENABLE(qobuz,
366         AS_HELP_STRING([--enable-qobuz],
367                 [enable support for Qobuz streaming]),,
368         [enable_qobuz=auto])
370 AC_ARG_ENABLE(soundcloud,
371         AS_HELP_STRING([--enable-soundcloud],
372                 [enable support for soundcloud.com]),,
373         [enable_soundcloud=auto])
375 AC_ARG_ENABLE(tidal,
376         AS_HELP_STRING([--enable-tidal],
377                 [enable support for Tidal streaming]),,
378         [enable_tidal=auto])
380 AC_ARG_ENABLE([libwrap],
381         AS_HELP_STRING([--enable-libwrap], [use libwrap]),,
382         [enable_libwrap=auto])
384 AC_ARG_ENABLE(mikmod,
385         AS_HELP_STRING([--enable-mikmod],
386                 [enable the mikmod decoder (default: disable)]),,
387         enable_mikmod=no)
389 AC_ARG_ENABLE(openal,
390         AS_HELP_STRING([--enable-openal],
391                 [enable OpenAL support (default: auto)]),,
392         enable_openal=auto)
394 AC_ARG_ENABLE(oss,
395         AS_HELP_STRING([--disable-oss],
396                 [disable OSS support (default: enable)]),,
397         enable_oss=yes)
399 AC_ARG_ENABLE(osx,
400         AS_HELP_STRING([--enable-osx],
401                 [enable the OS X output plugin - unsupported! (default: disable)]),,
402         enable_osx=no)
404 AC_ARG_ENABLE(pipe-output,
405         AS_HELP_STRING([--enable-pipe-output],
406                 [enable support for writing audio to a pipe (default: disable)]),,
407         enable_pipe_output=no)
409 AC_ARG_ENABLE(recorder-output,
410         AS_HELP_STRING([--enable-recorder-output],
411                 [enables the recorder file output plugin (default: disable)]),,
412         [enable_recorder_output=auto])
414 AC_ARG_ENABLE(sidplay,
415         AS_HELP_STRING([--enable-sidplay],
416                 [enable C64 SID support via libsidplay2]),,
417         enable_sidplay=auto)
419 AC_ARG_ENABLE(shout,
420         AS_HELP_STRING([--enable-shout],
421                 [enables the shoutcast streaming output]),,
422         [enable_shout=auto])
424 AC_ARG_ENABLE(solaris_output,
425         AS_HELP_STRING([--enable-solaris-output],
426                 [enables the Solaris /dev/audio output]),,
427         [enable_solaris_output=$host_is_solaris])
429 AC_ARG_ENABLE(tcp,
430         AS_HELP_STRING([--disable-tcp],
431                 [disable support for clients connecting via TCP (default: enable)]),,
432         [enable_tcp=yes])
434 AC_ARG_ENABLE(test,
435         AS_HELP_STRING([--enable-test],
436                 [build the test programs (default: disabled)]),,
437         enable_test=no)
439 AC_ARG_ENABLE(un,
440         AS_HELP_STRING([--disable-un],
441                 [disable support for clients connecting via unix domain sockets (default: enable)]),,
442         [enable_un=$host_is_unix])
444 AC_ARG_ENABLE(vorbis,
445         AS_HELP_STRING([--enable-vorbis],
446                 [enable Ogg Vorbis decoder]),,
447         enable_vorbis=auto)
449 AC_ARG_ENABLE(wave-encoder,
450         AS_HELP_STRING([--enable-wave-encoder],
451                 [enable the PCM wave encoder]),,
452         enable_wave_encoder=yes)
454 AC_ARG_ENABLE(werror,
455         AS_HELP_STRING([--enable-werror],
456                 [treat warnings as errors (default: disabled)]),,
457         enable_werror=no)
459 AC_ARG_WITH(zeroconf,
460         AS_HELP_STRING([--with-zeroconf=@<:@auto|avahi|bonjour|no@:>@],
461                 [enable zeroconf backend (default=auto)]),,
462         with_zeroconf="auto")
464 dnl ---------------------------------------------------------------------------
465 dnl Mandatory Libraries
466 dnl ---------------------------------------------------------------------------
468 AX_BOOST_BASE([1.46],, [AC_MSG_ERROR([Boost not found])])
470 AC_ARG_ENABLE(icu,
471         AS_HELP_STRING([--enable-icu],
472                 [enable libicu for Unicode (default: auto)]),,
473         enable_icu=auto)
475 MPD_AUTO_PKG(icu, ICU, [icu-i18n], [libicu], [libicu not found])
476 MPD_DEFINE_CONDITIONAL(enable_icu, HAVE_ICU, [libicu])
478 AC_ARG_ENABLE(iconv,
479         AS_HELP_STRING([--enable-iconv],
480                 [enable iconv for character set conversion (default: auto)]),,
481         enable_iconv=yes)
483 if test x$enable_icu = xyes; then
484         dnl We don't need iconv() if we have libicu
485         enable_iconv=no
488 if test x$enable_iconv = xyes; then
489         AC_CHECK_FUNCS(iconv)
492 dnl ---------------------------------------------------------------------------
493 dnl Protocol Options
494 dnl ---------------------------------------------------------------------------
496 if test x$enable_tcp = xno; then
497         # if we don't support TCP, we don't need IPv6 either
498         enable_ipv6=no
501 if test x$enable_ipv6 = xyes; then
502         AC_MSG_CHECKING(for ipv6)
503         AC_EGREP_CPP([AP_maGiC_VALUE],
504         [
505 #include <sys/types.h>
506 #ifdef _WIN32
507 #include <winsock2.h>
508 #else
509 #include <sys/socket.h>
510 #endif
511 #include <netdb.h>
512 #ifdef PF_INET6
513 #ifdef AF_INET6
514 AP_maGiC_VALUE
515 #endif
516 #endif
517         ],
518         AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 support present])
519         AC_MSG_RESULT([yes]),
520         AC_MSG_RESULT([no])
524 if test x$enable_tcp = xyes; then
525         AC_DEFINE(HAVE_TCP, 1, [Define if TCP socket support is enabled])
528 if test x$enable_un = xyes; then
529         AC_DEFINE(HAVE_UN, 1, [Define if unix domain socket support is enabled])
530         STRUCT_UCRED
531         AC_CHECK_FUNCS(getpeereid)
534 dnl --------------------------- Post Protocol Tests ---------------------------
536         test x$enable_tcp = xno &&
537         test x$enable_un = xno; then
538         AC_MSG_ERROR([No client interfaces configured!])
541 MPD_ENABLE_AUTO(systemd_daemon, SYSTEMD_DAEMON, [systemd socket activation],
542         [libsystemd not found], [$linux_auto], [
543         dnl Check for libsystemd and fall back to (the older)
544         dnl libsystemd-daemon
545         PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd],
546                 [found_systemd_daemon=yes],
547                 [PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon],
548                         [found_systemd_daemon=yes],
549                         [found_systemd_daemon=no])])
552 dnl ---------------------------------------------------------------------------
553 dnl LIBC Features
554 dnl ---------------------------------------------------------------------------
555 if test x$enable_largefile != xno; then
556         AC_DEFINE([ENABLE_LARGEFILE], 1, [Define if large file support is enabled])
559 dnl ---------------------------------------------------------------------------
560 dnl Miscellaneous Libraries
561 dnl ---------------------------------------------------------------------------
563 dnl -------------------------------- libmpdclient --------------------------------
564 MPD_ENABLE_AUTO_PKG_DEPENDS(libmpdclient, LIBMPDCLIENT,
565         [libmpdclient >= 2.2],
566         [MPD client library], [libmpdclient not found], [],
567         [enable_database], [Database support is disabled])
569 dnl -------------------------------- expat --------------------------------
570 MPD_ENABLE_AUTO_PKG(expat, EXPAT, [expat],
571         [expat XML parser], [expat not found])
573 dnl -------------------------------- libgcrypt --------------------------------
575 if test x$enable_qobuz != xno; then
576         AM_PATH_LIBGCRYPT([1], [found_gcrypt=yes], [found_gcrypt=no])
579 dnl -------------------------------- yajl -------------------------------------
581 if test x$enable_qobuz != xno || x$enable_soundcloud != xno || test x$enable_tidal != xno; then
582         PKG_CHECK_MODULES([YAJL], [yajl >= 2.0],
583                 [found_yajl=yes],
584                 [found_yajl=no])
587 dnl --------------------------------- inotify ---------------------------------
588 AC_CHECK_FUNCS(inotify_init inotify_init1)
590 if test x$ac_cv_func_inotify_init = xno; then
591         enable_inotify=no
594 MPD_DEFINE_CONDITIONAL(enable_inotify, ENABLE_INOTIFY, [inotify support])
596 dnl --------------------------------- libwrap ---------------------------------
597 if test x$enable_libwrap != xno; then
598         AC_CHECK_LIBWRAP(found_libwrap=yes, found_libwrap=no)
600         if test x$found_libwrap = xyes; then
601                 dnl  See if libwrap is compatible with C++; it is
602                 dnl  broken on many systems
603                 AC_MSG_CHECKING(whether libwrap is compatible with C++)
604                 AC_LANG_PUSH([C++])
605                 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
606                         #include <tcpd.h>
607                         bool CheckLibWrap(int fd, const char &progname) {
608                                 struct request_info req;
609                                 request_init(&req, RQ_FILE, fd, RQ_DAEMON, progname, 0);
610                                 fromhost(&req);
611                                 return hosts_access(&req);
612                         }
613                         ])],
614                         AC_MSG_RESULT([yes]),
615                         [found_libwrap=no; AC_MSG_RESULT([no]);
616                         AC_MSG_WARN([Your version of libwrap is broken with C++])])
617                 AC_LANG_POP
618         fi
620         MPD_AUTO_RESULT(libwrap, libwrap, [libwrap not found])
623 if test x$enable_libwrap = xyes; then
624         AC_SUBST(LIBWRAP_CFLAGS)
625         AC_SUBST(LIBWRAP_LDFLAGS)
626         AC_DEFINE(HAVE_LIBWRAP, 1, [define to enable libwrap library])
629 dnl ---------------------------------------------------------------------------
630 dnl Metadata Plugins
631 dnl ---------------------------------------------------------------------------
633 dnl -------------------------------- libid3tag --------------------------------
634 MPD_ENABLE_AUTO_PKG_LIB(id3, ID3TAG,
635         id3tag, id3tag, id3_file_open, [-lid3tag -lz], [],
636         [ID3 support using libid3tag], [libid3tag not found])
638 dnl ---------------------------------------------------------------------------
639 dnl Autodiscovery
640 dnl ---------------------------------------------------------------------------
642 dnl --------------------------------- zeroconf --------------------------------
644 case $with_zeroconf in
645 no|bonjour)
646         enable_avahi=no
647         ;;
649 avahi)
650         enable_avahi=yes
651         ;;
654         with_zeroconf=auto
655         enable_avahi=auto
656         ;;
657 esac
659 MPD_AUTO_PKG(avahi, AVAHI, [avahi-client dbus-1],
660         [avahi client library], [avahi-client not found])
661 if test x$enable_avahi = xyes; then
662         with_zeroconf=avahi
665 MPD_DEFINE_CONDITIONAL(enable_avahi, HAVE_AVAHI, [Avahi Zeroconf])
667 enable_bounjour=no
668 if test x$with_zeroconf != xno; then
669         if test x$with_zeroconf = xbonjour || test x$with_zeroconf = xauto; then
670                 AC_CHECK_HEADER(dns_sd.h,
671                         [enable_bonjour=yes;AC_DEFINE([HAVE_BONJOUR], 1, [Define to enable Bonjour Zeroconf support])])
672                 AC_CHECK_LIB([dns_sd], [DNSServiceRegister])
673         fi
675         if test x$enable_bonjour = xyes; then
676                 with_zeroconf=bonjour
677         elif test x$with_zeroconf = xbonjour; then
678                 AC_MSG_ERROR([Bonjour support requested but not found])
679         fi
681         if test x$with_zeroconf = xauto; then
682                 AC_MSG_WARN([No supported Zeroconf backend found, disabling Zeroconf])
683                 with_zeroconf=no
684         else
685                 AC_DEFINE([HAVE_ZEROCONF], 1, [Define to enable Zeroconf support])
686         fi
689 AM_CONDITIONAL(HAVE_ZEROCONF, test x$with_zeroconf != xno)
690 AM_CONDITIONAL(HAVE_BONJOUR, test x$with_zeroconf = xbonjour)
692 dnl ---------------------------------------------------------------------------
693 dnl Sticker Database
694 dnl ---------------------------------------------------------------------------
696 dnl ---------------------------------- sqlite ---------------------------------
698 MPD_ENABLE_AUTO_PKG(sqlite, SQLITE, [sqlite3 >= 3.7.3],
699         [SQLite database support], [sqlite not found],
700         [$database_auto])
702 dnl ---------------------------------------------------------------------------
703 dnl Converter Plugins
704 dnl ---------------------------------------------------------------------------
706 dnl ------------------------------ libsamplerate ------------------------------
707 MPD_ENABLE_AUTO_PKG(lsr, LIBSAMPLERATE, [samplerate >= 0.1.3],
708         [libsamplerate resampling], [libsamplerate not found])
710 dnl ------------------------------ libsoxr ------------------------------------
711 MPD_ENABLE_AUTO_PKG(soxr, SOXR, [soxr],
712         [libsoxr resampler], [libsoxr not found])
714 dnl ---------------------------------------------------------------------------
715 dnl Input Plugins
716 dnl ---------------------------------------------------------------------------
718 dnl ----------------------------------- CURL ----------------------------------
720 MPD_ENABLE_AUTO_PKG(curl, CURL, [libcurl >= 7.18],
721         [libcurl HTTP streaming], [libcurl not found])
723 dnl ----------------------------------- smbclient -----------------------------
724 MPD_ENABLE_AUTO_PKG_LIB(smbclient, SMBCLIENT, [smbclient >= 0.2],
725         [smbclient], [smbc_init], [-lsmbclient], [],
726         [smbclient input plugin], [libsmbclient not found])
728 dnl ----------------------------------- NFS -----------------------------
729 MPD_ENABLE_AUTO_PKG(nfs, NFS, [libnfs],
730         [NFS input plugin], [libnfs not found])
732 dnl --------------------------------- Qobuz -----------------------------------
733 MPD_DEPENDS([enable_qobuz], [found_yajl], [Qobuz streaming], [libyajl not found])
734 MPD_DEPENDS([enable_qobuz], [found_gcrypt], [Qobuz streaming], [libgcrypt not found])
735 MPD_DEPENDS([enable_qobuz], [enable_curl], [Qobuz streaming], [libcurl not found])
736 MPD_AUTO(qobuz, [Qobuz streaming], [Qobuz not available], [found_qobuz=yes])
737 MPD_DEFINE_CONDITIONAL(enable_qobuz, ENABLE_QOBUZ, [Qobuz streaming])
739 dnl --------------------------------- Soundcloud ------------------------------
740 MPD_DEPENDS([enable_soundcloud], [found_yajl],
741         [soundcloud.com support], [libyajl not found])
742 MPD_DEFINE_CONDITIONAL(enable_soundcloud, ENABLE_SOUNDCLOUD,
743         [soundcloud.com support])
745 dnl --------------------------------- Tidal -----------------------------------
746 MPD_DEPENDS([enable_tidal], [found_yajl], [Tidal streaming], [libyajl not found])
747 MPD_DEPENDS([enable_tidal], [enable_curl], [Tidal streaming], [libcurl not found])
748 MPD_AUTO(tidal, [Tidal streaming], [Tidal not available], [found_tidal=yes])
749 MPD_DEFINE_CONDITIONAL(enable_tidal, ENABLE_TIDAL, [Tidal streaming])
751 dnl ---------------------------------- cdio ---------------------------------
752 MPD_ENABLE_AUTO_PKG(cdio_paranoia, CDIO_PARANOIA, [libcdio_paranoia],
753         [libcdio_paranoia input plugin], [libcdio_paranoia not found])
754 if test x$enable_cdio_paranoia = xyes; then
755         AC_CHECK_HEADERS(cdio/paranoia/paranoia.h)
758 MPD_ENABLE_AUTO_PKG(mms, MMS, [libmms >= 0.4],
759         [libmms mms:// protocol support], [libmms not found])
761 dnl ---------------------------------------------------------------------------
762 dnl Storage Plugins
763 dnl ---------------------------------------------------------------------------
765 MPD_ENABLE_AUTO(webdav, WEBDAV, [WebDAV storage plugin],
766         [WebDAV requires libcurl and libexpat],
767         [auto],
768         [if test x$enable_curl = xyes && test x$enable_expat = xyes; then
769                 found_webdav=yes
770         else
771                 found_webdav=no
772         fi])
774 dnl ---------------------------------------------------------------------------
775 dnl Playlist Plugins
776 dnl ---------------------------------------------------------------------------
778 MPD_ARG_ENABLE(cue, CUE, [CUE sheet parser], yes)
780 dnl ---------------------------------------------------------------------------
781 dnl Neighbor Plugins
782 dnl ---------------------------------------------------------------------------
784 AC_ARG_ENABLE(neighbor-plugins,
785         AS_HELP_STRING([--enable-neighbor-plugins],
786                 [enable support for neighbor discovery (default: auto)]),,
787         [enable_neighbor_plugins=auto])
789 if test x$enable_neighbor_plugins = xauto; then
790         if test x$enable_smbclient = xyes; then
791                 enable_neighbor_plugins=yes
792         fi
793         if test x$enable_upnp = xyes; then
794                 enable_neighbor_plugins=yes
795         fi
798 MPD_DEFINE_CONDITIONAL(enable_neighbor_plugins, ENABLE_NEIGHBOR_PLUGINS,
799         [neighbor discovery])
801 dnl ---------------------------------------------------------------------------
802 dnl Archive Plugins
803 dnl ---------------------------------------------------------------------------
805 dnl --------------------------------- iso9660 ---------------------------------
806 MPD_ENABLE_AUTO_PKG(iso9660, ISO9660, [libiso9660],
807         [libiso9660 archive plugin], [libiso9660 not found])
809 if test x$enable_iso9660 = xyes; then
810         AC_PATH_PROG(MKISOFS, mkisofs, no)
811 else
812         MKISOFS="no"
815 AM_CONDITIONAL(ENABLE_ISO9660_TEST, test x$MKISOFS != xno)
817 dnl ---------------------------------- zlib ---------------------------------
819 MPD_ENABLE_AUTO_PKG(zlib, ZLIB, [zlib],
820         [zlib support], [zlib not found])
822 dnl ---------------------------------- libbz2 ---------------------------------
824 MPD_ENABLE_AUTO_LIB(bzip2, BZ2, bz2, BZ2_bzDecompressInit, [-lbz2], [],
825         [bzip2 archive plugin], [libbz2 not found])
827 if test x$enable_bzip2 = xyes; then
828         AC_PATH_PROG(BZIP2, bzip2, no)
829 else
830         BZIP2="no"
833 AM_CONDITIONAL(ENABLE_BZIP2_TEST, test x$BZIP2 != xno)
835 dnl ---------------------------------- libupnp ---------------------------------
837 MPD_ENABLE_AUTO_PKG_DEPENDS(upnp, UPNP, [libupnp],
838         [UPnP client support], [libupnp not found], [],
839         [enable_database], [Database support is disabled], [
840                 MPD_DEPENDS([enable_upnp], [enable_curl],
841                         [UPnP client support],
842                         [UPnP requires CURL])
843                 MPD_DEPENDS([enable_upnp], [enable_expat],
844                         [UPnP client support],
845                         [UPnP requires expat])
846         ]
849 dnl --------------------------------- libzzip ---------------------------------
850 MPD_ENABLE_AUTO_PKG(zzip, ZZIP, [zziplib >= 0.13],
851         [libzzip archive library], [libzzip not found],
852         [no])
854 if test x$enable_zzip = xyes; then
855         AC_PATH_PROG(ZIP, zip, no)
856 else
857         ZIP="no"
860 AM_CONDITIONAL(ENABLE_ZZIP_TEST, test x$ZIP != xno)
862 dnl ------------------------------- Archive API -------------------------------
864         test x$enable_bzip2 = xyes ||
865         test x$enable_zzip = xyes ||
866         test x$enable_iso9660 = xyes; then
867                 enable_archive=yes
868 else
869         enable_archive=no
872 MPD_DEFINE_CONDITIONAL(enable_archive, ENABLE_ARCHIVE, [the archive API])
874 dnl ---------------------------------------------------------------------------
875 dnl Decoder Plugins
876 dnl ---------------------------------------------------------------------------
878 dnl -------------------------------- libadplug --------------------------------
879 MPD_ENABLE_AUTO_PKG(adplug, ADPLUG, [adplug],
880         [AdPlug decoder plugin], [libadplug not found])
882 dnl -------------------------------- audiofile --------------------------------
883 MPD_ENABLE_AUTO_PKG(audiofile, AUDIOFILE, [audiofile >= 0.3],
884         [audiofile decoder plugin], [libaudiofile not found])
886 dnl ----------------------------------- DSD -----------------------------------
888 MPD_DEFINE_CONDITIONAL(enable_dsd, ENABLE_DSD, [DSD decoder])
890 dnl ----------------------------------- FAAD ----------------------------------
891 MPD_ENABLE_AUTO_LIB(aac, FAAD, faad, NeAACDecOpen, [-lfaad], [],
892         [FAAD decoder plugin], [libfaad not found])
894 dnl ---------------------------------- ffmpeg ---------------------------------
895 MPD_ENABLE_AUTO_PKG(ffmpeg, FFMPEG,
896         [libavformat >= 53.17 libavcodec >= 53.25 libavutil >= 51.17],
897         [ffmpeg decoder library], [libavformat+libavcodec+libavutil not found])
899 dnl ----------------------------------- FLAC ----------------------------------
901 MPD_ENABLE_AUTO_PKG(flac, FLAC, [flac >= 1.2],
902         [FLAC decoder], [libFLAC not found])
904 enable_flac_encoder=$enable_flac
906 dnl -------------------------------- FluidSynth -------------------------------
908 MPD_ENABLE_AUTO_PKG(fluidsynth, FLUIDSYNTH, [fluidsynth >= 1.1],
909         [fluidsynth MIDI decoder plugin], [fluidsynth not found])
911 dnl ---------------------------------- libgme ---------------------------------
913 MPD_ENABLE_AUTO_PKG_LIB(gme, GME, [libgme],
914         gme, gme_open_file, [-lgme], [],
915         [Game Music Emulator decoder plugin], [libgme not found])
917 dnl ---------------------------------- libmad ---------------------------------
918 MPD_ENABLE_AUTO_PKG_LIB(mad, MAD, [mad],
919         mad, mad_stream_init, [-lmad], [],
920         [libmad MP3 decoder plugin], [libmad not found])
922 enable_shout2="$enable_shout"
923 MPD_AUTO_PKG(shout, SHOUT, [shout],
924         [shout output plugin], [libshout not found])
925 if test x$enable_shout = xyes && test x$enable_shout2 = xauto; then
926         enable_shout=auto
929 dnl -------------------------------- libmpg123 --------------------------------
930 MPD_ENABLE_AUTO_PKG(mpg123, MPG123, [libmpg123],
931         [libmpg123 decoder plugin], [libmpg123 not found])
933 dnl -------------------------------- libmikmod --------------------------------
934 if test x$enable_mikmod = xyes; then
935         AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config)
936         if test x$LIBMIKMOD_CONFIG != x ; then
937                 AC_SUBST(LIBMIKMOD_CFLAGS, `$LIBMIKMOD_CONFIG --cflags`)
938                 AC_SUBST(LIBMIKMOD_LIBS, `$LIBMIKMOD_CONFIG --libs`)
939                 AC_DEFINE(ENABLE_MIKMOD_DECODER, 1, [Define for mikmod support])
940         else
941                 enable_mikmod=no
942         fi
945 AM_CONDITIONAL(ENABLE_MIKMOD_DECODER, test x$enable_mikmod = xyes)
947 dnl -------------------------------- libmodplug -------------------------------
948 MPD_ENABLE_AUTO_PKG(modplug, MODPLUG, [libmodplug],
949         [modplug decoder plugin], [libmodplug not found])
951 dnl -------------------------------- libopus ----------------------------------
952 MPD_ENABLE_AUTO_PKG(opus, OPUS, [opus ogg],
953         [opus decoder plugin], [libopus not found])
955 dnl -------------------------------- libsndfile -------------------------------
956 dnl See above test, which may disable this.
957 MPD_ENABLE_AUTO_PKG(sndfile, SNDFILE, [sndfile],
958         [libsndfile decoder plugin], [libsndfile not found])
960 dnl --------------------------------- musepack --------------------------------
962 MPD_ENABLE_AUTO_LIB(mpc, MPCDEC, mpcdec, mpc_demux_init, [-lmpcdec], [],
963         [Musepack decoder plugin], [libmpcdec not found])
965 dnl -------------------------------- Ogg Tremor -------------------------------
967 AC_ARG_WITH(tremor,
968         AS_HELP_STRING([--with-tremor=PFX],
969                 [use Tremor (vorbisidec) integer Ogg Vorbis decoder (with optional prefix)]),,
970         with_tremor=no)
972 AC_ARG_VAR([TREMOR_CFLAGS], [C compiler flags for Tremor])
973 AC_ARG_VAR([TREMOR_LIBS], [linker flags for Tremor])
975 if test x$with_tremor = xyes || test x$with_tremor = xno; then
976         enable_tremor="$with_tremor"
977         tremor_prefix=""
978 else
979         tremor_prefix="$with_tremor"
980         enable_tremor=yes
983 if test x$enable_tremor = xyes; then
984         if test x$TREMOR_CFLAGS = x && test x$tremor_prefix != x; then
985                 TREMOR_CFLAGS="-I$tremor_prefix/include"
986         fi
987         if test x$TREMOR_LIBS = x; then
988                 TREMOR_LIBS="-lvorbisidec"
990                 if test x$tremor_prefix != x; then
991                         TREMOR_LIBS="-L$tremor_prefix/lib $TREMOR_LIBS"
992                 fi
993         fi
995         MPD_WITH_LIBRARY([TREMOR],
996                 [AC_CHECK_FUNC([ov_read],,
997                         [AC_MSG_ERROR([libvorbisidec not found])])])
999         AC_DEFINE(HAVE_TREMOR,1,
1000                 [Define to use tremor (libvorbisidec) for ogg support])
1001         AC_DEFINE(ENABLE_VORBIS_DECODER, 1, [Define for Ogg Vorbis support])
1002 else
1003         TREMOR_CFLAGS=
1004         TREMOR_LIBS=
1007 dnl -------------------------------- Ogg Vorbis -------------------------------
1009 if test x$enable_tremor = xyes; then
1010         if test x$enable_vorbis = xyes; then
1011                 AC_MSG_WARN(["OggTremor detected, could not enable Vorbis."])
1012         fi
1013         enable_vorbis=no
1015         if test x$enable_vorbis_encoder = xauto; then
1016                 AC_MSG_WARN([OggTremor detected, disabling the Vorbis encoder plugin.])
1017                 enable_vorbis_encoder=no
1018         fi
1021 MPD_AUTO_PKG(vorbis, VORBIS, [vorbis ogg],
1022         [Ogg Vorbis decoder], [libvorbis not found])
1023 if test x$enable_vorbis = xyes; then
1024         AC_DEFINE(ENABLE_VORBIS_DECODER, 1, [Define for Ogg Vorbis support])
1027 AM_CONDITIONAL(ENABLE_VORBIS_DECODER, test x$enable_vorbis = xyes || test x$enable_tremor = xyes)
1029 dnl --------------------------------- sidplay ---------------------------------
1030 if test x$enable_sidplay != xno; then
1031         dnl Check for libsidplayfp first
1032         PKG_CHECK_MODULES([SIDPLAY], [libsidplayfp],
1033                 [found_sidplayfp=yes],
1034                 [found_sidplayfp=no])
1035         found_sidplay=$found_sidplayfp
1038 if test x$enable_sidplay != xno && test x$found_sidplayfp = xno; then
1039         PKG_CHECK_MODULES([SIDPLAY], [libsidplay2 libsidutils],
1040                 [found_sidplay=yes],
1041                 [found_sidplay=no])
1043         MPD_AUTO_PRE(sidplay, [sidplay decoder plugin],
1044                 [libsidplay2 not found])
1047 if test x$enable_sidplay != xno && test x$found_sidplayfp = xno; then
1048         AC_CHECK_LIB([resid-builder], [main],
1049                 [found_sidplay=yes], [found_sidplay=no])
1051         MPD_AUTO_RESULT(sidplay, [sidplay decoder plugin],
1052                 [libresid-builder not found])
1055 if test x$enable_sidplay = xyes; then
1056         SIDPLAY_LIBS="$SIDPLAY_LIBS -lresid-builder"
1057         AC_DEFINE(ENABLE_SIDPLAY, 1, [Define for libsidplay2 support])
1058         if test x$found_sidplayfp = xyes; then
1059                 AC_DEFINE(HAVE_SIDPLAYFP, 1, [Define if libsidplayfp is used instead of libsidplay2])
1060         fi
1063 AM_CONDITIONAL(ENABLE_SIDPLAY, test x$enable_sidplay = xyes)
1065 dnl --------------------------------- wavpack ---------------------------------
1066 MPD_ENABLE_AUTO_PKG(wavpack, WAVPACK, [wavpack],
1067         [WavPack decoder plugin], [libwavpack not found])
1069 dnl --------------------------------- WildMidi --------------------------------
1070 MPD_ENABLE_AUTO_LIB(wildmidi, WILDMIDI, WildMidi, WildMidi_Init, [-lWildMidi], [],
1071         [WildMidi decoder plugin], [libwildmidi not found])
1073 dnl ---------------------------------------------------------------------------
1074 dnl Encoders for Streaming Audio Output Plugins
1075 dnl ---------------------------------------------------------------------------
1077 dnl ------------------------------- Encoder API -------------------------------
1078 if test x$enable_shout = xyes || \
1079         test x$enable_recorder_output = xyes || \
1080         test x$enable_httpd_output = xyes; then
1081         # at least one output using encoders is explicitly enabled
1082         need_encoder=yes
1083 elif test x$enable_shout = xauto || \
1084         test x$enable_recorder_output = xauto || \
1085         test x$enable_httpd_output = xauto; then
1086         need_encoder=auto
1087 else
1088         # all outputs using encoders are disabled
1089         need_encoder=no
1091         # don't bother to check for encoder plugins
1092         enable_vorbis_encoder=no
1093         enable_lame_encoder=no
1094         enable_twolame_encoder=no
1095         enable_shine_encoder=no
1096         enable_wave_encoder=no
1097         enable_flac_encoder=no
1100 dnl ------------------------------- FLAC Encoder ------------------------------
1101 MPD_DEFINE_CONDITIONAL(enable_flac_encoder, ENABLE_FLAC_ENCODER,
1102         [FLAC encoder plugin])
1104 dnl ------------------------------- Shine Encoder ------------------------------
1106 MPD_ENABLE_AUTO_PKG(shine_encoder, SHINE, [shine >= 3.1],
1107         [shine encoder], [libshine not found])
1109 dnl ---------------------------- Ogg Vorbis Encoder ---------------------------
1110 MPD_ENABLE_AUTO_PKG(vorbis_encoder, VORBISENC, [vorbisenc vorbis ogg],
1111         [Ogg Vorbis encoder], [libvorbisenc not found])
1113 dnl ------------------------------- LAME Encoder ------------------------------
1115 MPD_ENABLE_AUTO_LIB(lame_encoder, LAME, mp3lame, lame_init, [-lmp3lame], [],
1116         [LAME encoder plugin], [libmp3lame not found])
1118 dnl ----------------------------- TwoLAME Encoder -----------------------------
1119 MPD_ENABLE_AUTO_PKG(twolame_encoder, TWOLAME, [twolame],
1120         [TwoLAME encoder plugin], [libtwolame not found])
1122 dnl ------------------------------- WAVE Encoder ------------------------------
1123 MPD_DEFINE_CONDITIONAL(enable_wave_encoder, ENABLE_WAVE_ENCODER,
1124         [PCM wave encoder plugin])
1126 dnl --------------------------- encoder plugins test --------------------------
1127 if test x$enable_vorbis_encoder != xno ||
1128         test x$enable_opus != xno ||
1129         test x$enable_lame_encoder != xno ||
1130         test x$enable_twolame_encoder != xno ||
1131         test x$enable_flac_encoder != xno ||
1132         test x$enable_shine_encoder != xno ||
1133         test x$enable_wave_encoder != xno; then
1134         # at least one encoder plugin is enabled
1135         enable_encoder=yes
1136 else
1137         # no encoder plugin is enabled: disable the whole encoder API
1138         enable_encoder=no
1140         if test x$need_encoder = xyes; then
1141                 AC_MSG_ERROR([No encoder plugin found])
1142         fi
1145 MPD_DEFINE_CONDITIONAL(enable_encoder, ENABLE_ENCODER,
1146                 [the encoder plugins])
1148 dnl ---------------------------------------------------------------------------
1149 dnl Audio Output Plugins
1150 dnl ---------------------------------------------------------------------------
1152 dnl ----------------------------------- ALSA ----------------------------------
1153 MPD_ENABLE_AUTO_PKG(alsa, ALSA, [alsa >= 0.9.0],
1154         [ALSA output plugin], [libasound not found],
1155         [$linux_auto])
1157 dnl ----------------------------------- ROAR ----------------------------------
1158 MPD_ENABLE_AUTO_PKG(roar, ROAR, [libroar >= 0.4.0],
1159         [RoarAudio output plugin], [libroar not found])
1161 dnl ----------------------------------- FIFO ----------------------------------
1162 if test x$enable_fifo = xyes; then
1163         AC_CHECK_FUNC([mkfifo],
1164                 [enable_fifo=yes],
1165                 [enable_fifo=no;AC_MSG_WARN([mkfifo not found -- disabling support for writing audio to a FIFO])])
1168 MPD_DEFINE_CONDITIONAL(enable_fifo, HAVE_FIFO,
1169         [support for writing audio to a FIFO])
1171 dnl ----------------------------------- SNDIO ----------------------------------
1172 MPD_ARG_ENABLE([sndio], [SNDIO], [sndio output plugin], [], [
1173         AC_SUBST([SNDIO_LIBS], [])
1174         AC_SUBST([SNDIO_CFLAGS], [])
1176         found_sndio=no
1177         MPD_AUTO([sndio], [SNDIO], [sndio output plugin],
1178                 [AC_CHECK_HEADER([sndio.h],
1179                         [AC_PREPROC_IFELSE(
1180                                 [AC_LANG_PROGRAM([
1181                                         #include <sndio.h>
1182                                         #ifdef ROAR_VERSION
1183                                         #error libroarsndio not supported
1184                                         #endif
1185                                 ])],
1186                                 [found_sndio=yes SNDIO_LIBS='-lsndio' SNDIO_CFLAGS=''],
1187                                 [AC_MSG_WARN([Found libroarsndio, which is known to be broken; ignoring it.])],
1188                         )]
1189                 )]
1190         )
1193 dnl ----------------------------------- Haiku ---------------------------------
1194 MPD_ENABLE_AUTO_HEADER([haiku], [HAIKU], [media/MediaDefs.h],
1195         [-lbe -lmedia], [],
1196         [Haiku output plugin],
1197         [Haiku headers not found])
1199 dnl ------------------------------- HTTPD Output ------------------------------
1200 if test x$enable_httpd_output = xauto; then
1201         # handle HTTPD auto-detection: disable if no encoder is
1202         # available
1203         if test x$enable_encoder = xyes; then
1204                 enable_httpd_output=yes
1205         else
1206                 AC_MSG_WARN([No encoder plugin -- disabling the HTTP output plugin])
1207                 enable_httpd_output=no
1208         fi
1211 MPD_DEFINE_CONDITIONAL(enable_httpd_output, ENABLE_HTTPD_OUTPUT,
1212         [the HTTP server output])
1214 dnl ----------------------------------- JACK ----------------------------------
1215 MPD_ENABLE_AUTO_PKG(jack, JACK, [jack >= 0.100],
1216         [JACK output plugin], [libjack not found])
1218 if test x$enable_jack = xyes; then
1219         # check whether jack_set_info_function() is available
1220         old_LIBS=$LIBS
1221         LIBS="$LIBS $JACK_LIBS"
1223         AC_CHECK_FUNCS(jack_set_info_function)
1225         LIBS=$old_LIBS
1228 dnl ---------------------------------- libao ----------------------------------
1229 MPD_ENABLE_AUTO_PKG(ao, AO, [ao],
1230         [libao output plugin], [libao not found])
1232 dnl ---------------------------------- OpenAL ---------------------------------
1233 AC_SUBST(OPENAL_CFLAGS,"")
1234 AC_SUBST(OPENAL_LIBS,"")
1236 if test x$host_is_darwin = xyes; then
1237         if test x$enable_openal != xno; then
1238                 AC_CHECK_HEADERS([OpenAL/al.h OpenAL/alc.h],
1239                         [found_openal=yes], [found_openal=no])
1240         fi
1242         MPD_AUTO_RESULT(openal, [OpenAL output plugin], [OpenAL not found])
1244         if test x$enable_openal = xyes; then
1245                 OPENAL_LIBS="-framework OpenAL"
1246         fi
1247 else
1248         MPD_AUTO_PKG(openal, [OPENAL], [openal],
1249                 [OpenAL output plugin], [OpenAL not found])
1252 MPD_DEFINE_CONDITIONAL(enable_openal, HAVE_OPENAL, [OpenAL support])
1254 dnl ---------------------------- Open Sound System ----------------------------
1255 if test x$enable_oss = xyes; then
1256         AC_CHECK_HEADER(sys/soundcard.h,
1257                 [enable_oss=yes],
1258                 [AC_MSG_WARN(Soundcard headers not found -- disabling OSS support);
1259                         enable_oss=no])
1262 MPD_DEFINE_CONDITIONAL(enable_oss, HAVE_OSS, [Open Sound System])
1264 dnl ----------------------------------- OSX -----------------------------------
1265 if test x$enable_osx = xyes; then
1266         AC_DEFINE(HAVE_OSX, 1, [Define for compiling OS X support])
1267         LIBS="$LIBS -framework AudioUnit -framework CoreAudio -framework CoreServices"
1270 AM_CONDITIONAL(HAVE_OSX, test x$enable_osx = xyes)
1272 dnl ------------------------------- Pipe Output -------------------------------
1273 MPD_DEFINE_CONDITIONAL(enable_pipe_output, ENABLE_PIPE_OUTPUT,
1274                 [support for writing audio to a pipe])
1276 dnl -------------------------------- PulseAudio -------------------------------
1277 MPD_ENABLE_AUTO_PKG(pulse, PULSE, [libpulse >= 0.9.16],
1278         [PulseAudio output plugin], [libpulse not found])
1280 dnl --------------------------------- Recorder --------------------------------
1281 if test x$enable_recorder_output = xauto; then
1282         # handle recorder auto-detection: disable if no encoder is
1283         # available
1284         if test x$enable_encoder = xyes; then
1285                 enable_recorder_output=yes
1286         else
1287                 AC_MSG_WARN([No encoder plugin -- disabling the recorder output plugin])
1288                 enable_recorder_output=no
1289         fi
1292 MPD_DEFINE_CONDITIONAL(enable_recorder_output, ENABLE_RECORDER_OUTPUT,
1293         [the recorder output])
1295 dnl -------------------------------- SHOUTcast --------------------------------
1296 if test x$enable_shout = xauto; then
1297         # handle shout auto-detection: disable if no encoder is
1298         # available
1299         if test x$enable_encoder = xyes; then
1300                 enable_shout=yes
1301         else
1302                 AC_MSG_WARN([No encoder plugin -- disabling the shout output plugin])
1303                 enable_shout=no
1304         fi
1307 MPD_DEFINE_CONDITIONAL(enable_shout, HAVE_SHOUT,
1308         [shoutcast output])
1310 dnl --------------------------------- Solaris ---------------------------------
1312 MPD_DEFINE_CONDITIONAL(enable_solaris_output, ENABLE_SOLARIS_OUTPUT,
1313         [Solaris /dev/audio support])
1315 dnl --------------------------------- WinMM ---------------------------------
1317 if test "x$host_is_windows" = xyes; then
1318         AC_DEFINE(ENABLE_WINMM_OUTPUT, 1, [Define to enable WinMM support])
1319         enable_winmm_output=yes
1320         LIBS="$LIBS -lwinmm"
1321 else
1322         enable_winmm_output=no
1325 AM_CONDITIONAL(ENABLE_WINMM_OUTPUT, test x$enable_winmm_output = xyes)
1327 dnl ---------------------------------------------------------------------------
1328 dnl Option groups
1329 dnl ---------------------------------------------------------------------------
1331 have_ogg=no
1332 if test x$enable_vorbis = xyes || test x$enable_tremor = xyes || test x$enable_opus = xyes || test x$enable_vorbis_encoder = xyes; then
1333         have_ogg=yes
1336 have_xiph=no
1337 if test x$have_ogg = xyes || test x$enable_flac = xyes || test x$enable_flac_encoder = xyes; then
1338         have_xiph=yes
1341 if test x$have_ogg = xyes; then
1342         PKG_CHECK_MODULES([OGG], [ogg],, [AC_MSG_ERROR([libogg not found])])
1345 AM_CONDITIONAL(HAVE_OGG, test x$have_ogg = xyes)
1346 AM_CONDITIONAL(HAVE_XIPH, test x$have_xiph = xyes)
1348 dnl ---------------------------------------------------------------------------
1349 dnl Documentation
1350 dnl ---------------------------------------------------------------------------
1351 if test x$enable_documentation = xyes; then
1352         AC_PATH_PROG(XMLTO, xmlto)
1353         if test x$XMLTO = x; then
1354                 AC_MSG_ERROR([xmlto not found])
1355         fi
1357         AC_SUBST(XMLTO)
1359         AC_PATH_PROG(DOXYGEN, doxygen)
1360         if test x$DOXYGEN = x; then
1361                 AC_MSG_ERROR([doxygen not found])
1362         fi
1364         AC_SUBST(DOXYGEN)
1367 AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)
1369 dnl ---------------------------------------------------------------------------
1370 dnl test suite
1371 dnl ---------------------------------------------------------------------------
1373 if test "x$enable_test" = xyes; then
1374         PKG_CHECK_MODULES([CPPUNIT], [cppunit],,
1375                 [AC_MSG_ERROR([cppunit not found])])
1378 AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes)
1380 dnl ---------------------------------------------------------------------------
1381 dnl CFLAGS
1382 dnl ---------------------------------------------------------------------------
1384 dnl ---------------------------- warnings as errors ---------------------------
1385 if test "x$enable_werror" = xyes; then
1386         CFLAGS="$CFLAGS -Werror -pedantic-errors"
1387         CXXFLAGS="$CXXFLAGS -Werror"
1390 dnl ---------------------------- language features ----------------------------
1391 AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden])
1392 AX_APPEND_COMPILE_FLAGS([-ffast-math])
1393 AX_APPEND_COMPILE_FLAGS([-ftree-vectorize])
1395 AC_LANG_PUSH([C++])
1396 AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden])
1397 AX_APPEND_COMPILE_FLAGS([-fno-threadsafe-statics])
1398 AX_APPEND_COMPILE_FLAGS([-fmerge-all-constants])
1399 AX_APPEND_COMPILE_FLAGS([-ffast-math])
1400 AX_APPEND_COMPILE_FLAGS([-ftree-vectorize])
1401 AC_LANG_POP
1403 dnl ---------------------------------- debug ----------------------------------
1404 if test "x$enable_debug" = xno; then
1405         AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG"
1407         AX_APPEND_COMPILE_FLAGS([-ffunction-sections])
1408         AX_APPEND_COMPILE_FLAGS([-fdata-sections])
1410         AC_LANG_PUSH([C++])
1411         AX_APPEND_COMPILE_FLAGS([-ffunction-sections])
1412         AX_APPEND_COMPILE_FLAGS([-fdata-sections])
1413         AC_LANG_POP
1415         AX_APPEND_LINK_FLAGS([-Wl,--gc-sections])
1418 dnl ----------------------------------- GCC -----------------------------------
1419 if test x$GCC = xyes
1420 then
1421         AX_APPEND_COMPILE_FLAGS([-Wall])
1422         AX_APPEND_COMPILE_FLAGS([-Wextra])
1423         AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes])
1424         AX_APPEND_COMPILE_FLAGS([-Wshadow])
1425         AX_APPEND_COMPILE_FLAGS([-Wpointer-arith])
1426         AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes])
1427         AX_APPEND_COMPILE_FLAGS([-Wcast-qual])
1428         AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
1429         AX_APPEND_COMPILE_FLAGS([-pedantic])
1431         AC_LANG_PUSH([C++])
1432         AX_APPEND_COMPILE_FLAGS([-Wall])
1433         AX_APPEND_COMPILE_FLAGS([-Wextra])
1434         AX_APPEND_COMPILE_FLAGS([-Wmissing-declarations])
1435         AX_APPEND_COMPILE_FLAGS([-Wshadow])
1436         AX_APPEND_COMPILE_FLAGS([-Wpointer-arith])
1437         AX_APPEND_COMPILE_FLAGS([-Wcast-qual])
1438         AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
1439         AX_APPEND_COMPILE_FLAGS([-Wsign-compare])
1441         dnl This GCC8 warning for C++17 ABI compatibility is of no
1442         dnl interest for us, because we're not a shared library.
1443         AX_APPEND_COMPILE_FLAGS([-Wno-noexcept-type])
1445         AC_LANG_POP
1448 dnl ---------------------------------------------------------------------------
1449 dnl Pretty-Print Results
1450 dnl ---------------------------------------------------------------------------
1451 echo ''
1452 echo '########### MPD CONFIGURATION ############'
1454 printf '\nArchive support:\n\t'
1455 results(bzip2,[bzip2])
1456 results(iso9660,[ISO9660])
1457 results(zzip,[ZIP])
1459 if test x$with_zeroconf != xno; then
1460         printf '\nAutodiscovery support:\n\t'
1461         results(avahi, [Avahi])
1462         results(bonjour, [Bonjour])
1465 printf '\nClient support:\n\t'
1466 results(ipv6, "IPv6")
1467 results(tcp, "TCP")
1468 results(un,[UNIX Domain Sockets])
1470 printf '\nStorage support:\n\t'
1471 results(nfs, [NFS])
1472 results(smbclient, [SMB])
1474 printf '\nFile format support:\n\t'
1475 results(aac, [AAC])
1476 results(adplug, [AdPlug])
1477 results(dsd, [DSD])
1478 results(sidplay, [C64 SID])
1479 results(ffmpeg, [FFMPEG])
1480 results(flac, [FLAC])
1481 results(fluidsynth, [FluidSynth])
1482 results(gme, [GME])
1483 printf '\n\t'
1484 results(sndfile, [libsndfile])
1485 results(mikmod, [MikMod])
1486 results(modplug, [MODPLUG])
1487 results(mad, [MAD])
1488 results(mpg123, [MPG123])
1489 results(mpc, [Musepack])
1490 printf '\n\t'
1491 results(opus, [Opus])
1492 results(tremor, [OggTremor])
1493 results(vorbis, [OggVorbis])
1494 results(audiofile, [WAVE])
1495 results(wavpack, [WavPack])
1496 results(wildmidi, [WildMidi])
1498 printf '\nOther features:\n\t'
1499 results(lsr, [libsamplerate])
1500 results(soxr, [libsoxr])
1501 results(libmpdclient, [libmpdclient])
1502 results(inotify, [inotify])
1503 results(sqlite, [SQLite])
1505 printf '\nMetadata support:\n\t'
1506 results(id3,[ID3])
1508 printf '\nPlayback support:\n\t'
1509 results(alsa,ALSA)
1510 results(fifo,FIFO)
1511 results(sndio,[SNDIO])
1512 results(recorder_output,[File Recorder])
1513 results(haiku,[Haiku])
1514 results(httpd_output,[HTTP Daemon])
1515 results(jack,[JACK])
1516 printf '\n\t'
1517 results(ao,[libao])
1518 results(oss,[OSS])
1519 results(openal,[OpenAL])
1520 results(osx, [OS X])
1521 results(pipe_output, [Pipeline])
1522 printf '\n\t'
1523 results(pulse, [PulseAudio])
1524 results(roar,[ROAR])
1525 results(shout, [SHOUTcast])
1526 results(solaris_output, [Solaris])
1527 results(winmm_output, [WinMM])
1530         test x$enable_shout = xyes ||
1531         test x$enable_recorder = xyes ||
1532         test x$enable_httpd_output = xyes; then
1533                 printf '\nStreaming encoder support:\n\t'
1534                 results(flac_encoder, [FLAC])
1535                 results(lame_encoder, [LAME])
1536                 results(shine_encoder, [Shine])
1537                 results(vorbis_encoder, [Ogg Vorbis])
1538                 results(opus, [Opus])
1539                 results(twolame_encoder, [TwoLAME])
1540                 results(wave_encoder, [WAVE])
1543 printf '\nStreaming support:\n\t'
1544 results(cdio_paranoia, [CDIO_PARANOIA])
1545 results(curl,[CURL])
1546 results(qobuz,[Qobuz])
1547 results(smbclient,[SMBCLIENT])
1548 results(soundcloud,[Soundcloud])
1549 results(tidal,[Tidal])
1550 printf '\n\t'
1551 results(mms,[MMS])
1553 printf '\nEvent loop:\n\t'
1554 printf $with_pollmethod
1556 printf '\n\n##########################################\n\n'
1558 echo 'Generating files needed for compilation'
1560 dnl ---------------------------------------------------------------------------
1561 dnl Generate files
1562 dnl ---------------------------------------------------------------------------
1563 AC_CONFIG_FILES(Makefile)
1564 AC_CONFIG_FILES(doc/doxygen.conf)
1565 AC_CONFIG_FILES(systemd/system/mpd.service)
1566 AC_CONFIG_FILES(systemd/user/mpd.service)
1567 AC_OUTPUT
1569 echo 'MPD is ready for compilation, type "make" to begin.'