fi
with_os=`echo ${with_os} | tr '[[:upper:]]' '[[:lower:]]' `
+if test "x${with_os}" != xlinux && "x${with_os}" != xfreebsd && "x${with_os}" != xdarwin ; then
+ AC_MSG_ERROR(--with-os=<arg> argument must linux, freebsd, openbsd or darwin)
+fi
+
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
##### Some build systems are not fully using pkg-config, so we can use the flag ${with_pkg_config} on a case-by-case basis
##### to control how to deal with them
+##### Note -- this flag is sometimes ignored, especially for newer packages
AC_ARG_WITH([pkg_config],[AS_HELP_STRING([--with-pkg-config],[use pkg-config to find libraries])],[],[with_pkg_config=yes])
AC_MSG_RESULT(include the pipe audio back end)
AC_DEFINE([CONFIG_PIPE], 1, [Needed by the compiler.])
fi
-AM_CONDITIONAL([USE_PIPE], [test "x$with_dummy" = "xyes" ])
+AM_CONDITIONAL([USE_PIPE], [test "x$with_pipe" = "xyes" ])
# Check to see if we should include the System V initscript
AC_ARG_WITH([cygwin-service],[AS_HELP_STRING([--with-cygwin-service],[install a CYGWIN config script during a make install])])
AM_CONDITIONAL([INSTALL_CYGWIN_SERVICE], [test "x$with_cygwin_service" = "xyes"])
-AC_ARG_WITH([external-mdns],[AS_HELP_STRING([--with-external-mdns],[support the use of 'avahi-publish-service' or 'mDNSPublish' to advertise the service on Bonjour/ZeroConf])],[ AC_MSG_RESULT(include external mdns support) AC_DEFINE([CONFIG_EXTERNAL_MDNS], 1, [Needed by the compiler.]) ], )
+AC_ARG_WITH([external-mdns],[AS_HELP_STRING([--with-external-mdns],[support the use of 'avahi-publish-service' or 'mDNSPublish' to advertise the service on Bonjour/ZeroConf])])
+if test "x$with_external_mdns" = xyes ; then
+ AC_MSG_RESULT(include external mdns support)
+ AC_DEFINE([CONFIG_EXTERNAL_MDNS], 1, [Use 'avahi-publish-service' or 'mDNSPublish' to advertise.])
+fi
AM_CONDITIONAL([USE_EXTERNAL_MDNS], [test "x$with_external_mdns" = "xyes" ])
# Add the libconfig package
AM_CONDITIONAL([USE_APPLE_ALAC], [test "x${with_apple_alac}" = "xyes"])
# Look for piddir flag
-AC_ARG_WITH(piddir, [AS_HELP_STRING([--with-piddir=<pathname>],[Specify a pathname to a directory in which to write the PID file.])], [
+AC_ARG_WITH(piddir, [AS_HELP_STRING([--with-piddir=<pathname>],[Specify a pathname to a directory in which to write the PID file.])])
+if test "x${with_piddir}" != "x" ; then
AC_MSG_CHECKING(--with-piddir argument)
if test "x${with_piddir}" = x -o "x${with_piddir}" = xyes ; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(when you use the --with-piddir directive you must specify the pathname of the directory into which the PID file will be written)
fi
AC_MSG_RESULT(${with_piddir})
- REQUESTED_CUSTOMPIDDIR=1
- AC_SUBST(CUSTOM_PID_DIR,["${with_piddir}"])
- AC_DEFINE([DEFINED_CUSTOM_PID_DIR],1,[Hook up special proc to libdaemon to point to this directory])], )
-AM_CONDITIONAL([USE_CUSTOMPIDDIR], [test "x$REQUESTED_CUSTOMPIDDIR" = "x1"])
-
+ AC_SUBST(CUSTOM_PID_DIR,["${with_piddir}"])
+ AC_DEFINE([DEFINED_CUSTOM_PID_DIR],1,[Hook up special proc to libdaemon to point to this directory])
+fi
+AM_CONDITIONAL([USE_CUSTOMPIDDIR], [ test "x${with_piddir}" != "x" ])
# Look for libdaemon
-AC_ARG_WITH(libdaemon,[AS_HELP_STRING([--with-libdaemon],[include support for daemonising in non-systemd systems])], REQUESTED_LIBDAEMON=1, )
-if test "x$REQUESTED_LIBDAEMON" = "x1"; then
+AC_ARG_WITH(libdaemon,[AS_HELP_STRING([--with-libdaemon],[include support for daemonising in non-systemd systems])])
+if test "x$with_libdaemon" = "x1"; then
AC_DEFINE([CONFIG_LIBDAEMON], 1, [Include libdaemon])
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
AC_CHECK_LIB([daemon],[daemon_fork], , AC_MSG_ERROR(libdaemon needed))
fi
fi
-AM_CONDITIONAL([USE_LIBDAEMON], [test "x$REQUESTED_LIBDAEMON" = "x1"])
+AM_CONDITIONAL([USE_LIBDAEMON], [test "x$with_libdaemon" = "x1"])
# Check --with-ssl=argument
-AC_ARG_WITH(ssl, [AS_HELP_STRING([--with-ssl=<argument>],[choose --with-ssl=openssl, --with-ssl=mbedtls or --with-ssl=polarssl (deprecated) for encryption services ])], [
- AC_MSG_CHECKING(encryption libraries chosen)
- if test "x${with_ssl}" = x -o "x${with_ssl}" = xyes ; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(choose "openssl", "mbedtls" or "polarssl" encryption)
- fi
- if test "x${with_ssl}" = xopenssl ; then
- AC_DEFINE([CONFIG_OPENSSL], 1, [Use the OpenSSL libraries for encryption and encoding and decoding])
- if test "x${with_pkg_config}" = xyes ; then
- PKG_CHECK_MODULES(
- [SSL], [libssl,libcrypto],
- [LIBS="${SSL_LIBS} ${LIBS}"])
- else
- AC_CHECK_LIB([crypto], [main], , AC_MSG_ERROR(libcrypto selected but the library cannot be found!))
- AC_CHECK_LIB([ssl], [main], , AC_MSG_ERROR(libssl selected but the library cannot be found!))
- fi
- elif test "x${with_ssl}" = xmbedtls ; then
- AC_DEFINE([CONFIG_MBEDTLS], 1, [Use the mbed TLS libraries for encryption and encoding and decoding])
- AC_CHECK_LIB([mbedtls],[mbedtls_ssl_init],,
+AC_ARG_WITH(ssl, [AS_HELP_STRING([--with-ssl=<argument>],[choose --with-ssl=openssl, --with-ssl=mbedtls or --with-ssl=polarssl (deprecated) for encryption services ])])
+
+if test "x${with_ssl}" = xopenssl ; then
+ AC_DEFINE([CONFIG_OPENSSL], 1, [Use the OpenSSL libraries for encryption and encoding and decoding])
+ if test "x${with_pkg_config}" = xyes ; then
+ PKG_CHECK_MODULES(
+ [SSL], [libssl,libcrypto],
+ [LIBS="${SSL_LIBS} ${LIBS}"])
+ else
+ AC_CHECK_LIB([crypto], [main], , AC_MSG_ERROR(libcrypto selected but the library cannot be found!))
+ AC_CHECK_LIB([ssl], [main], , AC_MSG_ERROR(libssl selected but the library cannot be found!))
+ fi
+elif test "x${with_ssl}" = xmbedtls ; then
+ AC_DEFINE([CONFIG_MBEDTLS], 1, [Use the mbed TLS libraries for encryption and encoding and decoding])
+ AC_CHECK_LIB([mbedtls],[mbedtls_ssl_init],,
[AC_MSG_ERROR([mbed tls support requires the mbedtls library -- libmbedtls-dev suggested],1)])
- AC_CHECK_LIB([mbedcrypto], [mbedtls_entropy_func],,
- [AC_MSG_ERROR([mbed tls support requires the mbedcrypto library -- libmbedcrypto0 suggested],1)])
- AC_CHECK_LIB([mbedx509], [mbedtls_pk_init],,
- [AC_MSG_ERROR([mbed tls support requires the mbedx509 library -- libmbedx509-0 suggested],1)])
- elif test "x${with_ssl}" = xpolarssl ; then
- AC_DEFINE([CONFIG_POLARSSL], 1, [Use the PolarSSL libraries for encryption and encoding and decoding])
- AC_CHECK_LIB([polarssl],[ssl_init], , AC_MSG_ERROR(PolarSSL is selected but the library cannot be found and is deprecated. Consider selecting mbed TLS instead using --with-ssl=mbedtls.))
- else
- AC_MSG_ERROR(unknown option "${with_ssl}"." Please choose with "openssl", "mbedtls" or "polarssl")
- fi
-], )
+ AC_CHECK_LIB([mbedcrypto], [mbedtls_entropy_func],,
+ [AC_MSG_ERROR([mbed tls support requires the mbedcrypto library -- libmbedcrypto0 suggested],1)])
+ AC_CHECK_LIB([mbedx509], [mbedtls_pk_init],,
+ [AC_MSG_ERROR([mbed tls support requires the mbedx509 library -- libmbedx509-0 suggested],1)])
+elif test "x${with_ssl}" = xpolarssl ; then
+ AC_DEFINE([CONFIG_POLARSSL], 1, [Use the PolarSSL libraries for encryption and encoding and decoding])
+ AC_CHECK_LIB([polarssl],[ssl_init], , AC_MSG_ERROR(PolarSSL is selected but the library cannot be found and is deprecated. Consider selecting mbed TLS instead using --with-ssl=mbedtls.))
+else
+ AC_MSG_ERROR(specify one of --with-ssl=openssl or --with-ssl=mbedtls or --with-ssl=polarssl)
+fi
# Look for soxr flag
-AC_ARG_WITH(soxr, [AS_HELP_STRING([--with-soxr],[choose libsoxr for high-quality interpolation])], [
+
+AC_ARG_WITH(soxr, [AS_HELP_STRING([--with-soxr],[choose libsoxr for high-quality interpolation])])
+if test "x$with_soxr" = "xyes" ; then
AC_DEFINE([CONFIG_SOXR], 1, [Include support for using the SoX Resampler library for interpolation])
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
AC_CHECK_LIB([soxr],[soxr_create], , AC_MSG_ERROR(soxr support requires the libsoxr library -- libsoxr-dev suggested!))
fi
fi
-], )
+fi
# Look for metadata flag and resolve it further down the script
-AC_ARG_WITH(metadata,[AS_HELP_STRING([--with-metadata],[include support for a metadata feed])], [REQUESTED_METADATA=1], )
+AC_ARG_WITH(metadata,[AS_HELP_STRING([--with-metadata],[include support for a metadata feed])])
# What follows is a bit messy, because if the relevant library is requested, a compiler flag is defined, a file is included in the compilation
# and the relevant link files are added.
# Look for avahi flag
-AC_ARG_WITH(avahi, [AS_HELP_STRING([--with-avahi],[choose Avahi-based mDNS support])], [
- REQUESTED_AVAHI=1
+AC_ARG_WITH(avahi, [AS_HELP_STRING([--with-avahi],[choose Avahi-based mDNS support])])
+if test "x$with_avahi" = "xyes" ; then
AC_DEFINE([CONFIG_AVAHI], 1, [Needed by the compiler.])
AC_CHECK_LIB([avahi-client], [avahi_client_new], , AC_MSG_ERROR(Avahi support requires the avahi-client library!))
- AC_CHECK_LIB([avahi-common],[avahi_strerror], , AC_MSG_ERROR(Avahi support requires the avahi-common library!))])
-AM_CONDITIONAL([USE_AVAHI], [test "x$REQUESTED_AVAHI" = "x1"])
+ AC_CHECK_LIB([avahi-common],[avahi_strerror], , AC_MSG_ERROR(Avahi support requires the avahi-common library!))
+fi
+AM_CONDITIONAL([USE_AVAHI], [test "x$with_avahi" = "xyes"])
# Look for tinysvcmdns flag
-AC_ARG_WITH(tinysvcmdns, [AS_HELP_STRING([--with-tinysvcmdns],[choose tinysvcmdns-based mDNS support])], [
- REQUESTED_TINYSVCMDNS=1
- AC_DEFINE([CONFIG_TINYSVCMDNS], 1, [Needed by the compiler.])], )
-AM_CONDITIONAL([USE_TINYSVCMDNS], [test "x$REQUESTED_TINYSVCMDNS" = "x1"])
+AC_ARG_WITH(tinysvcmdns, [AS_HELP_STRING([--with-tinysvcmdns],[choose tinysvcmdns-based mDNS support])])
+if test "x$with_tinysvcmdns" = "xyes" ; then
+ AC_DEFINE([CONFIG_TINYSVCMDNS], 1, [Include TinySVCmDNS-based mDNS support])
+fi
+AM_CONDITIONAL([USE_TINYSVCMDNS], [test "x$with_tinysvcmdns" = "xyes"])
# Look for ALSA flag
-AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa],[choose ALSA API support (GNU/Linux only)])], [
- REQUESTED_ALSA=1
+AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa],[choose ALSA API support (GNU/Linux only)])])
+if test "x$with_alsa" = "xyes" ; then
AC_DEFINE([CONFIG_ALSA], 1, [Needed by the compiler.])
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
[LIBS="${alsa_LIBS} ${LIBS}"])
else
AC_CHECK_LIB([asound], [snd_pcm_open], , AC_MSG_ERROR(ALSA support requires the asound library!))
- fi ])
-AM_CONDITIONAL([USE_ALSA], [test "x$REQUESTED_ALSA" = "x1"])
+ fi
+fi
+AM_CONDITIONAL([USE_ALSA], [test "x$with_alsa" = "xyes"])
# Look for jack flag
-AC_ARG_WITH(jack, [AS_HELP_STRING([--with-jack],[include a Jack Audio Connection Kit (jack) backend])], [
- REQUESTED_JACK=1
+AC_ARG_WITH(jack, [AS_HELP_STRING([--with-jack],[include a Jack Audio Connection Kit (jack) backend])])
+if test "x$with_jack" = "xyes" ; then
AC_DEFINE([CONFIG_JACK], 1, [Needed by the compiler.])
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
[AC_MSG_ERROR(Jack Audio Connection Kit support requires the jack library -- libjack-dev suggested!)])
else
AC_CHECK_LIB([jack], [jack_client_open], , AC_MSG_ERROR(Jack Audio Connection Kit support requires the jack library -- libjack-dev suggested!))
- fi ])
-AM_CONDITIONAL([USE_JACK], [test "x$REQUESTED_JACK" = "x1"])
+ fi
+fi
+AM_CONDITIONAL([USE_JACK], [test "x$with_jack" = "xyes"])
# Look for SNDIO flag
-AC_ARG_WITH(sndio, [AS_HELP_STRING([--with-sndio],[choose SNDIO API support])], [
- REQUESTED_SNDIO=1
+AC_ARG_WITH(sndio, [AS_HELP_STRING([--with-sndio],[choose SNDIO API support])])
+if test "x$with_sndio" = "xyes" ; then
AC_DEFINE([CONFIG_SNDIO], 1, [Needed by the compiler.])
- AC_CHECK_LIB([sndio], [sio_open], , AC_MSG_ERROR(SNDIO support requires the sndio library -- libsndio-dev suggested))], )
-AM_CONDITIONAL([USE_SNDIO], [test "x$REQUESTED_SNDIO" = "x1"])
+ AC_CHECK_LIB([sndio], [sio_open], , AC_MSG_ERROR(SNDIO support requires the sndio library -- libsndio-dev suggested))
+fi
+AM_CONDITIONAL([USE_SNDIO], [test "x$with_sndio" = "xyes"])
# Look for AO flag
-AC_ARG_WITH(ao, [AS_HELP_STRING([--with-ao],[choose AO (Audio Output?) API support. N.B. no synchronisation -- so underflow or overflow is inevitable!])], [
- REQUESTED_AO=1
+AC_ARG_WITH(ao, [AS_HELP_STRING([--with-ao],[choose AO (Audio Output?) API support. N.B. no synchronisation -- so underflow or overflow is inevitable!])])
+if test "x$with_ao" = "xyes" ; then
AC_DEFINE([CONFIG_AO], 1, [Needed by the compiler.])
- AC_CHECK_LIB([ao], [ao_initialize], , AC_MSG_ERROR(AO support requires the ao library -- libao-dev suggested))], )
-AM_CONDITIONAL([USE_AO], [test "x$REQUESTED_AO" = "x1"])
+ AC_CHECK_LIB([ao], [ao_initialize], , AC_MSG_ERROR(AO support requires the ao library -- libao-dev suggested))
+fi
+AM_CONDITIONAL([USE_AO], [test "x$with_ao" = "xyes"])
# Look for Soundio flag
-AC_ARG_WITH(soundio, [AS_HELP_STRING([--with-soundio],[choose soundio API support.])], [
- REQUESTED_SOUNDIO=1
- AC_DEFINE([CONFIG_SOUNDIO], 1, [Needed by the compiler.])
- AC_CHECK_LIB([soundio], [soundio_create], , AC_MSG_ERROR(soundio support requires the soundio library -- libsoundio-dev suggested))], )
-AM_CONDITIONAL([USE_SOUNDIO], [test "x$REQUESTED_SOUNDIO" = "x1"])
+AC_ARG_WITH(soundio, [AS_HELP_STRING([--with-soundio],[choose soundio API support.])])
+if test "x$with_soundio" = "xyes" ; then
+ AC_DEFINE([CONFIG_SOUNDIO], 1, [Include SoundIO Support.])
+ AC_CHECK_LIB([soundio], [soundio_create], , AC_MSG_ERROR(soundio support requires the soundio library -- libsoundio-dev suggested))
+fi
+AM_CONDITIONAL([USE_SOUNDIO], [test "x$with_soundio" = "xyes"])
# Look for pulseaudio flag
-AC_ARG_WITH(pa, [AS_HELP_STRING([--with-pa],[choose PulseAudio support.])], [
- REQUESTED_PA=1
+AC_ARG_WITH(pa, [AS_HELP_STRING([--with-pa],[choose PulseAudio support.])])
+if test "x$with_pa" = "xyes" ; then
AC_DEFINE([CONFIG_PA], 1, [Needed by the compiler.])
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
else
AC_CHECK_LIB([pulse-simple], [pa_simple_new], , AC_MSG_ERROR(PulseAudio support requires the libpulse library!))
AC_CHECK_LIB([pulse], [pa_stream_peek], , AC_MSG_ERROR(PulseAudio support requires the libpulse-dev library.))
- fi ])
-AM_CONDITIONAL([USE_PA], [test "x$REQUESTED_PA" = "x1"])
+ fi
+fi
+AM_CONDITIONAL([USE_PA], [test "x$with_pa" = "xyes"])
# Look for Convolution flag
AC_ARG_WITH(convolution, [AS_HELP_STRING([--with-convolution],[choose audio DSP convolution support])], [
],)
AM_CONDITIONAL([USE_MQTT], [test "x$REQUESTED_MQTT" = "x1"])
-if test "x$REQUESTED_MQTT" = "x1" && test "x$REQUESTED_AVAHI" != "x1"; then
+if test "x$REQUESTED_MQTT" = "x1" && test "x$with_avahi" = "xyes" ; then
AC_MSG_WARN([MQTT needs Avahi to allow remote control functionality. At present, only metadata publishing will be supported])
fi
AM_CONDITIONAL([USE_METADATA_HUB], [test "x$REQUESTED_EXTENDED_METADATA_SUPPORT" = "x1"])
AM_CONDITIONAL([USE_DACP_CLIENT], [test "x$REQUESTED_EXTENDED_METADATA_SUPPORT" = "x1"])
-if test "x$REQUESTED_EXTENDED_METADATA_SUPPORT" = "x1" || test "x$REQUESTED_METADATA" = "x1"; then
+if test "x$REQUESTED_EXTENDED_METADATA_SUPPORT" = "x1" || test "x$with_metadata" = "xyes" ; then
AC_DEFINE([CONFIG_METADATA], 1, [Needed by the compiler.])
fi
-AM_CONDITIONAL([USE_METADATA], [test "x$REQUESTED_METADATA" = "x1"])
+AM_CONDITIONAL([USE_METADATA], [test "x$with_metadata" = "xyes"])
if test "x${with_systemd}" = xyes ; then
# Find systemd unit dir