build: Convert libid3tag detection 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 STASH_FLAGS
322 LIB_ARG_WITH([faad], [-lfaad])
323 HAVE_FAAD=yes
324 AC_CHECK_HEADER(neaacdec.h, [], HAVE_FAAD=no)
325 AC_CHECK_LIB([faad], [NeAACDecOpen], [], HAVE_FAAD=no)
326 LIB_SUBST_FLAGS(faad)
327 UNSTASH_FLAGS
328 ########################################################################### mad
329 STASH_FLAGS
330 LIB_ARG_WITH([mad], [-lmad])
331 HAVE_MAD=yes
332 AC_CHECK_HEADER(mad.h, [], HAVE_MAD=no)
333 AC_CHECK_LIB([mad], [mad_stream_init], [], HAVE_MAD=no)
334 LIB_SUBST_FLAGS(mad)
335 UNSTASH_FLAGS
336 ###################################################################### libid3tag
337 STASH_FLAGS
338 LIB_ARG_WITH([id3tag], [-lid3tag -lz])
339 HAVE_ID3TAG=yes
340 AC_CHECK_HEADER(id3tag.h, [], HAVE_ID3TAG=no)
341 AC_CHECK_LIB([id3tag], [id3_file_fdopen], [], HAVE_ID3TAG=no)
342 LIB_SUBST_FLAGS(id3tag)
343 UNSTASH_FLAGS
344 ########################################################################### flac
345 OLD_CPPFLAGS="$CPPFLAGS"
346 OLD_LDFLAGS="$LDFLAGS"
347 OLD_LIBS="$LIBS"
348
349 have_flac="yes"
350 AC_ARG_WITH(flac_headers, [AS_HELP_STRING(--with-flac-headers=dir,
351 [look for flac headers also in dir])])
352 if test -n "$with_flac_headers"; then
353 flac_cppflags="-I$with_flac_headers"
354 CPPFLAGS="$CPPFLAGS $flac_cppflags"
355 fi
356 AC_ARG_WITH(flac_libs, [AS_HELP_STRING(--with-flac-libs=dir,
357 [look for flac libs also in dir])])
358 if test -n "$with_flac_libs"; then
359 flac_libs="-L$with_flac_libs"
360 LDFLAGS="$LDFLAGS $flac_libs"
361 fi
362 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no)
363 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], [
364 # nope, try again with -logg
365 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [],
366 have_flac=no, -lm -logg)
367 ], -lm)
368 if test "$have_flac" = "yes"; then
369 AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter)
370 AC_SUBST(flac_cppflags)
371 flac_ldflags="$flac_libs -lFLAC"
372 AC_SUBST(flac_ldflags)
373 else
374 AC_MSG_WARN([no flac support in para_audiod/para_filter/para_afh/para_server])
375 fi
376 CPPFLAGS="$OLD_CPPFLAGS"
377 LDFLAGS="$OLD_LDFLAGS"
378 LIBS="$OLD_LIBS"
379 ########################################################################### oss
380 OLD_CPPFLAGS="$CPPFLAGS"
381 OLD_LDFLAGS="$LDFLAGS"
382 OLD_LIBS="$LIBS"
383
384 have_oss="yes"
385 msg="=> will not build oss writer"
386
387 AC_CHECK_HEADER(sys/soundcard.h, [
388 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
389 oss_ldflags="-lossaudio"
390 AC_SUBST(oss_ldflags)
391 ]
392 )
393 ],
394 [
395 have_oss="no"
396 AC_MSG_WARN([no sys/soundcard.h $msg])
397 ]
398 )
399 CPPFLAGS="$OLD_CPPFLAGS"
400 LDFLAGS="$OLD_LDFLAGS"
401 LIBS="$OLD_LIBS"
402
403 ########################################################################### alsa
404 OLD_CPPFLAGS="$CPPFLAGS"
405 OLD_LDFLAGS="$LDFLAGS"
406 OLD_LIBS="$LIBS"
407
408 msg="=> no alsa support for para_audiod/para_write"
409 if test "$OSTYPE" != "Linux"; then
410 have_alsa="no"
411 else
412 have_alsa="yes"
413 fi
414 if test "$have_alsa" = "yes"; then
415 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
416 have_alsa="no"
417 AC_MSG_WARN([no alsa/asoundlib $msg])
418 ])
419 fi
420
421 if test "$have_alsa" = "yes"; then
422 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
423 have_alsa="no"
424 AC_MSG_WARN([no libasound $msg])
425 ])
426 fi
427
428 if test "$have_alsa" = "yes"; then
429 alsa_ldflags="-lasound"
430 AC_SUBST(alsa_ldflags)
431 fi
432
433 CPPFLAGS="$OLD_CPPFLAGS"
434 LDFLAGS="$OLD_LDFLAGS"
435 LIBS="$OLD_LIBS"
436 ########################################################################### libao
437 OLD_CPPFLAGS="$CPPFLAGS"
438 OLD_LDFLAGS="$LDFLAGS"
439 OLD_LIBS="$LIBS"
440
441 have_ao="yes"
442 AC_ARG_WITH(ao_headers, [AS_HELP_STRING(--with-ao-headers=dir,
443 [look for ao/ao.h also in dir])])
444 if test -n "$with_ao_headers"; then
445 ao_cppflags="-I$with_ao_headers"
446 CPPFLAGS="$CPPFLAGS $ao_cppflags"
447 fi
448 AC_ARG_WITH(ao_libs, [AS_HELP_STRING(--with-ao-libs=dir,
449 [look for libao also in dir])])
450 if test -n "$with_ao_libs"; then
451 ao_libs="-L$with_ao_libs"
452 LDFLAGS="$LDFLAGS $ao_libs"
453 fi
454 msg="no libao support for para_audiod/para_write"
455 AC_CHECK_HEADERS([ao/ao.h], [
456 ], [
457 have_ao="no"
458 AC_MSG_WARN([ao.h not found, $msg])
459 ])
460 if test "$have_ao" = "yes"; then
461 AC_CHECK_LIB([ao], [ao_initialize], [], [
462 have_ao="no"
463 AC_MSG_WARN([ao lib not found or not working, $msg])
464 ])
465 fi
466 if test "$have_ao" = "yes"; then
467 AC_CHECK_HEADERS([pthread.h], [
468 ], [
469 have_ao="no"
470 AC_MSG_WARN([pthread.h not found, $msg])
471 ])
472 fi
473 if test "$have_ao" = "yes"; then
474 AC_CHECK_LIB([pthread], [pthread_create], [], [
475 have_ao="no"
476 AC_MSG_WARN([pthread lib not found or not working, $msg])
477 ])
478 fi
479 if test "$have_ao" = "yes"; then
480 AC_SUBST(ao_cppflags)
481 ao_ldflags="$ao_libs -lao -lpthread"
482 AC_SUBST(ao_ldflags)
483 fi
484
485 CPPFLAGS="$OLD_CPPFLAGS"
486 LDFLAGS="$OLD_LDFLAGS"
487 LIBS="$OLD_LIBS"
488 ############################################################# readline
489 OLD_CPPFLAGS="$CPPFLAGS"
490 OLD_LDFLAGS="$LDFLAGS"
491 OLD_LIBS="$LIBS"
492
493 have_readline="yes"
494 AC_ARG_WITH(readline_headers, [AS_HELP_STRING(--with-readline-headers=dir,
495 [look for libreadline header files also in dir])])
496 if test -n "$with_readline_headers"; then
497 readline_cppflags="-I$with_readline_headers"
498 CPPFLAGS="$CPPFLAGS $readline_cppflags"
499 fi
500
501 AC_ARG_WITH(readline_libs, [AS_HELP_STRING(--with-readline-libs=dir,
502 [look for readline library also in dir])])
503 if test -n "$with_readline_libs"; then
504 readline_libs="-L$with_readline_libs"
505 LDFLAGS="$LDFLAGS $readline_libs"
506 fi
507 msg="no interactive cli support"
508 AC_CHECK_HEADERS([readline/readline.h], [
509 ], [
510 have_readline="no"
511 AC_MSG_WARN([readline/readline.h not found, $msg])
512 ])
513
514 if test "$have_readline" = "yes"; then
515 readline_ldflags="$readline_libs"
516 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
517 readline_ldflags="$readline_ldflags -lreadline"
518 ], [have_readline="no"])
519 if test "$have_readline" = "no"; then # try with -lcurses
520 # clear cache
521 AC_MSG_NOTICE([trying again with -lcurses])
522 unset ac_cv_search_rl_free_keymap 2> /dev/null
523 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
524 have_readline=yes
525 readline_ldflags="$readline_ldflags -lreadline -lcurses"
526 ], [], [-lcurses])
527 fi
528 if test "$have_readline" = "no"; then # try with -ltermcap
529 # clear cache
530 AC_MSG_NOTICE([trying again with -ltermcap])
531 unset ac_cv_search_rl_free_keymap 2> /dev/null
532 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
533 have_readline=yes
534 readline_ldflags="$readline_ldflags -lreadline -ltermcap"
535 ], [], [-ltermcap])
536 fi
537 fi
538
539 if test "$have_readline" = "yes"; then
540 AC_CHECK_DECL(
541 [rl_free_keymap],
542 [AC_DEFINE(RL_FREE_KEYMAP_DECLARED, 1, readline >= 6.3)],
543 [],
544 [
545 #include <stdio.h>
546 #include <readline/readline.h>
547 ]
548 )
549 AC_SUBST(readline_cppflags)
550 AC_SUBST(readline_ldflags)
551 AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
552 else
553 AC_MSG_WARN([libreadline not found or unusable])
554 fi
555 CPPFLAGS="$OLD_CPPFLAGS"
556 LDFLAGS="$OLD_LDFLAGS"
557 LIBS="$OLD_LIBS"
558 ############################################################# libsamplerate
559 OLD_CPPFLAGS="$CPPFLAGS"
560 OLD_LDFLAGS="$LDFLAGS"
561 OLD_LIBS="$LIBS"
562
563 have_samplerate="yes"
564 AC_ARG_WITH(samplerate_headers, [AS_HELP_STRING(--with-samplerate-headers=dir,
565 [look for samplerate headers also in dir])])
566 if test -n "$with_samplerate_headers"; then
567 samplerate_cppflags="-I$with_samplerate_headers"
568 CPPFLAGS="$CPPFLAGS $samplerate_cppflags"
569 fi
570 AC_ARG_WITH(samplerate_libs, [AS_HELP_STRING(--with-samplerate-libs=dir,
571 [look for samplerate libs also in dir])])
572 if test -n "$with_samplerate_libs"; then
573 samplerate_libs="-L$with_samplerate_libs"
574 LDFLAGS="$LDFLAGS $samplerate_libs"
575 fi
576
577 AC_CHECK_HEADER(samplerate.h, [], have_samplerate=no)
578 AC_CHECK_LIB([samplerate], [src_process], [], have_samplerate=no, [])
579
580 if test "$have_samplerate" = "yes"; then
581 AC_SUBST(samplerate_cppflags)
582 samplerate_ldflags="$samplerate_libs -lsamplerate"
583 AC_SUBST(samplerate_ldflags)
584 else
585 AC_MSG_WARN([no resample support in para_audiod/para_filter])
586 fi
587 CPPFLAGS="$OLD_CPPFLAGS"
588 LDFLAGS="$OLD_LDFLAGS"
589 LIBS="$OLD_LIBS"
590 ######################################################################### server
591 if test -n "$CRYPTOLIB" && test $HAVE_OSL = yes; then
592 build_server="yes"
593 executables="$executables server"
594 server_cmdline_objs="server"
595 server_errlist_objs="
596 server
597 afh_common
598 mp3_afh
599 vss
600 command
601 net
602 string
603 signal
604 time
605 daemon
606 http_send
607 close_on_fork
608 mm
609 crypt_common
610 ipc
611 dccp_send
612 fd
613 user_list
614 chunk_queue
615 afs
616 aft
617 mood
618 score
619 attribute
620 blob
621 playlist
622 sched
623 acl
624 send_common
625 udp_send
626 color
627 fec
628 wma_afh
629 wma_common
630 sideband
631 version
632 ggo
633 "
634 if test "$CRYPTOLIB" = openssl; then
635 server_errlist_objs="$server_errlist_objs crypt"
636 else
637 server_errlist_objs="$server_errlist_objs gcrypt"
638 fi
639 NEED_OGG_OBJECTS() && server_errlist_objs="$server_errlist_objs ogg_afh_common"
640 NEED_VORBIS_OBJECTS() && server_errlist_objs="$server_errlist_objs ogg_afh"
641 NEED_SPEEX_OBJECTS() && server_errlist_objs="$server_errlist_objs spx_afh spx_common"
642 NEED_OPUS_OBJECTS() && server_errlist_objs="$server_errlist_objs opus_afh opus_common"
643 test $HAVE_FAAD = yes && server_errlist_objs="$server_errlist_objs aac_afh aac_common"
644 if test "$have_flac" = "yes"; then
645 server_errlist_objs="$server_errlist_objs flac_afh"
646 fi
647 server_objs="add_cmdline($server_cmdline_objs) $server_errlist_objs"
648 AC_SUBST(server_objs, add_dot_o($server_objs))
649 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
650 objlist_to_errlist($server_errlist_objs), errors used by para_server)
651 else
652 build_server="no"
653 fi
654 ############################################################# client
655 if test -n "$CRYPTOLIB"; then
656 build_client="yes"
657 executables="$executables client"
658 client_cmdline_objs="client"
659 client_errlist_objs="
660 client
661 net
662 string
663 fd
664 sched
665 stdin
666 stdout
667 time
668 sideband
669 client_common
670 buffer_tree
671 crypt_common
672 version
673 ggo
674 "
675 if test "$CRYPTOLIB" = openssl; then
676 client_errlist_objs="$client_errlist_objs crypt"
677 else
678 client_errlist_objs="$client_errlist_objs gcrypt"
679 fi
680 if test "$have_readline" = "yes"; then
681 client_errlist_objs="$client_errlist_objs interactive"
682 fi
683 client_objs="add_cmdline($client_cmdline_objs) $client_errlist_objs"
684 AC_SUBST(client_objs, add_dot_o($client_objs))
685 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
686 objlist_to_errlist($client_errlist_objs), errors used by para_client)
687 else
688 build_client="no"
689 fi
690 ############################################################# audiod
691 if test -n "$CRYPTOLIB"; then
692 build_audiod="yes"
693 executables="$executables audiod"
694 audiod_audio_formats="wma"
695 audiod_cmdline_objs="$audiod_cmdline_objs
696 audiod
697 compress_filter
698 http_recv
699 dccp_recv
700 file_write
701 client
702 amp_filter
703 udp_recv
704 prebuffer_filter
705 sync_filter
706 "
707 audiod_errlist_objs="$audiod_errlist_objs
708 audiod
709 signal
710 string
711 daemon
712 stat
713 net
714 crypt_common
715 sideband
716 time
717 grab_client
718 filter_common
719 wav_filter
720 compress_filter
721 amp_filter
722 http_recv
723 dccp_recv
724 recv_common
725 fd
726 sched
727 write_common
728 file_write
729 audiod_command
730 fecdec_filter
731 client_common
732 ggo
733 udp_recv
734 color
735 fec
736 prebuffer_filter
737 version
738 bitstream
739 imdct
740 wma_common
741 wmadec_filter
742 buffer_tree
743 sync_filter
744 "
745 if test "$CRYPTOLIB" = openssl; then
746 audiod_errlist_objs="$audiod_errlist_objs crypt"
747 else
748 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
749 fi
750 if test "$have_core_audio" = "yes"; then
751 audiod_errlist_objs="$audiod_errlist_objs osx_write ipc"
752 audiod_cmdline_objs="$audiod_cmdline_objs osx_write"
753 fi
754 NEED_VORBIS_OBJECTS && {
755 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
756 audiod_audio_formats="$audiod_audio_formats ogg"
757 }
758 NEED_SPEEX_OBJECTS && {
759 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
760 audiod_audio_formats="$audiod_audio_formats spx"
761 }
762 NEED_OPUS_OBJECTS && {
763 audiod_errlist_objs="$audiod_errlist_objs opusdec_filter opus_common"
764 audiod_audio_formats="$audiod_audio_formats opus"
765 }
766 if test $HAVE_FAAD = yes; then
767 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
768 audiod_audio_formats="$audiod_audio_formats aac"
769 fi
770 if test $HAVE_MAD = yes; then
771 audiod_audio_formats="$audiod_audio_formats mp3"
772 audiod_cmdline_objs="$audiod_cmdline_objs mp3dec_filter"
773 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
774 fi
775 if test "$have_flac" = "yes"; then
776 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
777 audiod_audio_formats="$audiod_audio_formats flac"
778 fi
779 if test "$have_oss" = "yes"; then
780 audiod_errlist_objs="$audiod_errlist_objs oss_write"
781 audiod_cmdline_objs="$audiod_cmdline_objs oss_write"
782 fi
783 if test "$have_alsa" = "yes"; then
784 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
785 audiod_cmdline_objs="$audiod_cmdline_objs alsa_write"
786 fi
787 if test "$have_ao" = "yes"; then
788 audiod_errlist_objs="$audiod_errlist_objs ao_write"
789 audiod_cmdline_objs="$audiod_cmdline_objs ao_write"
790 fi
791 if test "$have_samplerate" = "yes"; then
792 audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
793 audiod_cmdline_objs="$audiod_cmdline_objs resample_filter"
794 fi
795 audiod_objs="add_cmdline($audiod_cmdline_objs) $audiod_errlist_objs"
796 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
797 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
798 errors used by para_audiod)
799
800 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
801 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
802 enum of audio formats supported by audiod)
803 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
804 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
805 else
806 build_audiod="no"
807 fi
808 ########################################################################### fade
809 if test "$have_oss" = "yes" -o "$have_alsa" = "yes"; then
810 build_fade="yes"
811 executables="$executables fade"
812 fade_cmdline_objs="fade"
813 fade_errlist_objs="fade exec string fd version ggo"
814 if test "$have_oss" = "yes"; then
815 fade_errlist_objs="$fade_errlist_objs oss_mix"
816 mixers="${mixers}oss "
817 default_mixer="OSS_MIX"
818 fi
819 if test "$have_alsa" = "yes"; then
820 fade_errlist_objs="$fade_errlist_objs alsa_mix"
821 mixers="${mixers}alsa "
822 default_mixer="ALSA_MIX"
823 fi
824 fade_objs="add_cmdline($fade_cmdline_objs) $fade_errlist_objs"
825 AC_SUBST(fade_objs, add_dot_o($fade_objs))
826 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
827 objlist_to_errlist($fade_errlist_objs),
828 errors used by para_fade)
829 enum="$(
830 for i in $mixers; do
831 printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
832 done
833 )"
834 AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
835 enum of supported mixers)
836 AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
837 use this mixer if none was specified)
838 names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
839 AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
840 inits="$(
841 for i in $mixers; do
842 printf 'extern void '$i'_mix_init(struct mixer *); '
843 done
844 )"
845 AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
846 init functions of the supported mixers)
847 array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
848 AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
849 else
850 build_fade="no"
851 AC_MSG_WARN([no mixer support])
852 fi
853 ########################################################################### gui
854 if test "$have_curses" = "yes"; then
855 build_gui="yes"
856 executables="$executables gui"
857 gui_cmdline_objs="gui"
858 gui_errlist_objs="
859 exec
860 signal
861 string
862 stat
863 ringbuffer
864 fd
865 gui
866 gui_theme
867 time
868 sched
869 version
870 ggo
871 "
872 gui_objs="add_cmdline($gui_cmdline_objs) $gui_errlist_objs"
873 AC_SUBST(gui_objs, add_dot_o($gui_objs))
874 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
875 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
876 else
877 build_gui="no"
878 AC_MSG_WARN([no curses lib, cannot build para_gui])
879 fi
880 ######################################################################## filter
881 filters="
882 compress
883 wav
884 amp
885 fecdec
886 wmadec
887 prebuffer
888 sync
889 "
890 filter_errlist_objs="
891 filter_common
892 wav_filter
893 compress_filter
894 filter
895 string
896 stdin
897 stdout
898 sched
899 fd
900 amp_filter
901 ggo
902 fecdec_filter
903 fec
904 version
905 prebuffer_filter
906 time
907 bitstream
908 imdct
909 wma_common
910 wmadec_filter
911 buffer_tree
912 net
913 sync_filter
914 "
915 filter_cmdline_objs="
916 filter
917 compress_filter
918 amp_filter
919 prebuffer_filter
920 sync_filter
921 "
922 NEED_VORBIS_OBJECTS && {
923 filters="$filters oggdec"
924 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
925 }
926 NEED_SPEEX_OBJECTS && {
927 filters="$filters spxdec"
928 filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
929 }
930 NEED_OPUS_OBJECTS && {
931 filters="$filters opusdec"
932 filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
933 }
934 if test $HAVE_FAAD = yes; then
935 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
936 filters="$filters aacdec"
937 fi
938 if test $HAVE_MAD = yes; then
939 filter_cmdline_objs="$filter_cmdline_objs mp3dec_filter"
940 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
941 filters="$filters mp3dec"
942 fi
943 if test "$have_flac" = "yes"; then
944 filter_errlist_objs="$filter_errlist_objs flacdec_filter"
945 filters="$filters flacdec"
946 fi
947 if test "$have_samplerate" = "yes"; then
948 filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
949 filter_cmdline_objs="$filter_cmdline_objs resample_filter"
950 filters="$filters resample"
951 fi
952 filters="$(echo $filters)"
953 AC_SUBST(filters)
954 filter_objs="add_cmdline($filter_cmdline_objs) $filter_errlist_objs"
955
956 AC_SUBST(filter_objs, add_dot_o($filter_objs))
957 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
958 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
959
960 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
961 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
962 enum of supported filters)
963 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
964 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
965 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
966 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
967 ########################################################################## recv
968 recv_cmdline_objs="
969 recv
970 http_recv
971 dccp_recv
972 udp_recv
973 afh_recv
974 "
975
976 recv_errlist_objs="
977 http_recv
978 recv_common
979 recv
980 time
981 string
982 net
983 dccp_recv
984 fd
985 sched
986 stdout
987 ggo
988 udp_recv
989 buffer_tree
990 afh_recv
991 afh_common
992 wma_afh
993 wma_common
994 mp3_afh
995 version
996 "
997 NEED_OGG_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
998 NEED_VORBIS_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh"
999 NEED_SPEEX_OBJECTS && recv_errlist_objs="$recv_errlist_objs spx_afh spx_common"
1000 NEED_OPUS_OBJECTS && recv_errlist_objs="$recv_errlist_objs opus_afh opus_common"
1001
1002 if test $HAVE_FAAD = yes; then
1003 recv_errlist_objs="$recv_errlist_objs aac_afh aac_common"
1004 fi
1005 if test "$have_flac" = "yes"; then
1006 recv_errlist_objs="$recv_errlist_objs flac_afh"
1007 fi
1008 recv_objs="add_cmdline($recv_cmdline_objs) $recv_errlist_objs"
1009 AC_SUBST(receivers, "http dccp udp afh")
1010 AC_SUBST(recv_objs, add_dot_o($recv_objs))
1011 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
1012 errors used by para_recv)
1013 ########################################################################### afh
1014 audio_format_handlers="mp3 wma"
1015 afh_cmdline_objs="afh"
1016 afh_errlist_objs="
1017 afh
1018 string
1019 fd
1020 mp3_afh
1021 afh_common
1022 time
1023 wma_afh
1024 wma_common
1025 version
1026 ggo
1027 "
1028 NEED_OGG_OBJECTS && afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
1029 NEED_VORBIS_OBJECTS && {
1030 afh_errlist_objs="$afh_errlist_objs ogg_afh"
1031 audio_format_handlers="$audio_format_handlers ogg"
1032 }
1033 NEED_SPEEX_OBJECTS && {
1034 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
1035 audio_format_handlers="$audio_format_handlers spx"
1036 }
1037 NEED_OPUS_OBJECTS && {
1038 afh_errlist_objs="$afh_errlist_objs opus_afh opus_common"
1039 audio_format_handlers="$audio_format_handlers opus"
1040 }
1041 if test $HAVE_FAAD = yes; then
1042 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
1043 audio_format_handlers="$audio_format_handlers aac"
1044 fi
1045 if test "$have_flac" = "yes"; then
1046 afh_errlist_objs="$afh_errlist_objs flac_afh"
1047 audio_format_handlers="$audio_format_handlers flac"
1048 fi
1049
1050 afh_objs="add_cmdline($afh_cmdline_objs) $afh_errlist_objs"
1051
1052 AC_SUBST(afh_objs, add_dot_o($afh_objs))
1053 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
1054 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
1055 ########################################################################## play
1056 play_errlist_objs="
1057 play
1058 fd
1059 sched
1060 ggo
1061 buffer_tree
1062 time
1063 string
1064 net
1065 afh_recv
1066 afh_common
1067 wma_afh
1068 wma_common
1069 mp3_afh
1070 recv_common
1071 udp_recv
1072 http_recv
1073 dccp_recv
1074 filter_common
1075 fec
1076 bitstream
1077 imdct
1078 wav_filter
1079 compress_filter
1080 amp_filter
1081 prebuffer_filter
1082 fecdec_filter
1083 wmadec_filter
1084 write_common
1085 file_write
1086 version
1087 sync_filter
1088 "
1089 play_cmdline_objs="
1090 http_recv
1091 dccp_recv
1092 udp_recv
1093 afh_recv
1094 compress_filter
1095 amp_filter
1096 prebuffer_filter
1097 file_write
1098 play
1099 sync_filter
1100 "
1101 if test "$have_core_audio" = "yes"; then
1102 play_errlist_objs="$play_errlist_objs osx_write ipc"
1103 play_cmdline_objs="$play_cmdline_objs osx_write"
1104 fi
1105 NEED_OGG_OBJECTS && play_errlist_objs="$play_errlist_objs ogg_afh_common"
1106 NEED_VORBIS_OBJECTS && {
1107 play_errlist_objs="$play_errlist_objs oggdec_filter ogg_afh"
1108 }
1109 NEED_SPEEX_OBJECTS && {
1110 play_errlist_objs="$play_errlist_objs spxdec_filter spx_afh spx_common"
1111 }
1112 NEED_OPUS_OBJECTS &&
1113 play_errlist_objs="$play_errlist_objs
1114 opusdec_filter
1115 opus_afh
1116 opus_common
1117 "
1118 if test $HAVE_FAAD = yes; then
1119 play_errlist_objs="$play_errlist_objs aacdec_filter aac_afh aac_common"
1120 fi
1121 if test $HAVE_MAD = yes; then
1122 play_cmdline_objs="$play_cmdline_objs mp3dec_filter"
1123 play_errlist_objs="$play_errlist_objs mp3dec_filter"
1124 fi
1125 if test "$have_flac" = "yes"; then
1126 play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
1127 fi
1128 if test "$have_oss" = "yes"; then
1129 play_errlist_objs="$play_errlist_objs oss_write"
1130 play_cmdline_objs="$play_cmdline_objs oss_write"
1131 fi
1132 if test "$have_alsa" = "yes"; then
1133 play_errlist_objs="$play_errlist_objs alsa_write"
1134 play_cmdline_objs="$play_cmdline_objs alsa_write"
1135 fi
1136 if test "$have_ao" = "yes"; then
1137 play_errlist_objs="$play_errlist_objs ao_write"
1138 play_cmdline_objs="$play_cmdline_objs ao_write"
1139 fi
1140 if test "$have_readline" = "yes"; then
1141 play_errlist_objs="$play_errlist_objs interactive"
1142 fi
1143 if test "$have_samplerate" = "yes"; then
1144 play_errlist_objs="$play_errlist_objs resample_filter check_wav"
1145 play_cmdline_objs="$play_cmdline_objs resample_filter"
1146 fi
1147
1148 play_objs="add_cmdline($play_cmdline_objs) $play_errlist_objs"
1149 AC_SUBST(play_objs, add_dot_o($play_objs))
1150 AC_DEFINE_UNQUOTED(INIT_PLAY_ERRLISTS,
1151 objlist_to_errlist($play_errlist_objs), errors used by para_play)
1152 ######################################################################### write
1153 write_cmdline_objs="
1154 write
1155 file_write
1156 "
1157 write_errlist_objs="
1158 write
1159 write_common
1160 file_write
1161 time
1162 fd
1163 string
1164 sched
1165 stdin
1166 buffer_tree
1167 ggo
1168 check_wav
1169 version
1170 "
1171 writers="file"
1172 default_writer="FILE_WRITE"
1173
1174 if test "$have_core_audio" = "yes"; then
1175 write_errlist_objs="$write_errlist_objs osx_write ipc"
1176 write_cmdline_objs="$write_cmdline_objs osx_write"
1177 writers="$writers osx"
1178 default_writer="OSX_WRITE"
1179 fi
1180 if test "$have_ao" = "yes"; then
1181 write_errlist_objs="$write_errlist_objs ao_write"
1182 write_cmdline_objs="$write_cmdline_objs ao_write"
1183 writers="$writers ao"
1184 default_writer="AO_WRITE"
1185 fi
1186 if test "$have_oss" = "yes"; then
1187 write_errlist_objs="$write_errlist_objs oss_write"
1188 write_cmdline_objs="$write_cmdline_objs oss_write"
1189 writers="$writers oss"
1190 default_writer="OSS_WRITE"
1191 fi
1192 if test "$have_alsa" = "yes"; then
1193 write_errlist_objs="$write_errlist_objs alsa_write"
1194 write_cmdline_objs="$write_cmdline_objs alsa_write"
1195 writers="$writers alsa"
1196 default_writer="ALSA_WRITE"
1197 fi
1198 AC_SUBST(writers)
1199 write_objs="add_cmdline($write_cmdline_objs) $write_errlist_objs"
1200 AC_SUBST(write_objs, add_dot_o($write_objs))
1201 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
1202 objlist_to_errlist($write_errlist_objs), errors used by para_write)
1203 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
1204 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
1205 enum of supported writers)
1206 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
1207 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
1208 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
1209 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
1210 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
1211 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
1212 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
1213 ######################################################################## audioc
1214 audioc_cmdline_objs="audioc"
1215 audioc_errlist_objs="
1216 audioc
1217 string
1218 net
1219 fd
1220 version
1221 ggo
1222 "
1223 if test "$have_readline" = "yes"; then
1224 audioc_errlist_objs="$audioc_errlist_objs
1225 buffer_tree
1226 interactive
1227 sched
1228 time
1229 "
1230 fi
1231 audioc_objs="add_cmdline($audioc_cmdline_objs) $audioc_errlist_objs"
1232 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
1233 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
1234 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
1235 ############################################################# error2.h
1236 # these are always built
1237 all_errlist_objs="
1238 $recv_errlist_objs
1239 $filter_errlist_objs
1240 $audioc_errlist_objs
1241 $write_errlist_objs
1242 $afh_errlist_objs
1243 $play_errlist_objs
1244 "
1245
1246 # optional executables
1247 if test "$build_server" = "yes"; then
1248 all_errlist_objs="$all_errlist_objs $server_errlist_objs"
1249 fi
1250 if test "$build_gui" = "yes"; then
1251 all_errlist_objs="$all_errlist_objs $gui_errlist_objs"
1252 fi
1253 if test "$build_fade" = "yes"; then
1254 all_errlist_objs="$all_errlist_objs $fade_errlist_objs"
1255 fi
1256 if test "$build_client" = "yes"; then
1257 all_errlist_objs="$all_errlist_objs $client_errlist_objs"
1258 fi
1259 if test "$build_audiod" = "yes"; then
1260 all_errlist_objs="$all_errlist_objs $audiod_errlist_objs"
1261 fi
1262
1263 all_errlist_objs="$(echo $all_errlist_objs | tr ' ' '\n' | sort | uniq)"
1264
1265 object_executable_matrix=
1266 for i in $executables; do
1267 eval objs=\$${i}_errlist_objs
1268 object_executable_matrix="$object_executable_matrix $i: $objs"
1269 done
1270 # use echo to replace newlines by space
1271 AC_SUBST(object_executable_matrix, $(echo $object_executable_matrix))
1272
1273 SS=$(for obj in $all_errlist_objs; do
1274 printf '%s' " SS_$obj,"; done | tr 'a-z' 'A-Z')
1275 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
1276 [enum {$SS NUM_SS}],
1277 [list of all objects that use the paraslash error facility]
1278 )
1279 ################################################################## status items
1280
1281 status_items="basename status num_played mtime bitrate frequency file_size
1282 status_flags format score techinfo afs_mode
1283 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
1284 offset seconds_total stream_start current_time audiod_uptime image_id
1285 lyrics_id duration directory lyrics_name image_name path hash channels
1286 last_played num_chunks chunk_time amplification artist title year album
1287 comment"
1288
1289 result=
1290 for i in $status_items; do
1291 result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
1292 done
1293 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
1294 [enum of all status items])
1295
1296 result=
1297 for i in $status_items; do
1298 result="$result \"$i\", "
1299 done
1300 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
1301 [char * array of all status items])
1302
1303 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
1304 [formats supported by para_server and para_afh])
1305
1306 AC_SUBST(executables)
1307
1308 AC_OUTPUT
1309 AC_MSG_NOTICE([
1310 paraslash configuration:
1311 ~~~~~~~~~~~~~~~~~~~~~~~~
1312 crypto lib: ${CRYPTOLIB:-[none]}
1313 unix socket credentials: $have_ucred
1314 readline (interactive CLIs): $have_readline
1315 audio formats handlers: $audio_format_handlers
1316 id3 version 2 support: $HAVE_ID3TAG
1317 filters: $filters
1318 writers: $writers
1319
1320 para_fade: $build_fade
1321 para_server: $build_server
1322 para_gui: $build_gui
1323 para_fade: $build_fade
1324 para_client: $build_client
1325 para_audiod: $build_audiod
1326 ])