Merge branch 'refs/heads/t/ubsan'
[paraslash.git] / configure.ac
1 AC_PREREQ([2.61])
2
3 AC_INIT([paraslash], [m4_esyscmd_s(./GIT-VERSION-GEN)],
4 [maan@tuebingen.mpg.de], [], [http://people.tuebingen.mpg.de/maan/paraslash/])
5 AC_CONFIG_HEADERS([config.h])
6
7 AC_CONFIG_FILES([Makefile])
8 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
9 AC_DEFUN([LIB_ARG_WITH], [
10 AC_ARG_WITH($1-headers, [AS_HELP_STRING(--with-$1-headers=dir,
11 [look for $1 headers in dir])])
12 AC_ARG_WITH($1-libs, [AS_HELP_STRING(--with-$1-libs=dir,
13 [look for $1 libraries in dir])])
14 if test -n "$with_$1_headers"; then
15 $1_cppflags="-I$with_$1_headers"
16 CPPFLAGS="$CPPFLAGS $$1_cppflags"
17 fi
18 if test -n "$with_$1_libs"; then
19 $1_ldflags="-L$with_$1_libs $2"
20 else
21 $1_ldflags="$2"
22 fi
23 LDFLAGS="$LDFLAGS $$1_ldflags"
24 ])
25
26 AC_DEFUN([STASH_FLAGS], [
27 OLD_CPPFLAGS="$CPPFLAGS"
28 OLD_LDFLAGS="$LDFLAGS"
29 OLD_LIBS="$LIBS"
30 ])
31
32 AC_DEFUN([UNSTASH_FLAGS], [
33 CPPFLAGS="$OLD_CPPFLAGS"
34 LDFLAGS="$OLD_LDFLAGS"
35 LIBS="$OLD_LIBS"
36 ])
37 AC_DEFUN([LIB_SUBST_FLAGS], [
38 if test "$HAVE_[]m4_toupper([$1])" = 'yes'; then
39 AC_DEFINE(HAVE_[]m4_toupper([$1]), 1,
40 define to 1 to turn on $1 support)
41 else
42 $1_cppflags=
43 $1_ldflags=
44 fi
45 AC_SUBST(HAVE_[]m4_toupper([$1]))
46 AC_SUBST($1_cppflags)
47 AC_SUBST($1_ldflags)
48 ])
49 AC_DEFUN([REQUIRE_EXECUTABLE], [
50 AC_PATH_PROG(m4_toupper([$1]), [$1])
51 test -z "$m4_toupper([$1])" && AC_MSG_ERROR(
52 [$1 is required to build this package])
53 ])
54
55 AC_USE_SYSTEM_EXTENSIONS
56 AC_C_BIGENDIAN()
57 AC_PROG_CC
58 AC_PROG_CPP
59
60 REQUIRE_EXECUTABLE([bison])
61 REQUIRE_EXECUTABLE([flex])
62 REQUIRE_EXECUTABLE([m4])
63
64 executables="recv filter audioc write afh play"
65 ########################################################################### osl
66 STASH_FLAGS
67 LIB_ARG_WITH([osl], [-losl])
68 HAVE_OSL=yes
69 AC_CHECK_HEADER(osl.h, [], [HAVE_OSL=no])
70 AC_CHECK_LIB([osl], [osl_open_table], [], [HAVE_OSL=no])
71 LIB_SUBST_FLAGS(osl)
72 UNSTASH_FLAGS
73 ######################################################################## lopsub
74 HAVE_LOPSUB=yes
75 AC_PATH_PROG([LOPSUBGEN], [lopsubgen])
76 test -z "$LOPSUBGEN" && HAVE_LOPSUB=no
77 STASH_FLAGS
78 LIB_ARG_WITH([lopsub], [-llopsub])
79 AC_CHECK_HEADER(lopsub.h, [], [HAVE_LOPSUB=no])
80 AC_CHECK_LIB([lopsub], [lls_merge], [], [HAVE_LOPSUB=no])
81 if test $HAVE_LOPSUB = no; then AC_MSG_ERROR([
82 The lopsub library is required to build this software, but
83 the above checks indicate it is not installed on your system.
84 Run the following command to download a copy.
85 git clone git://git.tuebingen.mpg.de/lopsub.git
86 Install the library, then run this configure script again.
87 ])
88 fi
89 LIB_SUBST_FLAGS([lopsub])
90 UNSTASH_FLAGS
91 ######################################################################## openssl
92 STASH_FLAGS
93 HAVE_OPENSSL=yes
94 LIB_ARG_WITH([openssl], [-lssl -lcrypto])
95 AC_CHECK_HEADER(openssl/ssl.h, [], [HAVE_OPENSSL=no])
96 AC_CHECK_LIB([crypto], [RAND_bytes], [], [HAVE_OPENSSL=no])
97 LIB_SUBST_FLAGS(openssl)
98 if test $HAVE_OPENSSL = yes; then
99 HAVE_RSA_SET0_KEY=yes
100 AC_CHECK_DECL([RSA_set0_key], [], [], [#include <openssl/rsa.h>])
101 AC_CHECK_LIB([crypto], [RSA_set0_key], [], [])
102 if test "$ac_cv_have_decl_RSA_set0_key" != "$ac_cv_lib_crypto_RSA_set0_key"; then
103 AC_MSG_ERROR([openssl header/library mismatch])
104 fi
105 test "$ac_cv_have_decl_RSA_set0_key" = yes &&
106 AC_DEFINE([HAVE_RSA_SET0_KEY], [1], [openssl >= 1.1])
107
108 HAVE_CRYPTO_CLEANUP_ALL_EX_DATA=yes
109 AC_CHECK_DECL([CRYPTO_cleanup_all_ex_data], [],
110 [HAVE_CRYPTO_CLEANUP_ALL_EX_DATA=no],
111 [#include <openssl/rsa.h>])
112 AC_CHECK_LIB([crypto], [CRYPTO_cleanup_all_ex_data], [],
113 [HAVE_CRYPTO_CLEANUP_ALL_EX_DATA=no])
114 test $HAVE_CRYPTO_CLEANUP_ALL_EX_DATA = yes &&
115 AC_DEFINE([HAVE_CRYPTO_CLEANUP_ALL_EX_DATA], [1],
116 [not available on FreeBSD 12])
117 HAVE_OPENSSL_THREAD_STOP=yes
118 AC_CHECK_DECL([OPENSSL_thread_stop], [],
119 [HAVE_OPENSSL_THREAD_STOP=no],
120 [#include <openssl/crypto.h>])
121 AC_CHECK_LIB([crypto], [OPENSSL_thread_stop], [],
122 [HAVE_OPENSSL_THREAD_STOP=no])
123 test $HAVE_OPENSSL_THREAD_STOP = yes &&
124 AC_DEFINE([HAVE_OPENSSL_THREAD_STOP], [1],
125 [not available on openssl-1.0])
126 fi
127 UNSTASH_FLAGS
128 ######################################################################### gcrypt
129 STASH_FLAGS
130 HAVE_GCRYPT=yes
131 LIB_ARG_WITH([gcrypt], [-lgcrypt])
132 AC_CHECK_HEADER(gcrypt.h, [], [HAVE_GCRYPT=no])
133 AC_CHECK_LIB([gcrypt], [gcry_randomize], [], [HAVE_GCRYPT=no])
134 LIB_SUBST_FLAGS(gcrypt)
135 UNSTASH_FLAGS
136 ######################################################################### crypto
137 AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
138 Force using crypto library "lib". This package requires either
139 openssl or libgcrypt being installed. Possible values for "lib"
140 are thus "openssl" and "gcrypt". If this option is not given,
141 openssl is tried first. If openssl was not found, gcrypt is
142 tried next.])])
143
144 CRYPTOLIB="$enable_cryptolib"
145 case "$enable_cryptolib" in
146 "openssl")
147 test $HAVE_OPENSSL = no && AC_MSG_ERROR(openssl not found)
148 crypto_ldflags="$openssl_ldflags"
149 ;;
150 "gcrypt")
151 test $HAVE_GCRYPT = no && AC_MSG_ERROR(gcrypt not found)
152 crypto_ldflags="$gcrypt_ldflags"
153 ;;
154 "")
155 crypto_ldflags=
156 if test $HAVE_GCRYPT = yes; then
157 CRYPTOLIB=gcrypt
158 crypto_ldflags="$gcrypt_ldflags"
159 fi
160 if test $HAVE_OPENSSL = yes; then
161 CRYPTOLIB=openssl
162 crypto_ldflags="$openssl_ldflags"
163 fi
164 ;;
165 *)
166 AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib])
167 ;;
168 esac
169 AC_SUBST(crypto_ldflags)
170 ########################################################################## iconv
171 STASH_FLAGS
172 LIBS=
173 AC_SEARCH_LIBS([libiconv_open], [iconv],
174 [iconv_ldflags="$LIBS"],
175 []
176 )
177 AC_SUBST(iconv_ldflags)
178 AC_MSG_CHECKING([whether iconv needs const char ** cast])
179 AC_COMPILE_IFELSE([
180 AC_LANG_PROGRAM([
181 #include <iconv.h>
182 ],[
183 size_t iconv(iconv_t cd, const char **inbuf,
184 size_t *inbytesleft, char **outbuf,
185 size_t *outbytesleft);
186 ])
187 ],
188 [cast='(const char **)'; msg=yes],
189 [cast=; msg=no]
190 )
191 AC_DEFINE_UNQUOTED(ICONV_CAST, $cast, [cast for second arg to iconv()])
192 AC_MSG_RESULT($msg)
193 UNSTASH_FLAGS
194 ########################################################################### ucred
195 AC_CHECK_TYPE([struct ucred], [
196 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
197 ], [], [
198 #include <sys/types.h>
199 #include <sys/socket.h>
200 ])
201 ################################################################### FNM_EXTMATCH
202 AC_MSG_CHECKING(for extended wildcard pattern matching)
203 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
204 #include <fnmatch.h>
205 ]], [[
206 unsigned n = FNM_EXTMATCH;
207 ]])], [have_fnm_extmatch=yes], [have_fnm_extmatch=no])
208 AC_MSG_RESULT($have_fnm_extmatch)
209 if test $have_fnm_extmatch = yes; then
210 AC_DEFINE(HAVE_FNM_EXTMATCH, 1, define to 1 if FNM_EXTMATCH is defined)
211 fi
212 ########################################################################### curses
213 STASH_FLAGS
214 LIB_ARG_WITH([curses], [])
215 HAVE_CURSES=yes
216 AC_CHECK_HEADER(curses.h, [], [HAVE_CURSES=no])
217 AC_SEARCH_LIBS([initscr], [ncursesw curses], [], [HAVE_CURSES=no])
218 curses_ldflags="$curses_ldflags $LIBS"
219 LIB_SUBST_FLAGS(curses)
220 UNSTASH_FLAGS
221 ########################################################################### ip_mreqn
222 AC_CHECK_TYPE([struct ip_mreqn], [
223 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 if you have struct ip_mreqn)
224 ], [], [
225 #include <netdb.h>
226 #include <net/if.h>
227 ])
228 ########################################################################### ogg
229 STASH_FLAGS
230 LIB_ARG_WITH([ogg], [-logg])
231 HAVE_OGG=yes
232 AC_CHECK_HEADERS([ogg/ogg.h], [], [HAVE_OGG=no])
233 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [HAVE_OGG=no])
234 AC_CHECK_LIB([ogg], [ogg_stream_flush_fill], [
235 AC_DEFINE(HAVE_OGG_STREAM_FLUSH_FILL, 1, [libogg >= 1.3.0])])
236 LIB_SUBST_FLAGS(ogg)
237 UNSTASH_FLAGS
238 ######################################################################### vorbis
239 STASH_FLAGS
240 LIB_ARG_WITH([vorbis], [-lvorbis -lvorbisfile])
241 HAVE_VORBIS=yes
242 AC_CHECK_HEADERS([vorbis/codec.h], [], [HAVE_VORBIS=no])
243 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [HAVE_VORBIS=no])
244 LIB_SUBST_FLAGS(vorbis)
245 UNSTASH_FLAGS
246 ######################################################################### speex
247 STASH_FLAGS
248 LIB_ARG_WITH([speex], [-lspeex])
249 HAVE_SPEEX=yes
250 AC_CHECK_HEADERS([speex/speex.h], [], [HAVE_SPEEX=no])
251 AC_CHECK_LIB([speex], [speex_decoder_init], [], [HAVE_SPEEX=no])
252 LIB_SUBST_FLAGS(speex)
253 UNSTASH_FLAGS
254 ######################################################################### opus
255 STASH_FLAGS
256 LIB_ARG_WITH([opus], [-lopus])
257 HAVE_OPUS=yes
258 AC_CHECK_HEADERS([opus/opus.h], [], [HAVE_OPUS=no])
259 AC_CHECK_LIB([opus], [opus_multistream_decode], [], [HAVE_OPUS=no])
260 LIB_SUBST_FLAGS(opus)
261 UNSTASH_FLAGS
262 ########################################################################### flac
263 STASH_FLAGS
264 LIB_ARG_WITH([flac], [-lFLAC -lm])
265 HAVE_FLAC=yes
266 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], HAVE_FLAC=no)
267 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], HAVE_FLAC=no)
268 LIB_SUBST_FLAGS(flac)
269 UNSTASH_FLAGS
270
271 # some helper functions for codecs which use the ogg container format
272 AC_DEFUN([NEED_OGG_OBJECTS], [{
273 test "$HAVE_OGG" = 'yes' -a \( \
274 "$HAVE_VORBIS" = 'yes' \
275 -o "$HAVE_SPEEX" = 'yes' \
276 -o "$HAVE_OPUS" = 'yes' \
277 -o "$HAVE_FLAC" = 'yes' \
278 \)
279 }])
280 AC_DEFUN([NEED_VORBIS_OBJECTS], [{
281 test "$HAVE_OGG" = 'yes' -a "$HAVE_VORBIS" = 'yes'
282 }])
283 AC_DEFUN([NEED_SPEEX_OBJECTS], [{
284 test "$HAVE_OGG" = 'yes' -a "$HAVE_SPEEX" = 'yes'
285 }])
286 AC_DEFUN([NEED_OPUS_OBJECTS], [{
287 test "$HAVE_OGG" = 'yes' -a "$HAVE_OPUS" = 'yes'
288 }])
289 AC_DEFUN([NEED_FLAC_OBJECTS], [{
290 test "$HAVE_OGG" = 'yes' -a "$HAVE_FLAC" = 'yes'
291 }])
292 ########################################################################### faad
293 STASH_FLAGS
294 LIB_ARG_WITH([faad], [-lfaad -lmp4ff])
295 HAVE_FAAD=yes
296 AC_CHECK_HEADER(neaacdec.h, [], HAVE_FAAD=no)
297 AC_CHECK_HEADER(mp4ff.h, [], HAVE_FAAD=no)
298 AC_CHECK_LIB([faad], [NeAACDecOpen], [], HAVE_FAAD=no)
299 AC_CHECK_LIB([mp4ff], [mp4ff_meta_get_artist], [], HAVE_FAAD=no)
300 LIB_SUBST_FLAGS(faad)
301 UNSTASH_FLAGS
302 ########################################################################### mad
303 STASH_FLAGS
304 LIB_ARG_WITH([mad], [-lmad])
305 HAVE_MAD=yes
306 AC_CHECK_HEADER(mad.h, [], HAVE_MAD=no)
307 AC_CHECK_LIB([mad], [mad_stream_init], [], HAVE_MAD=no)
308 LIB_SUBST_FLAGS(mad)
309 UNSTASH_FLAGS
310 ###################################################################### libid3tag
311 STASH_FLAGS
312 LIB_ARG_WITH([id3tag], [-lid3tag -lz])
313 HAVE_ID3TAG=yes
314 AC_CHECK_HEADER(id3tag.h, [], HAVE_ID3TAG=no)
315 AC_CHECK_LIB([id3tag], [id3_file_fdopen], [], HAVE_ID3TAG=no)
316 LIB_SUBST_FLAGS(id3tag)
317 UNSTASH_FLAGS
318 ########################################################################### oss
319 STASH_FLAGS
320 LIB_ARG_WITH([oss], [])
321 AC_CHECK_HEADER(sys/soundcard.h, [HAVE_OSS=yes], [HAVE_OSS=no])
322 AC_CHECK_LIB(ossaudio, _oss_ioctl, [oss_ldflags="$oss_ldflags -lossaudio"], [])
323 LIB_SUBST_FLAGS(oss)
324 UNSTASH_FLAGS
325 ########################################################################### alsa
326 STASH_FLAGS
327 LIB_ARG_WITH([alsa], [-lasound])
328 HAVE_ALSA=yes
329 AC_CHECK_HEADER(alsa/asoundlib.h, [], HAVE_ALSA=no)
330 AC_CHECK_LIB([asound], [snd_pcm_open], [], HAVE_ALSA=no)
331 LIB_SUBST_FLAGS(alsa)
332 UNSTASH_FLAGS
333 ######################################################################### pthread
334 STASH_FLAGS
335 LIB_ARG_WITH([pthread], [-lpthread])
336 HAVE_PTHREAD=yes
337 AC_CHECK_HEADER(pthread.h, [], HAVE_PTHREAD=no)
338 AC_CHECK_LIB([pthread], [pthread_create], [], HAVE_PTHREAD=no)
339 LIB_SUBST_FLAGS(pthread)
340 UNSTASH_FLAGS
341 ########################################################################### libao
342 STASH_FLAGS
343 LIB_ARG_WITH([ao], [-lao])
344 HAVE_AO=yes
345 AC_CHECK_HEADER(ao/ao.h, [], HAVE_AO=no)
346 AC_CHECK_LIB([ao], [ao_initialize], [], HAVE_AO=no)
347 LIB_SUBST_FLAGS(ao)
348 UNSTASH_FLAGS
349 AC_DEFUN([NEED_AO_OBJECTS], [{ test $HAVE_AO = yes -a $HAVE_PTHREAD = yes; }])
350 ######################################################################## readline
351 STASH_FLAGS
352 AC_SEARCH_LIBS([tgetent], [tinfo curses terminfo termcap])
353 LIB_ARG_WITH([readline], [-lreadline $LIBS])
354 HAVE_READLINE=yes
355 AC_CHECK_HEADER([readline/readline.h], [], [HAVE_READLINE=no])
356 AC_CHECK_LIB([readline], [rl_free_keymap], [], HAVE_READLINE=no)
357 AC_CHECK_DECL(
358 [rl_free_keymap],
359 [AC_DEFINE(RL_FREE_KEYMAP_DECLARED, 1, readline >= 6.3)],
360 [],
361 [
362 #include <stdio.h>
363 #include <readline/readline.h>
364 ]
365 )
366 LIB_SUBST_FLAGS(readline)
367 UNSTASH_FLAGS
368 ############################################################# libsamplerate
369 STASH_FLAGS
370 LIB_ARG_WITH([samplerate], [-lsamplerate])
371 HAVE_SAMPLERATE=yes
372 AC_CHECK_HEADER(samplerate.h, [], HAVE_SAMPLERATE=no)
373 AC_CHECK_LIB([samplerate], [src_process], [], HAVE_SAMPLERATE=no)
374 LIB_SUBST_FLAGS(samplerate)
375 UNSTASH_FLAGS
376 ######################################################################### ubsan
377 AC_ARG_ENABLE([ubsan], [AS_HELP_STRING(--enable-ubsan,
378 [Detect and report undefined behaviour.])],
379 [ENABLE_UBSAN=yes], [ENABLE_UBSAN=no])
380 AC_SUBST(ENABLE_UBSAN)
381 ######################################################################### server
382 if test -n "$CRYPTOLIB" && test $HAVE_OSL = yes && test -n "$BISON" && \
383 test -n "$FLEX"; then
384 build_server="yes"
385 executables="$executables server"
386 server_errlist_objs="
387 server
388 afh_common
389 mp3_afh
390 vss
391 command
392 net
393 string
394 signal
395 time
396 daemon
397 http_send
398 close_on_fork
399 mm
400 crypt_common
401 base64
402 ipc
403 dccp_send
404 fd
405 user_list
406 chunk_queue
407 afs
408 aft
409 mood
410 mp
411 score
412 attribute
413 blob
414 playlist
415 sched
416 acl
417 send_common
418 udp_send
419 color
420 fec
421 wma_afh
422 wma_common
423 sideband
424 version
425 lsu
426 "
427 if test "$CRYPTOLIB" = openssl; then
428 server_errlist_objs="$server_errlist_objs openssl"
429 else
430 server_errlist_objs="$server_errlist_objs gcrypt"
431 fi
432 NEED_OGG_OBJECTS() && server_errlist_objs="$server_errlist_objs ogg_afh_common"
433 NEED_VORBIS_OBJECTS() && server_errlist_objs="$server_errlist_objs ogg_afh"
434 NEED_SPEEX_OBJECTS() && server_errlist_objs="$server_errlist_objs spx_afh spx_common"
435 NEED_OPUS_OBJECTS() && server_errlist_objs="$server_errlist_objs opus_afh opus_common"
436 NEED_FLAC_OBJECTS && server_errlist_objs="$server_errlist_objs flac_afh"
437 if test $HAVE_FAAD = yes; then
438 server_errlist_objs="$server_errlist_objs aac_afh"
439 fi
440 server_objs="$server_errlist_objs"
441 AC_SUBST(server_objs, add_dot_o($server_objs))
442 else
443 build_server="no"
444 fi
445 ############################################################# client
446 if test -n "$CRYPTOLIB"; then
447 build_client="yes"
448 executables="$executables client"
449 client_errlist_objs="
450 client
451 net
452 string
453 fd
454 lsu
455 sched
456 stdin
457 stdout
458 time
459 sideband
460 client_common
461 buffer_tree
462 crypt_common
463 base64
464 version
465 "
466 if test "$CRYPTOLIB" = openssl; then
467 client_errlist_objs="$client_errlist_objs openssl"
468 else
469 client_errlist_objs="$client_errlist_objs gcrypt"
470 fi
471 if test $HAVE_READLINE = yes; then
472 client_errlist_objs="$client_errlist_objs interactive"
473 fi
474 client_objs="$client_errlist_objs"
475 AC_SUBST(client_objs, add_dot_o($client_errlist_objs))
476 else
477 build_client="no"
478 fi
479 ############################################################# audiod
480 if test -n "$CRYPTOLIB"; then
481 build_audiod="yes"
482 executables="$executables audiod"
483 audiod_audio_formats="wma"
484 audiod_errlist_objs="$audiod_errlist_objs
485 audiod
486 signal
487 string
488 daemon
489 stat
490 net
491 crypt_common
492 base64
493 sideband
494 time
495 grab_client
496 filter_common
497 wav_filter
498 compress_filter
499 amp_filter
500 http_recv
501 dccp_recv
502 recv_common
503 fd
504 sched
505 write_common
506 file_write
507 audiod_command
508 fecdec_filter
509 client_common
510 udp_recv
511 color
512 fec
513 prebuffer_filter
514 version
515 bitstream
516 imdct
517 wma_common
518 wmadec_filter
519 buffer_tree
520 sync_filter
521 lsu
522 "
523 if test "$CRYPTOLIB" = openssl; then
524 audiod_errlist_objs="$audiod_errlist_objs openssl"
525 else
526 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
527 fi
528 NEED_VORBIS_OBJECTS && {
529 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
530 audiod_audio_formats="$audiod_audio_formats ogg"
531 }
532 NEED_SPEEX_OBJECTS && {
533 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
534 audiod_audio_formats="$audiod_audio_formats spx"
535 }
536 NEED_OPUS_OBJECTS && {
537 audiod_errlist_objs="$audiod_errlist_objs opusdec_filter opus_common"
538 audiod_audio_formats="$audiod_audio_formats opus"
539 }
540 NEED_FLAC_OBJECTS && {
541 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
542 audiod_audio_formats="$audiod_audio_formats flac"
543 }
544 if test $HAVE_FAAD = yes; then
545 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter"
546 audiod_audio_formats="$audiod_audio_formats aac"
547 fi
548 if test $HAVE_MAD = yes; then
549 audiod_audio_formats="$audiod_audio_formats mp3"
550 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
551 fi
552 if test $HAVE_OSS = yes; then
553 audiod_errlist_objs="$audiod_errlist_objs oss_write"
554 fi
555 if test $HAVE_ALSA = yes; then
556 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
557 fi
558 NEED_AO_OBJECTS && {
559 audiod_errlist_objs="$audiod_errlist_objs ao_write"
560 }
561 if test $HAVE_SAMPLERATE = yes; then
562 audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
563 fi
564 audiod_objs="$audiod_errlist_objs"
565 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
566
567 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
568 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
569 enum of audio formats supported by audiod)
570 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
571 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
572 else
573 build_audiod="no"
574 fi
575 ########################################################################### mixer
576 if test $HAVE_OSS = yes -o $HAVE_ALSA = yes; then
577 build_mixer="yes"
578 executables="$executables mixer"
579 mixer_errlist_objs="mixer exec string fd lsu version"
580 if test $HAVE_OSS = yes; then
581 mixer_errlist_objs="$mixer_errlist_objs oss_mix"
582 fi
583 if test $HAVE_ALSA = yes; then
584 mixer_errlist_objs="$mixer_errlist_objs alsa_mix"
585 fi
586 mixer_objs="$mixer_errlist_objs"
587 AC_SUBST(mixer_objs, add_dot_o($mixer_objs))
588 else
589 build_mixer="no"
590 AC_MSG_WARN([no mixer support])
591 fi
592 ########################################################################### gui
593 if test $HAVE_CURSES = yes; then
594 build_gui="yes"
595 executables="$executables gui"
596 gui_errlist_objs="
597 exec
598 signal
599 string
600 stat
601 ringbuffer
602 fd
603 gui
604 gui_theme
605 lsu
606 time
607 sched
608 version
609 "
610 gui_objs="$gui_errlist_objs"
611 AC_SUBST(gui_objs, add_dot_o($gui_objs))
612 else
613 build_gui="no"
614 AC_MSG_WARN([no curses lib, cannot build para_gui])
615 fi
616 ######################################################################## filter
617 filter_errlist_objs="
618 filter_common
619 wav_filter
620 compress_filter
621 filter
622 string
623 stdin
624 stdout
625 sched
626 fd
627 amp_filter
628 fecdec_filter
629 fec
630 lsu
631 version
632 prebuffer_filter
633 time
634 bitstream
635 imdct
636 wma_common
637 wmadec_filter
638 buffer_tree
639 net
640 sync_filter
641 "
642 NEED_VORBIS_OBJECTS && filter_errlist_objs="$filter_errlist_objs oggdec_filter"
643 NEED_SPEEX_OBJECTS && filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
644 NEED_OPUS_OBJECTS && filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
645 NEED_FLAC_OBJECTS && filter_errlist_objs="$filter_errlist_objs flacdec_filter"
646 if test $HAVE_FAAD = yes; then
647 filter_errlist_objs="$filter_errlist_objs aacdec_filter"
648 fi
649 if test $HAVE_MAD = yes; then
650 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
651 fi
652 if test $HAVE_SAMPLERATE = yes; then
653 filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
654 fi
655 filter_objs="$filter_errlist_objs"
656
657 AC_SUBST(filter_objs, add_dot_o($filter_objs))
658 ########################################################################## recv
659 recv_errlist_objs="
660 http_recv
661 recv_common
662 recv
663 time
664 string
665 net
666 dccp_recv
667 fd
668 sched
669 stdout
670 udp_recv
671 buffer_tree
672 afh_recv
673 afh_common
674 wma_afh
675 wma_common
676 mp3_afh
677 version
678 "
679 NEED_OGG_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
680 NEED_VORBIS_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh"
681 NEED_SPEEX_OBJECTS && recv_errlist_objs="$recv_errlist_objs spx_afh spx_common"
682 NEED_OPUS_OBJECTS && recv_errlist_objs="$recv_errlist_objs opus_afh opus_common"
683 NEED_FLAC_OBJECTS && recv_errlist_objs="$recv_errlist_objs flac_afh"
684
685 if test $HAVE_FAAD = yes; then
686 recv_errlist_objs="$recv_errlist_objs aac_afh"
687 fi
688 recv_objs="$recv_errlist_objs"
689 AC_SUBST(recv_objs, add_dot_o($recv_objs))
690 ########################################################################### afh
691 audio_format_handlers="mp3 wma"
692 afh_errlist_objs="
693 afh
694 string
695 fd
696 mp3_afh
697 afh_common
698 time
699 wma_afh
700 wma_common
701 version
702 "
703 NEED_OGG_OBJECTS && afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
704 NEED_VORBIS_OBJECTS && {
705 afh_errlist_objs="$afh_errlist_objs ogg_afh"
706 audio_format_handlers="$audio_format_handlers ogg"
707 }
708 NEED_SPEEX_OBJECTS && {
709 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
710 audio_format_handlers="$audio_format_handlers spx"
711 }
712 NEED_OPUS_OBJECTS && {
713 afh_errlist_objs="$afh_errlist_objs opus_afh opus_common"
714 audio_format_handlers="$audio_format_handlers opus"
715 }
716 NEED_FLAC_OBJECTS && {
717 afh_errlist_objs="$afh_errlist_objs flac_afh"
718 audio_format_handlers="$audio_format_handlers flac"
719 }
720 if test $HAVE_FAAD = yes; then
721 afh_errlist_objs="$afh_errlist_objs aac_afh"
722 audio_format_handlers="$audio_format_handlers aac"
723 fi
724
725 afh_objs="$afh_errlist_objs"
726
727 AC_SUBST(afh_objs, add_dot_o($afh_objs))
728 ########################################################################## play
729 play_errlist_objs="
730 play
731 fd
732 sched
733 buffer_tree
734 time
735 string
736 net
737 afh_recv
738 afh_common
739 wma_afh
740 wma_common
741 mp3_afh
742 recv_common
743 udp_recv
744 http_recv
745 dccp_recv
746 filter_common
747 fec
748 bitstream
749 imdct
750 wav_filter
751 compress_filter
752 amp_filter
753 prebuffer_filter
754 fecdec_filter
755 wmadec_filter
756 write_common
757 file_write
758 version
759 sync_filter
760 lsu
761 "
762 NEED_OGG_OBJECTS && play_errlist_objs="$play_errlist_objs ogg_afh_common"
763 NEED_VORBIS_OBJECTS && {
764 play_errlist_objs="$play_errlist_objs oggdec_filter ogg_afh"
765 }
766 NEED_SPEEX_OBJECTS && {
767 play_errlist_objs="$play_errlist_objs spxdec_filter spx_afh spx_common"
768 }
769 NEED_OPUS_OBJECTS &&
770 play_errlist_objs="$play_errlist_objs
771 opusdec_filter
772 opus_afh
773 opus_common
774 "
775 NEED_FLAC_OBJECTS && {
776 play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
777 }
778 if test $HAVE_FAAD = yes; then
779 play_errlist_objs="$play_errlist_objs aac_afh aacdec_filter"
780 fi
781 if test $HAVE_MAD = yes; then
782 play_errlist_objs="$play_errlist_objs mp3dec_filter"
783 fi
784 if test $HAVE_OSS = yes; then
785 play_errlist_objs="$play_errlist_objs oss_write"
786 fi
787 if test $HAVE_ALSA = yes; then
788 play_errlist_objs="$play_errlist_objs alsa_write"
789 fi
790 NEED_AO_OBJECTS && {
791 play_errlist_objs="$play_errlist_objs ao_write"
792 }
793 if test $HAVE_READLINE = yes; then
794 play_errlist_objs="$play_errlist_objs interactive"
795 fi
796 if test $HAVE_SAMPLERATE = yes; then
797 play_errlist_objs="$play_errlist_objs resample_filter check_wav"
798 fi
799
800 play_objs="$play_errlist_objs"
801 AC_SUBST(play_objs, add_dot_o($play_objs))
802 ######################################################################### write
803 write_errlist_objs="
804 write
805 write_common
806 file_write
807 time
808 fd
809 string
810 sched
811 stdin
812 buffer_tree
813 check_wav
814 version
815 "
816
817 NEED_AO_OBJECTS && {
818 write_errlist_objs="$write_errlist_objs ao_write"
819 }
820 if test $HAVE_OSS = yes; then
821 write_errlist_objs="$write_errlist_objs oss_write"
822 fi
823 if test $HAVE_ALSA = yes; then
824 write_errlist_objs="$write_errlist_objs alsa_write"
825 fi
826 write_objs="$write_errlist_objs"
827 AC_SUBST(write_objs, add_dot_o($write_objs))
828 ######################################################################## audioc
829 audioc_errlist_objs="
830 audioc
831 string
832 lsu
833 net
834 fd
835 version
836 "
837 if test $HAVE_READLINE = yes; then
838 audioc_errlist_objs="$audioc_errlist_objs
839 buffer_tree
840 interactive
841 sched
842 time
843 "
844 fi
845 audioc_objs="$audioc_errlist_objs"
846 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
847
848 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
849 [formats supported by para_server and para_afh])
850 AC_SUBST(executables)
851
852 AC_OUTPUT
853 AC_MSG_NOTICE([
854 paraslash configuration:
855 ~~~~~~~~~~~~~~~~~~~~~~~~
856 crypto lib: ${CRYPTOLIB:-[none]}
857 unix socket credentials: $have_ucred
858 readline (interactive CLIs): $HAVE_READLINE
859 id3 version 2 support: $HAVE_ID3TAG
860 faad: $HAVE_FAAD
861 audio format handlers: $audio_format_handlers
862
863 para_server: $build_server
864 para_gui: $build_gui
865 para_mixer: $build_mixer
866 para_client: $build_client
867 para_audiod: $build_audiod
868 ])