build: Convert crypto detection/selection to new macros.
[paraslash.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ([2.61])
5
6 AC_INIT([paraslash], [m4_esyscmd_s(./GIT-VERSION-GEN)],
7 [maan@tuebingen.mpg.de], [], [http://people.tuebingen.mpg.de/maan/paraslash/])
8 AC_CONFIG_HEADERS([config.h])
9
10 AC_CONFIG_FILES([Makefile])
11 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
12 AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; done)])
13 AC_DEFUN([make_errlist_defines], \
14 $(for i in $@; do \
15 printf "DEFINE_ERRLIST($(echo $i | tr 'a-z' 'A-Z'));"; \
16 done) \
17 )
18 AC_DEFUN([make_para_errlists], \
19 $(for i in $@; do \
20 printf "PARA_ERRLIST($(echo $i | tr 'a-z' 'A-Z')), "; \
21 done) \
22 )
23 AC_DEFUN([objlist_to_errlist],[ \
24 make_errlist_defines($@) \
25 [const char **para_errlist[[]]] = {make_para_errlists($@)} \
26 ])
27 AC_DEFUN([LIB_ARG_WITH], [
28 AC_ARG_WITH($1-headers, [AS_HELP_STRING(--with-$1-headers=dir,
29 [look for $1 headers in dir])])
30 AC_ARG_WITH($1-libs, [AS_HELP_STRING(--with-$1-libs=dir,
31 [look for $1 libraries in dir])])
32 if test -n "$with_$1_headers"; then
33 $1_cppflags="-I$with_$1_headers"
34 CPPFLAGS="$CPPFLAGS $$1_cppflags"
35 fi
36 if test -n "$with_$1_libs"; then
37 $1_ldflags="-L$with_$1_libs $2"
38 else
39 $1_ldflags="$2"
40 fi
41 LDFLAGS="$LDFLAGS $$1_ldflags"
42 ])
43
44 AC_DEFUN([STASH_FLAGS], [
45 OLD_CPPFLAGS="$CPPFLAGS"
46 OLD_LDFLAGS="$LDFLAGS"
47 OLD_LIBS="$LIBS"
48 ])
49
50 AC_DEFUN([UNSTASH_FLAGS], [
51 CPPFLAGS="$OLD_CPPFLAGS"
52 LDFLAGS="$OLD_LDFLAGS"
53 LIBS="$OLD_LIBS"
54 ])
55 AC_DEFUN([LIB_SUBST_FLAGS], [
56 if test "$HAVE_[]m4_toupper([$1])" == 'yes'; then
57 AC_DEFINE(HAVE_[]m4_toupper([$1]), 1,
58 define to 1 to turn on $1 support)
59 else
60 $1_cppflags=
61 $1_ldflags=
62 fi
63 AC_SUBST(HAVE_[]m4_toupper([$1]))
64 AC_SUBST($1_cppflags)
65 AC_SUBST($1_ldflags)
66 ])
67
68 AC_PATH_PROG(UNAMEPATH, uname, no)
69 if test "$UNAMEPATH" = "no"; then
70 AC_MSG_ERROR(unable to determine system type)
71 fi
72 AC_MSG_CHECKING(os type)
73 OSTYPE="`$UNAMEPATH -s`"
74 AC_MSG_RESULT("$OSTYPE")
75
76 if test "$OSTYPE" = "SunOS"; then
77 # needed on SunOS for socket magic
78 arch_cppflags="-D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
79 AC_SUBST(arch_cppflags)
80 fi
81
82 AC_C_BIGENDIAN()
83
84 AC_PATH_PROG([gengetopt], [gengetopt])
85 test -z "$gengetopt" && AC_MSG_ERROR(
86 [gengetopt is required to build this package])
87
88 AC_PATH_PROG([help2man], [help2man])
89 test -z "$help2man" && AC_MSG_ERROR(
90 [help2man is required to build this package])
91
92 AC_PATH_PROG([install], [install])
93 test -z "$install" && AC_MSG_ERROR(
94 [The install program is required to build this package])
95
96 AC_PROG_CC
97 AC_PROG_CPP
98
99 executables="recv filter audioc write afh play"
100 ################################################################## clock_gettime
101 clock_gettime_lib=
102 AC_CHECK_LIB([c], [clock_gettime], [clock_gettime_lib=c], [
103 AC_CHECK_LIB([rt], [clock_gettime], [clock_gettime_lib=rt], [], [])
104 ])
105 if test -n "$clock_gettime_lib"; then
106 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [
107 define to 1 if clock_gettime() is supported])
108 fi
109 if test "$clock_gettime_lib" = "rt"; then
110 AC_SUBST(clock_gettime_ldflags, -lrt)
111 fi
112
113 ########################################################################### osl
114 STASH_FLAGS
115 LIB_ARG_WITH([osl], [-losl])
116 HAVE_OSL=yes
117 AC_CHECK_HEADER(osl.h, [], [HAVE_OSL=no])
118 AC_CHECK_LIB([osl], [osl_open_table], [], [HAVE_OSL=no])
119 LIB_SUBST_FLAGS(osl)
120 UNSTASH_FLAGS
121 ######################################################################## openssl
122 STASH_FLAGS
123 HAVE_OPENSSL=yes
124 LIB_ARG_WITH([openssl], [-lssl -lcrypto])
125 AC_CHECK_HEADER(openssl/ssl.h, [], [HAVE_OPENSSL=no])
126 AC_CHECK_LIB([crypto], [RAND_bytes], [], [HAVE_OPENSSL=no])
127 LIB_SUBST_FLAGS(openssl)
128 UNSTASH_FLAGS
129 ######################################################################### gcrypt
130 STASH_FLAGS
131 HAVE_GCRYPT=yes
132 LIB_ARG_WITH([gcrypt], [-lgcrypt])
133 AC_CHECK_HEADER(gcrypt.h, [], [HAVE_GCRYPT=no])
134 AC_CHECK_LIB([gcrypt], [gcry_randomize], [], [HAVE_GCRYPT=no])
135 LIB_SUBST_FLAGS(gcrypt)
136 UNSTASH_FLAGS
137 ######################################################################### crypto
138 AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
139 Force using crypto library "lib". This package requires either
140 openssl or libgcrypt being installed. Possible values for "lib"
141 are thus "openssl" and "gcrypt". If this option is not given,
142 openssl is tried first. If openssl was not found, gcrypt is
143 tried next.])])
144
145 CRYPTOLIB="$enable_cryptolib"
146 case "$enable_cryptolib" in
147 "openssl")
148 test $HAVE_OPENSSL = no && AC_MSG_ERROR(openssl not found)
149 crypto_ldflags="$openssl_ldflags"
150 ;;
151 "gcrypt")
152 test $HAVE_GCRYPT = no && AC_MSG_ERROR(gcrypt not found)
153 crypto_ldflags="$gcrypt_ldflags"
154 ;;
155 "")
156 crypto_ldflags=
157 if test $HAVE_GCRYPT = yes; then
158 CRYPTOLIB=gcrypt
159 crypto_ldflags="$gcrypt_ldflags"
160 fi
161 if test $HAVE_OPENSSL = yes; then
162 CRYPTOLIB=openssl
163 crypto_ldflags="$openssl_ldflags"
164 fi
165 ;;
166 *)
167 AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib])
168 ;;
169 esac
170 AC_SUBST(crypto_ldflags)
171 ########################################################################### libsocket
172 AC_CHECK_LIB([c], [socket],
173 [socket_ldlflags=],
174 [socket_ldflags="-lsocket"]
175 )
176 AC_SUBST(socket_ldflags)
177 ########################################################################### libnsl
178 AC_CHECK_LIB([c], [gethostbyname],
179 [nsl_ldflags=],
180 [nsl_ldflags="-lnsl"]
181 )
182 AC_SUBST(nsl_ldflags)
183 ########################################################################### ucred
184 AC_MSG_CHECKING(for struct ucred)
185 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
186 #define _GNU_SOURCE
187 #include <sys/types.h>
188 #include <sys/socket.h>
189 ]], [[
190 struct ucred sucred; sucred.pid=0;
191 ]])],[have_ucred=yes],[have_ucred=no])
192 AC_MSG_RESULT($have_ucred)
193 if test ${have_ucred} = yes; then
194 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
195 fi
196 ########################################################################### gengetopt
197 echo 'option "z" z "" flag off' | $gengetopt --file-name conftest-ggo &&
198 AC_CHECK_DECL(
199 [gengetopt_args_info_description],
200 [ggo_descriptions_declared=yes],
201 [ggo_descriptions_declared=no],
202 [#include "conftest-ggo.h"]
203 )
204 AC_SUBST(ggo_descriptions_declared)
205 ########################################################################### curses
206 have_curses="yes"
207 OLD_CPPFLAGS="$CPPFLAGS"
208 OLD_LDFLAGS="$LDFLAGS"
209 OLD_LIBS="$LIBS"
210 AC_ARG_WITH(curses_headers, [AS_HELP_STRING(--with-curses-headers=dir,
211 [look for curses.h also in dir])])
212 if test -n "$with_curses_headers"; then
213 curses_cppflags="-I$with_curses_headers"
214 CPPFLAGS="$CPPFLAGS $curses_cppflags"
215 fi
216 AC_ARG_WITH(curses_libs, [AS_HELP_STRING(--with-curses-libs=dir,
217 [look for libcurses also in dir])])
218 if test -n "$with_curses_libs"; then
219 curses_libs="-L$with_curses_libs"
220 LDFLAGS="$LDFLAGS $curses_libs"
221 fi
222 AC_CHECK_HEADER(curses.h, [], [
223 have_curses="no"
224 ])
225 curses_ldflags="$curses_libs"
226 AC_CHECK_LIB([ncursesw], [initscr],
227 [curses_ldflags="$curses_libs -lncursesw"], [
228 AC_CHECK_LIB([curses], [initscr],
229 [curses_ldflags="$curses_libs -lcurses"],
230 [have_curses="no"]
231 )
232 ]
233 )
234 AC_SUBST(curses_cppflags)
235 AC_SUBST(curses_ldflags)
236 CPPFLAGS="$OLD_CPPFLAGS"
237 LDFLAGS="$OLD_LDFLAGS"
238 LIBS="$OLD_LIBS"
239 ########################################################################### ip_mreqn
240 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
241 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
242 #include <netdb.h>
243 #include <net/if.h>
244 ]], [[
245 struct ip_mreqn mn;
246 mn.imr_ifindex = 0;
247 ]])],[have_ip_mreqn=yes],[have_ip_mreqn=no])
248 AC_MSG_RESULT($have_ip_mreqn)
249 if test ${have_ip_mreqn} = yes; then
250 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
251 fi
252 ########################################################################### osx
253
254 AC_MSG_CHECKING(for CoreAudio (MacOs))
255 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
256 #include <CoreAudio/CoreAudio.h>
257 ]], [[
258 AudioDeviceID id;
259 ]])],[have_core_audio=yes],[have_core_audio=no])
260 AC_MSG_RESULT($have_core_audio)
261 if test ${have_core_audio} = yes; then
262 f1="-framework CoreAudio"
263 f2="-framework AudioToolbox"
264 f3="-framework AudioUnit"
265 f4="-framework CoreServices"
266 core_audio_ldflags="$f1 $f2 $f3 $f4"
267 AC_SUBST(core_audio_ldflags)
268 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
269 fi
270 ########################################################################### ogg
271 STASH_FLAGS
272 LIB_ARG_WITH([ogg], [-logg])
273 HAVE_OGG=yes
274 AC_CHECK_HEADERS([ogg/ogg.h], [], [HAVE_OGG=no])
275 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [HAVE_OGG=no])
276 LIB_SUBST_FLAGS(ogg)
277 UNSTASH_FLAGS
278 ######################################################################### vorbis
279 STASH_FLAGS
280 LIB_ARG_WITH([vorbis], [-lvorbis -lvorbisfile])
281 HAVE_VORBIS=yes
282 AC_CHECK_HEADERS([vorbis/codec.h], [], [HAVE_VORBIS=no])
283 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [HAVE_VORBIS=no])
284 LIB_SUBST_FLAGS(vorbis)
285 UNSTASH_FLAGS
286 ######################################################################### speex
287 STASH_FLAGS
288 LIB_ARG_WITH([speex], [-lspeex])
289 HAVE_SPEEX=yes
290 AC_CHECK_HEADERS([speex/speex.h], [], [HAVE_SPEEX=no])
291 AC_CHECK_LIB([speex], [speex_decoder_init], [], [HAVE_SPEEX=no])
292 LIB_SUBST_FLAGS(speex)
293 UNSTASH_FLAGS
294 ######################################################################### opus
295 STASH_FLAGS
296 LIB_ARG_WITH([opus], [-lopus])
297 HAVE_OPUS=yes
298 AC_CHECK_HEADERS([opus/opus.h], [], [HAVE_OPUS=no])
299 AC_CHECK_LIB([opus], [opus_multistream_decode], [], [HAVE_OPUS=no])
300 LIB_SUBST_FLAGS(opus)
301 UNSTASH_FLAGS
302
303 # some helper functions for codecs which use the ogg container format
304 AC_DEFUN([NEED_OGG_OBJECTS], [{
305 test "$HAVE_OGG" = 'yes' -a \( \
306 "$HAVE_VORBIS" = 'yes' \
307 -o "$HAVE_SPEEX" = 'yes' \
308 -o "$HAVE_OPUS" = 'yes' \
309 \)
310 }])
311 AC_DEFUN([NEED_VORBIS_OBJECTS], [{
312 test "$HAVE_OGG" = 'yes' -a "$HAVE_VORBIS" = 'yes'
313 }])
314 AC_DEFUN([NEED_SPEEX_OBJECTS], [{
315 test "$HAVE_OGG" = 'yes' -a "$HAVE_SPEEX" = 'yes'
316 }])
317 AC_DEFUN([NEED_OPUS_OBJECTS], [{
318 test "$HAVE_OGG" = 'yes' -a "$HAVE_OPUS" = 'yes'
319 }])
320 ########################################################################### faad
321 have_faad=yes
322 OLD_CPPFLAGS="$CPPFLAGS"
323 OLD_LDFLAGS="$LDFLAGS"
324 OLD_LIBS="$LIBS"
325 AC_ARG_WITH(faad_headers, [AS_HELP_STRING(--with-faad-headers=dir,
326 [look for neaacdec.h also in dir])])
327 if test -n "$with_faad_headers"; then
328 faad_cppflags="-I$with_faad_headers"
329 CPPFLAGS="$CPPFLAGS $faad_cppflags"
330 fi
331 AC_ARG_WITH(faad_libs, [AS_HELP_STRING(--with-faad-libs=dir,
332 [look for libfaad also in dir])])
333 if test -n "$with_faad_libs"; then
334 faad_libs="-L$with_faad_libs"
335 LDFLAGS="$LDFLAGS $faad_libs"
336 fi
337 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
338 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
339 if test "$have_faad" = "yes"; then
340 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
341 AC_SUBST(faad_cppflags)
342 faad_ldflags="$faad_libs -lfaad"
343 AC_SUBST(faad_ldflags)
344 fi
345 CPPFLAGS="$OLD_CPPFLAGS"
346 LDFLAGS="$OLD_LDFLAGS"
347 LIBS="$OLD_LIBS"
348 ########################################################################### mad
349 have_mad="yes"
350 OLD_CPPFLAGS="$CPPFLAGS"
351 OLD_LDFLAGS="$LDFLAGS"
352 OLD_LIBS="$LIBS"
353
354 AC_ARG_WITH(mad_headers, [AS_HELP_STRING(--with-mad-headers=dir,
355 [look for mad.h also in dir])])
356 if test -n "$with_mad_headers"; then
357 mad_cppflags="-I$with_mad_headers"
358 CPPFLAGS="$CPPFLAGS $mad_cppflags"
359 fi
360 AC_ARG_WITH(mad_libs, [AS_HELP_STRING(--with-mad-libs=dir,
361 [look for libmad also in dir])])
362 if test -n "$with_mad_libs"; then
363 mad_libs="-L$with_mad_libs"
364 LDFLAGS="$LDFLAGS $mad_libs"
365 fi
366 AC_CHECK_HEADERS([mad.h], [], [
367 have_mad="no"
368 ])
369 AC_CHECK_LIB([mad], [mad_stream_init], [], [
370 have_mad="no"
371 ])
372 if test "$have_mad" = "yes"; then
373 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
374 AC_SUBST(mad_cppflags)
375 mad_ldflags="$mad_libs -lmad"
376 AC_SUBST(mad_ldflags)
377 else
378 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
379 fi
380 CPPFLAGS="$OLD_CPPFLAGS"
381 LDFLAGS="$OLD_LDFLAGS"
382 LIBS="$OLD_LIBS"
383 ###################################################################### libid3tag
384 OLD_CPPFLAGS="$CPPFLAGS"
385 OLD_LDFLAGS="$LDFLAGS"
386 OLD_LIBS="$LIBS"
387
388 have_libid3tag="yes"
389 AC_ARG_WITH(id3tag_headers, [AS_HELP_STRING(--with-id3tag-headers=dir,
390 [look for id3tag header files also in dir])])
391 if test -n "$with_id3tag_headers"; then
392 id3tag_cppflags="-I$with_id3tag_headers"
393 CPPFLAGS="$CPPFLAGS $id3tag_cppflags"
394 fi
395 AC_ARG_WITH(id3tag_libs, [AS_HELP_STRING(--with-id3tag-libs=dir,
396 [look for id3tag libs also in dir])])
397 if test -n "$with_id3tag_libs"; then
398 id3tag_libs="-L$with_id3tag_libs"
399 LDFLAGS="$LDFLAGS $id3tag_libs"
400 fi
401
402 AC_MSG_CHECKING(for libid3tag)
403 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
404 #include <id3tag.h>
405 ]], [[
406 struct id3_tag t = {.flags = 0};
407 ]])],[],[have_libid3tag=no])
408 AC_MSG_RESULT($have_libid3tag)
409
410 if test ${have_libid3tag} = yes; then
411 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
412 AC_SUBST(id3tag_cppflags)
413 AC_SUBST(id3tag_ldflags, "$id3tag_libs -lid3tag -lz")
414 fi
415 CPPFLAGS="$OLD_CPPFLAGS"
416 LDFLAGS="$OLD_LDFLAGS"
417 LIBS="$OLD_LIBS"
418 ########################################################################### flac
419 OLD_CPPFLAGS="$CPPFLAGS"
420 OLD_LDFLAGS="$LDFLAGS"
421 OLD_LIBS="$LIBS"
422
423 have_flac="yes"
424 AC_ARG_WITH(flac_headers, [AS_HELP_STRING(--with-flac-headers=dir,
425 [look for flac headers also in dir])])
426 if test -n "$with_flac_headers"; then
427 flac_cppflags="-I$with_flac_headers"
428 CPPFLAGS="$CPPFLAGS $flac_cppflags"
429 fi
430 AC_ARG_WITH(flac_libs, [AS_HELP_STRING(--with-flac-libs=dir,
431 [look for flac libs also in dir])])
432 if test -n "$with_flac_libs"; then
433 flac_libs="-L$with_flac_libs"
434 LDFLAGS="$LDFLAGS $flac_libs"
435 fi
436 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no)
437 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], [
438 # nope, try again with -logg
439 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [],
440 have_flac=no, -lm -logg)
441 ], -lm)
442 if test "$have_flac" = "yes"; then
443 AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter)
444 AC_SUBST(flac_cppflags)
445 flac_ldflags="$flac_libs -lFLAC"
446 AC_SUBST(flac_ldflags)
447 else
448 AC_MSG_WARN([no flac support in para_audiod/para_filter/para_afh/para_server])
449 fi
450 CPPFLAGS="$OLD_CPPFLAGS"
451 LDFLAGS="$OLD_LDFLAGS"
452 LIBS="$OLD_LIBS"
453 ########################################################################### oss
454 OLD_CPPFLAGS="$CPPFLAGS"
455 OLD_LDFLAGS="$LDFLAGS"
456 OLD_LIBS="$LIBS"
457
458 have_oss="yes"
459 msg="=> will not build oss writer"
460
461 AC_CHECK_HEADER(sys/soundcard.h, [
462 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
463 oss_ldflags="-lossaudio"
464 AC_SUBST(oss_ldflags)
465 ]
466 )
467 ],
468 [
469 have_oss="no"
470 AC_MSG_WARN([no sys/soundcard.h $msg])
471 ]
472 )
473 CPPFLAGS="$OLD_CPPFLAGS"
474 LDFLAGS="$OLD_LDFLAGS"
475 LIBS="$OLD_LIBS"
476
477 ########################################################################### alsa
478 OLD_CPPFLAGS="$CPPFLAGS"
479 OLD_LDFLAGS="$LDFLAGS"
480 OLD_LIBS="$LIBS"
481
482 msg="=> no alsa support for para_audiod/para_write"
483 if test "$OSTYPE" != "Linux"; then
484 have_alsa="no"
485 else
486 have_alsa="yes"
487 fi
488 if test "$have_alsa" = "yes"; then
489 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
490 have_alsa="no"
491 AC_MSG_WARN([no alsa/asoundlib $msg])
492 ])
493 fi
494
495 if test "$have_alsa" = "yes"; then
496 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
497 have_alsa="no"
498 AC_MSG_WARN([no libasound $msg])
499 ])
500 fi
501
502 if test "$have_alsa" = "yes"; then
503 alsa_ldflags="-lasound"
504 AC_SUBST(alsa_ldflags)
505 fi
506
507 CPPFLAGS="$OLD_CPPFLAGS"
508 LDFLAGS="$OLD_LDFLAGS"
509 LIBS="$OLD_LIBS"
510 ########################################################################### libao
511 OLD_CPPFLAGS="$CPPFLAGS"
512 OLD_LDFLAGS="$LDFLAGS"
513 OLD_LIBS="$LIBS"
514
515 have_ao="yes"
516 AC_ARG_WITH(ao_headers, [AS_HELP_STRING(--with-ao-headers=dir,
517 [look for ao/ao.h also in dir])])
518 if test -n "$with_ao_headers"; then
519 ao_cppflags="-I$with_ao_headers"
520 CPPFLAGS="$CPPFLAGS $ao_cppflags"
521 fi
522 AC_ARG_WITH(ao_libs, [AS_HELP_STRING(--with-ao-libs=dir,
523 [look for libao also in dir])])
524 if test -n "$with_ao_libs"; then
525 ao_libs="-L$with_ao_libs"
526 LDFLAGS="$LDFLAGS $ao_libs"
527 fi
528 msg="no libao support for para_audiod/para_write"
529 AC_CHECK_HEADERS([ao/ao.h], [
530 ], [
531 have_ao="no"
532 AC_MSG_WARN([ao.h not found, $msg])
533 ])
534 if test "$have_ao" = "yes"; then
535 AC_CHECK_LIB([ao], [ao_initialize], [], [
536 have_ao="no"
537 AC_MSG_WARN([ao lib not found or not working, $msg])
538 ])
539 fi
540 if test "$have_ao" = "yes"; then
541 AC_CHECK_HEADERS([pthread.h], [
542 ], [
543 have_ao="no"
544 AC_MSG_WARN([pthread.h not found, $msg])
545 ])
546 fi
547 if test "$have_ao" = "yes"; then
548 AC_CHECK_LIB([pthread], [pthread_create], [], [
549 have_ao="no"
550 AC_MSG_WARN([pthread lib not found or not working, $msg])
551 ])
552 fi
553 if test "$have_ao" = "yes"; then
554 AC_SUBST(ao_cppflags)
555 ao_ldflags="$ao_libs -lao -lpthread"
556 AC_SUBST(ao_ldflags)
557 fi
558
559 CPPFLAGS="$OLD_CPPFLAGS"
560 LDFLAGS="$OLD_LDFLAGS"
561 LIBS="$OLD_LIBS"
562 ############################################################# readline
563 OLD_CPPFLAGS="$CPPFLAGS"
564 OLD_LDFLAGS="$LDFLAGS"
565 OLD_LIBS="$LIBS"
566
567 have_readline="yes"
568 AC_ARG_WITH(readline_headers, [AS_HELP_STRING(--with-readline-headers=dir,
569 [look for libreadline header files also in dir])])
570 if test -n "$with_readline_headers"; then
571 readline_cppflags="-I$with_readline_headers"
572 CPPFLAGS="$CPPFLAGS $readline_cppflags"
573 fi
574
575 AC_ARG_WITH(readline_libs, [AS_HELP_STRING(--with-readline-libs=dir,
576 [look for readline library also in dir])])
577 if test -n "$with_readline_libs"; then
578 readline_libs="-L$with_readline_libs"
579 LDFLAGS="$LDFLAGS $readline_libs"
580 fi
581 msg="no interactive cli support"
582 AC_CHECK_HEADERS([readline/readline.h], [
583 ], [
584 have_readline="no"
585 AC_MSG_WARN([readline/readline.h not found, $msg])
586 ])
587
588 if test "$have_readline" = "yes"; then
589 readline_ldflags="$readline_libs"
590 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
591 readline_ldflags="$readline_ldflags -lreadline"
592 ], [have_readline="no"])
593 if test "$have_readline" = "no"; then # try with -lcurses
594 # clear cache
595 AC_MSG_NOTICE([trying again with -lcurses])
596 unset ac_cv_search_rl_free_keymap 2> /dev/null
597 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
598 have_readline=yes
599 readline_ldflags="$readline_ldflags -lreadline -lcurses"
600 ], [], [-lcurses])
601 fi
602 if test "$have_readline" = "no"; then # try with -ltermcap
603 # clear cache
604 AC_MSG_NOTICE([trying again with -ltermcap])
605 unset ac_cv_search_rl_free_keymap 2> /dev/null
606 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
607 have_readline=yes
608 readline_ldflags="$readline_ldflags -lreadline -ltermcap"
609 ], [], [-ltermcap])
610 fi
611 fi
612
613 if test "$have_readline" = "yes"; then
614 AC_CHECK_DECL(
615 [rl_free_keymap],
616 [AC_DEFINE(RL_FREE_KEYMAP_DECLARED, 1, readline >= 6.3)],
617 [],
618 [
619 #include <stdio.h>
620 #include <readline/readline.h>
621 ]
622 )
623 AC_SUBST(readline_cppflags)
624 AC_SUBST(readline_ldflags)
625 AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
626 else
627 AC_MSG_WARN([libreadline not found or unusable])
628 fi
629 CPPFLAGS="$OLD_CPPFLAGS"
630 LDFLAGS="$OLD_LDFLAGS"
631 LIBS="$OLD_LIBS"
632 ############################################################# libsamplerate
633 OLD_CPPFLAGS="$CPPFLAGS"
634 OLD_LDFLAGS="$LDFLAGS"
635 OLD_LIBS="$LIBS"
636
637 have_samplerate="yes"
638 AC_ARG_WITH(samplerate_headers, [AS_HELP_STRING(--with-samplerate-headers=dir,
639 [look for samplerate headers also in dir])])
640 if test -n "$with_samplerate_headers"; then
641 samplerate_cppflags="-I$with_samplerate_headers"
642 CPPFLAGS="$CPPFLAGS $samplerate_cppflags"
643 fi
644 AC_ARG_WITH(samplerate_libs, [AS_HELP_STRING(--with-samplerate-libs=dir,
645 [look for samplerate libs also in dir])])
646 if test -n "$with_samplerate_libs"; then
647 samplerate_libs="-L$with_samplerate_libs"
648 LDFLAGS="$LDFLAGS $samplerate_libs"
649 fi
650
651 AC_CHECK_HEADER(samplerate.h, [], have_samplerate=no)
652 AC_CHECK_LIB([samplerate], [src_process], [], have_samplerate=no, [])
653
654 if test "$have_samplerate" = "yes"; then
655 AC_SUBST(samplerate_cppflags)
656 samplerate_ldflags="$samplerate_libs -lsamplerate"
657 AC_SUBST(samplerate_ldflags)
658 else
659 AC_MSG_WARN([no resample support in para_audiod/para_filter])
660 fi
661 CPPFLAGS="$OLD_CPPFLAGS"
662 LDFLAGS="$OLD_LDFLAGS"
663 LIBS="$OLD_LIBS"
664 ######################################################################### server
665 if test -n "$CRYPTOLIB" && test $HAVE_OSL = yes; then
666 build_server="yes"
667 executables="$executables server"
668 server_cmdline_objs="server"
669 server_errlist_objs="
670 server
671 afh_common
672 mp3_afh
673 vss
674 command
675 net
676 string
677 signal
678 time
679 daemon
680 http_send
681 close_on_fork
682 mm
683 crypt_common
684 ipc
685 dccp_send
686 fd
687 user_list
688 chunk_queue
689 afs
690 aft
691 mood
692 score
693 attribute
694 blob
695 playlist
696 sched
697 acl
698 send_common
699 udp_send
700 color
701 fec
702 wma_afh
703 wma_common
704 sideband
705 version
706 ggo
707 "
708 if test "$CRYPTOLIB" = openssl; then
709 server_errlist_objs="$server_errlist_objs crypt"
710 else
711 server_errlist_objs="$server_errlist_objs gcrypt"
712 fi
713 NEED_OGG_OBJECTS() && server_errlist_objs="$server_errlist_objs ogg_afh_common"
714 NEED_VORBIS_OBJECTS() && server_errlist_objs="$server_errlist_objs ogg_afh"
715 NEED_SPEEX_OBJECTS() && server_errlist_objs="$server_errlist_objs spx_afh spx_common"
716 NEED_OPUS_OBJECTS() && server_errlist_objs="$server_errlist_objs opus_afh opus_common"
717 if test "$have_faad" = "yes"; then
718 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
719 fi
720 if test "$have_flac" = "yes"; then
721 server_errlist_objs="$server_errlist_objs flac_afh"
722 fi
723 server_objs="add_cmdline($server_cmdline_objs) $server_errlist_objs"
724 AC_SUBST(server_objs, add_dot_o($server_objs))
725 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
726 objlist_to_errlist($server_errlist_objs), errors used by para_server)
727 else
728 build_server="no"
729 fi
730 ############################################################# client
731 if test -n "$CRYPTOLIB"; then
732 build_client="yes"
733 executables="$executables client"
734 client_cmdline_objs="client"
735 client_errlist_objs="
736 client
737 net
738 string
739 fd
740 sched
741 stdin
742 stdout
743 time
744 sideband
745 client_common
746 buffer_tree
747 crypt_common
748 version
749 ggo
750 "
751 if test "$CRYPTOLIB" = openssl; then
752 client_errlist_objs="$client_errlist_objs crypt"
753 else
754 client_errlist_objs="$client_errlist_objs gcrypt"
755 fi
756 if test "$have_readline" = "yes"; then
757 client_errlist_objs="$client_errlist_objs interactive"
758 fi
759 client_objs="add_cmdline($client_cmdline_objs) $client_errlist_objs"
760 AC_SUBST(client_objs, add_dot_o($client_objs))
761 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
762 objlist_to_errlist($client_errlist_objs), errors used by para_client)
763 else
764 build_client="no"
765 fi
766 ############################################################# audiod
767 if test -n "$CRYPTOLIB"; then
768 build_audiod="yes"
769 executables="$executables audiod"
770 audiod_audio_formats="wma"
771 audiod_cmdline_objs="$audiod_cmdline_objs
772 audiod
773 compress_filter
774 http_recv
775 dccp_recv
776 file_write
777 client
778 amp_filter
779 udp_recv
780 prebuffer_filter
781 sync_filter
782 "
783 audiod_errlist_objs="$audiod_errlist_objs
784 audiod
785 signal
786 string
787 daemon
788 stat
789 net
790 crypt_common
791 sideband
792 time
793 grab_client
794 filter_common
795 wav_filter
796 compress_filter
797 amp_filter
798 http_recv
799 dccp_recv
800 recv_common
801 fd
802 sched
803 write_common
804 file_write
805 audiod_command
806 fecdec_filter
807 client_common
808 ggo
809 udp_recv
810 color
811 fec
812 prebuffer_filter
813 version
814 bitstream
815 imdct
816 wma_common
817 wmadec_filter
818 buffer_tree
819 sync_filter
820 "
821 if test "$CRYPTOLIB" = openssl; then
822 audiod_errlist_objs="$audiod_errlist_objs crypt"
823 else
824 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
825 fi
826 if test "$have_core_audio" = "yes"; then
827 audiod_errlist_objs="$audiod_errlist_objs osx_write ipc"
828 audiod_cmdline_objs="$audiod_cmdline_objs osx_write"
829 fi
830 NEED_VORBIS_OBJECTS && {
831 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
832 audiod_audio_formats="$audiod_audio_formats ogg"
833 }
834 NEED_SPEEX_OBJECTS && {
835 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
836 audiod_audio_formats="$audiod_audio_formats spx"
837 }
838 NEED_OPUS_OBJECTS && {
839 audiod_errlist_objs="$audiod_errlist_objs opusdec_filter opus_common"
840 audiod_audio_formats="$audiod_audio_formats opus"
841 }
842 if test "$have_faad" = "yes"; then
843 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
844 audiod_audio_formats="$audiod_audio_formats aac"
845 fi
846 if test "$have_mad" = "yes"; then
847 audiod_audio_formats="$audiod_audio_formats mp3"
848 audiod_cmdline_objs="$audiod_cmdline_objs mp3dec_filter"
849 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
850 fi
851 if test "$have_flac" = "yes"; then
852 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
853 audiod_audio_formats="$audiod_audio_formats flac"
854 fi
855 if test "$have_oss" = "yes"; then
856 audiod_errlist_objs="$audiod_errlist_objs oss_write"
857 audiod_cmdline_objs="$audiod_cmdline_objs oss_write"
858 fi
859 if test "$have_alsa" = "yes"; then
860 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
861 audiod_cmdline_objs="$audiod_cmdline_objs alsa_write"
862 fi
863 if test "$have_ao" = "yes"; then
864 audiod_errlist_objs="$audiod_errlist_objs ao_write"
865 audiod_cmdline_objs="$audiod_cmdline_objs ao_write"
866 fi
867 if test "$have_samplerate" = "yes"; then
868 audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
869 audiod_cmdline_objs="$audiod_cmdline_objs resample_filter"
870 fi
871 audiod_objs="add_cmdline($audiod_cmdline_objs) $audiod_errlist_objs"
872 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
873 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
874 errors used by para_audiod)
875
876 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
877 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
878 enum of audio formats supported by audiod)
879 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
880 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
881 else
882 build_audiod="no"
883 fi
884 ########################################################################### fade
885 if test "$have_oss" = "yes" -o "$have_alsa" = "yes"; then
886 build_fade="yes"
887 executables="$executables fade"
888 fade_cmdline_objs="fade"
889 fade_errlist_objs="fade exec string fd version ggo"
890 if test "$have_oss" = "yes"; then
891 fade_errlist_objs="$fade_errlist_objs oss_mix"
892 mixers="${mixers}oss "
893 default_mixer="OSS_MIX"
894 fi
895 if test "$have_alsa" = "yes"; then
896 fade_errlist_objs="$fade_errlist_objs alsa_mix"
897 mixers="${mixers}alsa "
898 default_mixer="ALSA_MIX"
899 fi
900 fade_objs="add_cmdline($fade_cmdline_objs) $fade_errlist_objs"
901 AC_SUBST(fade_objs, add_dot_o($fade_objs))
902 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
903 objlist_to_errlist($fade_errlist_objs),
904 errors used by para_fade)
905 enum="$(
906 for i in $mixers; do
907 printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
908 done
909 )"
910 AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
911 enum of supported mixers)
912 AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
913 use this mixer if none was specified)
914 names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
915 AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
916 inits="$(
917 for i in $mixers; do
918 printf 'extern void '$i'_mix_init(struct mixer *); '
919 done
920 )"
921 AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
922 init functions of the supported mixers)
923 array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
924 AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
925 else
926 build_fade="no"
927 AC_MSG_WARN([no mixer support])
928 fi
929 ########################################################################### gui
930 if test "$have_curses" = "yes"; then
931 build_gui="yes"
932 executables="$executables gui"
933 gui_cmdline_objs="gui"
934 gui_errlist_objs="
935 exec
936 signal
937 string
938 stat
939 ringbuffer
940 fd
941 gui
942 gui_theme
943 time
944 sched
945 version
946 ggo
947 "
948 gui_objs="add_cmdline($gui_cmdline_objs) $gui_errlist_objs"
949 AC_SUBST(gui_objs, add_dot_o($gui_objs))
950 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
951 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
952 else
953 build_gui="no"
954 AC_MSG_WARN([no curses lib, cannot build para_gui])
955 fi
956 ######################################################################## filter
957 filters="
958 compress
959 wav
960 amp
961 fecdec
962 wmadec
963 prebuffer
964 sync
965 "
966 filter_errlist_objs="
967 filter_common
968 wav_filter
969 compress_filter
970 filter
971 string
972 stdin
973 stdout
974 sched
975 fd
976 amp_filter
977 ggo
978 fecdec_filter
979 fec
980 version
981 prebuffer_filter
982 time
983 bitstream
984 imdct
985 wma_common
986 wmadec_filter
987 buffer_tree
988 net
989 sync_filter
990 "
991 filter_cmdline_objs="
992 filter
993 compress_filter
994 amp_filter
995 prebuffer_filter
996 sync_filter
997 "
998 NEED_VORBIS_OBJECTS && {
999 filters="$filters oggdec"
1000 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
1001 }
1002 NEED_SPEEX_OBJECTS && {
1003 filters="$filters spxdec"
1004 filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
1005 }
1006 NEED_OPUS_OBJECTS && {
1007 filters="$filters opusdec"
1008 filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
1009 }
1010 if test "$have_faad" = "yes"; then
1011 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
1012 filters="$filters aacdec"
1013 fi
1014 if test "$have_mad" = "yes"; then
1015 filter_cmdline_objs="$filter_cmdline_objs mp3dec_filter"
1016 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
1017 filters="$filters mp3dec"
1018 fi
1019 if test "$have_flac" = "yes"; then
1020 filter_errlist_objs="$filter_errlist_objs flacdec_filter"
1021 filters="$filters flacdec"
1022 fi
1023 if test "$have_samplerate" = "yes"; then
1024 filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
1025 filter_cmdline_objs="$filter_cmdline_objs resample_filter"
1026 filters="$filters resample"
1027 fi
1028 filters="$(echo $filters)"
1029 AC_SUBST(filters)
1030 filter_objs="add_cmdline($filter_cmdline_objs) $filter_errlist_objs"
1031
1032 AC_SUBST(filter_objs, add_dot_o($filter_objs))
1033 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
1034 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
1035
1036 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
1037 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
1038 enum of supported filters)
1039 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
1040 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
1041 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
1042 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
1043 ########################################################################## recv
1044 recv_cmdline_objs="
1045 recv
1046 http_recv
1047 dccp_recv
1048 udp_recv
1049 afh_recv
1050 "
1051
1052 recv_errlist_objs="
1053 http_recv
1054 recv_common
1055 recv
1056 time
1057 string
1058 net
1059 dccp_recv
1060 fd
1061 sched
1062 stdout
1063 ggo
1064 udp_recv
1065 buffer_tree
1066 afh_recv
1067 afh_common
1068 wma_afh
1069 wma_common
1070 mp3_afh
1071 version
1072 "
1073 NEED_OGG_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
1074 NEED_VORBIS_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh"
1075 NEED_SPEEX_OBJECTS && recv_errlist_objs="$recv_errlist_objs spx_afh spx_common"
1076 NEED_OPUS_OBJECTS && recv_errlist_objs="$recv_errlist_objs opus_afh opus_common"
1077
1078 if test "$have_faad" = "yes"; then
1079 recv_errlist_objs="$recv_errlist_objs aac_afh aac_common"
1080 fi
1081 if test "$have_flac" = "yes"; then
1082 recv_errlist_objs="$recv_errlist_objs flac_afh"
1083 fi
1084 recv_objs="add_cmdline($recv_cmdline_objs) $recv_errlist_objs"
1085 AC_SUBST(receivers, "http dccp udp afh")
1086 AC_SUBST(recv_objs, add_dot_o($recv_objs))
1087 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
1088 errors used by para_recv)
1089 ########################################################################### afh
1090 audio_format_handlers="mp3 wma"
1091 afh_cmdline_objs="afh"
1092 afh_errlist_objs="
1093 afh
1094 string
1095 fd
1096 mp3_afh
1097 afh_common
1098 time
1099 wma_afh
1100 wma_common
1101 version
1102 ggo
1103 "
1104 NEED_OGG_OBJECTS && afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
1105 NEED_VORBIS_OBJECTS && {
1106 afh_errlist_objs="$afh_errlist_objs ogg_afh"
1107 audio_format_handlers="$audio_format_handlers ogg"
1108 }
1109 NEED_SPEEX_OBJECTS && {
1110 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
1111 audio_format_handlers="$audio_format_handlers spx"
1112 }
1113 NEED_OPUS_OBJECTS && {
1114 afh_errlist_objs="$afh_errlist_objs opus_afh opus_common"
1115 audio_format_handlers="$audio_format_handlers opus"
1116 }
1117 if test "$have_faad" = "yes"; then
1118 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
1119 audio_format_handlers="$audio_format_handlers aac"
1120 fi
1121 if test "$have_flac" = "yes"; then
1122 afh_errlist_objs="$afh_errlist_objs flac_afh"
1123 audio_format_handlers="$audio_format_handlers flac"
1124 fi
1125
1126 afh_objs="add_cmdline($afh_cmdline_objs) $afh_errlist_objs"
1127
1128 AC_SUBST(afh_objs, add_dot_o($afh_objs))
1129 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
1130 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
1131 ########################################################################## play
1132 play_errlist_objs="
1133 play
1134 fd
1135 sched
1136 ggo
1137 buffer_tree
1138 time
1139 string
1140 net
1141 afh_recv
1142 afh_common
1143 wma_afh
1144 wma_common
1145 mp3_afh
1146 recv_common
1147 udp_recv
1148 http_recv
1149 dccp_recv
1150 filter_common
1151 fec
1152 bitstream
1153 imdct
1154 wav_filter
1155 compress_filter
1156 amp_filter
1157 prebuffer_filter
1158 fecdec_filter
1159 wmadec_filter
1160 write_common
1161 file_write
1162 version
1163 sync_filter
1164 "
1165 play_cmdline_objs="
1166 http_recv
1167 dccp_recv
1168 udp_recv
1169 afh_recv
1170 compress_filter
1171 amp_filter
1172 prebuffer_filter
1173 file_write
1174 play
1175 sync_filter
1176 "
1177 if test "$have_core_audio" = "yes"; then
1178 play_errlist_objs="$play_errlist_objs osx_write ipc"
1179 play_cmdline_objs="$play_cmdline_objs osx_write"
1180 fi
1181 NEED_OGG_OBJECTS && play_errlist_objs="$play_errlist_objs ogg_afh_common"
1182 NEED_VORBIS_OBJECTS && {
1183 play_errlist_objs="$play_errlist_objs oggdec_filter ogg_afh"
1184 }
1185 NEED_SPEEX_OBJECTS && {
1186 play_errlist_objs="$play_errlist_objs spxdec_filter spx_afh spx_common"
1187 }
1188 NEED_OPUS_OBJECTS &&
1189 play_errlist_objs="$play_errlist_objs
1190 opusdec_filter
1191 opus_afh
1192 opus_common
1193 "
1194 if test "$have_faad" = "yes"; then
1195 play_errlist_objs="$play_errlist_objs aacdec_filter aac_afh aac_common"
1196 fi
1197 if test "$have_mad" = "yes"; then
1198 play_cmdline_objs="$play_cmdline_objs mp3dec_filter"
1199 play_errlist_objs="$play_errlist_objs mp3dec_filter"
1200 fi
1201 if test "$have_flac" = "yes"; then
1202 play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
1203 fi
1204 if test "$have_oss" = "yes"; then
1205 play_errlist_objs="$play_errlist_objs oss_write"
1206 play_cmdline_objs="$play_cmdline_objs oss_write"
1207 fi
1208 if test "$have_alsa" = "yes"; then
1209 play_errlist_objs="$play_errlist_objs alsa_write"
1210 play_cmdline_objs="$play_cmdline_objs alsa_write"
1211 fi
1212 if test "$have_ao" = "yes"; then
1213 play_errlist_objs="$play_errlist_objs ao_write"
1214 play_cmdline_objs="$play_cmdline_objs ao_write"
1215 fi
1216 if test "$have_readline" = "yes"; then
1217 play_errlist_objs="$play_errlist_objs interactive"
1218 fi
1219 if test "$have_samplerate" = "yes"; then
1220 play_errlist_objs="$play_errlist_objs resample_filter check_wav"
1221 play_cmdline_objs="$play_cmdline_objs resample_filter"
1222 fi
1223
1224 play_objs="add_cmdline($play_cmdline_objs) $play_errlist_objs"
1225 AC_SUBST(play_objs, add_dot_o($play_objs))
1226 AC_DEFINE_UNQUOTED(INIT_PLAY_ERRLISTS,
1227 objlist_to_errlist($play_errlist_objs), errors used by para_play)
1228 ######################################################################### write
1229 write_cmdline_objs="
1230 write
1231 file_write
1232 "
1233 write_errlist_objs="
1234 write
1235 write_common
1236 file_write
1237 time
1238 fd
1239 string
1240 sched
1241 stdin
1242 buffer_tree
1243 ggo
1244 check_wav
1245 version
1246 "
1247 writers="file"
1248 default_writer="FILE_WRITE"
1249
1250 if test "$have_core_audio" = "yes"; then
1251 write_errlist_objs="$write_errlist_objs osx_write ipc"
1252 write_cmdline_objs="$write_cmdline_objs osx_write"
1253 writers="$writers osx"
1254 default_writer="OSX_WRITE"
1255 fi
1256 if test "$have_ao" = "yes"; then
1257 write_errlist_objs="$write_errlist_objs ao_write"
1258 write_cmdline_objs="$write_cmdline_objs ao_write"
1259 writers="$writers ao"
1260 default_writer="AO_WRITE"
1261 fi
1262 if test "$have_oss" = "yes"; then
1263 write_errlist_objs="$write_errlist_objs oss_write"
1264 write_cmdline_objs="$write_cmdline_objs oss_write"
1265 writers="$writers oss"
1266 default_writer="OSS_WRITE"
1267 fi
1268 if test "$have_alsa" = "yes"; then
1269 write_errlist_objs="$write_errlist_objs alsa_write"
1270 write_cmdline_objs="$write_cmdline_objs alsa_write"
1271 writers="$writers alsa"
1272 default_writer="ALSA_WRITE"
1273 fi
1274 AC_SUBST(writers)
1275 write_objs="add_cmdline($write_cmdline_objs) $write_errlist_objs"
1276 AC_SUBST(write_objs, add_dot_o($write_objs))
1277 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
1278 objlist_to_errlist($write_errlist_objs), errors used by para_write)
1279 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
1280 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
1281 enum of supported writers)
1282 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
1283 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
1284 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
1285 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
1286 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
1287 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
1288 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
1289 ######################################################################## audioc
1290 audioc_cmdline_objs="audioc"
1291 audioc_errlist_objs="
1292 audioc
1293 string
1294 net
1295 fd
1296 version
1297 ggo
1298 "
1299 if test "$have_readline" = "yes"; then
1300 audioc_errlist_objs="$audioc_errlist_objs
1301 buffer_tree
1302 interactive
1303 sched
1304 time
1305 "
1306 fi
1307 audioc_objs="add_cmdline($audioc_cmdline_objs) $audioc_errlist_objs"
1308 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
1309 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
1310 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
1311 ############################################################# error2.h
1312 # these are always built
1313 all_errlist_objs="
1314 $recv_errlist_objs
1315 $filter_errlist_objs
1316 $audioc_errlist_objs
1317 $write_errlist_objs
1318 $afh_errlist_objs
1319 $play_errlist_objs
1320 "
1321
1322 # optional executables
1323 if test "$build_server" = "yes"; then
1324 all_errlist_objs="$all_errlist_objs $server_errlist_objs"
1325 fi
1326 if test "$build_gui" = "yes"; then
1327 all_errlist_objs="$all_errlist_objs $gui_errlist_objs"
1328 fi
1329 if test "$build_fade" = "yes"; then
1330 all_errlist_objs="$all_errlist_objs $fade_errlist_objs"
1331 fi
1332 if test "$build_client" = "yes"; then
1333 all_errlist_objs="$all_errlist_objs $client_errlist_objs"
1334 fi
1335 if test "$build_audiod" = "yes"; then
1336 all_errlist_objs="$all_errlist_objs $audiod_errlist_objs"
1337 fi
1338
1339 all_errlist_objs="$(echo $all_errlist_objs | tr ' ' '\n' | sort | uniq)"
1340
1341 object_executable_matrix=
1342 for i in $executables; do
1343 eval objs=\$${i}_errlist_objs
1344 object_executable_matrix="$object_executable_matrix $i: $objs"
1345 done
1346 # use echo to replace newlines by space
1347 AC_SUBST(object_executable_matrix, $(echo $object_executable_matrix))
1348
1349 SS=$(for obj in $all_errlist_objs; do
1350 printf '%s' " SS_$obj,"; done | tr 'a-z' 'A-Z')
1351 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
1352 [enum {$SS NUM_SS}],
1353 [list of all objects that use the paraslash error facility]
1354 )
1355 ################################################################## status items
1356
1357 status_items="basename status num_played mtime bitrate frequency file_size
1358 status_flags format score techinfo afs_mode
1359 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
1360 offset seconds_total stream_start current_time audiod_uptime image_id
1361 lyrics_id duration directory lyrics_name image_name path hash channels
1362 last_played num_chunks chunk_time amplification artist title year album
1363 comment"
1364
1365 result=
1366 for i in $status_items; do
1367 result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
1368 done
1369 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
1370 [enum of all status items])
1371
1372 result=
1373 for i in $status_items; do
1374 result="$result \"$i\", "
1375 done
1376 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
1377 [char * array of all status items])
1378
1379 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
1380 [formats supported by para_server and para_afh])
1381
1382 AC_SUBST(executables)
1383
1384 AC_OUTPUT
1385 AC_MSG_NOTICE([
1386 paraslash configuration:
1387 ~~~~~~~~~~~~~~~~~~~~~~~~
1388 crypto lib: ${CRYPTOLIB:-[none]}
1389 unix socket credentials: $have_ucred
1390 readline (interactive CLIs): $have_readline
1391 audio formats handlers: $audio_format_handlers
1392 id3 version2 support: $have_libid3tag
1393 filters: $filters
1394 writers: $writers
1395
1396 para_fade: $build_fade
1397 para_server: $build_server
1398 para_gui: $build_gui
1399 para_fade: $build_fade
1400 para_client: $build_client
1401 para_audiod: $build_audiod
1402 ])