]>
Commit | Line | Data |
---|---|---|
9d450966 MB |
1 | # -*- Autoconf -*- |
2 | # Process this file with autoconf to produce a configure script. | |
3 | ||
4 | AC_PREREQ([2.50]) | |
37faed13 | 5 | AC_INIT([shairport-sync], [4.1-dev], [4265913+mikebrady@users.noreply.github.com]) |
424cc398 | 6 | AM_INIT_AUTOMAKE([subdir-objects]) |
9d450966 MB |
7 | AC_CONFIG_SRCDIR([shairport.c]) |
8 | AC_CONFIG_HEADERS([config.h]) | |
b91df8ec | 9 | AC_PROG_RANLIB |
9d450966 | 10 | |
2203d6a3 | 11 | AC_CHECK_PROGS([GIT], [git]) |
d4a625cf | 12 | if 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'.]) |
14 | fi | |
d4a625cf | 15 | AM_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 | 20 | AC_ARG_WITH(os, AS_HELP_STRING([--with-os=OSType],[Specify the distribution to target: One of linux, freebsd, openbsd or darwin])) |
f6eca4ca MB |
21 | if test "z$with_os" = "z"; then |
22 | with_os="linux" | |
60c3d6cf | 23 | fi |
f6eca4ca | 24 | with_os=`echo ${with_os} | tr '[[:upper:]]' '[[:lower:]]' ` |
5aeb4ab9 AL |
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 | |
26ff0c20 | 32 | |
9d450966 MB |
33 | # Checks for programs. |
34 | AC_PROG_CC | |
b7723d3a | 35 | AC_PROG_CXX |
9d450966 MB |
36 | AC_PROG_INSTALL |
37 | ||
2a430ec4 YM |
38 | PKG_PROG_PKG_CONFIG([0.9.0]) |
39 | ||
9d450966 | 40 | # Checks for libraries. |
f6eca4ca | 41 | if 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)) |
43 | fi | |
44 | ||
1c045979 MB |
45 | if test "x${with_os}" = xopenbsd ; then |
46 | AC_CHECK_LIB([c],[clock_gettime], , AC_MSG_ERROR(libc needed)) | |
47 | fi | |
48 | ||
e925e196 | 49 | # Pass the conditionals to automake |
4aea4cc5 | 50 | AM_CONDITIONAL([BUILD_FOR_LINUX], [test "x${with_os}" = xlinux ]) |
f6eca4ca | 51 | AM_CONDITIONAL([BUILD_FOR_FREEBSD], [test "x${with_os}" = xfreebsd ]) |
1c045979 MB |
52 | AM_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 | 58 | AC_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 |
63 | AC_CHECK_LIB([pthread],[pthread_create], , AC_MSG_ERROR(pthread library needed)) |
64 | AC_CHECK_LIB([m],[exp], , AC_MSG_ERROR(maths library needed)) | |
e73657d6 | 65 | |
670dd933 | 66 | if 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 |
71 | else |
72 | AC_CHECK_LIB([popt],[poptGetContext], , AC_MSG_ERROR(libpopt needed)) | |
73 | fi | |
85ca9317 | 74 | |
2538e46a | 75 | AC_ARG_WITH([dummy],[AS_HELP_STRING([--with-dummy],[include the dummy audio back end])]) |
72176a95 | 76 | if 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 | 79 | fi |
670dd933 | 80 | AM_CONDITIONAL([USE_DUMMY], [test "x$with_dummy" = "xyes" ]) |
a090a14c | 81 | |
2538e46a | 82 | AC_ARG_WITH([stdout],[AS_HELP_STRING([--with-stdout],[include the stdout audio back end])]) |
72176a95 | 83 | if 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 |
86 | fi |
87 | AM_CONDITIONAL([USE_STDOUT], [test "x$with_stdout" = "xyes"]) | |
a090a14c | 88 | |
2538e46a | 89 | AC_ARG_WITH([pipe],[AS_HELP_STRING([--with-pipe],[include the pipe audio back end])]) |
72176a95 | 90 | if 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 | 93 | fi |
26ff0c20 | 94 | AM_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 | 98 | AC_ARG_WITH([systemv],[AS_HELP_STRING([--with-systemv],[install a System V startup script during a make install])]) |
670dd933 | 99 | AM_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 | 103 | AC_ARG_WITH([systemd],[AS_HELP_STRING([--with-systemd],[install a systemd startup script during a make install])]) |
670dd933 MB |
104 | AM_CONDITIONAL([INSTALL_SYSTEMD], [test "x$with_systemd" = "xyes"]) |
105 | ||
2538e46a | 106 | AC_ARG_WITH([freebsd-service],[AS_HELP_STRING([--with-freebsd-service],[install a FreeBSD startup script during a make install])]) |
f6eca4ca | 107 | AM_CONDITIONAL([INSTALL_FREEBSD_SERVICE], [test "x$with_freebsd_service" = "xyes"]) |
670dd933 | 108 | |
2538e46a | 109 | AC_ARG_WITH([cygwin-service],[AS_HELP_STRING([--with-cygwin-service],[install a CYGWIN config script during a make install])]) |
623b9b4b MB |
110 | AM_CONDITIONAL([INSTALL_CYGWIN_SERVICE], [test "x$with_cygwin_service" = "xyes"]) |
111 | ||
26ff0c20 MB |
112 | 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])]) |
113 | if 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.]) | |
116 | fi | |
3162977c MB |
117 | AM_CONDITIONAL([USE_EXTERNAL_MDNS], [test "x$with_external_mdns" = "xyes" ]) |
118 | ||
670dd933 MB |
119 | # Add the libconfig package |
120 | if 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 |
124 | else |
125 | AC_CHECK_LIB([config],[config_init], , AC_MSG_ERROR([libconfig library needed])) | |
e73657d6 | 126 | fi |
f29792d9 | 127 | |
2538e46a | 128 | AC_ARG_WITH([configfiles],[AS_HELP_STRING([--with-configfiles],[install configuration files during a make install])], ,[with_configfiles=yes]) |
670dd933 | 129 | AM_CONDITIONAL([INSTALL_CONFIG_FILES], [test "x$with_configfiles" = "xyes"]) |
f29792d9 | 130 | |
b7723d3a | 131 | # Look for Apple ALAC flag |
2538e46a | 132 | AC_ARG_WITH(apple-alac,[AS_HELP_STRING([--with-apple-alac],[include support for the Apple ALAC decoder])]) |
72176a95 | 133 | if 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 |
140 | fi | |
141 | AM_CONDITIONAL([USE_APPLE_ALAC], [test "x${with_apple_alac}" = "xyes"]) | |
270d2920 | 142 | |
043363fb | 143 | # Look for piddir flag |
26ff0c20 MB |
144 | AC_ARG_WITH(piddir, [AS_HELP_STRING([--with-piddir=<pathname>],[Specify a pathname to a directory in which to write the PID file.])]) |
145 | if 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]) | |
154 | fi | |
155 | AM_CONDITIONAL([USE_CUSTOMPIDDIR], [ test "x${with_piddir}" != "x" ]) | |
6d088ac4 MB |
156 | |
157 | # Look for libdaemon | |
26ff0c20 | 158 | AC_ARG_WITH(libdaemon,[AS_HELP_STRING([--with-libdaemon],[include support for daemonising in non-systemd systems])]) |
23ac1e31 | 159 | if 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 |
169 | fi | |
23ac1e31 | 170 | AM_CONDITIONAL([USE_LIBDAEMON], [test "x$with_libdaemon" = "xyes"]) |
12f26893 | 171 | |
9cafb4b4 | 172 | # Check --with-ssl=argument |
26ff0c20 MB |
173 | 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 ])]) |
174 | ||
175 | if 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 | |
185 | elif 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)]) | |
193 | elif 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 |
196 | else |
197 | AC_MSG_ERROR(specify one of --with-ssl=openssl or --with-ssl=mbedtls or --with-ssl=polarssl) | |
198 | fi | |
2de9a580 MB |
199 | |
200 | # Look for soxr flag | |
26ff0c20 MB |
201 | |
202 | AC_ARG_WITH(soxr, [AS_HELP_STRING([--with-soxr],[choose libsoxr for high-quality interpolation])]) | |
203 | if 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 | 219 | fi |
5f3b96f0 | 220 | |
69642bb7 | 221 | # Look for metadata flag and resolve it further down the script |
26ff0c20 | 222 | AC_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 |
228 | AC_ARG_WITH(avahi, [AS_HELP_STRING([--with-avahi],[choose Avahi-based mDNS support])]) |
229 | if 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!)) |
233 | fi | |
234 | AM_CONDITIONAL([USE_AVAHI], [test "x$with_avahi" = "xyes"]) | |
9d450966 | 235 | |
2de9a580 | 236 | # Look for tinysvcmdns flag |
26ff0c20 MB |
237 | AC_ARG_WITH(tinysvcmdns, [AS_HELP_STRING([--with-tinysvcmdns],[choose tinysvcmdns-based mDNS support])]) |
238 | if test "x$with_tinysvcmdns" = "xyes" ; then | |
239 | AC_DEFINE([CONFIG_TINYSVCMDNS], 1, [Include TinySVCmDNS-based mDNS support]) | |
240 | fi | |
241 | AM_CONDITIONAL([USE_TINYSVCMDNS], [test "x$with_tinysvcmdns" = "xyes"]) | |
2de9a580 | 242 | |
9d450966 | 243 | # Look for ALSA flag |
26ff0c20 MB |
244 | AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa],[choose ALSA API support (GNU/Linux only)])]) |
245 | if 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 | 254 | fi |
26ff0c20 | 255 | AM_CONDITIONAL([USE_ALSA], [test "x$with_alsa" = "xyes"]) |
9d450966 | 256 | |
8cabb16f | 257 | # Look for jack flag |
26ff0c20 MB |
258 | AC_ARG_WITH(jack, [AS_HELP_STRING([--with-jack],[include a Jack Audio Connection Kit (jack) backend])]) |
259 | if 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 |
269 | fi | |
270 | AM_CONDITIONAL([USE_JACK], [test "x$with_jack" = "xyes"]) | |
9d450966 MB |
271 | |
272 | # Look for SNDIO flag | |
26ff0c20 MB |
273 | AC_ARG_WITH(sndio, [AS_HELP_STRING([--with-sndio],[choose SNDIO API support])]) |
274 | if 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)) |
277 | fi | |
278 | AM_CONDITIONAL([USE_SNDIO], [test "x$with_sndio" = "xyes"]) | |
270d2920 | 279 | |
9d450966 | 280 | # Look for AO flag |
26ff0c20 MB |
281 | 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!])]) |
282 | if 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)) |
285 | fi | |
286 | AM_CONDITIONAL([USE_AO], [test "x$with_ao" = "xyes"]) | |
9d450966 | 287 | |
b7723d3a | 288 | # Look for Soundio flag |
26ff0c20 MB |
289 | AC_ARG_WITH(soundio, [AS_HELP_STRING([--with-soundio],[choose soundio API support.])]) |
290 | if 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)) | |
293 | fi | |
294 | AM_CONDITIONAL([USE_SOUNDIO], [test "x$with_soundio" = "xyes"]) | |
b7723d3a | 295 | |
9d450966 | 296 | # Look for pulseaudio flag |
26ff0c20 MB |
297 | AC_ARG_WITH(pa, [AS_HELP_STRING([--with-pa],[choose PulseAudio support.])]) |
298 | if 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 |
308 | fi | |
309 | AM_CONDITIONAL([USE_PA], [test "x$with_pa" = "xyes"]) | |
b3ae05ea | 310 | |
ec232363 LR |
311 | # Look for pipewire flag |
312 | AC_ARG_WITH(pw, [AS_HELP_STRING([--with-pw],[choose Pipewire support.])]) | |
313 | if 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 | |
323 | fi | |
324 | AM_CONDITIONAL([USE_PW], [test "x$with_pw" = "xyes"]) | |
325 | ||
7b9cd28e | 326 | # Look for Convolution flag |
ca40780a MB |
327 | AC_ARG_WITH(convolution, [AS_HELP_STRING([--with-convolution],[choose audio DSP convolution support])]) |
328 | if 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 |
338 | fi |
339 | AM_CONDITIONAL([USE_CONVOLUTION], [test "x$with_convolution" = "xyes"]) | |
7b9cd28e | 340 | |
9d450966 | 341 | # Look for dns_sd flag |
ca40780a MB |
342 | AC_ARG_WITH(dns_sd, [AS_HELP_STRING([--with-dns_sd],[choose dns_sd mDNS support])]) |
343 | if 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 |
346 | fi |
347 | AM_CONDITIONAL([USE_DNS_SD], [test "x$with_dns_sd" = "xyes"]) | |
9d450966 | 348 | |
1e07e1e0 | 349 | # Look for dbus flag |
ca40780a | 350 | AC_ARG_WITH(dbus-interface, [AS_HELP_STRING([--with-dbus-interface],[include support for the native Shairport Sync D-Bus interface])]) |
23ac1e31 | 351 | if 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 | |
354 | fi | |
355 | AM_CONDITIONAL([USE_DBUS], [test "x$with_dbus_interface" = "xyes"]) | |
1e07e1e0 MB |
356 | |
357 | # Look for dbus test client flag | |
ca40780a MB |
358 | AC_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 | |
360 | AM_CONDITIONAL([USE_DBUS_CLIENT], [test "x$with_dbus_test_client" = "xyes"]) | |
1e07e1e0 | 361 | |
74f41a17 | 362 | # Look for mpris flag |
ca40780a MB |
363 | AC_ARG_WITH(mpris-interface, [AS_HELP_STRING([--with-mpris-interface],[include support for a D-Bus interface conforming to the MPRIS standard])]) |
364 | if test "x$with_mpris_interface" = "xyes" ; then | |
365 | AC_DEFINE([CONFIG_MPRIS_INTERFACE], 1, [Support the MPRIS standard]) | |
366 | # remember to include glib, below | |
367 | fi | |
368 | AM_CONDITIONAL([USE_MPRIS], [test "x$with_mpris_interface" = "xyes"]) | |
74f41a17 | 369 | |
df7c48f0 | 370 | # Look for mpris test client flag |
ca40780a MB |
371 | AC_ARG_WITH(mpris-test-client, [AS_HELP_STRING([--with-mpris-test-client],[compile an MPRIS test client application])]) |
372 | # remember to include glib, below | |
373 | AM_CONDITIONAL([USE_MPRIS_CLIENT], [test "x$with_mpris_test_client" = "xyes"]) | |
374 | ||
375 | 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 | |
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 | 377 | fi |
df7c48f0 | 378 | |
02694948 | 379 | # Look for mqtt flag |
ca40780a MB |
380 | AC_ARG_WITH(mqtt-client, [AS_HELP_STRING([--with-mqtt-client],[include a client for MQTT -- the Message Queuing Telemetry Transport protocol])]) |
381 | if 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 |
384 | fi |
385 | AM_CONDITIONAL([USE_MQTT], [test "x$with_mqtt_client" = "xyes"]) | |
02694948 | 386 | |
ca40780a MB |
387 | if 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 | 389 | fi |
065eada6 | 390 | |
ca40780a | 391 | if 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 | 395 | fi |
69642bb7 MB |
396 | AM_CONDITIONAL([USE_METADATA_HUB], [test "x$REQUESTED_EXTENDED_METADATA_SUPPORT" = "x1"]) |
397 | AM_CONDITIONAL([USE_DACP_CLIENT], [test "x$REQUESTED_EXTENDED_METADATA_SUPPORT" = "x1"]) | |
065eada6 | 398 | |
26ff0c20 | 399 | if 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.]) |
401 | fi | |
26ff0c20 | 402 | AM_CONDITIONAL([USE_METADATA], [test "x$with_metadata" = "xyes"]) |
74f41a17 | 403 | |
8110851d MB |
404 | # Look for AirPlay 2 flag |
405 | AC_ARG_WITH(airplay-2, [AS_HELP_STRING([--with-airplay-2],[Build for AirPlay 2])]) | |
406 | if 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])]) | |
425 | fi | |
426 | AM_CONDITIONAL([USE_AIRPLAY_2], [test "x$with_airplay_2" = "xyes"]) | |
427 | ||
b7723d3a MB |
428 | if 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 | 443 | fi |
0ad11fb1 | 444 | |
6f8ee38d CB |
445 | # Look for xmltoman |
446 | AC_CHECK_PROGS([XMLTOMAN], [xmltoman]) | |
447 | if test -z "$XMLTOMAN"; then | |
2538e46a | 448 | AC_MSG_WARN([xmltoman not found - not rebuilding man pages]) |
6f8ee38d CB |
449 | fi |
450 | AM_CONDITIONAL([HAVE_XMLTOMAN], [test -n "$XMLTOMAN"]) | |
451 | ||
9d450966 MB |
452 | # Checks for header files. |
453 | AC_HEADER_STDC | |
454 | AC_CHECK_HEADERS([getopt_long.h]) | |
04aa3261 | 455 | 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]) |
9d450966 MB |
456 | |
457 | # Checks for typedefs, structures, and compiler characteristics. | |
5bdc16e3 MB |
458 | AC_C_INLINE |
459 | AC_TYPE_INT16_T | |
460 | AC_TYPE_INT32_T | |
461 | AC_TYPE_INT64_T | |
462 | AC_TYPE_PID_T | |
463 | AC_TYPE_SIZE_T | |
464 | AC_TYPE_SSIZE_T | |
465 | AC_TYPE_UINT16_T | |
466 | AC_TYPE_UINT32_T | |
467 | AC_TYPE_UINT64_T | |
468 | AC_TYPE_UINT8_T | |
9d450966 MB |
469 | |
470 | # Checks for library functions. | |
04aa3261 | 471 | AC_FUNC_ALLOCA |
5bdc16e3 MB |
472 | AC_FUNC_ERROR_AT_LINE |
473 | AC_FUNC_FORK | |
04aa3261 | 474 | AC_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 | 476 | AC_CONFIG_FILES([Makefile man/Makefile scripts/shairport-sync.service]) |
93516018 | 477 | AC_CONFIG_FILES([scripts/shairport-sync],[chmod +x scripts/shairport-sync]) |
9d450966 | 478 | AC_OUTPUT |