]> git.ipfire.org Git - thirdparty/shairport-sync.git/blame - configure.ac
More of the configure.ac fixes done. Still incomplete.
[thirdparty/shairport-sync.git] / configure.ac
CommitLineData
9d450966
MB
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.50])
9af9dafb 5AC_INIT([shairport-sync], [3.3.8d4], [4265913+mikebrady@users.noreply.github.com])
9d450966
MB
6AM_INIT_AUTOMAKE
7AC_CONFIG_SRCDIR([shairport.c])
8AC_CONFIG_HEADERS([config.h])
b91df8ec 9AC_PROG_RANLIB
9d450966 10
60c3d6cf 11# Derived from the Avahi configure.ac file
60c3d6cf
MB
12# Specifying the OS type, defaulting to linux.
13#
f6eca4ca
MB
14AC_ARG_WITH(os, AS_HELP_STRING([--with-os=OSType],[Specify the distribution to target: One of linux freebsd or darwin]))
15if test "z$with_os" = "z"; then
16 with_os="linux"
60c3d6cf 17fi
f6eca4ca 18with_os=`echo ${with_os} | tr '[[:upper:]]' '[[:lower:]]' `
60c3d6cf 19
26ff0c20
MB
20if test "x${with_os}" != xlinux && "x${with_os}" != xfreebsd && "x${with_os}" != xdarwin ; then
21 AC_MSG_ERROR(--with-os=<arg> argument must linux, freebsd, openbsd or darwin)
22fi
23
9d450966
MB
24# Checks for programs.
25AC_PROG_CC
b7723d3a 26AC_PROG_CXX
9d450966
MB
27AC_PROG_INSTALL
28
2a430ec4
YM
29PKG_PROG_PKG_CONFIG([0.9.0])
30
9d450966 31# Checks for libraries.
f6eca4ca 32if test "x${with_os}" = xlinux -o "x${with_os}" = xfreebsd ; then
563d4c87
MB
33 AC_CHECK_LIB([rt],[clock_gettime], , AC_MSG_ERROR(librt needed))
34fi
35
1c045979
MB
36if test "x${with_os}" = xopenbsd ; then
37 AC_CHECK_LIB([c],[clock_gettime], , AC_MSG_ERROR(libc needed))
38fi
39
4aea4cc5 40AM_CONDITIONAL([BUILD_FOR_LINUX], [test "x${with_os}" = xlinux ])
f6eca4ca 41AM_CONDITIONAL([BUILD_FOR_FREEBSD], [test "x${with_os}" = xfreebsd ])
1c045979
MB
42AM_CONDITIONAL([BUILD_FOR_OPENBSD], [test "x${with_os}" = xopenbsd ])
43
44
282f79c9
MB
45##### Some build systems are not fully using pkg-config, so we can use the flag ${with_pkg_config} on a case-by-case basis
46##### to control how to deal with them
26ff0c20 47##### Note -- this flag is sometimes ignored, especially for newer packages
282f79c9 48
72176a95 49AC_ARG_WITH([pkg_config],[AS_HELP_STRING([--with-pkg-config],[use pkg-config to find libraries])],[],[with_pkg_config=yes])
282f79c9 50
9264f3a8
MB
51##### The following check for the pthreads library doesn't put the compiler into the correct pthread mode
52##### so we add the -pthread compilation flag in AMFLAGS in the Makefile.am as well.
53
9f46038d
MB
54AC_CHECK_LIB([pthread],[pthread_create], , AC_MSG_ERROR(pthread library needed))
55AC_CHECK_LIB([m],[exp], , AC_MSG_ERROR(maths library needed))
e73657d6 56
670dd933 57if test "x${with_pkg_config}" = xyes ; then
282f79c9 58 PKG_CHECK_MODULES(
72176a95
MB
59 [popt], [popt],
60 [CFLAGS="${popt_CFLAGS} ${CFLAGS}"
61 LIBS="${popt_LIBS} ${LIBS}"], AC_MSG_ERROR(libpopt needed))
282f79c9
MB
62else
63 AC_CHECK_LIB([popt],[poptGetContext], , AC_MSG_ERROR(libpopt needed))
64fi
85ca9317 65
2538e46a 66AC_ARG_WITH([dummy],[AS_HELP_STRING([--with-dummy],[include the dummy audio back end])])
72176a95 67if test "x$with_dummy" = "xyes" ; then
2538e46a 68 AC_MSG_RESULT(include the dummy audio back end)
72176a95
MB
69 AC_DEFINE([CONFIG_DUMMY], 1, [Needed by the compiler.])
70fi
670dd933 71AM_CONDITIONAL([USE_DUMMY], [test "x$with_dummy" = "xyes" ])
a090a14c 72
2538e46a 73AC_ARG_WITH([stdout],[AS_HELP_STRING([--with-stdout],[include the stdout audio back end])])
72176a95 74if test "x$with_stdout" = "xyes" ; then
2538e46a 75 AC_MSG_RESULT(include the stdout audio back end)
72176a95
MB
76 AC_DEFINE([CONFIG_STDOUT], 1, [Needed by the compiler.])
77fi
78AM_CONDITIONAL([USE_STDOUT], [test "x$with_stdout" = "xyes"])
a090a14c 79
2538e46a 80AC_ARG_WITH([pipe],[AS_HELP_STRING([--with-pipe],[include the pipe audio back end])])
72176a95 81if test "x$with_pipe" = "xyes" ; then
2538e46a 82 AC_MSG_RESULT(include the pipe audio back end)
72176a95
MB
83 AC_DEFINE([CONFIG_PIPE], 1, [Needed by the compiler.])
84fi
26ff0c20 85AM_CONDITIONAL([USE_PIPE], [test "x$with_pipe" = "xyes" ])
670dd933
MB
86
87# Check to see if we should include the System V initscript
88
2538e46a 89AC_ARG_WITH([systemv],[AS_HELP_STRING([--with-systemv],[install a System V startup script during a make install])])
670dd933 90AM_CONDITIONAL([INSTALL_SYSTEMV], [test "x$with_systemv" = "xyes"])
a090a14c 91
670dd933 92# Check to see if we should include the systemd stuff to define it as a service
2de9a580 93
2538e46a 94AC_ARG_WITH([systemd],[AS_HELP_STRING([--with-systemd],[install a systemd startup script during a make install])])
670dd933
MB
95AM_CONDITIONAL([INSTALL_SYSTEMD], [test "x$with_systemd" = "xyes"])
96
2538e46a 97AC_ARG_WITH([freebsd-service],[AS_HELP_STRING([--with-freebsd-service],[install a FreeBSD startup script during a make install])])
f6eca4ca 98AM_CONDITIONAL([INSTALL_FREEBSD_SERVICE], [test "x$with_freebsd_service" = "xyes"])
670dd933 99
2538e46a 100AC_ARG_WITH([cygwin-service],[AS_HELP_STRING([--with-cygwin-service],[install a CYGWIN config script during a make install])])
623b9b4b
MB
101AM_CONDITIONAL([INSTALL_CYGWIN_SERVICE], [test "x$with_cygwin_service" = "xyes"])
102
26ff0c20
MB
103AC_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])])
104if test "x$with_external_mdns" = xyes ; then
105 AC_MSG_RESULT(include external mdns support)
106 AC_DEFINE([CONFIG_EXTERNAL_MDNS], 1, [Use 'avahi-publish-service' or 'mDNSPublish' to advertise.])
107fi
3162977c
MB
108AM_CONDITIONAL([USE_EXTERNAL_MDNS], [test "x$with_external_mdns" = "xyes" ])
109
670dd933
MB
110# Add the libconfig package
111if test "x${with_pkg_config}" = xyes ; then
112 PKG_CHECK_MODULES(
2538e46a
MB
113 [libconfig], [libconfig],
114 [LIBS="${libconfig_LIBS} ${LIBS}"], AC_MSG_ERROR([libconfig library needed]))
670dd933
MB
115else
116 AC_CHECK_LIB([config],[config_init], , AC_MSG_ERROR([libconfig library needed]))
e73657d6 117fi
f29792d9 118
2538e46a 119AC_ARG_WITH([configfiles],[AS_HELP_STRING([--with-configfiles],[install configuration files during a make install])], ,[with_configfiles=yes])
670dd933 120AM_CONDITIONAL([INSTALL_CONFIG_FILES], [test "x$with_configfiles" = "xyes"])
f29792d9 121
b7723d3a 122# Look for Apple ALAC flag
2538e46a 123AC_ARG_WITH(apple-alac,[AS_HELP_STRING([--with-apple-alac],[include support for the Apple ALAC decoder])])
72176a95 124if test "x${with_apple_alac}" = "xyes" ; then
c9b3d2a2 125 AC_DEFINE([CONFIG_APPLE_ALAC], 1, [Include support for using the Apple ALAC Decoder])
b7723d3a 126 if test "x${with_pkg_config}" = xyes ; then
3612fa37 127 PKG_CHECK_MODULES([alac], [alac], [LIBS="${alac_LIBS} ${LIBS}"], AC_MSG_ERROR(Apple ALAC Decoder support requires the ALAC library.))
b7723d3a 128 else
3612fa37 129 AC_CHECK_LIB([alac], [BitBufferInit], , AC_MSG_ERROR(Apple ALAC Decoder support requires the ALAC library.))
72176a95
MB
130 fi
131fi
132AM_CONDITIONAL([USE_APPLE_ALAC], [test "x${with_apple_alac}" = "xyes"])
270d2920 133
043363fb 134# Look for piddir flag
26ff0c20
MB
135AC_ARG_WITH(piddir, [AS_HELP_STRING([--with-piddir=<pathname>],[Specify a pathname to a directory in which to write the PID file.])])
136if test "x${with_piddir}" != "x" ; then
043363fb
MB
137 AC_MSG_CHECKING(--with-piddir argument)
138 if test "x${with_piddir}" = x -o "x${with_piddir}" = xyes ; then
139 AC_MSG_RESULT(not found)
140 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)
141 fi
142 AC_MSG_RESULT(${with_piddir})
26ff0c20
MB
143 AC_SUBST(CUSTOM_PID_DIR,["${with_piddir}"])
144 AC_DEFINE([DEFINED_CUSTOM_PID_DIR],1,[Hook up special proc to libdaemon to point to this directory])
145fi
146AM_CONDITIONAL([USE_CUSTOMPIDDIR], [ test "x${with_piddir}" != "x" ])
6d088ac4
MB
147
148# Look for libdaemon
26ff0c20
MB
149AC_ARG_WITH(libdaemon,[AS_HELP_STRING([--with-libdaemon],[include support for daemonising in non-systemd systems])])
150if test "x$with_libdaemon" = "x1"; then
6d088ac4
MB
151 AC_DEFINE([CONFIG_LIBDAEMON], 1, [Include libdaemon])
152 if test "x${with_pkg_config}" = xyes ; then
153 PKG_CHECK_MODULES(
154 [DAEMON], [libdaemon],
155 [LIBS="${DAEMON_LIBS} ${LIBS}"])
156 else
157 AC_CHECK_LIB([daemon],[daemon_fork], , AC_MSG_ERROR(libdaemon needed))
158 fi
159fi
26ff0c20 160AM_CONDITIONAL([USE_LIBDAEMON], [test "x$with_libdaemon" = "x1"])
12f26893 161
9cafb4b4 162# Check --with-ssl=argument
26ff0c20
MB
163AC_ARG_WITH(ssl, [AS_HELP_STRING([--with-ssl=<argument>],[choose --with-ssl=openssl, --with-ssl=mbedtls or --with-ssl=polarssl (deprecated) for encryption services ])])
164
165if test "x${with_ssl}" = xopenssl ; then
166 AC_DEFINE([CONFIG_OPENSSL], 1, [Use the OpenSSL libraries for encryption and encoding and decoding])
167 if test "x${with_pkg_config}" = xyes ; then
168 PKG_CHECK_MODULES(
169 [SSL], [libssl,libcrypto],
170 [LIBS="${SSL_LIBS} ${LIBS}"])
171 else
172 AC_CHECK_LIB([crypto], [main], , AC_MSG_ERROR(libcrypto selected but the library cannot be found!))
173 AC_CHECK_LIB([ssl], [main], , AC_MSG_ERROR(libssl selected but the library cannot be found!))
174 fi
175elif test "x${with_ssl}" = xmbedtls ; then
176 AC_DEFINE([CONFIG_MBEDTLS], 1, [Use the mbed TLS libraries for encryption and encoding and decoding])
177 AC_CHECK_LIB([mbedtls],[mbedtls_ssl_init],,
fe202167 178 [AC_MSG_ERROR([mbed tls support requires the mbedtls library -- libmbedtls-dev suggested],1)])
26ff0c20
MB
179 AC_CHECK_LIB([mbedcrypto], [mbedtls_entropy_func],,
180 [AC_MSG_ERROR([mbed tls support requires the mbedcrypto library -- libmbedcrypto0 suggested],1)])
181 AC_CHECK_LIB([mbedx509], [mbedtls_pk_init],,
182 [AC_MSG_ERROR([mbed tls support requires the mbedx509 library -- libmbedx509-0 suggested],1)])
183elif test "x${with_ssl}" = xpolarssl ; then
184 AC_DEFINE([CONFIG_POLARSSL], 1, [Use the PolarSSL libraries for encryption and encoding and decoding])
185 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.))
186else
187 AC_MSG_ERROR(specify one of --with-ssl=openssl or --with-ssl=mbedtls or --with-ssl=polarssl)
188fi
2de9a580
MB
189
190# Look for soxr flag
26ff0c20
MB
191
192AC_ARG_WITH(soxr, [AS_HELP_STRING([--with-soxr],[choose libsoxr for high-quality interpolation])])
193if test "x$with_soxr" = "xyes" ; then
6cbaa15b 194 AC_DEFINE([CONFIG_SOXR], 1, [Include support for using the SoX Resampler library for interpolation])
5101ab2d
MB
195 if test "x${with_pkg_config}" = xyes ; then
196 PKG_CHECK_MODULES(
2538e46a
MB
197 [soxr], [soxr],
198 [LIBS="${soxr_LIBS} ${LIBS}"],
4f9730e3 199 [AC_MSG_ERROR(soxr support requires the libsoxr library -- libsoxr-dev suggested!)])
5101ab2d
MB
200 else
201 AC_CHECK_LIB([avutil],[av_get_cpu_flags])
202 if test "x${ac_cv_lib_avutil_av_get_cpu_flags}" = xyes ; then
203 # soxr may link against libavutil, depending on the architecture, but for the sake of simplicity link with it if it is found
4f9730e3 204 AC_CHECK_LIB([soxr],[soxr_create], , AC_MSG_ERROR(soxr support requires the libsoxr library -- libsoxr-dev suggested!), [-lavutil])
5101ab2d 205 else
4f9730e3 206 AC_CHECK_LIB([soxr],[soxr_create], , AC_MSG_ERROR(soxr support requires the libsoxr library -- libsoxr-dev suggested!))
5101ab2d
MB
207 fi
208 fi
26ff0c20 209fi
5f3b96f0 210
69642bb7 211# Look for metadata flag and resolve it further down the script
26ff0c20 212AC_ARG_WITH(metadata,[AS_HELP_STRING([--with-metadata],[include support for a metadata feed])])
75f3f912 213
5f3b96f0 214# 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
9d450966
MB
215# and the relevant link files are added.
216
217# Look for avahi flag
26ff0c20
MB
218AC_ARG_WITH(avahi, [AS_HELP_STRING([--with-avahi],[choose Avahi-based mDNS support])])
219if test "x$with_avahi" = "xyes" ; then
9d450966
MB
220 AC_DEFINE([CONFIG_AVAHI], 1, [Needed by the compiler.])
221 AC_CHECK_LIB([avahi-client], [avahi_client_new], , AC_MSG_ERROR(Avahi support requires the avahi-client library!))
26ff0c20
MB
222 AC_CHECK_LIB([avahi-common],[avahi_strerror], , AC_MSG_ERROR(Avahi support requires the avahi-common library!))
223fi
224AM_CONDITIONAL([USE_AVAHI], [test "x$with_avahi" = "xyes"])
9d450966 225
2de9a580 226# Look for tinysvcmdns flag
26ff0c20
MB
227AC_ARG_WITH(tinysvcmdns, [AS_HELP_STRING([--with-tinysvcmdns],[choose tinysvcmdns-based mDNS support])])
228if test "x$with_tinysvcmdns" = "xyes" ; then
229 AC_DEFINE([CONFIG_TINYSVCMDNS], 1, [Include TinySVCmDNS-based mDNS support])
230fi
231AM_CONDITIONAL([USE_TINYSVCMDNS], [test "x$with_tinysvcmdns" = "xyes"])
2de9a580 232
9d450966 233# Look for ALSA flag
26ff0c20
MB
234AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa],[choose ALSA API support (GNU/Linux only)])])
235if test "x$with_alsa" = "xyes" ; then
9d450966 236 AC_DEFINE([CONFIG_ALSA], 1, [Needed by the compiler.])
8e8a0ee7 237 if test "x${with_pkg_config}" = xyes ; then
5f919264 238 PKG_CHECK_MODULES(
2538e46a
MB
239 [alsa], [alsa],
240 [LIBS="${alsa_LIBS} ${LIBS}"])
5f919264
MB
241 else
242 AC_CHECK_LIB([asound], [snd_pcm_open], , AC_MSG_ERROR(ALSA support requires the asound library!))
26ff0c20
MB
243 fi
244fi
245AM_CONDITIONAL([USE_ALSA], [test "x$with_alsa" = "xyes"])
9d450966 246
8cabb16f 247# Look for jack flag
26ff0c20
MB
248AC_ARG_WITH(jack, [AS_HELP_STRING([--with-jack],[include a Jack Audio Connection Kit (jack) backend])])
249if test "x$with_jack" = "xyes" ; then
8cabb16f
MB
250 AC_DEFINE([CONFIG_JACK], 1, [Needed by the compiler.])
251 if test "x${with_pkg_config}" = xyes ; then
252 PKG_CHECK_MODULES(
2538e46a
MB
253 [jack], [jack],
254 [LIBS="${jack_LIBS} ${LIBS}"],
69642bb7 255 [AC_MSG_ERROR(Jack Audio Connection Kit support requires the jack library -- libjack-dev suggested!)])
8cabb16f
MB
256 else
257 AC_CHECK_LIB([jack], [jack_client_open], , AC_MSG_ERROR(Jack Audio Connection Kit support requires the jack library -- libjack-dev suggested!))
26ff0c20
MB
258 fi
259fi
260AM_CONDITIONAL([USE_JACK], [test "x$with_jack" = "xyes"])
9d450966
MB
261
262# Look for SNDIO flag
26ff0c20
MB
263AC_ARG_WITH(sndio, [AS_HELP_STRING([--with-sndio],[choose SNDIO API support])])
264if test "x$with_sndio" = "xyes" ; then
9d450966 265 AC_DEFINE([CONFIG_SNDIO], 1, [Needed by the compiler.])
26ff0c20
MB
266 AC_CHECK_LIB([sndio], [sio_open], , AC_MSG_ERROR(SNDIO support requires the sndio library -- libsndio-dev suggested))
267fi
268AM_CONDITIONAL([USE_SNDIO], [test "x$with_sndio" = "xyes"])
270d2920 269
9d450966 270# Look for AO flag
26ff0c20
MB
271AC_ARG_WITH(ao, [AS_HELP_STRING([--with-ao],[choose AO (Audio Output?) API support. N.B. no synchronisation -- so underflow or overflow is inevitable!])])
272if test "x$with_ao" = "xyes" ; then
9d450966 273 AC_DEFINE([CONFIG_AO], 1, [Needed by the compiler.])
26ff0c20
MB
274 AC_CHECK_LIB([ao], [ao_initialize], , AC_MSG_ERROR(AO support requires the ao library -- libao-dev suggested))
275fi
276AM_CONDITIONAL([USE_AO], [test "x$with_ao" = "xyes"])
9d450966 277
b7723d3a 278# Look for Soundio flag
26ff0c20
MB
279AC_ARG_WITH(soundio, [AS_HELP_STRING([--with-soundio],[choose soundio API support.])])
280if test "x$with_soundio" = "xyes" ; then
281 AC_DEFINE([CONFIG_SOUNDIO], 1, [Include SoundIO Support.])
282 AC_CHECK_LIB([soundio], [soundio_create], , AC_MSG_ERROR(soundio support requires the soundio library -- libsoundio-dev suggested))
283fi
284AM_CONDITIONAL([USE_SOUNDIO], [test "x$with_soundio" = "xyes"])
b7723d3a 285
9d450966 286# Look for pulseaudio flag
26ff0c20
MB
287AC_ARG_WITH(pa, [AS_HELP_STRING([--with-pa],[choose PulseAudio support.])])
288if test "x$with_pa" = "xyes" ; then
b3ae05ea
MB
289 AC_DEFINE([CONFIG_PA], 1, [Needed by the compiler.])
290 if test "x${with_pkg_config}" = xyes ; then
291 PKG_CHECK_MODULES(
292 [PULSEAUDIO], [libpulse >= 0.9.2],
293 [LIBS="${PULSEAUDIO_LIBS} ${LIBS}"],[AC_MSG_ERROR(PulseAudio support requires the libpulse-dev library!)])
294 else
295 AC_CHECK_LIB([pulse-simple], [pa_simple_new], , AC_MSG_ERROR(PulseAudio support requires the libpulse library!))
296 AC_CHECK_LIB([pulse], [pa_stream_peek], , AC_MSG_ERROR(PulseAudio support requires the libpulse-dev library.))
26ff0c20
MB
297 fi
298fi
299AM_CONDITIONAL([USE_PA], [test "x$with_pa" = "xyes"])
b3ae05ea 300
7b9cd28e 301# Look for Convolution flag
2538e46a 302AC_ARG_WITH(convolution, [AS_HELP_STRING([--with-convolution],[choose audio DSP convolution support])], [
69642bb7 303 REQUESTED_CONVOLUTION=1
7b9cd28e
YP
304 AM_INIT_AUTOMAKE([subdir-objects])
305 AC_DEFINE([CONFIG_CONVOLUTION], 1, [Needed by the compiler.])
54d13238 306 AC_CHECK_LIB([sndfile], [sf_open], , AC_MSG_ERROR(Convolution support requires the sndfile library -- libsndfile1-dev suggested!))], )
69642bb7 307AM_CONDITIONAL([USE_CONVOLUTION], [test "x$REQUESTED_CONVOLUTION" = "x1"])
7b9cd28e 308
9d450966 309# Look for dns_sd flag
2538e46a 310AC_ARG_WITH(dns_sd, [AS_HELP_STRING([--with-dns_sd],[choose dns_sd mDNS support])], [
69642bb7 311 REQUESTED_DNS_SD=1
c9b3d2a2 312 AC_DEFINE([CONFIG_DNS_SD], 1, [Needed by the compiler.])
270d2920 313 AC_SEARCH_LIBS([DNSServiceRefDeallocate], [dns_sd], , AC_MSG_ERROR(dns_sd support requires the dns_sd library!))], )
69642bb7 314AM_CONDITIONAL([USE_DNS_SD], [test "x$REQUESTED_DNS_SD" = "x1"])
9d450966 315
1e07e1e0 316# Look for dbus flag
2538e46a 317AC_ARG_WITH(dbus-interface, [AS_HELP_STRING([--with-dbus-interface],[include support for the native Shairport Sync D-Bus interface])], [
c9b3d2a2 318 AC_DEFINE([CONFIG_DBUS_INTERFACE], 1, [Include support for the native Shairport Sync D-Bus interface])
69642bb7 319 REQUESTED_DBUS=1
3612fa37 320 PKG_CHECK_MODULES([glib], [gio-unix-2.0 >= 2.30.0],[CFLAGS="${glib_CFLAGS} ${CFLAGS}" LIBS="${glib_LIBS} ${LIBS}"],[AC_MSG_ERROR(D-Bus messaging support requires the glib 2.0 library -- libglib2.0-dev suggested!)])
1e07e1e0 321 ], )
69642bb7 322AM_CONDITIONAL([USE_DBUS], [test "x$REQUESTED_DBUS" = "x1"])
1e07e1e0
MB
323
324# Look for dbus test client flag
2538e46a 325AC_ARG_WITH(dbus-test-client, [AS_HELP_STRING([--with-dbus-test-client],[compile a separare D-Bus test client])], [
69642bb7 326 REQUESTED_DBUS_CLIENT=1
3612fa37 327 PKG_CHECK_MODULES([glib], [gio-unix-2.0 >= 2.30.0],[CFLAGS="${glib_CFLAGS} ${CFLAGS}" LIBS="${glib_LIBS} ${LIBS}"],[AC_MSG_ERROR(D-Bus client support requires the glib 2.0 library -- libglib2.0-dev suggested!)])
1e07e1e0 328 ], )
69642bb7 329AM_CONDITIONAL([USE_DBUS_CLIENT], [test "x$REQUESTED_DBUS_CLIENT" = "x1"])
1e07e1e0 330
74f41a17 331# Look for mpris flag
2538e46a 332AC_ARG_WITH(mpris-interface, [AS_HELP_STRING([--with-mpris-interface],[include support for a D-Bus interface conforming to the MPRIS standard])], [
c9b3d2a2 333 AC_DEFINE([CONFIG_MPRIS_INTERFACE], 1, [Include support for a D-Bus interface conforming to the MPRIS standard])
69642bb7 334 REQUESTED_MPRIS=1
3612fa37 335 PKG_CHECK_MODULES([glib], [gio-unix-2.0 >= 2.30.0],[CFLAGS="${glib_CFLAGS} ${CFLAGS}" LIBS="${glib_LIBS} ${LIBS}"],[AC_MSG_ERROR(MPRIS messaging support for mpris requires the glib 2.0 library -- libglib2.0-dev suggested!)])
74f41a17 336 ], )
69642bb7 337AM_CONDITIONAL([USE_MPRIS], [test "x$REQUESTED_MPRIS" = "x1"])
74f41a17 338
df7c48f0 339# Look for mpris test client flag
2538e46a 340AC_ARG_WITH(mpris-test-client, [AS_HELP_STRING([--with-mpris-test-client],[compile an separate MPRIS test client])], [
69642bb7 341 REQUESTED_MPRIS_CLIENT=1
3612fa37 342 PKG_CHECK_MODULES([glib], [gio-unix-2.0 >= 2.30.0],[CFLAGS="${glib_CFLAGS} ${CFLAGS}" LIBS="${glib_LIBS} ${LIBS}"],[AC_MSG_ERROR(MPRIS client support requires the glib 2.0 library -- libglib2.0-dev suggested!)])
df7c48f0 343 ], )
69642bb7 344AM_CONDITIONAL([USE_MPRIS_CLIENT], [test "x$REQUESTED_MPRIS_CLIENT" = "x1"])
df7c48f0 345
02694948 346# Look for mqtt flag
2538e46a 347AC_ARG_WITH(mqtt-client, [AS_HELP_STRING([--with-mqtt-client],[include a client for MQTT -- the Message Queuing Telemetry Transport protocol])], [
c9b3d2a2 348 AC_DEFINE([CONFIG_MQTT], 1, [Include a client for MQTT, the Message Queuing Telemetry Transport protocol])
69642bb7 349 REQUESTED_MQTT=1
820486ad 350 AC_CHECK_LIB([mosquitto], [mosquitto_lib_init], , AC_MSG_ERROR(MQTT support requires the mosquitto library -- libmosquitto-dev suggested!))
02694948 351 ],)
69642bb7 352AM_CONDITIONAL([USE_MQTT], [test "x$REQUESTED_MQTT" = "x1"])
02694948 353
26ff0c20 354if test "x$REQUESTED_MQTT" = "x1" && test "x$with_avahi" = "xyes" ; then
2538e46a 355 AC_MSG_WARN([MQTT needs Avahi to allow remote control functionality. At present, only metadata publishing will be supported])
60b9347a 356fi
065eada6 357
69642bb7 358if test "x$REQUESTED_MPRIS" = "x1" || test "x$REQUESTED_DBUS" = "x1" || test "x$REQUESTED_MQTT" = "x1"; then
69642bb7
MB
359 REQUESTED_EXTENDED_METADATA_SUPPORT=1
360 AC_DEFINE([CONFIG_METADATA_HUB], 1, [Needed by the compiler.])
361 AC_DEFINE([CONFIG_DACP_CLIENT], 1, [Needed by the compiler.])
065eada6 362fi
69642bb7
MB
363AM_CONDITIONAL([USE_METADATA_HUB], [test "x$REQUESTED_EXTENDED_METADATA_SUPPORT" = "x1"])
364AM_CONDITIONAL([USE_DACP_CLIENT], [test "x$REQUESTED_EXTENDED_METADATA_SUPPORT" = "x1"])
065eada6 365
26ff0c20 366if test "x$REQUESTED_EXTENDED_METADATA_SUPPORT" = "x1" || test "x$with_metadata" = "xyes" ; then
69642bb7
MB
367 AC_DEFINE([CONFIG_METADATA], 1, [Needed by the compiler.])
368fi
26ff0c20 369AM_CONDITIONAL([USE_METADATA], [test "x$with_metadata" = "xyes"])
74f41a17 370
b7723d3a
MB
371if test "x${with_systemd}" = xyes ; then
372 # Find systemd unit dir
373 AC_ARG_WITH([systemdsystemunitdir],
374 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
375 [with_systemdsystemunitdir=auto])
376 AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
377 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
378
379 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
380 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
381 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
382 with_systemdsystemunitdir=no],
383 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
384 AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
385 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
b7723d3a 386fi
0ad11fb1 387
6f8ee38d
CB
388# Look for xmltoman
389AC_CHECK_PROGS([XMLTOMAN], [xmltoman])
390if test -z "$XMLTOMAN"; then
2538e46a 391 AC_MSG_WARN([xmltoman not found - not rebuilding man pages])
6f8ee38d
CB
392fi
393AM_CONDITIONAL([HAVE_XMLTOMAN], [test -n "$XMLTOMAN"])
394
9d450966
MB
395# Checks for header files.
396AC_HEADER_STDC
397AC_CHECK_HEADERS([getopt_long.h])
04aa3261 398AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h mach/mach.h memory.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h syslog.h unistd.h])
9d450966
MB
399
400# Checks for typedefs, structures, and compiler characteristics.
5bdc16e3
MB
401AC_C_INLINE
402AC_TYPE_INT16_T
403AC_TYPE_INT32_T
404AC_TYPE_INT64_T
405AC_TYPE_PID_T
406AC_TYPE_SIZE_T
407AC_TYPE_SSIZE_T
408AC_TYPE_UINT16_T
409AC_TYPE_UINT32_T
410AC_TYPE_UINT64_T
411AC_TYPE_UINT8_T
9d450966
MB
412
413# Checks for library functions.
04aa3261 414AC_FUNC_ALLOCA
5bdc16e3
MB
415AC_FUNC_ERROR_AT_LINE
416AC_FUNC_FORK
04aa3261 417AC_CHECK_FUNCS([atexit clock_gettime gethostname inet_ntoa memchr memmove memset mkfifo pow select socket stpcpy strcasecmp strchr strdup strerror strstr strtol strtoul])
9d450966 418
49788bd6 419AC_CONFIG_FILES([Makefile man/Makefile scripts/shairport-sync.service])
93516018 420AC_CONFIG_FILES([scripts/shairport-sync],[chmod +x scripts/shairport-sync])
9d450966 421AC_OUTPUT