2 # Process this file with autoconf to produce a configure script.
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])
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], \
15 printf "DEFINE_ERRLIST($(echo $i | tr 'a-z' 'A-Z'));"; \
18 AC_DEFUN([make_para_errlists], \
20 printf "PARA_ERRLIST($(echo $i | tr 'a-z' 'A-Z')), "; \
23 AC_DEFUN([objlist_to_errlist],[ \
24 make_errlist_defines($@) \
25 [const char **para_errlist[[]]] = {make_para_errlists($@)} \
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"
36 if test -n "$with_$1_libs"; then
37 $1_ldflags="-L$with_$1_libs $2"
41 LDFLAGS="$LDFLAGS $$1_ldflags"
44 AC_DEFUN([STASH_FLAGS], [
45 OLD_CPPFLAGS="$CPPFLAGS"
46 OLD_LDFLAGS="$LDFLAGS"
50 AC_DEFUN([UNSTASH_FLAGS], [
51 CPPFLAGS="$OLD_CPPFLAGS"
52 LDFLAGS="$OLD_LDFLAGS"
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)
63 AC_SUBST(HAVE_[]m4_toupper([$1]))
68 AC_PATH_PROG(UNAMEPATH, uname, no)
69 if test "$UNAMEPATH" = "no"; then
70 AC_MSG_ERROR(unable to determine system type)
72 AC_MSG_CHECKING(os type)
73 OSTYPE="`$UNAMEPATH -s`"
74 AC_MSG_RESULT("$OSTYPE")
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)
84 AC_PATH_PROG([gengetopt], [gengetopt])
85 test -z "$gengetopt" && AC_MSG_ERROR(
86 [gengetopt is required to build this package])
88 AC_PATH_PROG([help2man], [help2man])
89 test -z "$help2man" && AC_MSG_ERROR(
90 [help2man is required to build this package])
92 AC_PATH_PROG([install], [install])
93 test -z "$install" && AC_MSG_ERROR(
94 [The install program is required to build this package])
99 executables="recv filter audioc write afh play"
100 ################################################################## clock_gettime
102 AC_CHECK_LIB([c], [clock_gettime], [clock_gettime_lib=c], [
103 AC_CHECK_LIB([rt], [clock_gettime], [clock_gettime_lib=rt], [], [])
105 if test -n "$clock_gettime_lib"; then
106 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [
107 define to 1 if clock_gettime() is supported])
109 if test "$clock_gettime_lib" = "rt"; then
110 AC_SUBST(clock_gettime_ldflags, -lrt)
113 ########################################################################### osl
115 LIB_ARG_WITH([osl], [-losl])
117 AC_CHECK_HEADER(osl.h, [], [HAVE_OSL=no])
118 AC_CHECK_LIB([osl], [osl_open_table], [], [HAVE_OSL=no])
121 ######################################################################## openssl
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)
129 ######################################################################### gcrypt
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)
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
145 CRYPTOLIB="$enable_cryptolib"
146 case "$enable_cryptolib" in
148 test $HAVE_OPENSSL = no && AC_MSG_ERROR(openssl not found)
149 crypto_ldflags="$openssl_ldflags"
152 test $HAVE_GCRYPT = no && AC_MSG_ERROR(gcrypt not found)
153 crypto_ldflags="$gcrypt_ldflags"
157 if test $HAVE_GCRYPT = yes; then
159 crypto_ldflags="$gcrypt_ldflags"
161 if test $HAVE_OPENSSL = yes; then
163 crypto_ldflags="$openssl_ldflags"
167 AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib])
170 AC_SUBST(crypto_ldflags)
171 ########################################################################### libsocket
172 AC_CHECK_LIB([c], [socket],
174 [socket_ldflags="-lsocket"]
176 AC_SUBST(socket_ldflags)
177 ########################################################################### libnsl
178 AC_CHECK_LIB([c], [gethostbyname],
180 [nsl_ldflags="-lnsl"]
182 AC_SUBST(nsl_ldflags)
183 ########################################################################### ucred
184 AC_MSG_CHECKING(for struct ucred)
185 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
187 #include <sys/types.h>
188 #include <sys/socket.h>
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)
196 ########################################################################### gengetopt
197 echo 'option "z" z "" flag off' | $gengetopt --file-name conftest-ggo &&
199 [gengetopt_args_info_description],
200 [ggo_descriptions_declared=yes],
201 [ggo_descriptions_declared=no],
202 [#include "conftest-ggo.h"]
204 AC_SUBST(ggo_descriptions_declared)
205 ########################################################################### curses
207 OLD_CPPFLAGS="$CPPFLAGS"
208 OLD_LDFLAGS="$LDFLAGS"
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"
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"
222 AC_CHECK_HEADER(curses.h, [], [
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"],
234 AC_SUBST(curses_cppflags)
235 AC_SUBST(curses_ldflags)
236 CPPFLAGS="$OLD_CPPFLAGS"
237 LDFLAGS="$OLD_LDFLAGS"
239 ########################################################################### ip_mreqn
240 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
241 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
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)
252 ########################################################################### osx
254 AC_MSG_CHECKING(for CoreAudio (MacOs))
255 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
256 #include <CoreAudio/CoreAudio.h>
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)
270 ########################################################################### ogg
272 LIB_ARG_WITH([ogg], [-logg])
274 AC_CHECK_HEADERS([ogg/ogg.h], [], [HAVE_OGG=no])
275 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [HAVE_OGG=no])
278 ######################################################################### vorbis
280 LIB_ARG_WITH([vorbis], [-lvorbis -lvorbisfile])
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)
286 ######################################################################### speex
288 LIB_ARG_WITH([speex], [-lspeex])
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)
294 ######################################################################### opus
296 LIB_ARG_WITH([opus], [-lopus])
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)
302 ########################################################################### flac
304 LIB_ARG_WITH([flac], [-lFLAC -lm])
306 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], HAVE_FLAC=no)
307 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], HAVE_FLAC=no)
308 LIB_SUBST_FLAGS(flac)
311 # some helper functions for codecs which use the ogg container format
312 AC_DEFUN([NEED_OGG_OBJECTS], [{
313 test "$HAVE_OGG" = 'yes' -a \( \
314 "$HAVE_VORBIS" = 'yes' \
315 -o "$HAVE_SPEEX" = 'yes' \
316 -o "$HAVE_OPUS" = 'yes' \
317 -o "$HAVE_FLAC" = 'yes' \
320 AC_DEFUN([NEED_VORBIS_OBJECTS], [{
321 test "$HAVE_OGG" = 'yes' -a "$HAVE_VORBIS" = 'yes'
323 AC_DEFUN([NEED_SPEEX_OBJECTS], [{
324 test "$HAVE_OGG" = 'yes' -a "$HAVE_SPEEX" = 'yes'
326 AC_DEFUN([NEED_OPUS_OBJECTS], [{
327 test "$HAVE_OGG" = 'yes' -a "$HAVE_OPUS" = 'yes'
329 AC_DEFUN([NEED_FLAC_OBJECTS], [{
330 test "$HAVE_OGG" = 'yes' -a "$HAVE_FLAC" = 'yes'
332 ########################################################################### faad
334 LIB_ARG_WITH([faad], [-lfaad])
336 AC_CHECK_HEADER(neaacdec.h, [], HAVE_FAAD=no)
337 AC_CHECK_LIB([faad], [NeAACDecOpen], [], HAVE_FAAD=no)
338 LIB_SUBST_FLAGS(faad)
340 ########################################################################### mad
342 LIB_ARG_WITH([mad], [-lmad])
344 AC_CHECK_HEADER(mad.h, [], HAVE_MAD=no)
345 AC_CHECK_LIB([mad], [mad_stream_init], [], HAVE_MAD=no)
348 ###################################################################### libid3tag
350 LIB_ARG_WITH([id3tag], [-lid3tag -lz])
352 AC_CHECK_HEADER(id3tag.h, [], HAVE_ID3TAG=no)
353 AC_CHECK_LIB([id3tag], [id3_file_fdopen], [], HAVE_ID3TAG=no)
354 LIB_SUBST_FLAGS(id3tag)
356 ########################################################################### oss
357 OLD_CPPFLAGS="$CPPFLAGS"
358 OLD_LDFLAGS="$LDFLAGS"
362 msg="=> will not build oss writer"
364 AC_CHECK_HEADER(sys/soundcard.h, [
365 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
366 oss_ldflags="-lossaudio"
367 AC_SUBST(oss_ldflags)
373 AC_MSG_WARN([no sys/soundcard.h $msg])
376 CPPFLAGS="$OLD_CPPFLAGS"
377 LDFLAGS="$OLD_LDFLAGS"
380 ########################################################################### alsa
382 LIB_ARG_WITH([alsa], [-lasound])
384 AC_CHECK_HEADER(alsa/asoundlib.h, [], HAVE_ALSA=no)
385 AC_CHECK_LIB([asound], [snd_pcm_open], [], HAVE_ALSA=no)
386 LIB_SUBST_FLAGS(alsa)
388 ######################################################################### pthread
390 LIB_ARG_WITH([pthread], [-lpthread])
392 AC_CHECK_HEADER(pthread.h, [], HAVE_PTHREAD=no)
393 AC_CHECK_LIB([pthread], [pthread_create], [], HAVE_PTHREAD=no)
394 LIB_SUBST_FLAGS(pthread)
396 ########################################################################### libao
398 LIB_ARG_WITH([ao], [-lao])
400 AC_CHECK_HEADER(ao/ao.h, [], HAVE_AO=no)
401 AC_CHECK_LIB([ao], [ao_initialize], [], HAVE_AO=no)
404 AC_DEFUN([NEED_AO_OBJECTS], [{ test $HAVE_AO = yes -a $HAVE_PTHREAD = yes; }])
405 ############################################################# readline
406 OLD_CPPFLAGS="$CPPFLAGS"
407 OLD_LDFLAGS="$LDFLAGS"
411 AC_ARG_WITH(readline_headers, [AS_HELP_STRING(--with-readline-headers=dir,
412 [look for libreadline header files also in dir])])
413 if test -n "$with_readline_headers"; then
414 readline_cppflags="-I$with_readline_headers"
415 CPPFLAGS="$CPPFLAGS $readline_cppflags"
418 AC_ARG_WITH(readline_libs, [AS_HELP_STRING(--with-readline-libs=dir,
419 [look for readline library also in dir])])
420 if test -n "$with_readline_libs"; then
421 readline_libs="-L$with_readline_libs"
422 LDFLAGS="$LDFLAGS $readline_libs"
424 msg="no interactive cli support"
425 AC_CHECK_HEADERS([readline/readline.h], [
428 AC_MSG_WARN([readline/readline.h not found, $msg])
431 if test "$have_readline" = "yes"; then
432 readline_ldflags="$readline_libs"
433 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
434 readline_ldflags="$readline_ldflags -lreadline"
435 ], [have_readline="no"])
436 if test "$have_readline" = "no"; then # try with -lcurses
438 AC_MSG_NOTICE([trying again with -lcurses])
439 unset ac_cv_search_rl_free_keymap 2> /dev/null
440 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
442 readline_ldflags="$readline_ldflags -lreadline -lcurses"
445 if test "$have_readline" = "no"; then # try with -ltermcap
447 AC_MSG_NOTICE([trying again with -ltermcap])
448 unset ac_cv_search_rl_free_keymap 2> /dev/null
449 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
451 readline_ldflags="$readline_ldflags -lreadline -ltermcap"
456 if test "$have_readline" = "yes"; then
459 [AC_DEFINE(RL_FREE_KEYMAP_DECLARED, 1, readline >= 6.3)],
463 #include <readline/readline.h>
466 AC_SUBST(readline_cppflags)
467 AC_SUBST(readline_ldflags)
468 AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
470 AC_MSG_WARN([libreadline not found or unusable])
472 CPPFLAGS="$OLD_CPPFLAGS"
473 LDFLAGS="$OLD_LDFLAGS"
475 ############################################################# libsamplerate
476 OLD_CPPFLAGS="$CPPFLAGS"
477 OLD_LDFLAGS="$LDFLAGS"
480 have_samplerate="yes"
481 AC_ARG_WITH(samplerate_headers, [AS_HELP_STRING(--with-samplerate-headers=dir,
482 [look for samplerate headers also in dir])])
483 if test -n "$with_samplerate_headers"; then
484 samplerate_cppflags="-I$with_samplerate_headers"
485 CPPFLAGS="$CPPFLAGS $samplerate_cppflags"
487 AC_ARG_WITH(samplerate_libs, [AS_HELP_STRING(--with-samplerate-libs=dir,
488 [look for samplerate libs also in dir])])
489 if test -n "$with_samplerate_libs"; then
490 samplerate_libs="-L$with_samplerate_libs"
491 LDFLAGS="$LDFLAGS $samplerate_libs"
494 AC_CHECK_HEADER(samplerate.h, [], have_samplerate=no)
495 AC_CHECK_LIB([samplerate], [src_process], [], have_samplerate=no, [])
497 if test "$have_samplerate" = "yes"; then
498 AC_SUBST(samplerate_cppflags)
499 samplerate_ldflags="$samplerate_libs -lsamplerate"
500 AC_SUBST(samplerate_ldflags)
502 AC_MSG_WARN([no resample support in para_audiod/para_filter])
504 CPPFLAGS="$OLD_CPPFLAGS"
505 LDFLAGS="$OLD_LDFLAGS"
507 ######################################################################### server
508 if test -n "$CRYPTOLIB" && test $HAVE_OSL = yes; then
510 executables="$executables server"
511 server_cmdline_objs="server"
512 server_errlist_objs="
551 if test "$CRYPTOLIB" = openssl; then
552 server_errlist_objs="$server_errlist_objs crypt"
554 server_errlist_objs="$server_errlist_objs gcrypt"
556 NEED_OGG_OBJECTS() && server_errlist_objs="$server_errlist_objs ogg_afh_common"
557 NEED_VORBIS_OBJECTS() && server_errlist_objs="$server_errlist_objs ogg_afh"
558 NEED_SPEEX_OBJECTS() && server_errlist_objs="$server_errlist_objs spx_afh spx_common"
559 NEED_OPUS_OBJECTS() && server_errlist_objs="$server_errlist_objs opus_afh opus_common"
560 NEED_FLAC_OBJECTS && server_errlist_objs="$server_errlist_objs flac_afh"
561 test $HAVE_FAAD = yes && server_errlist_objs="$server_errlist_objs aac_afh aac_common"
562 server_objs="add_cmdline($server_cmdline_objs) $server_errlist_objs"
563 AC_SUBST(server_objs, add_dot_o($server_objs))
564 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
565 objlist_to_errlist($server_errlist_objs), errors used by para_server)
569 ############################################################# client
570 if test -n "$CRYPTOLIB"; then
572 executables="$executables client"
573 client_cmdline_objs="client"
574 client_errlist_objs="
590 if test "$CRYPTOLIB" = openssl; then
591 client_errlist_objs="$client_errlist_objs crypt"
593 client_errlist_objs="$client_errlist_objs gcrypt"
595 if test "$have_readline" = "yes"; then
596 client_errlist_objs="$client_errlist_objs interactive"
598 client_objs="add_cmdline($client_cmdline_objs) $client_errlist_objs"
599 AC_SUBST(client_objs, add_dot_o($client_objs))
600 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
601 objlist_to_errlist($client_errlist_objs), errors used by para_client)
605 ############################################################# audiod
606 if test -n "$CRYPTOLIB"; then
608 executables="$executables audiod"
609 audiod_audio_formats="wma"
610 audiod_cmdline_objs="$audiod_cmdline_objs
622 audiod_errlist_objs="$audiod_errlist_objs
660 if test "$CRYPTOLIB" = openssl; then
661 audiod_errlist_objs="$audiod_errlist_objs crypt"
663 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
665 if test "$have_core_audio" = "yes"; then
666 audiod_errlist_objs="$audiod_errlist_objs osx_write ipc"
667 audiod_cmdline_objs="$audiod_cmdline_objs osx_write"
669 NEED_VORBIS_OBJECTS && {
670 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
671 audiod_audio_formats="$audiod_audio_formats ogg"
673 NEED_SPEEX_OBJECTS && {
674 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
675 audiod_audio_formats="$audiod_audio_formats spx"
677 NEED_OPUS_OBJECTS && {
678 audiod_errlist_objs="$audiod_errlist_objs opusdec_filter opus_common"
679 audiod_audio_formats="$audiod_audio_formats opus"
681 NEED_FLAC_OBJECTS && {
682 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
683 audiod_audio_formats="$audiod_audio_formats flac"
685 if test $HAVE_FAAD = yes; then
686 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
687 audiod_audio_formats="$audiod_audio_formats aac"
689 if test $HAVE_MAD = yes; then
690 audiod_audio_formats="$audiod_audio_formats mp3"
691 audiod_cmdline_objs="$audiod_cmdline_objs mp3dec_filter"
692 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
694 if test "$have_oss" = "yes"; then
695 audiod_errlist_objs="$audiod_errlist_objs oss_write"
696 audiod_cmdline_objs="$audiod_cmdline_objs oss_write"
698 if test $HAVE_ALSA = yes; then
699 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
700 audiod_cmdline_objs="$audiod_cmdline_objs alsa_write"
703 audiod_errlist_objs="$audiod_errlist_objs ao_write"
704 audiod_cmdline_objs="$audiod_cmdline_objs ao_write"
706 if test "$have_samplerate" = "yes"; then
707 audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
708 audiod_cmdline_objs="$audiod_cmdline_objs resample_filter"
710 audiod_objs="add_cmdline($audiod_cmdline_objs) $audiod_errlist_objs"
711 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
712 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
713 errors used by para_audiod)
715 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
716 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
717 enum of audio formats supported by audiod)
718 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
719 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
723 ########################################################################### fade
724 if test "$have_oss" = "yes" -o $HAVE_ALSA = yes; then
726 executables="$executables fade"
727 fade_cmdline_objs="fade"
728 fade_errlist_objs="fade exec string fd version ggo"
729 if test "$have_oss" = "yes"; then
730 fade_errlist_objs="$fade_errlist_objs oss_mix"
731 mixers="${mixers}oss "
732 default_mixer="OSS_MIX"
734 if test $HAVE_ALSA = yes; then
735 fade_errlist_objs="$fade_errlist_objs alsa_mix"
736 mixers="${mixers}alsa "
737 default_mixer="ALSA_MIX"
739 fade_objs="add_cmdline($fade_cmdline_objs) $fade_errlist_objs"
740 AC_SUBST(fade_objs, add_dot_o($fade_objs))
741 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
742 objlist_to_errlist($fade_errlist_objs),
743 errors used by para_fade)
746 printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
749 AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
750 enum of supported mixers)
751 AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
752 use this mixer if none was specified)
753 names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
754 AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
757 printf 'extern void '$i'_mix_init(struct mixer *); '
760 AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
761 init functions of the supported mixers)
762 array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
763 AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
766 AC_MSG_WARN([no mixer support])
768 ########################################################################### gui
769 if test "$have_curses" = "yes"; then
771 executables="$executables gui"
772 gui_cmdline_objs="gui"
787 gui_objs="add_cmdline($gui_cmdline_objs) $gui_errlist_objs"
788 AC_SUBST(gui_objs, add_dot_o($gui_objs))
789 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
790 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
793 AC_MSG_WARN([no curses lib, cannot build para_gui])
795 ######################################################################## filter
805 filter_errlist_objs="
830 filter_cmdline_objs="
837 NEED_VORBIS_OBJECTS && {
838 filters="$filters oggdec"
839 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
841 NEED_SPEEX_OBJECTS && {
842 filters="$filters spxdec"
843 filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
845 NEED_OPUS_OBJECTS && {
846 filters="$filters opusdec"
847 filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
849 NEED_FLAC_OBJECTS && {
850 filter_errlist_objs="$filter_errlist_objs flacdec_filter"
851 filters="$filters flacdec"
853 if test $HAVE_FAAD = yes; then
854 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
855 filters="$filters aacdec"
857 if test $HAVE_MAD = yes; then
858 filter_cmdline_objs="$filter_cmdline_objs mp3dec_filter"
859 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
860 filters="$filters mp3dec"
862 if test "$have_samplerate" = "yes"; then
863 filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
864 filter_cmdline_objs="$filter_cmdline_objs resample_filter"
865 filters="$filters resample"
867 filters="$(echo $filters)"
869 filter_objs="add_cmdline($filter_cmdline_objs) $filter_errlist_objs"
871 AC_SUBST(filter_objs, add_dot_o($filter_objs))
872 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
873 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
875 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
876 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
877 enum of supported filters)
878 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
879 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
880 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
881 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
882 ########################################################################## recv
912 NEED_OGG_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
913 NEED_VORBIS_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh"
914 NEED_SPEEX_OBJECTS && recv_errlist_objs="$recv_errlist_objs spx_afh spx_common"
915 NEED_OPUS_OBJECTS && recv_errlist_objs="$recv_errlist_objs opus_afh opus_common"
916 NEED_FLAC_OBJECTS && recv_errlist_objs="$recv_errlist_objs flac_afh"
918 if test $HAVE_FAAD = yes; then
919 recv_errlist_objs="$recv_errlist_objs aac_afh aac_common"
921 recv_objs="add_cmdline($recv_cmdline_objs) $recv_errlist_objs"
922 AC_SUBST(receivers, "http dccp udp afh")
923 AC_SUBST(recv_objs, add_dot_o($recv_objs))
924 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
925 errors used by para_recv)
926 ########################################################################### afh
927 audio_format_handlers="mp3 wma"
928 afh_cmdline_objs="afh"
941 NEED_OGG_OBJECTS && afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
942 NEED_VORBIS_OBJECTS && {
943 afh_errlist_objs="$afh_errlist_objs ogg_afh"
944 audio_format_handlers="$audio_format_handlers ogg"
946 NEED_SPEEX_OBJECTS && {
947 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
948 audio_format_handlers="$audio_format_handlers spx"
950 NEED_OPUS_OBJECTS && {
951 afh_errlist_objs="$afh_errlist_objs opus_afh opus_common"
952 audio_format_handlers="$audio_format_handlers opus"
954 NEED_FLAC_OBJECTS && {
955 afh_errlist_objs="$afh_errlist_objs flac_afh"
956 audio_format_handlers="$audio_format_handlers flac"
958 if test $HAVE_FAAD = yes; then
959 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
960 audio_format_handlers="$audio_format_handlers aac"
963 afh_objs="add_cmdline($afh_cmdline_objs) $afh_errlist_objs"
965 AC_SUBST(afh_objs, add_dot_o($afh_objs))
966 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
967 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
968 ########################################################################## play
1014 if test "$have_core_audio" = "yes"; then
1015 play_errlist_objs="$play_errlist_objs osx_write ipc"
1016 play_cmdline_objs="$play_cmdline_objs osx_write"
1018 NEED_OGG_OBJECTS && play_errlist_objs="$play_errlist_objs ogg_afh_common"
1019 NEED_VORBIS_OBJECTS && {
1020 play_errlist_objs="$play_errlist_objs oggdec_filter ogg_afh"
1022 NEED_SPEEX_OBJECTS && {
1023 play_errlist_objs="$play_errlist_objs spxdec_filter spx_afh spx_common"
1025 NEED_OPUS_OBJECTS &&
1026 play_errlist_objs="$play_errlist_objs
1031 NEED_FLAC_OBJECTS && {
1032 play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
1034 if test $HAVE_FAAD = yes; then
1035 play_errlist_objs="$play_errlist_objs aacdec_filter aac_afh aac_common"
1037 if test $HAVE_MAD = yes; then
1038 play_cmdline_objs="$play_cmdline_objs mp3dec_filter"
1039 play_errlist_objs="$play_errlist_objs mp3dec_filter"
1041 if test "$have_oss" = "yes"; then
1042 play_errlist_objs="$play_errlist_objs oss_write"
1043 play_cmdline_objs="$play_cmdline_objs oss_write"
1045 if test $HAVE_ALSA = yes; then
1046 play_errlist_objs="$play_errlist_objs alsa_write"
1047 play_cmdline_objs="$play_cmdline_objs alsa_write"
1049 NEED_AO_OBJECTS && {
1050 play_errlist_objs="$play_errlist_objs ao_write"
1051 play_cmdline_objs="$play_cmdline_objs ao_write"
1053 if test "$have_readline" = "yes"; then
1054 play_errlist_objs="$play_errlist_objs interactive"
1056 if test "$have_samplerate" = "yes"; then
1057 play_errlist_objs="$play_errlist_objs resample_filter check_wav"
1058 play_cmdline_objs="$play_cmdline_objs resample_filter"
1061 play_objs="add_cmdline($play_cmdline_objs) $play_errlist_objs"
1062 AC_SUBST(play_objs, add_dot_o($play_objs))
1063 AC_DEFINE_UNQUOTED(INIT_PLAY_ERRLISTS,
1064 objlist_to_errlist($play_errlist_objs), errors used by para_play)
1065 ######################################################################### write
1066 write_cmdline_objs="
1070 write_errlist_objs="
1085 default_writer="FILE_WRITE"
1087 if test "$have_core_audio" = "yes"; then
1088 write_errlist_objs="$write_errlist_objs osx_write ipc"
1089 write_cmdline_objs="$write_cmdline_objs osx_write"
1090 writers="$writers osx"
1091 default_writer="OSX_WRITE"
1093 NEED_AO_OBJECTS && {
1094 write_errlist_objs="$write_errlist_objs ao_write"
1095 write_cmdline_objs="$write_cmdline_objs ao_write"
1096 writers="$writers ao"
1097 default_writer="AO_WRITE"
1099 if test "$have_oss" = "yes"; then
1100 write_errlist_objs="$write_errlist_objs oss_write"
1101 write_cmdline_objs="$write_cmdline_objs oss_write"
1102 writers="$writers oss"
1103 default_writer="OSS_WRITE"
1105 if test $HAVE_ALSA = yes; then
1106 write_errlist_objs="$write_errlist_objs alsa_write"
1107 write_cmdline_objs="$write_cmdline_objs alsa_write"
1108 writers="$writers alsa"
1109 default_writer="ALSA_WRITE"
1112 write_objs="add_cmdline($write_cmdline_objs) $write_errlist_objs"
1113 AC_SUBST(write_objs, add_dot_o($write_objs))
1114 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
1115 objlist_to_errlist($write_errlist_objs), errors used by para_write)
1116 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
1117 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
1118 enum of supported writers)
1119 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
1120 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
1121 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
1122 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
1123 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
1124 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
1125 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
1126 ######################################################################## audioc
1127 audioc_cmdline_objs="audioc"
1128 audioc_errlist_objs="
1136 if test "$have_readline" = "yes"; then
1137 audioc_errlist_objs="$audioc_errlist_objs
1144 audioc_objs="add_cmdline($audioc_cmdline_objs) $audioc_errlist_objs"
1145 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
1146 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
1147 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
1148 ############################################################# error2.h
1149 # these are always built
1152 $filter_errlist_objs
1153 $audioc_errlist_objs
1159 # optional executables
1160 if test "$build_server" = "yes"; then
1161 all_errlist_objs="$all_errlist_objs $server_errlist_objs"
1163 if test "$build_gui" = "yes"; then
1164 all_errlist_objs="$all_errlist_objs $gui_errlist_objs"
1166 if test "$build_fade" = "yes"; then
1167 all_errlist_objs="$all_errlist_objs $fade_errlist_objs"
1169 if test "$build_client" = "yes"; then
1170 all_errlist_objs="$all_errlist_objs $client_errlist_objs"
1172 if test "$build_audiod" = "yes"; then
1173 all_errlist_objs="$all_errlist_objs $audiod_errlist_objs"
1176 all_errlist_objs="$(echo $all_errlist_objs | tr ' ' '\n' | sort | uniq)"
1178 object_executable_matrix=
1179 for i in $executables; do
1180 eval objs=\$${i}_errlist_objs
1181 object_executable_matrix="$object_executable_matrix $i: $objs"
1183 # use echo to replace newlines by space
1184 AC_SUBST(object_executable_matrix, $(echo $object_executable_matrix))
1186 SS=$(for obj in $all_errlist_objs; do
1187 printf '%s' " SS_$obj,"; done | tr 'a-z' 'A-Z')
1188 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
1189 [enum {$SS NUM_SS}],
1190 [list of all objects that use the paraslash error facility]
1192 ################################################################## status items
1194 status_items="basename status num_played mtime bitrate frequency file_size
1195 status_flags format score techinfo afs_mode
1196 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
1197 offset seconds_total stream_start current_time audiod_uptime image_id
1198 lyrics_id duration directory lyrics_name image_name path hash channels
1199 last_played num_chunks chunk_time amplification artist title year album
1203 for i in $status_items; do
1204 result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
1206 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
1207 [enum of all status items])
1210 for i in $status_items; do
1211 result="$result \"$i\", "
1213 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
1214 [char * array of all status items])
1216 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
1217 [formats supported by para_server and para_afh])
1219 AC_SUBST(executables)
1223 paraslash configuration:
1224 ~~~~~~~~~~~~~~~~~~~~~~~~
1225 crypto lib: ${CRYPTOLIB:-[none]}
1226 unix socket credentials: $have_ucred
1227 readline (interactive CLIs): $have_readline
1228 audio formats handlers: $audio_format_handlers
1229 id3 version 2 support: $HAVE_ID3TAG
1233 para_fade: $build_fade
1234 para_server: $build_server
1235 para_gui: $build_gui
1236 para_fade: $build_fade
1237 para_client: $build_client
1238 para_audiod: $build_audiod