forked from mikebrady/shairport-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
343 lines (297 loc) · 15.8 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.50])
AC_INIT([shairport-sync], [3.1.1], [[email protected]])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([shairport.c])
AC_CONFIG_HEADERS([config.h])
# Derived from the Avahi configure.ac file
# Specifying the OS type, defaulting to linux.
#
AC_ARG_WITH(os, AS_HELP_STRING([--with-os=OSType],[Specify the distribution to target: One of linux freebsd or darwin]))
if test "z$with_os" = "z"; then
with_os="linux"
fi
with_os=`echo ${with_os} | tr '[[:upper:]]' '[[:lower:]]' `
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
PKG_PROG_PKG_CONFIG([0.9.0])
# Checks for libraries.
if test "x${with_os}" = xlinux -o "x${with_os}" = xfreebsd ; then
AC_CHECK_LIB([rt],[clock_gettime], , AC_MSG_ERROR(librt needed))
fi
AM_CONDITIONAL([BUILD_FOR_FREEBSD], [test "x${with_os}" = xfreebsd ])
##### Some build systems are not fully using pkg-config, so we can use the flag ${with_pkg_config} on a case-by-case basis
##### to control how to deal with them
AC_ARG_WITH([pkg_config],
[ --with-pkg-config = use pkg-config to find libraries], ,[with_pkg_config=yes])
AC_MSG_RESULT(>>Including libdaemon)
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
[DAEMON], [libdaemon],
[LIBS="${DAEMON_LIBS} ${LIBS}"])
else
AC_CHECK_LIB([daemon],[daemon_fork], , AC_MSG_ERROR(libdaemon needed))
fi
AC_CHECK_LIB([pthread],[pthread_create], , AC_MSG_ERROR(pthread library needed))
AC_CHECK_LIB([m],[exp], , AC_MSG_ERROR(maths library needed))
AC_MSG_RESULT(>>Including libpopt)
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
[POPT], [popt],
[LIBS="${POPT_LIBS} ${LIBS}"
AC_DEFINE([HAVE_LIBPOPT],[1],[Define to 1 if you have popt])])
else
AC_CHECK_LIB([popt],[poptGetContext], , AC_MSG_ERROR(libpopt needed))
AC_DEFINE([HAVE_LIBPOPT],[1],[Define to 1 if you have popt])
fi
AC_ARG_WITH([dummy],[ --with-dummy = include the dummy audio back end ],[AC_MSG_RESULT(>>Including the dummy audio back end) AC_DEFINE([CONFIG_DUMMY], 1, [Needed by the compiler.]) ], )
AM_CONDITIONAL([USE_DUMMY], [test "x$with_dummy" = "xyes" ])
AC_ARG_WITH([stdout],[ --with-stdout = include the stdout audio back end ],[ AC_MSG_RESULT(>>Including the stdout audio back end) AC_DEFINE([CONFIG_STDOUT], 1, [Needed by the compiler.]) ], )
AM_CONDITIONAL([USE_STDOUT], [test "x$with_stdout" = "xyes" ])
AC_ARG_WITH([pipe],[ --with-pipe = include the pipe audio back end ],[ AC_MSG_RESULT(>>Including the pipe audio back end) AC_DEFINE([CONFIG_PIPE], 1, [Needed by the compiler.]) ], )
AM_CONDITIONAL([USE_PIPE], [test "x$with_pipe" = "xyes" ])
# Check to see if we should include the System V initscript
AC_ARG_WITH([systemv],
[ --with-systemv = install a System V startup script during a make install], , )
AM_CONDITIONAL([INSTALL_SYSTEMV], [test "x$with_systemv" = "xyes"])
# Check to see if we should include the systemd stuff to define it as a service
AC_ARG_WITH([systemd],
[ --with-systemd = install a systemd startup script during a make install], , )
AM_CONDITIONAL([INSTALL_SYSTEMD], [test "x$with_systemd" = "xyes"])
AC_ARG_WITH([freebsd-service],
[ --with-freebsd-service = install a FreeBSD startup script during a make install], , )
AM_CONDITIONAL([INSTALL_FREEBSD_SERVICE], [test "x$with_freebsd_service" = "xyes"])
# Add the libconfig package
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
[LIBCONFIG], [libconfig],
[LIBS="${LIBCONFIG_LIBS} ${LIBS}"])
else
AC_CHECK_LIB([config],[config_init], , AC_MSG_ERROR([libconfig library needed]))
fi
AC_ARG_WITH([configfiles],
[ --with-configfiles = install configuration files during a make install ], ,[with_configfiles=yes])
AM_CONDITIONAL([INSTALL_CONFIG_FILES], [test "x$with_configfiles" = "xyes"])
# Look for Apple ALAC flag
AC_ARG_WITH(apple-alac, [ --with-apple-alac = include support for the Apple ALAC decoder],
[AC_MSG_RESULT(>>Including the Apple ALAC Decoder)
HAS_APPLE_ALAC=1
AM_CONDITIONAL([USE_APPLE_ALAC], [test 0])
AC_DEFINE([CONFIG_APPLE_ALAC], 1, [Needed by the compiler.])
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
[ALAC], [alac],
[LIBS="${ALAC_LIBS} ${LIBS}"
AC_DEFINE([HAVE_APPLE_ALAC],[1],[Define to 1 if you are using the Apple ALAC Decoder])])
else
AC_CHECK_LIB([alac], [BitBufferInit], , AC_MSG_ERROR(Apple ALAC Decoder support requires the alac library!))
AC_DEFINE([HAVE_APPLE_ALAC],[1],[Define to 1 if you have the Apple ALAC library])
fi ])
AM_CONDITIONAL([USE_APPLE_ALAC], [test "x$HAS_APPLE_ALAC" = "x1"])
# Look for firstconfdir flag
AC_ARG_WITH(firstconfdir, [ --with-firstconfdir=<pathname> Specify a pathname to a directory where a configuration file will be searched for before looking in sysconfdir.], [
AC_MSG_CHECKING(--with-firstconfdir argument)
if test "x${with_firstconfdir}" = x -o "x${with_firstconfdir}" = xyes ; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(when you use the --with-firstconfdir directive you must specify a pathname to a directory where a configuration file will be searched for before looking in sysconfdir.)
fi
AC_MSG_RESULT(${with_firstconfdir})
HAS_FIRSTCONFDIR=1
AC_SUBST(FIRST_CONF_DIR,["${with_firstconfdir}"])
AC_DEFINE([USE_FIRSTCONFDIR],1,[Look for a configuration file here before looking in the sysconfdir])], )
AM_CONDITIONAL([USE_FIRSTCONFDIR], [test "x$HAS_FIRSTCONFDIR" = "x1"])
# Look for piddir flag
AC_ARG_WITH(piddir, [ --with-piddir=<pathname> Specify a pathname to a directory in which to write the PID file.], [
AC_MSG_CHECKING(--with-piddir argument)
if test "x${with_piddir}" = x -o "x${with_piddir}" = xyes ; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(when you use the --with-piddir directive you must specify the pathname of the directory into which the PID file will be written)
fi
AC_MSG_RESULT(${with_piddir})
HAS_CUSTOMPIDDIR=1
AC_SUBST(CUSTOM_PID_DIR,["${with_piddir}"])
AC_DEFINE([USE_CUSTOM_PID_DIR],1,[Hook up special proc to libdaemon to point to this directory])], )
AM_CONDITIONAL([USE_CUSTOMPIDDIR], [test "x$HAS_CUSTOMPIDDIR" = "x1"])
# Check --with-ssl=argument
AC_ARG_WITH(ssl, [ choose --with-ssl=openssl, --with-ssl=mbedtls or --with-ssl=polarssl (deprecated) for encryption services ], [
AC_MSG_CHECKING(encryption libraries chosen)
if test "x${with_ssl}" = x -o "x${with_ssl}" = xyes ; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(choose "openssl", "mbedtls" or "polarssl" encryption)
fi
if test "x${with_ssl}" = xopenssl ; then
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
[SSL], [libssl,libcrypto],
[LIBS="${SSL_LIBS} ${LIBS}"
AC_DEFINE([HAVE_LIBCRYPTO],[1],[Define to 1 if you have libcrypto])
AC_DEFINE([HAVE_LIBSSL],[1],[Define to 1 if you have libssl])])
else
AC_CHECK_LIB([crypto], [main], , AC_MSG_ERROR(libcrypto selected but the library cannot be found!))
AC_CHECK_LIB([ssl], [main], , AC_MSG_ERROR(libssl selected but the library cannot be found!))
AC_DEFINE([HAVE_LIBCRYPTO],[1],[Define to 1 if you have libcrypto])
AC_DEFINE([HAVE_LIBSSL],[1],[Define to 1 if you have libssl])
fi
elif test "x${with_ssl}" = xmbedtls ; then
AC_CHECK_LIB([mbedtls],[mbedtls_ssl_init],,
[AC_MSG_ERROR([Cannot find required libray: libmbedtls],1)])
AC_CHECK_LIB([mbedcrypto], [mbedtls_entropy_func],,
[AC_MSG_ERROR([Cannot find required library: libmbedcrypto],1)])
AC_CHECK_LIB([mbedx509], [mbedtls_pk_init],,
[AC_MSG_ERROR([Cannot find required library: libmbedx509],1)])
elif test "x${with_ssl}" = xpolarssl ; then
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.))
else
AC_MSG_ERROR(unknown option "${with_ssl}"." Please choose with "openssl", "mbedtls" or "polarssl")
fi
], )
# Look for soxr flag
AC_ARG_WITH(soxr, [ --with-soxr = choose libsoxr for high-quality interpolation], [
AC_MSG_RESULT(>>Including support for soxr-based interpolation)
AC_CHECK_LIB([soxr],[soxr_create], , AC_MSG_ERROR(soxr support requested but libsoxr not found!))], )
# Look for metadata flag -- set flag for conditional compilation
AC_ARG_WITH(metadata, [ --with-metadata = include support for a metadata feed], [
AC_MSG_RESULT(>>Including metadata support)
AC_DEFINE([CONFIG_METADATA], 1, [Needed by the compiler.])], )
AM_CONDITIONAL([USE_METADATA], [test "x$with_metadata" = "xyes"])
# What follows is a bit messy, because if the relevant library is requested, a compiler flag is defined, a file is included in the compilation
# and the relevant link files are added.
# Look for avahi flag
AC_ARG_WITH(avahi, [ --with-avahi = choose Avahi-based mDNS support], [
AC_MSG_RESULT(>>Including Avahi mDNS support)
HAS_AVAHI=1
AC_DEFINE([CONFIG_AVAHI], 1, [Needed by the compiler.])
AC_CHECK_LIB([avahi-client], [avahi_client_new], , AC_MSG_ERROR(Avahi support requires the avahi-client library!))
AC_CHECK_LIB([avahi-common],[avahi_strerror], , AC_MSG_ERROR(Avahi support requires the avahi-common library!))], )
AM_CONDITIONAL([USE_AVAHI], [test "x$HAS_AVAHI" = "x1"])
# Look for tinysvcmdns flag
AC_ARG_WITH(tinysvcmdns, [ --with-tinysvcmdns = choose tinysvcmdns-based mDNS support], [
AC_MSG_RESULT(>>Including tinysvcmdns mDNS support)
HAS_TINYSVCMDNS=1
AC_DEFINE([CONFIG_TINYSVCMDNS], 1, [Needed by the compiler.])], )
AM_CONDITIONAL([USE_TINYSVCMDNS], [test "x$HAS_TINYSVCMDNS" = "x1"])
# Look for ALSA flag
AC_ARG_WITH(alsa, [ --with-alsa = choose ALSA API support (GNU/Linux only)],
[AC_MSG_RESULT(>>Including an ALSA back end)
HAS_ALSA=1
AM_CONDITIONAL([USE_ALSA], [test 0])
AC_DEFINE([CONFIG_ALSA], 1, [Needed by the compiler.])
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
[ALSA], [alsa],
[LIBS="${ALSA_LIBS} ${LIBS}"
AC_DEFINE([HAVE_LIBASOUND],[1],[Define to 1 if you have ALSA])])
else
AC_CHECK_LIB([asound], [snd_pcm_open], , AC_MSG_ERROR(ALSA support requires the asound library!))
AC_DEFINE([HAVE_LIBASOUND],[1],[Define to 1 if you have ALSA])
fi ])
AM_CONDITIONAL([USE_ALSA], [test "x$HAS_ALSA" = "x1"])
# Look for SNDIO flag
AC_ARG_WITH(sndio, [ --with-sndio = choose SNDIO API support], [
AC_MSG_RESULT(>>Including a SNDIO back end)
HAS_SNDIO=1
AC_DEFINE([CONFIG_SNDIO], 1, [Needed by the compiler.])
AC_CHECK_LIB([sndio], [sio_open], , AC_MSG_ERROR(SNDIO support requires the sndio library!))], )
AM_CONDITIONAL([USE_SNDIO], [test "x$HAS_SNDIO" = "x1"])
# Look for AO flag
AC_ARG_WITH(ao, [ --with-ao = choose AO (Audio Output?) API support. N.B. no synchronisation -- so underflow or overflow is inevitable!], [
AC_MSG_RESULT(>>Including an AO back end. N.B. no synchronisation -- so underflow or overflow is inevitable!)
HAS_AO=1
AC_DEFINE([CONFIG_AO], 1, [Needed by the compiler.])
AC_CHECK_LIB([ao], [ao_initialize], , AC_MSG_ERROR(AO support requires the ao library -- libao-dev suggested))], )
AM_CONDITIONAL([USE_AO], [test "x$HAS_AO" = "x1"])
# Look for Soundio flag
AC_ARG_WITH(soundio, [ --with-soundio = choose soundio API support.], [
AC_MSG_RESULT(>>Including an soundio back end)
HAS_SOUNDIO=1
AC_DEFINE([CONFIG_SOUNDIO], 1, [Needed by the compiler.])
AC_CHECK_LIB([soundio], [soundio_create], , AC_MSG_ERROR(soundio support requires the soundio library!))], )
AM_CONDITIONAL([USE_SOUNDIO], [test "x$HAS_SOUNDIO" = "x1"])
# Look for pulseaudio flag
AC_ARG_WITH(pa, [ --with-pa = choose PulseAudio support.], [
AC_MSG_RESULT(>>Including a PulseAudio back end.)
HAS_PA=1
AC_DEFINE([CONFIG_PA], 1, [Needed by the compiler.])
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
[PULSEAUDIO], [libpulse >= 0.9.2],
[LIBS="${PULSEAUDIO_LIBS} ${LIBS}"],[AC_MSG_ERROR(PulseAudio support requires the libpulse-dev library!)])
else
AC_CHECK_LIB([pulse-simple], [pa_simple_new], , AC_MSG_ERROR(PulseAudio support requires the libpulse library!))
AC_CHECK_LIB([pulse], [pa_stream_peek], , AC_MSG_ERROR(PulseAudio support requires the libpulse-dev library.))
fi ])
AM_CONDITIONAL([USE_PA], [test "x$HAS_PA" = "x1"])
# Look for old pulseaudio flag
AC_ARG_WITH(pulseaudio, [ --with-pulseaudio = choose PulseAudio API support. Note that this backend is deprecated. Use --with-pa for an updated PulseAudio backend!], [
AC_MSG_RESULT(>>Including an outdated PulseAudio back end. Note that this backend is deprecated. Use --with-pa for an updated PulseAudio backend!)
HAS_PULSE=1
AC_DEFINE([CONFIG_PULSE], 1, [Needed by the compiler.])
AC_CHECK_LIB([pulse-simple], [pa_simple_new], , AC_MSG_ERROR(PulseAudio support requires the pulse-simple library -- possibly in the libpulse-dev package!))
AC_CHECK_LIB([pulse], [pa_stream_peek], , AC_MSG_ERROR(PulseAudio support requires the libpulse-dev library.))], )
AM_CONDITIONAL([USE_PULSE], [test "x$HAS_PULSE" = "x1"])
# Look for Convolution flag
AC_ARG_WITH(convolution, [ --with-convolution = choose audio DSP convolution support], [
AC_MSG_RESULT(>>Including convolution support)
HAS_CONVOLUTION=1
AM_INIT_AUTOMAKE([subdir-objects])
AC_DEFINE([CONFIG_CONVOLUTION], 1, [Needed by the compiler.])
AC_CHECK_LIB([sndfile], [sf_open], , AC_MSG_ERROR(Convolution support requires the sndfile library!))], )
AM_CONDITIONAL([USE_CONVOLUTION], [test "x$HAS_CONVOLUTION" = "x1"])
# Look for dns_sd flag
AC_ARG_WITH(dns_sd, [ --with-dns_sd = choose dns_sd mDNS support], [
AC_MSG_RESULT(>>Including dns_sd for mDNS support)
HAS_DNS_SD=1
AC_DEFINE([CONFIG_HAVE_DNS_SD_H], 1, [Needed by the compiler.])
AC_SEARCH_LIBS([DNSServiceRefDeallocate], [dns_sd], , AC_MSG_ERROR(dns_sd support requires the dns_sd library!))], )
AM_CONDITIONAL([USE_DNS_SD], [test "x$HAS_DNS_SD" = "x1"])
if test "x${with_systemd}" = xyes ; then
# Find systemd unit dir
AC_ARG_WITH([systemdsystemunitdir],
[AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
[with_systemdsystemunitdir=auto])
AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
AS_IF([test "x$def_systemdsystemunitdir" = "x"],
[AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
[AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
with_systemdsystemunitdir=no],
[with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
[AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
else
AM_CONDITIONAL([HAVE_SYSTEMD], false)
fi
# Look for xmltoman
AC_CHECK_PROGS([XMLTOMAN], [xmltoman])
if test -z "$XMLTOMAN"; then
AC_MSG_WARN([>>xmltoman not found - not rebuilding man pages])
fi
AM_CONDITIONAL([HAVE_XMLTOMAN], [test -n "$XMLTOMAN"])
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([getopt_long.h])
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])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_CHECK_FUNCS([atexit clock_gettime gethostname inet_ntoa memchr memmove memset mkfifo pow select socket stpcpy strcasecmp strchr strdup strerror strstr strtol strtoul])
AC_CONFIG_FILES([Makefile man/Makefile scripts/shairport-sync.service])
AC_CONFIG_FILES([scripts/shairport-sync],[chmod +x scripts/shairport-sync])
AC_OUTPUT