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