From: Mike Brady Date: Sun, 9 Sep 2018 13:12:20 +0000 (+0100) Subject: Partly clean up use of automake, autoconfig and compiler flags. Works but still not... X-Git-Tag: 3.3RC0~226 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69642bb7de2380a307d8710938bb161d96be845a;p=thirdparty%2Fshairport-sync.git Partly clean up use of automake, autoconfig and compiler flags. Works but still not consistent. --- diff --git a/Makefile.am b/Makefile.am index e8e4a341..3b17f585 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,7 +17,7 @@ else endif endif -if USE_APPLE_ALAC +if USE_ALAC shairport_sync_SOURCES += apple_alac.cpp endif diff --git a/common.c b/common.c index 3ecb7751..da28cb8f 100644 --- a/common.c +++ b/common.c @@ -1218,7 +1218,7 @@ char *get_version_string() { #ifdef CONFIG_METADATA strcat(version_string, "-metadata"); #endif -#ifdef CONFIG_MQTT +#ifdef HAVE_LIBMOSQUITTO strcat(version_string, "-mqtt"); #endif #ifdef HAVE_DBUS diff --git a/common.h b/common.h index fccd4b8c..4aca72c7 100644 --- a/common.h +++ b/common.h @@ -94,7 +94,7 @@ typedef struct { size_t metadata_sockmsglength; int get_coverart; #endif -#ifdef CONFIG_MQTT +#ifdef HAVE_LIBMOSQUITTO int mqtt_enabled; char *mqtt_hostname; int mqtt_port; @@ -189,7 +189,7 @@ typedef struct { enum dbus_session_type mpris_service_bus_type; #endif -#ifdef HAVE_METADATA_HUB +#ifdef CONFIG_METADATA_HUB char *cover_art_cache_dir; int scan_interval_when_active; // number of seconds between DACP server scans when playing // something (1) diff --git a/configure.ac b/configure.ac index 9ecdefa8..cf569a57 100644 --- a/configure.ac +++ b/configure.ac @@ -64,10 +64,9 @@ if test "x${with_pkg_config}" = xyes ; then [POPT], [popt], [CFLAGS="${POPT_CFLAGS} ${CFLAGS}" LIBS="${POPT_LIBS} ${LIBS}" - AC_DEFINE([HAVE_LIBPOPT],[1],[Define to 1 if you have popt])]) + AC_DEFINE([HAVE_LIBPOPT],[1],[Define to 1 if you have the popt library])]) else AC_CHECK_LIB([popt],[poptGetContext], , AC_MSG_ERROR(libpopt needed)) - AC_DEFINE([HAVE_LIBPOPT],[1],[Define to 1 if you have popt]) fi AC_ARG_WITH([dummy],[ --with-dummy = include the dummy audio back end ],[AC_MSG_RESULT(>>Including the dummy audio back end) AC_DEFINE([CONFIG_DUMMY], 1, [Needed by the compiler.]) ], ) @@ -112,19 +111,16 @@ AM_CONDITIONAL([INSTALL_CONFIG_FILES], [test "x$with_configfiles" = "xyes"]) # Look for Apple ALAC flag AC_ARG_WITH(apple-alac, [ --with-apple-alac = include support for the Apple ALAC decoder], [AC_MSG_RESULT(>>Including the Apple ALAC Decoder) - HAS_APPLE_ALAC=1 - AM_CONDITIONAL([USE_APPLE_ALAC], [test 0]) - AC_DEFINE([CONFIG_APPLE_ALAC], 1, [Needed by the compiler.]) + REQUESTED_ALAC=1 if test "x${with_pkg_config}" = xyes ; then PKG_CHECK_MODULES( [ALAC], [alac], [LIBS="${ALAC_LIBS} ${LIBS}" - AC_DEFINE([HAVE_APPLE_ALAC],[1],[Define to 1 if you are using the Apple ALAC Decoder])]) + AC_DEFINE([HAVE_ALAC],[1],[Define to 1 if you are using the Apple ALAC Decoder])]) else AC_CHECK_LIB([alac], [BitBufferInit], , AC_MSG_ERROR(Apple ALAC Decoder support requires the alac library!)) - AC_DEFINE([HAVE_APPLE_ALAC],[1],[Define to 1 if you have the Apple ALAC library]) fi ]) -AM_CONDITIONAL([USE_APPLE_ALAC], [test "x$HAS_APPLE_ALAC" = "x1"]) +AM_CONDITIONAL([USE_ALAC], [test "x$REQUESTED_ALAC" = "x1"]) # Look for piddir flag AC_ARG_WITH(piddir, [ --with-piddir= Specify a pathname to a directory in which to write the PID file.], [ @@ -134,10 +130,10 @@ AC_ARG_WITH(piddir, [ --with-piddir= Specify a pathname to a directory 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}) - HAS_CUSTOMPIDDIR=1 + REQUESTED_CUSTOMPIDDIR=1 AC_SUBST(CUSTOM_PID_DIR,["${with_piddir}"]) - AC_DEFINE([USE_CUSTOM_PID_DIR],1,[Hook up special proc to libdaemon to point to this directory])], ) -AM_CONDITIONAL([USE_CUSTOMPIDDIR], [test "x$HAS_CUSTOMPIDDIR" = "x1"]) + 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"]) # Check --with-ssl=argument AC_ARG_WITH(ssl, [ choose --with-ssl=openssl, --with-ssl=mbedtls or --with-ssl=polarssl (deprecated) for encryption services ], [ @@ -156,8 +152,6 @@ AC_ARG_WITH(ssl, [ choose --with-ssl=openssl, --with-ssl=mbedtls or --with-ssl=p 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!)) - AC_DEFINE([HAVE_LIBCRYPTO],[1],[Define to 1 if you have libcrypto]) - AC_DEFINE([HAVE_LIBSSL],[1],[Define to 1 if you have libssl]) fi elif test "x${with_ssl}" = xmbedtls ; then AC_CHECK_LIB([mbedtls],[mbedtls_ssl_init],, @@ -179,8 +173,9 @@ AC_ARG_WITH(soxr, [ --with-soxr = choose libsoxr for high-quality interpolation if test "x${with_pkg_config}" = xyes ; then PKG_CHECK_MODULES( [SOXR], [soxr], - [LIBS="${SOXR_LIBS} ${LIBS}"]) - AC_DEFINE([HAVE_LIBSOXR],[1],[Define to 1 if you are including support for soxr interpolation]) + [LIBS="${SOXR_LIBS} ${LIBS}" + AC_DEFINE([HAVE_LIBSOXR],[1],[Define to 1 if you are including support for soxr interpolation])]) + else AC_CHECK_LIB([avutil],[av_get_cpu_flags]) if test "x${ac_cv_lib_avutil_av_get_cpu_flags}" = xyes ; then @@ -192,11 +187,9 @@ AC_ARG_WITH(soxr, [ --with-soxr = choose libsoxr for high-quality interpolation fi ], ) -# Look for metadata flag -- set flag for conditional compilation +# Look for metadata flag and resolve it further down the script AC_ARG_WITH(metadata, [ --with-metadata = include support for a metadata feed], [ - AC_MSG_RESULT(>>Including metadata support) - AC_DEFINE([CONFIG_METADATA], 1, [Needed by the compiler.])], ) -AM_CONDITIONAL([USE_METADATA], [test "x$with_metadata" = "xyes"]) + REQUESTED_METADATA=1], ) # 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. @@ -204,24 +197,23 @@ AM_CONDITIONAL([USE_METADATA], [test "x$with_metadata" = "xyes"]) # Look for avahi flag AC_ARG_WITH(avahi, [ --with-avahi = choose Avahi-based mDNS support], [ AC_MSG_RESULT(>>Including Avahi mDNS support) - HAS_AVAHI=1 + REQUESTED_AVAHI=1 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$HAS_AVAHI" = "x1"]) +AM_CONDITIONAL([USE_AVAHI], [test "x$REQUESTED_AVAHI" = "x1"]) # Look for tinysvcmdns flag AC_ARG_WITH(tinysvcmdns, [ --with-tinysvcmdns = choose tinysvcmdns-based mDNS support], [ AC_MSG_RESULT(>>Including tinysvcmdns mDNS support) - HAS_TINYSVCMDNS=1 + REQUESTED_TINYSVCMDNS=1 AC_DEFINE([CONFIG_TINYSVCMDNS], 1, [Needed by the compiler.])], ) -AM_CONDITIONAL([USE_TINYSVCMDNS], [test "x$HAS_TINYSVCMDNS" = "x1"]) +AM_CONDITIONAL([USE_TINYSVCMDNS], [test "x$REQUESTED_TINYSVCMDNS" = "x1"]) # Look for ALSA flag AC_ARG_WITH(alsa, [ --with-alsa = choose ALSA API support (GNU/Linux only)], [AC_MSG_RESULT(>>Including an ALSA back end) - HAS_ALSA=1 - AM_CONDITIONAL([USE_ALSA], [test 0]) + REQUESTED_ALSA=1 AC_DEFINE([CONFIG_ALSA], 1, [Needed by the compiler.]) if test "x${with_pkg_config}" = xyes ; then PKG_CHECK_MODULES( @@ -230,52 +222,53 @@ AC_ARG_WITH(alsa, [ --with-alsa = choose ALSA API support (GNU/Linux only)], AC_DEFINE([HAVE_LIBASOUND],[1],[Define to 1 if you have ALSA])]) else AC_CHECK_LIB([asound], [snd_pcm_open], , AC_MSG_ERROR(ALSA support requires the asound library!)) - AC_DEFINE([HAVE_LIBASOUND],[1],[Define to 1 if you have ALSA]) fi ]) -AM_CONDITIONAL([USE_ALSA], [test "x$HAS_ALSA" = "x1"]) +AM_CONDITIONAL([USE_ALSA], [test "x$REQUESTED_ALSA" = "x1"]) # Look for jack flag AC_ARG_WITH(jack, [ --with-jack = include a Jack Audio Connection Kit (jack) backend], [ AC_MSG_RESULT(>>Including a Jack Audio Connection Kit (jack) back end) - HAS_JACK=1 + REQUESTED_JACK=1 AC_DEFINE([CONFIG_JACK], 1, [Needed by the compiler.]) if test "x${with_pkg_config}" = xyes ; then PKG_CHECK_MODULES( [JACK], [jack], - [LIBS="${JACK_LIBS} ${LIBS}"],[AC_MSG_ERROR(Jack Audio Connection Kit support requires the jack library -- libjack-dev suggested!)]) + [LIBS="${JACK_LIBS} ${LIBS}" + AC_DEFINE([HAVE_JACK],[1],[Define to 1 if you have Jack audio])], + [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$HAS_JACK" = "x1"]) +AM_CONDITIONAL([USE_JACK], [test "x$REQUESTED_JACK" = "x1"]) # Look for SNDIO flag AC_ARG_WITH(sndio, [ --with-sndio = choose SNDIO API support], [ AC_MSG_RESULT(>>Including a SNDIO back end) - HAS_SNDIO=1 + REQUESTED_SNDIO=1 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$HAS_SNDIO" = "x1"]) +AM_CONDITIONAL([USE_SNDIO], [test "x$REQUESTED_SNDIO" = "x1"]) # Look for AO flag AC_ARG_WITH(ao, [ --with-ao = choose AO (Audio Output?) API support. N.B. no synchronisation -- so underflow or overflow is inevitable!], [ AC_MSG_RESULT(>>Including an AO back end. N.B. no synchronisation -- so underflow or overflow is inevitable!) - HAS_AO=1 + REQUESTED_AO=1 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$HAS_AO" = "x1"]) +AM_CONDITIONAL([USE_AO], [test "x$REQUESTED_AO" = "x1"]) # Look for Soundio flag AC_ARG_WITH(soundio, [ --with-soundio = choose soundio API support.], [ AC_MSG_RESULT(>>Including an soundio back end) - HAS_SOUNDIO=1 + 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$HAS_SOUNDIO" = "x1"]) +AM_CONDITIONAL([USE_SOUNDIO], [test "x$REQUESTED_SOUNDIO" = "x1"]) # Look for pulseaudio flag AC_ARG_WITH(pa, [ --with-pa = choose PulseAudio support.], [ AC_MSG_RESULT(>>Including a PulseAudio back end.) - HAS_PA=1 + REQUESTED_PA=1 AC_DEFINE([CONFIG_PA], 1, [Needed by the compiler.]) if test "x${with_pkg_config}" = xyes ; then PKG_CHECK_MODULES( @@ -285,92 +278,86 @@ AC_ARG_WITH(pa, [ --with-pa = choose PulseAudio support.], [ 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$HAS_PA" = "x1"]) +AM_CONDITIONAL([USE_PA], [test "x$REQUESTED_PA" = "x1"]) # Look for Convolution flag AC_ARG_WITH(convolution, [ --with-convolution = choose audio DSP convolution support], [ AC_MSG_RESULT(>>Including convolution support) - HAS_CONVOLUTION=1 + REQUESTED_CONVOLUTION=1 AM_INIT_AUTOMAKE([subdir-objects]) AC_DEFINE([CONFIG_CONVOLUTION], 1, [Needed by the compiler.]) AC_CHECK_LIB([sndfile], [sf_open], , AC_MSG_ERROR(Convolution support requires the sndfile library!))], ) -AM_CONDITIONAL([USE_CONVOLUTION], [test "x$HAS_CONVOLUTION" = "x1"]) +AM_CONDITIONAL([USE_CONVOLUTION], [test "x$REQUESTED_CONVOLUTION" = "x1"]) # Look for dns_sd flag AC_ARG_WITH(dns_sd, [ --with-dns_sd = choose dns_sd mDNS support], [ AC_MSG_RESULT(>>Including dns_sd for mDNS support) - HAS_DNS_SD=1 + REQUESTED_DNS_SD=1 AC_DEFINE([CONFIG_HAVE_DNS_SD_H], 1, [Needed by the compiler.]) AC_SEARCH_LIBS([DNSServiceRefDeallocate], [dns_sd], , AC_MSG_ERROR(dns_sd support requires the dns_sd library!))], ) -AM_CONDITIONAL([USE_DNS_SD], [test "x$HAS_DNS_SD" = "x1"]) +AM_CONDITIONAL([USE_DNS_SD], [test "x$REQUESTED_DNS_SD" = "x1"]) # Look for dbus flag AC_ARG_WITH(dbus-interface, [ --with-dbus-interface = include support for the native Shairport Sync D-Bus interface], [ AC_MSG_RESULT(>>Including dbus support) - HAS_DBUS=1 + REQUESTED_DBUS=1 AC_DEFINE([HAVE_DBUS], 1, [Needed by the compiler.]) PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.30.0],[CFLAGS="${GIO_UNIX_CFLAGS} ${CFLAGS}" LIBS="${GIO_UNIX_LIBS} ${LIBS}"],[AC_MSG_ERROR(dbus messaging support requires the glib 2.0 library -- libglib2.0-dev suggested!)]) ], ) -AM_CONDITIONAL([USE_DBUS], [test "x$HAS_DBUS" = "x1"]) +AM_CONDITIONAL([USE_DBUS], [test "x$REQUESTED_DBUS" = "x1"]) # Look for dbus test client flag AC_ARG_WITH(dbus-test-client, [ --with-dbus-test-client = compile dbus test client], [ AC_MSG_RESULT(>>Including dbus test client) - HAS_DBUS_CLIENT=1 + REQUESTED_DBUS_CLIENT=1 AC_DEFINE([HAVE_DBUS_CLIENT], 1, [Needed by the compiler.]) PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.30.0],[CFLAGS="${GIO_UNIX_CFLAGS} ${CFLAGS}" LIBS="${GIO_UNIX_LIBS} ${LIBS}"],[AC_MSG_ERROR(dbus client support requires the glib 2.0 library -- libglib2.0-dev suggested!)]) ], ) -AM_CONDITIONAL([USE_DBUS_CLIENT], [test "x$HAS_DBUS_CLIENT" = "x1"]) +AM_CONDITIONAL([USE_DBUS_CLIENT], [test "x$REQUESTED_DBUS_CLIENT" = "x1"]) # Look for mpris flag AC_ARG_WITH(mpris-interface, [ --with-mpris-interface = include support for a Shairport Sync D-Bus interface conforming to the MPRIS standard], [ AC_MSG_RESULT(>>Including the MPRIS D-Bus Interface) - HAS_MPRIS=1 + REQUESTED_MPRIS=1 AC_DEFINE([HAVE_MPRIS], 1, [Needed by the compiler.]) PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.30.0],[CFLAGS="${GIO_UNIX_CFLAGS} ${CFLAGS}" LIBS="${GIO_UNIX_LIBS} ${LIBS}"],[AC_MSG_ERROR(dbus messaging support for mpris requires the glib 2.0 library -- libglib2.0-dev suggested!)]) ], ) -AM_CONDITIONAL([USE_MPRIS], [test "x$HAS_MPRIS" = "x1"]) +AM_CONDITIONAL([USE_MPRIS], [test "x$REQUESTED_MPRIS" = "x1"]) # Look for mpris test client flag AC_ARG_WITH(mpris-test-client, [ --with-mpris-test-client = compile mpris test client], [ AC_MSG_RESULT(>>Including mpris test client) - HAS_MPRIS_CLIENT=1 + REQUESTED_MPRIS_CLIENT=1 AC_DEFINE([HAVE_MPRIS_CLIENT], 1, [Needed by the compiler.]) PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.30.0],[CFLAGS="${GIO_UNIX_CFLAGS} ${CFLAGS}" LIBS="${GIO_UNIX_LIBS} ${LIBS}"],[AC_MSG_ERROR(mpris client support requires the glib 2.0 library -- libglib2.0-dev suggested!)]) ], ) -AM_CONDITIONAL([USE_MPRIS_CLIENT], [test "x$HAS_MPRIS_CLIENT" = "x1"]) +AM_CONDITIONAL([USE_MPRIS_CLIENT], [test "x$REQUESTED_MPRIS_CLIENT" = "x1"]) -#AM_CONDITIONAL([USE_DBUS_CORE_AND_DACP], [test "x$HAS_MPRIS" = "x1" -o "x$HAS_DBUS" = "x1"]) +#AM_CONDITIONAL([USE_DBUS_CORE_AND_DACP], [test "x$REQUESTED_MPRIS" = "x1" -o "x$REQUESTED_DBUS" = "x1"]) # Look for mqtt flag AC_ARG_WITH(mqtt-client, [ --with-mqtt-client = include support for the native Shairport Sync MQTT interface], [ AC_MSG_RESULT(>>Including MQTT support) - HAS_MQTT=1 - AC_DEFINE([HAVE_MQTT], 1, [Needed by the compiler.]) - AC_DEFINE([CONFIG_MQTT], 1, [Needed by the compiler.]) + REQUESTED_MQTT=1 AC_CHECK_LIB([mosquitto], [mosquitto_lib_init], , AC_MSG_ERROR(MQTT support requires the mosquitto library -- libmosquitto-dev suggested!)) - AC_CHECK_HEADERS([mosquitto.h],,[AC_MSG_ERROR([ header missing])]) - AC_DEFINE([HAVE_MOSQUITTO],[1],[Define to 1 if you have the mosquitto library]) - - AC_MSG_RESULT(>>Enabling metadata as it is required by mqtt) - AC_DEFINE([CONFIG_METADATA], 1, [Needed by the compiler.]) - AC_DEFINE([USE_METADATA], 1, [Needed by the compiler.]) - PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.30.0],[CFLAGS="${GIO_UNIX_CFLAGS} ${CFLAGS}" LIBS="${GIO_UNIX_LIBS} ${LIBS}"],[AC_MSG_ERROR(dbus messaging support for mpris requires the glib 2.0 library -- libglib2.0-dev suggested!)]) ],) -AM_CONDITIONAL([USE_MQTT], [test "x$HAS_MQTT" = "x1"]) +AM_CONDITIONAL([USE_MQTT], [test "x$REQUESTED_MQTT" = "x1"]) -if test "x$HAS_MPRIS" = "x1" || test "x$HAS_DBUS" = "x1" || test "x$HAS_MQTT" = "x1"; then - AC_MSG_RESULT(>>Including the metadata hub) - HAS_METADATA_HUB=1 - AC_DEFINE([HAVE_METADATA_HUB], 1, [Needed by the compiler.]) - AC_MSG_RESULT(>>Including the DACP client) - HAS_DACP_CLIENT=1 - AC_DEFINE([HAVE_DACP_CLIENT], 1, [Needed by the compiler.]) +if test "x$REQUESTED_MPRIS" = "x1" || test "x$REQUESTED_DBUS" = "x1" || test "x$REQUESTED_MQTT" = "x1"; then + AC_MSG_RESULT(>>Including extended metadata and DACP client support) + REQUESTED_EXTENDED_METADATA_SUPPORT=1 + AC_DEFINE([CONFIG_METADATA_HUB], 1, [Needed by the compiler.]) + AC_DEFINE([CONFIG_DACP_CLIENT], 1, [Needed by the compiler.]) fi -AM_CONDITIONAL([USE_METADATA_HUB], [test "x$HAS_METADATA_HUB" = "x1"]) -AM_CONDITIONAL([USE_DACP_CLIENT], [test "x$HAS_DACP_CLIENT" = "x1"]) +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 + AC_MSG_RESULT(>>Including metadata support) + AC_DEFINE([CONFIG_METADATA], 1, [Needed by the compiler.]) +fi +AM_CONDITIONAL([USE_METADATA], [test "x$REQUESTED_METADATA" = "x1"]) if test "x${with_systemd}" = xyes ; then # Find systemd unit dir @@ -387,9 +374,6 @@ if test "x${with_systemd}" = xyes ; then [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) - AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) -else - AM_CONDITIONAL([HAVE_SYSTEMD], false) fi # Look for xmltoman diff --git a/dbus-service.c b/dbus-service.c index daf94e0f..0a66aed7 100644 --- a/dbus-service.c +++ b/dbus-service.c @@ -420,7 +420,7 @@ gboolean notify_drift_tolerance_callback(ShairportSync *skeleton, gboolean notify_alacdecoder_callback(ShairportSync *skeleton, __attribute__((unused)) gpointer user_data) { char *th = (char *)shairport_sync_get_alacdecoder(skeleton); -#ifdef HAVE_APPLE_ALAC +#ifdef HAVE_ALAC if (strcasecmp(th, "hammerton") == 0) config.use_apple_decoder = 0; else if (strcasecmp(th, "apple") == 0) @@ -677,7 +677,7 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name config.loudness_reference_volume_db); shairport_sync_set_drift_tolerance(SHAIRPORT_SYNC(shairportSyncSkeleton), config.tolerance); -#ifdef HAVE_APPLE_ALAC +#ifdef HAVE_ALAC if (config.use_apple_decoder == 0) { shairport_sync_set_alacdecoder(SHAIRPORT_SYNC(shairportSyncSkeleton), "hammerton"); debug(1, ">> ALACDecoder set to \"hammerton\""); diff --git a/mdns_avahi.c b/mdns_avahi.c index d9eb4b02..b739e716 100644 --- a/mdns_avahi.c +++ b/mdns_avahi.c @@ -33,7 +33,7 @@ #include "common.h" #include "mdns.h" #include "rtsp.h" -#ifdef HAVE_DACP_CLIENT +#ifdef CONFIG_DACP_CLIENT #include "dacp.h" #endif #include @@ -96,7 +96,7 @@ static void resolve_callback(AvahiServiceResolver *r, AVAHI_GCC_UNUSED AvahiIfIn dacpid += strlen("iTunes_Ctrl_"); if (strcmp(dacpid, dbs->dacp_id) == 0) { debug(3, "Client's DACP port: %u.", port); -#ifdef HAVE_DACP_CLIENT +#ifdef CONFIG_DACP_CLIENT dacp_monitor_port_update_callback(dacpid, port); #endif #ifdef CONFIG_METADATA @@ -140,7 +140,7 @@ static void browse_callback(AvahiServiceBrowser *b, AvahiIfIndex interface, Avah break; case AVAHI_BROWSER_REMOVE: debug(3, "(Browser) REMOVE: service '%s' of type '%s' in domain '%s'.", name, type, domain); -#ifdef HAVE_DACP_CLIENT +#ifdef CONFIG_DACP_CLIENT char *dacpid = strstr(name, "iTunes_Ctrl_"); if (dacpid) { dacpid += strlen("iTunes_Ctrl_"); diff --git a/player.c b/player.c index 73995fc4..a90ced91 100644 --- a/player.c +++ b/player.c @@ -67,18 +67,12 @@ #include #endif -#ifdef HAVE_METADATA_HUB +#ifdef CONFIG_METADATA_HUB #include "metadata_hub.h" #endif -#ifdef HAVE_DACP_CLIENT +#ifdef CONFIG_DACP_CLIENT #include "dacp.h" -#include -#endif - -#ifdef HAVE_DBUS -#include "dbus-interface.h" -#include "dbus-service.h" #endif #include "common.h" @@ -88,7 +82,7 @@ #include "alac.h" -#ifdef HAVE_APPLE_ALAC +#ifdef HAVE_ALAC #include "apple_alac.h" #endif @@ -276,7 +270,7 @@ static int alac_decode(short *dest, int *destlen, uint8_t *buf, int len, rtsp_co AES_cbc_encrypt(buf, packet, aeslen, &conn->aes, iv, AES_DECRYPT); #endif memcpy(packet + aeslen, buf + aeslen, len - aeslen); -#ifdef HAVE_APPLE_ALAC +#ifdef HAVE_ALAC if (config.use_apple_decoder) { if (conn->decoder_in_use != 1 << decoder_apple_alac) { debug(2, "Apple ALAC Decoder used on encrypted audio."); @@ -295,7 +289,7 @@ static int alac_decode(short *dest, int *destlen, uint8_t *buf, int len, rtsp_co } } else { // not encrypted -#ifdef HAVE_APPLE_ALAC +#ifdef HAVE_ALAC if (config.use_apple_decoder) { if (conn->decoder_in_use != 1 << decoder_apple_alac) { debug(2, "Apple ALAC Decoder used on unencrypted audio."); @@ -437,7 +431,7 @@ static int init_decoder(int32_t fmtp[12], rtsp_conn_info *conn) { alac->setinfo_8a_rate = fmtp[11]; alac_allocate_buffers(alac); // no pthread cancellation point in here -#ifdef HAVE_APPLE_ALAC +#ifdef HAVE_ALAC apple_alac_init(fmtp); // no pthread cancellation point in here #endif @@ -446,7 +440,7 @@ static int init_decoder(int32_t fmtp[12], rtsp_conn_info *conn) { static void terminate_decoders(rtsp_conn_info *conn) { alac_free(conn->decoder_info); -#ifdef HAVE_APPLE_ALAC +#ifdef HAVE_ALAC apple_alac_terminate(); #endif } @@ -1443,7 +1437,7 @@ void player_thread_cleanup_handler(void *arg) { elapsedHours, elapsedMin, elapsedSec, conn->input_frame_rate); } -#ifdef HAVE_DACP_CLIENT +#ifdef CONFIG_DACP_CLIENT relinquish_dacp_server_information( conn); // say it doesn't belong to this conversation thread any more... @@ -1694,7 +1688,7 @@ void *player_thread_func(void *arg) { 0; // number of times in a row that there's been a serious sync error // stop looking elsewhere for DACP stuff -#ifdef HAVE_DACP_CLIENT +#ifdef CONFIG_DACP_CLIENT // debug(1, "Set dacp server info"); // this does not have pthread cancellation points in it (assuming avahi doesn't) set_dacp_server_information(conn); // this will start scanning when a port is registered by the diff --git a/rtsp.c b/rtsp.c index 5c549e36..7feaaa37 100644 --- a/rtsp.c +++ b/rtsp.c @@ -63,11 +63,11 @@ #include "rtp.h" #include "rtsp.h" -#ifdef HAVE_METADATA_HUB +#ifdef CONFIG_METADATA_HUB #include "metadata_hub.h" #endif -#ifdef HAVE_MQTT +#ifdef HAVE_LIBMOSQUITTO #include "mqtt.h" #endif @@ -1298,10 +1298,10 @@ void *metadata_thread_function(__attribute__((unused)) void *ignore) { pthread_cleanup_push(metadata_pack_cleanup_function, (void *)&pack); if (config.metadata_enabled) { metadata_process(pack.type, pack.code, pack.data, pack.length); -#ifdef HAVE_METADATA_HUB +#ifdef CONFIG_METADATA_HUB metadata_hub_process_metadata(pack.type, pack.code, pack.data, pack.length); #endif -#ifdef HAVE_MQTT +#ifdef HAVE_LIBMOSQUITTO if (config.mqtt_enabled) { mqtt_process_metadata(pack.type, pack.code, pack.data, pack.length); } diff --git a/shairport.c b/shairport.c index 214e0d6e..457d1426 100644 --- a/shairport.c +++ b/shairport.c @@ -64,11 +64,11 @@ #include "rtp.h" #include "rtsp.h" -#if defined(HAVE_DACP_CLIENT) +#if defined(CONFIG_DACP_CLIENT) #include "dacp.h" #endif -#if defined(HAVE_METADATA_HUB) +#if defined(CONFIG_METADATA_HUB) #include "metadata_hub.h" #endif @@ -76,7 +76,7 @@ #include "dbus-service.h" #endif -#ifdef HAVE_MQTT +#ifdef HAVE_LIBMOSQUITTO #include "mqtt.h" #endif @@ -331,7 +331,7 @@ int parse_options(int argc, char **argv) { config.fixedLatencyOffset = 11025; // this sounds like it works properly. config.diagnostic_drop_packet_fraction = 0.0; -#ifdef HAVE_METADATA_HUB +#ifdef CONFIG_METADATA_HUB config.cover_art_cache_dir = "/tmp/shairport-sync/.cache/coverart"; config.scan_interval_when_active = 1; // number of seconds between DACP server scans when playing something @@ -853,7 +853,7 @@ int parse_options(int argc, char **argv) { } #endif -#ifdef CONFIG_MQTT +#ifdef HAVE_LIBMOSQUITTO int tmpval = 0; config_set_lookup_bool(config.cfg, "mqtt.enabled", &config.mqtt_enabled); if (config.mqtt_enabled && !config.metadata_enabled) { @@ -1007,7 +1007,7 @@ int parse_options(int argc, char **argv) { free(i3); free(vs); -#ifdef CONFIG_MQTT +#ifdef HAVE_LIBMOSQUITTO // mqtt topic was not set. As we have the service name just now, set it if (config.mqtt_topic == NULL) { int topic_length = 1 + strlen(config.service_name) + 1; @@ -1018,7 +1018,7 @@ int parse_options(int argc, char **argv) { #endif // now, check and calculate the pid directory -#ifdef USE_CUSTOM_PID_DIR +#ifdef DEFINED_CUSTOM_PID_DIR char *use_this_pid_dir = PIDDIR; #else char *use_this_pid_dir = "/var/run/shairport-sync"; @@ -1124,7 +1124,7 @@ void exit_function() { void main_cleanup_handler(__attribute__((unused)) void *arg) { debug(1, "main cleanup handler called."); -#ifdef HAVE_MQTT +#ifdef HAVE_LIBMOSQUITTO if (config.mqtt_enabled) { // terminate_mqtt(); } @@ -1142,12 +1142,12 @@ void main_cleanup_handler(__attribute__((unused)) void *arg) { pthread_join(dbus_thread, NULL); #endif -#ifdef HAVE_DACP_CLIENT +#ifdef CONFIG_DACP_CLIENT debug(1, "Stopping DACP Monitor"); dacp_monitor_stop(); #endif -#ifdef HAVE_METADATA_HUB +#ifdef CONFIG_METADATA_HUB debug(1, "Stopping metadata hub"); metadata_hub_stop(); #endif @@ -1239,7 +1239,7 @@ int main(int argc, char **argv) { config.output_rate = 44100; // default config.decoders_supported = 1 << decoder_hammerton; // David Hammerton's decoder supported by default -#ifdef HAVE_APPLE_ALAC +#ifdef HAVE_ALAC config.decoders_supported += 1 << decoder_apple_alac; #endif @@ -1595,12 +1595,12 @@ int main(int argc, char **argv) { metadata_init(); // create the metadata pipe if necessary #endif -#ifdef HAVE_METADATA_HUB +#ifdef CONFIG_METADATA_HUB // debug(1, "Initialising metadata hub"); metadata_hub_init(); #endif -#ifdef HAVE_DACP_CLIENT +#ifdef CONFIG_DACP_CLIENT // debug(1, "Requesting DACP Monitor"); dacp_monitor_start(); #endif @@ -1617,7 +1617,7 @@ int main(int argc, char **argv) { #endif #endif -#ifdef HAVE_MQTT +#ifdef HAVE_LIBMOSQUITTO if (config.mqtt_enabled) { initialise_mqtt(); }