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