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