2 # Process this file with autoconf to produce a configure script.
7 AC_INIT([paraslash],[git],[maan@systemlinux.org])
8 AC_CONFIG_HEADER([config.h])
10 AC_CONFIG_FILES([Makefile])
11 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
12 AC_DEFUN([objlist_to_errlist],[$(for i in $@; do printf "DEFINE_ERRLIST($(echo $i| tr 'a-z' 'A-Z'));"; done) [const char **para_errlist[[]]] = {$(for i in $@; do printf "PARA_ERRLIST($(echo $i | tr 'a-z' 'A-Z')), "; done) }])
13 AC_PATH_PROG(UNAMEPATH, uname, no)
14 if test "$UNAMEPATH" = "no"; then
15 AC_MSG_ERROR(unable to determine system type)
17 AC_MSG_CHECKING(os type)
18 OSTYPE="`$UNAMEPATH -s`"
19 AC_MSG_RESULT("$OSTYPE")
21 if test "$OSTYPE" = "SunOS"; then
22 # needed on SunOS for socket magic
23 arch_cppflags="-D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
24 AC_SUBST(arch_cppflags)
29 AC_PATH_PROG([gengetopt], [gengetopt])
30 test -z "$gengetopt" && AC_MSG_ERROR(
31 [gengetopt is required to build this package])
33 AC_PATH_PROG([help2man], [help2man])
34 test -z "$help2man" && AC_MSG_ERROR(
35 [help2man is required to build this package])
40 AC_SUBST(install_sh, [$INSTALL])
47 AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h \
48 stdlib.h string.h sys/socket.h sys/time.h sys/timeb.h sys/un.h \
49 sys/ipc.h unistd.h utime.h stddef.h],
50 [], [AC_MSG_ERROR([$ac_header not found])])
52 # Checks for typedefs, structures, and compiler characteristics.
72 # Checks for library functions.
74 AC_PROG_GCC_TRADITIONAL
80 AC_FUNC_SELECT_ARGTYPES
87 AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
88 regcomp select strchr strdup strerror strstr strtol uname \
89 fchdir gettimeofday localtime_r munmap strcasecmp strcspn \
90 strncasecmp strrchr strspn alarm mkdir inet_ntoa socket], [],
91 [AC_MSG_ERROR([function not found, cannot live without it])])
93 AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; done)])
96 all_errlist_objs="mp3_afh afh_common net string signal time daemon
97 stat afh amp_filter fd ringbuffer sched audiod
98 grab_client filter_common wav_filter compress_filter http_recv
99 dccp_recv recv_common write_common file_write audiod_command
100 client_common recv stdout filter stdin audioc write client
101 exec send_common ggo udp_recv color fec fecdec_filter
102 prebuffer_filter bitstream imdct check_wav
103 wma_afh wma_common wmadec_filter buffer_tree crypt_common
104 gui gui_theme sideband afh_recv play version"
106 executables="recv filter audioc write client afh audiod play"
108 recv_cmdline_objs="add_cmdline(recv http_recv dccp_recv udp_recv afh_recv)"
111 http_recv recv_common recv time string net dccp_recv fd
112 sched stdout ggo udp_recv buffer_tree afh_recv afh_common
113 wma_afh wma_common mp3_afh version
118 filter_cmdline_objs="add_cmdline(filter compress_filter amp_filter prebuffer_filter)"
119 filter_errlist_objs="filter_common wav_filter compress_filter filter string
120 stdin stdout sched fd amp_filter ggo fecdec_filter fec version
121 prebuffer_filter time bitstream imdct wma_common wmadec_filter buffer_tree"
123 filters=" compress wav amp fecdec wmadec prebuffer"
125 audioc_cmdline_objs="add_cmdline(audioc)"
126 audioc_errlist_objs="
136 audiod_cmdline_objs="add_cmdline(audiod compress_filter http_recv dccp_recv file_write client amp_filter udp_recv prebuffer_filter)"
137 audiod_errlist_objs="audiod signal string daemon stat net crypt_common sideband
138 time grab_client filter_common wav_filter compress_filter amp_filter http_recv dccp_recv
139 recv_common fd sched write_common file_write audiod_command fecdec_filter
140 client_common ggo udp_recv color fec prebuffer_filter version
141 bitstream imdct wma_common wmadec_filter buffer_tree"
143 audiod_audio_formats="wma"
145 afh_cmdline_objs="add_cmdline(afh)"
146 afh_errlist_objs="afh string fd mp3_afh afh_common time wma_afh wma_common
150 write_cmdline_objs="add_cmdline(write file_write)"
151 write_errlist_objs="write write_common file_write time fd string sched stdin
152 buffer_tree ggo check_wav version"
155 default_writer="FILE_WRITE"
157 client_cmdline_objs="add_cmdline(client)"
158 client_errlist_objs="
176 gui_cmdline_objs="add_cmdline(gui)"
190 gui_objs="$gui_cmdline_objs $gui_errlist_objs"
191 play_errlist_objs="play fd sched ggo buffer_tree time string net
193 wma_afh wma_common mp3_afh
194 recv_common udp_recv http_recv dccp_recv
195 filter_common fec bitstream imdct
196 wav_filter compress_filter amp_filter prebuffer_filter fecdec_filter
198 write_common file_write
201 play_cmdline_objs="add_cmdline(http_recv dccp_recv udp_recv afh_recv compress_filter amp_filter prebuffer_filter file_write play)"
203 ########################################################################### snprintf
204 # ===========================================================================
205 # http://www.nongnu.org/autoconf-archive/ax_func_snprintf.html
206 # ===========================================================================
214 # Checks for a fully C99 compliant snprintf, in particular checks whether
215 # it does bounds checking and returns the correct string length; does the
216 # same check for vsnprintf. If no working snprintf or vsnprintf is found,
217 # it prints an error message and aborts.
221 # Copyright (c) 2008 Ruediger Kuhlmann <info@ruediger-kuhlmann.de>
223 # Copying and distribution of this file, with or without modification, are
224 # permitted in any medium without royalty provided the copyright notice
225 # and this notice are preserved.
227 AU_ALIAS([AC_FUNC_SNPRINTF], [AX_FUNC_SNPRINTF])
228 AC_DEFUN([AX_FUNC_SNPRINTF],
229 [AC_CHECK_FUNCS(snprintf vsnprintf)
230 AC_MSG_CHECKING(for working snprintf)
231 AC_CACHE_VAL(ac_cv_have_working_snprintf,
232 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
237 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
238 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
240 i = snprintf (bufs, 2, "%s", "111");
241 if (strcmp (bufs, "1")) exit (1);
242 if (i != 3) exit (1);
243 i = snprintf (bufd, 2, "%d", 111);
244 if (strcmp (bufd, "1")) exit (1);
245 if (i != 3) exit (1);
247 }]])],[ac_cv_have_working_snprintf=yes],
248 [ac_cv_have_working_snprintf=no],[ac_cv_have_working_snprintf=cross])])
249 AC_MSG_RESULT([$ac_cv_have_working_snprintf])
250 AC_MSG_CHECKING(for working vsnprintf)
251 AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
252 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
255 int my_vsnprintf (char *buf, const char *tmpl, ...)
259 va_start (args, tmpl);
260 i = vsnprintf (buf, 2, tmpl, args);
267 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
268 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
270 i = my_vsnprintf (bufs, "%s", "111");
271 if (strcmp (bufs, "1")) exit (1);
272 if (i != 3) exit (1);
273 i = my_vsnprintf (bufd, "%d", 111);
274 if (strcmp (bufd, "1")) exit (1);
275 if (i != 3) exit (1);
277 }]])],[ac_cv_have_working_vsnprintf=yes],
278 [ac_cv_have_working_vsnprintf=no],[ac_cv_have_working_vsnprintf=cross])])
279 AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
280 if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
281 AC_MSG_ERROR([fatal: buggy snprintf() detected])
284 ################################################################## clock_gettime
286 AC_CHECK_LIB([c], [clock_gettime], [clock_gettime_lib=c], [
287 AC_CHECK_LIB([rt], [clock_gettime], [clock_gettime_lib=rt], [], [])
289 if test -n "$clock_gettime_lib"; then
290 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [
291 define to 1 if clock_gettime() is supported])
293 if test "$clock_gettime_lib" = "rt"; then
294 AC_SUBST(clock_gettime_ldflags, -lrt)
296 ########################################################################### osl
298 OLD_CPPFLAGS="$CPPFLAGS"
299 OLD_LD_FLAGS="$LDFLAGS"
301 AC_ARG_WITH(osl_headers, [AS_HELP_STRING(--with-osl-headers=dir,
302 [look for osl.h also in dir])])
303 if test -n "$with_osl_headers"; then
304 osl_cppflags="-I$with_osl_headers"
305 CPPFLAGS="$CPPFLAGS $osl_cppflags"
307 AC_ARG_WITH(osl_libs, [AS_HELP_STRING(--with-osl-libs=dir,
308 [look for libosl also in dir])])
309 if test -n "$with_osl_libs"; then
310 osl_libs="-L$with_osl_libs"
311 LDFLAGS="$LDFLAGS $osl_libs"
314 AC_CHECK_HEADER(osl.h, [], have_osl=no)
315 AC_CHECK_LIB([osl], [osl_open_table], [], have_osl=no)
316 if test "$have_osl" = "no"; then
317 AC_MSG_WARN([libosl not found, can not build para_server.
319 http://systemlinux.org/~maan/osl
321 git clone git://git.tuebingen.mpg.de/osl
324 extras="$extras server"
325 executables="$executables server"
326 server_cmdline_objs="add_cmdline(server)"
327 server_errlist_objs="
364 all_errlist_objs="$all_errlist_objs server vss command
365 http_send close_on_fork mm ipc dccp_send user_list
366 chunk_queue afs aft mood score attribute blob playlist
370 audio_format_handlers="mp3 wma"
371 AC_SUBST(osl_cppflags)
372 server_ldflags="$server_ldflags $osl_libs -losl"
374 CPPFLAGS="$OLD_CPPFLAGS"
375 LDFLAGS="$OLD_LDFLAGS"
377 ########################################################################### crypto
378 AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
379 Force using crypto library "lib". This package requires either
380 openssl or libgcrypt being installed. Possible values for "lib"
381 are thus "openssl" and "gcrypt". If this option is not given,
382 openssl is tried first. If openssl was not found, gcrypt is
385 case "$enable_cryptolib" in
386 "openssl") check_openssl="yes"; check_gcrypt="no";;
387 "gcrypt") check_openssl="no"; check_gcrypt="yes";;
388 "") check_openssl="yes"; check_gcrypt="yes";;
389 *) AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib]);;
391 ###################################################################### openssl
392 if test "$check_openssl" = "yes"; then
393 OLD_CPPFLAGS="$CPPFLAGS"
394 OLD_LD_FLAGS="$LDFLAGS"
397 AC_ARG_WITH(openssl_headers, [AS_HELP_STRING(--with-openssl-headers=dir,
398 [look for openssl headers also in dir])])
399 if test -n "$with_openssl_headers"; then
400 openssl_cppflags="-I$with_openssl_headers"
401 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
403 AC_ARG_WITH(openssl_libs, [AS_HELP_STRING(--with-openssl-libs=dir,
404 [look for openssl libraries also in dir])])
405 if test -n "$with_openssl_libs"; then
406 openssl_libs="-L$with_openssl_libs"
407 LDFLAGS="$LDFLAGS $openssl_libs"
409 AC_CHECK_HEADER(openssl/ssl.h, [], [have_openssl="no"])
410 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
411 if test "$have_openssl" = "no" -a -z "$with_openssl_headers$with_openssl_libs"; then
412 # try harder: openssl is sometimes installed in /usr/local/ssl
413 openssl_cppflags="-I/usr/local/ssl/include"
414 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
415 openssl_libs="-L/usr/local/ssl/lib"
416 LDFLAGS="$LDFLAGS $openssl_libs"
418 unset ac_cv_header_openssl_ssl_h 2> /dev/null
419 unset ac_cv_lib_crypto_RAND_bytes 2> /dev/null
420 AC_CHECK_HEADER(openssl/ssl.h, [have_openssl="yes"], [])
421 if test "$have_openssl" = "yes"; then
422 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
425 if test "$have_openssl" = "yes"; then
426 AC_DEFINE(HAVE_OPENSSL, 1, [define to 1 to turn on openssl support])
427 AC_SUBST(openssl_cppflags)
428 openssl_libs="$openssl_libs -lssl -lcrypto"
429 server_ldflags="$server_ldflags $openssl_libs"
430 client_ldflags="$client_ldflags $openssl_libs"
431 audiod_ldflags="$audiod_ldflags $openssl_libs"
433 all_errlist_objs="$all_errlist_objs crypt"
434 server_errlist_objs="$server_errlist_objs crypt"
435 client_errlist_objs="$client_errlist_objs crypt"
436 audiod_errlist_objs="$audiod_errlist_objs crypt"
440 AC_MSG_WARN([openssl libraries not found])
442 CPPFLAGS="$OLD_CPPFLAGS"
443 LDFLAGS="$OLD_LDFLAGS"
448 ########################################################################### gcrypt
449 if test "$check_gcrypt" = "yes"; then
450 OLD_CPPFLAGS="$CPPFLAGS"
451 OLD_LD_FLAGS="$LDFLAGS"
454 AC_ARG_WITH(gcrypt_headers, [AS_HELP_STRING(--with-gcrypt-headers=dir,
455 [look for gcrypt headers also in dir])])
456 if test -n "$with_gcrypt_headers"; then
457 gcrypt_cppflags="-I$with_gcrypt_headers"
458 CPPFLAGS="$CPPFLAGS $gcrypt_cppflags"
460 AC_ARG_WITH(gcrypt_libs, [AS_HELP_STRING(--with-gcrypt-libs=dir,
461 [look for libgcrypt also in dir])])
462 if test -n "$with_gcrypt_libs"; then
463 gcrypt_libs="-L$with_gcrypt_libs"
464 LDFLAGS="$LDFLAGS $gcrypt_libs"
466 AC_CHECK_HEADER(gcrypt.h, [], [have_gcrypt="no"])
467 AC_CHECK_LIB([gcrypt], [gcry_randomize], [], [have_gcrypt="no"])
468 if test "$have_gcrypt" = "yes"; then
469 AC_DEFINE(HAVE_GCRYPT, 1, [define to 1 to turn on gcrypt support])
470 AC_SUBST(gcrypt_cppflags)
471 gcrypt_libs="$gcrypt_libs -lgcrypt"
472 server_ldflags="$server_ldflags $gcrypt_libs"
473 client_ldflags="$client_ldflags $gcrypt_libs"
474 audiod_ldflags="$audiod_ldflags $gcrypt_libs"
476 all_errlist_objs="$all_errlist_objs gcrypt"
477 server_errlist_objs="$server_errlist_objs gcrypt"
478 client_errlist_objs="$client_errlist_objs gcrypt"
479 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
481 AC_MSG_WARN([gcrypt library not found])
483 CPPFLAGS="$OLD_CPPFLAGS"
484 LDFLAGS="$OLD_LDFLAGS"
489 ###########################################################################
490 if test "$have_openssl" = "no" -a "$have_gcrypt" = "no"; then
491 AC_MSG_ERROR([neither openssl nor gcrypt usable])
493 ########################################################################### libsocket
494 AC_CHECK_LIB([c], [socket],
496 [socket_lib="-lsocket"]
498 server_ldflags="$server_ldflags $socket_lib"
499 client_ldflags="$client_ldflags $socket_lib"
500 audioc_ldflags="$audioc_ldflags $socket_lib"
501 audiod_ldflags="$audiod_ldflags $socket_lib"
502 recv_ldflags="$recv_ldflags $socket_lib"
503 AC_SEARCH_LIBS([connect],[socket],[],[
504 AC_MSG_ERROR([Fatal: Did not find connect().])
506 ########################################################################### libnsl
507 AC_CHECK_LIB([c], [gethostbyname],
511 server_ldflags="$server_ldflags $nsl_lib"
512 client_ldflags="$client_ldflags $nsl_lib"
513 audioc_ldflags="$audioc_ldflags $nsl_lib"
514 recv_ldflags="$recv_ldflags $nsl_lib"
515 AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
516 AC_MSG_ERROR([Fatal: Did not find inet_ntoa().])
518 ########################################################################### ucred
519 AC_MSG_CHECKING(for struct ucred)
520 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
522 #include <sys/types.h>
523 #include <sys/socket.h>
525 struct ucred sucred; sucred.pid=0;
526 ]])],[have_ucred=yes],[have_ucred=no])
527 AC_MSG_RESULT($have_ucred)
528 if test ${have_ucred} = yes; then
529 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
531 ########################################################################### gengetopt
532 echo 'option "z" z "" flag off' | $gengetopt --file-name conftest-ggo &&
534 [gengetopt_args_info_description],
535 [ggo_descriptions_declared=yes],
536 [ggo_descriptions_declared=no],
537 [#include "conftest-ggo.h"]
539 AC_SUBST(ggo_descriptions_declared)
540 ########################################################################### curses
542 OLD_CPPFLAGS="$CPPFLAGS"
543 OLD_LD_FLAGS="$LDFLAGS"
545 AC_ARG_WITH(curses_headers, [AS_HELP_STRING(--with-curses-headers=dir,
546 [look for curses.h also in dir])])
547 if test -n "$with_curses_headers"; then
548 curses_cppflags="-I$with_curses_headers"
549 CPPFLAGS="$CPPFLAGS $curses_cppflags"
551 AC_ARG_WITH(curses_libs, [AS_HELP_STRING(--with-curses-libs=dir,
552 [look for libcurses also in dir])])
553 if test -n "$with_curses_libs"; then
554 curses_libs="-L$with_curses_libs"
555 LDFLAGS="$LDFLAGS $curses_libs"
557 AC_CHECK_HEADER(curses.h, [], [
560 gui_ldflags="$curses_libs"
561 AC_CHECK_LIB([ncursesw], [initscr],
562 [gui_ldflags="$curses_libs -lncursesw"], [
563 AC_CHECK_LIB([curses], [initscr],
564 [gui_ldflags="$curses_libs -lcurses"],
569 if test "$have_curses" = "yes"; then
570 AC_SUBST(curses_cppflags)
572 executables="$executables gui"
574 AC_MSG_WARN([no curses lib, cannot build para_gui])
576 CPPFLAGS="$OLD_CPPFLAGS"
577 LDFLAGS="$OLD_LDFLAGS"
580 ########################################################################### ip_mreqn
581 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
582 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
588 ]])],[have_ip_mreqn=yes],[have_ip_mreqn=no])
589 AC_MSG_RESULT($have_ip_mreqn)
590 if test ${have_ip_mreqn} = yes; then
591 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
593 ########################################################################### osx
595 AC_MSG_CHECKING(for CoreAudio (MacOs))
596 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
597 #include <CoreAudio/CoreAudio.h>
600 ]])],[have_core_audio=yes],[have_core_audio=no])
601 AC_MSG_RESULT($have_core_audio)
602 if test ${have_core_audio} = yes; then
603 f1="-framework CoreAudio"
604 f2="-framework AudioToolbox"
605 f3="-framework AudioUnit"
606 f4="-framework CoreServices"
609 all_errlist_objs="$all_errlist_objs osx_write"
610 # ipc is linked into para_server server and into the osx writer. If osl
611 # was not found, para_server will not be built and ipc has not yet been
612 # added to the list of all objects, so we must add it here.
613 if test "$have_osl" = "no"; then
614 all_errlist_objs="$all_errlist_objs ipc"
616 audiod_errlist_objs="$audiod_errlist_objs osx_write ipc"
617 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
618 audiod_ldflags="$audiod_ldflags $f"
620 play_errlist_objs="$play_errlist_objs osx_write ipc"
621 play_cmdline_objs="$play_cmdline_objs osx_write.cmdline"
622 play_ldflags="$play_ldflags $f"
624 write_errlist_objs="$write_errlist_objs osx_write ipc"
625 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
626 write_ldflags="$write_ldflags $f"
627 writers="$writers osx"
628 default_writer="OSX_WRITE"
629 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
631 ####################################################### ogg/vorbis/speex/opus
633 OLD_CPPFLAGS="$CPPFLAGS"
634 OLD_LD_FLAGS="$LDFLAGS"
636 AC_ARG_WITH(ogg_headers, [AS_HELP_STRING(--with-ogg-headers=dir,
637 [look for ogg headers also in dir])])
638 AC_ARG_WITH(ogg_libs, [AS_HELP_STRING(--with-ogg-libs=dir,
639 [look for ogg libs also in dir])])
640 AC_ARG_WITH(vorbis_headers, [AS_HELP_STRING(--with-vorbis-headers=dir,
641 [look for vorbis headers also in dir])])
642 AC_ARG_WITH(vorbis_libs, [AS_HELP_STRING(--with-vorbis-libs=dir,
643 [look for vorbis libs also in dir])])
644 AC_ARG_WITH(speex_headers, [AS_HELP_STRING(--with-speex-headers=dir,
645 [look for speex headers also in dir])])
646 AC_ARG_WITH(speex_libs, [AS_HELP_STRING(--with-speex-libs=dir,
647 [look for speex libs also in dir])])
648 AC_ARG_WITH(opus_headers, [AS_HELP_STRING(--with-opus-headers=dir,
649 [look for opus headers also in dir])])
650 AC_ARG_WITH(opus_libs, [AS_HELP_STRING(--with-opus-libs=dir,
651 [look for opus libs also in dir])])
653 if test -n "$with_ogg_headers"; then
654 ogg_cppflags="-I$with_ogg_headers"
655 CPPFLAGS="$CPPFLAGS $ogg_cppflags"
657 if test -n "$with_ogg_libs"; then
658 ogg_libs="-L$with_ogg_libs"
659 LDFLAGS="$LDFLAGS $ogg_libs"
661 AC_CHECK_HEADERS([ogg/ogg.h], [], [ have_ogg="no"; ])
662 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
667 if test "$have_ogg" = "yes"; then
669 if test -n "$with_vorbis_headers"; then
670 vorbis_cppflags="-I$with_vorbis_headers"
671 CPPFLAGS="$CPPFLAGS $vorbis_cppflags"
673 if test -n "$with_vorbis_libs"; then
674 vorbis_libs="-L$with_vorbis_libs"
675 LDFLAGS="$LDFLAGS $vorbis_libs"
677 AC_CHECK_HEADERS([vorbis/codec.h], [], [ have_vorbis="no" ])
678 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_vorbis="no" ])
681 if test -n "$with_speex_headers"; then
682 speex_cppflags="-I$with_speex_headers"
683 CPPFLAGS="$CPPFLAGS $speex_cppflags"
685 if test -n "$with_speex_libs"; then
686 speex_libs="-L$with_speex_libs"
687 LDFLAGS="$LDFLAGS $speex_libs"
689 AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ])
690 AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ])
693 if test -n "$with_opus_headers"; then
694 opus_cppflags="-I$with_opus_headers"
695 CPPFLAGS="$CPPFLAGS $opus_cppflags"
697 if test -n "$with_opus_libs"; then
698 speex_libs="-L$with_opus_libs"
699 LDFLAGS="$LDFLAGS $opus_libs"
701 AC_CHECK_LIB([opus], [opus_multistream_decode], [], [ have_opus="no" ])
702 AC_CHECK_HEADERS([opus/opus.h], [], [ have_opus="no" ])
704 AC_MSG_WARN([vorbis/speex/opus depend on libogg, which was not detected])
710 msg="support in para_server/para_filter/para_afh"
711 if test "$have_vorbis" = "yes" || \
712 test "$have_speex" = "yes" || \
713 test "$have_opus" = "yes"; then
714 AC_SUBST(ogg_cppflags)
715 ogg_libs="$ogg_libs -logg"
716 if test "$OSTYPE" = "Darwin"; then
717 ogg_libs="-Wl,-bind_at_load $ogg_libs"
719 server_ldflags="$server_ldflags $ogg_libs"
720 filter_ldflags="$filter_ldflags $ogg_libs"
721 audiod_ldflags="$audiod_ldflags $ogg_libs"
722 play_ldflags="$play_ldflags $ogg_libs"
723 afh_ldflags="$afh_ldflags $ogg_libs"
724 recv_ldflags="$recv_ldflags $ogg_libs"
725 all_errlist_objs="$all_errlist_objs ogg_afh_common"
726 afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
727 recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
728 server_errlist_objs="$server_errlist_objs ogg_afh_common"
729 play_errlist_objs="$play_errlist_objs ogg_afh_common"
731 if test "$have_vorbis" = "yes"; then
732 all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh"
733 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support)
734 filters="$filters oggdec"
735 vorbis_libs="-lvorbis -lvorbisfile"
736 server_ldflags="$server_ldflags $vorbis_libs"
737 filter_ldflags="$filter_ldflags $vorbis_libs"
738 audiod_ldflags="$audiod_ldflags $vorbis_libs"
739 play_ldflags="$play_ldflags $vorbis_libs"
740 afh_ldflags="$afh_ldflags $vorbis_libs"
741 recv_ldflags="$recv_ldflags $vorbis_libs"
743 server_errlist_objs="$server_errlist_objs ogg_afh"
744 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
745 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
746 play_errlist_objs="$play_errlist_objs oggdec_filter ogg_afh"
747 afh_errlist_objs="$afh_errlist_objs ogg_afh"
748 recv_errlist_objs="$recv_errlist_objs ogg_afh"
750 audiod_audio_formats="$audiod_audio_formats ogg"
751 audio_format_handlers="$audio_format_handlers ogg"
753 AC_MSG_WARN([no ogg/vorbis $msg])
755 if test "$have_speex" = "yes"; then
756 all_errlist_objs="$all_errlist_objs spxdec_filter spx_afh spx_common"
757 AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support)
758 filters="$filters spxdec"
760 server_ldflags="$server_ldflags $speex_libs"
761 filter_ldflags="$filter_ldflags $speex_libs"
762 audiod_ldflags="$audiod_ldflags $speex_libs"
763 play_ldflags="$play_ldflags $speex_libs"
764 afh_ldflags="$afh_ldflags $speex_libs"
765 recv_ldflags="$recv_ldflags $speex_libs"
767 server_errlist_objs="$server_errlist_objs spx_afh spx_common"
768 filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
769 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
770 play_errlist_objs="$play_errlist_objs spxdec_filter spx_afh spx_common"
771 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
772 recv_errlist_objs="$recv_errlist_objs spx_afh spx_common"
774 audiod_audio_formats="$audiod_audio_formats spx"
775 audio_format_handlers="$audio_format_handlers spx"
777 AC_MSG_WARN([no ogg/speex $msg])
779 if test "$have_opus" = "yes"; then
780 all_errlist_objs="$all_errlist_objs opusdec_filter opus_afh opus_common"
781 AC_DEFINE(HAVE_OPUS, 1, define to 1 to turn on ogg/opus support)
782 filters="$filters opusdec"
784 server_ldflags="$server_ldflags $opus_libs"
785 filter_ldflags="$filter_ldflags $opus_libs"
786 audiod_ldflags="$audiod_ldflags $opus_libs"
787 afh_ldflags="$afh_ldflags $opus_libs"
788 play_ldflags="$play_ldflags $opus_libs"
789 recv_ldflags="$recv_ldflags $opus_libs"
791 server_errlist_objs="$server_errlist_objs opus_afh opus_common"
792 filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
793 audiod_errlist_objs="$audiod_errlist_objs opusdec_filter opus_common"
794 afh_errlist_objs="$afh_errlist_objs opus_afh opus_common"
795 play_errlist_objs="$play_errlist_objs opusdec_filter opus_afh opus_common"
796 recv_errlist_objs="$recv_errlist_objs opus_afh opus_common"
798 audiod_audio_formats="$audiod_audio_formats opus"
799 server_audio_formats="$server_audio_formats opus"
801 AC_MSG_WARN([no ogg/opus $msg])
803 CPPFLAGS="$OLD_CPPFLAGS"
804 LDFLAGS="$OLD_LDFLAGS"
806 ########################################################################### faad
808 OLD_CPPFLAGS="$CPPFLAGS"
809 OLD_LD_FLAGS="$LDFLAGS"
811 AC_ARG_WITH(faad_headers, [AS_HELP_STRING(--with-faad-headers=dir,
812 [look for neaacdec.h also in dir])])
813 if test -n "$with_faad_headers"; then
814 faad_cppflags="-I$with_faad_headers"
815 CPPFLAGS="$CPPFLAGS $faad_cppflags"
817 AC_ARG_WITH(faad_libs, [AS_HELP_STRING(--with-faad-libs=dir,
818 [look for libfaad also in dir])])
819 if test -n "$with_faad_libs"; then
820 faad_libs="-L$with_faad_libs"
821 LDFLAGS="$LDFLAGS $faad_libs"
823 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
824 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
825 if test "$have_faad" = "yes"; then
826 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
827 all_errlist_objs="$all_errlist_objs aac_common aacdec_filter aac_afh"
828 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
829 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
830 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
831 play_errlist_objs="$play_errlist_objs aacdec_filter aac_afh aac_common"
832 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
833 recv_errlist_objs="$recv_errlist_objs aac_afh aac_common"
835 server_ldflags="$server_ldflags $faad_libs -lfaad"
836 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
837 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
838 play_ldflags="$play_ldflags $faad_libs -lfaad"
839 afh_ldflags="$afh_ldflags $faad_libs -lfaad"
840 recv_ldflags="$afh_ldflags $faad_libs -lfaad"
842 audiod_audio_formats="$audiod_audio_formats aac"
843 audio_format_handlers="$audio_format_handlers aac"
844 filters="$filters aacdec"
845 AC_SUBST(faad_cppflags)
847 AC_MSG_WARN([no aac support in para_audiod/para_filter])
849 CPPFLAGS="$OLD_CPPFLAGS"
850 LDFLAGS="$OLD_LDFLAGS"
852 ########################################################################### mad
854 OLD_CPPFLAGS="$CPPFLAGS"
855 OLD_LD_FLAGS="$LDFLAGS"
858 AC_ARG_WITH(mad_headers, [AS_HELP_STRING(--with-mad-headers=dir,
859 [look for mad.h also in dir])])
860 if test -n "$with_mad_headers"; then
861 mad_cppflags="-I$with_mad_headers"
862 CPPFLAGS="$CPPFLAGS $mad_cppflags"
864 AC_ARG_WITH(mad_libs, [AS_HELP_STRING(--with-mad-libs=dir,
865 [look for libmad also in dir])])
866 if test -n "$with_mad_libs"; then
867 mad_libs="-L$with_mad_libs"
868 LDFLAGS="$LDFLAGS $mad_libs"
870 AC_CHECK_HEADERS([mad.h], [], [
873 AC_CHECK_LIB([mad], [mad_stream_init], [], [
876 if test "$have_mad" = "yes"; then
877 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
878 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
879 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
880 play_cmdline_objs="$play_cmdline_objs add_cmdline(mp3dec_filter)"
881 all_errlist_objs="$all_errlist_objs mp3dec_filter"
882 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
883 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
884 play_errlist_objs="$play_errlist_objs mp3dec_filter"
885 filter_ldflags="$filter_ldflags $mad_libs -lmad"
886 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
887 play_ldflags="$play_ldflags $mad_libs -lmad"
888 audiod_audio_formats="$audiod_audio_formats mp3"
889 filters="$filters mp3dec"
890 AC_SUBST(mad_cppflags)
892 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
894 CPPFLAGS="$OLD_CPPFLAGS"
895 LDFLAGS="$OLD_LDFLAGS"
897 ###################################################################### libid3tag
898 OLD_CPPFLAGS="$CPPFLAGS"
899 OLD_LD_FLAGS="$LDFLAGS"
903 AC_ARG_WITH(id3tag_headers, [AS_HELP_STRING(--with-id3tag-headers=dir,
904 [look for id3tag header files also in dir])])
905 if test -n "$with_id3tag_headers"; then
906 id3tag_cppflags="-I$with_id3tag_headers"
907 CPPFLAGS="$CPPFLAGS $id3tag_cppflags"
909 AC_ARG_WITH(id3tag_libs, [AS_HELP_STRING(--with-id3tag-libs=dir,
910 [look for id3tag libs also in dir])])
911 if test -n "$with_id3tag_libs"; then
912 id3tag_libs="-L$with_id3tag_libs"
913 LDFLAGS="$LDFLAGS $id3tag_libs"
916 AC_MSG_CHECKING(for libid3tag)
917 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
920 struct id3_tag t = {.flags = 0};
921 ]])],[],[have_libid3tag=no])
922 AC_MSG_RESULT($have_libid3tag)
924 if test ${have_libid3tag} = yes; then
925 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
926 server_ldflags="$server_ldflags $id3tag_libs -lid3tag -lz"
927 afh_ldflags="$afh_ldflags $id3tag_libs -lid3tag -lz"
928 play_ldflags="$play_ldflags -lz"
929 recv_ldflags="$recv_ldflags $id3tag_libs -lid3tag"
930 play_ldflags="$play_ldflags $id3tag_libs -lid3tag"
931 AC_SUBST(id3tag_cppflags)
933 AC_MSG_WARN([no support for id3v2 tags])
935 CPPFLAGS="$OLD_CPPFLAGS"
936 LDFLAGS="$OLD_LDFLAGS"
938 ########################################################################### flac
939 OLD_CPPFLAGS="$CPPFLAGS"
940 OLD_LD_FLAGS="$LDFLAGS"
944 AC_ARG_WITH(flac_headers, [AS_HELP_STRING(--with-flac-headers=dir,
945 [look for flac headers also in dir])])
946 if test -n "$with_flac_headers"; then
947 flac_cppflags="-I$with_flac_headers"
948 CPPFLAGS="$CPPFLAGS $flac_cppflags"
950 AC_ARG_WITH(flac_libs, [AS_HELP_STRING(--with-flac-libs=dir,
951 [look for flac libs also in dir])])
952 if test -n "$with_flac_libs"; then
953 flac_libs="-L$with_flac_libs"
954 LDFLAGS="$LDFLAGS $flac_libs"
956 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no)
957 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], have_flac=no, -logg -lm)
958 if test "$have_flac" = "yes"; then
959 AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter)
960 all_errlist_objs="$all_errlist_objs flacdec_filter flac_afh"
961 filter_errlist_objs="$filter_errlist_objs flacdec_filter"
962 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
963 play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
964 afh_errlist_objs="$afh_errlist_objs flac_afh"
965 server_errlist_objs="$server_errlist_objs flac_afh"
966 recv_errlist_objs="$recv_errlist_objs flac_afh"
967 filter_ldflags="$filter_ldflags $flac_libs -lFLAC"
968 audiod_ldflags="$audiod_ldflags $flac_libs -lFLAC"
969 play_ldflags="$play_ldflags $flac_libs -lFLAC"
970 server_ldflags="$server_ldflags $flac_libs -lFLAC"
971 afh_ldflags="$afh_ldflags $flac_libs -lFLAC"
972 recv_ldflags="$afh_ldflags $flac_libs -lFLAC"
973 filters="$filters flacdec"
974 audio_format_handlers="$audio_format_handlers flac"
975 audiod_audio_formats="$audiod_audio_formats flac"
976 AC_SUBST(flac_cppflags)
978 AC_MSG_WARN([no flac support in para_audiod/para_filter/para_afh/para_server])
980 CPPFLAGS="$OLD_CPPFLAGS"
981 LDFLAGS="$OLD_LDFLAGS"
983 ########################################################################### oss
984 OLD_CPPFLAGS="$CPPFLAGS"
985 OLD_LD_FLAGS="$LDFLAGS"
989 msg="=> will not build oss writer"
991 AC_CHECK_HEADER(sys/soundcard.h, [
992 audiod_errlist_objs="$audiod_errlist_objs oss_write"
993 play_errlist_objs="$play_errlist_objs oss_write"
994 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
995 play_cmdline_objs="$play_cmdline_objs add_cmdline(oss_write)"
997 write_errlist_objs="$write_errlist_objs oss_write"
998 write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
999 fade_errlist_objs="$fade_errlist_objs oss_mix"
1000 all_errlist_objs="$all_errlist_objs oss_write oss_mix"
1002 writers="$writers oss"
1003 default_writer="OSS_WRITE"
1004 mixers="${mixers}oss "
1005 default_mixer="OSS_MIX"
1007 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
1008 audiod_ldflags="$audiod_ldflags -lossaudio"
1009 play_ldflags="$play_ldflags -lossaudio"
1010 write_ldflags="$write_ldflags -lossaudio"
1011 fade_ldflags="$fade_ldflags -lossaudio"
1017 AC_MSG_WARN([no sys/soundcard.h $msg])
1020 CPPFLAGS="$OLD_CPPFLAGS"
1021 LDFLAGS="$OLD_LDFLAGS"
1024 ########################################################################### alsa
1025 OLD_CPPFLAGS="$CPPFLAGS"
1026 OLD_LD_FLAGS="$LDFLAGS"
1029 msg="=> no alsa support for para_audiod/para_write"
1030 if test "$OSTYPE" != "Linux"; then
1035 if test "$have_alsa" = "yes"; then
1036 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
1038 AC_MSG_WARN([no alsa/asoundlib $msg])
1042 if test "$have_alsa" = "yes"; then
1043 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
1045 AC_MSG_WARN([no libasound $msg])
1049 if test "$have_alsa" = "yes"; then
1050 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
1051 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
1052 audiod_ldflags="$audiod_ldflags -lasound"
1053 play_errlist_objs="$play_errlist_objs alsa_write"
1054 play_cmdline_objs="$play_cmdline_objs add_cmdline(alsa_write)"
1055 play_ldflags="$play_ldflags -lasound"
1057 write_errlist_objs="$write_errlist_objs alsa_write"
1058 write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
1059 write_ldflags="$write_ldflags -lasound"
1060 fade_errlist_objs="$fade_errlist_objs alsa_mix"
1061 fade_ldflags="$fade_ldflags -lasound"
1062 all_errlist_objs="$all_errlist_objs alsa_write alsa_mix"
1064 writers="$writers alsa"
1065 default_writer="ALSA_WRITE"
1066 mixers="${mixers}alsa "
1067 default_mixer="ALSA_MIX"
1070 CPPFLAGS="$OLD_CPPFLAGS"
1071 LDFLAGS="$OLD_LDFLAGS"
1073 ########################################################################### fade
1074 if test -n "$mixers"; then
1075 extras="$extras fade"
1076 executables="$executables fade"
1077 all_errlist_objs="$all_errlist_objs fade"
1078 fade_errlist_objs="$fade_errlist_objs fade exec string fd version ggo"
1079 fade_cmdline_objs="add_cmdline(fade)"
1080 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
1081 AC_SUBST(fade_objs, add_dot_o($fade_objs))
1082 AC_SUBST(fade_ldflags, $fade_ldflags)
1083 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
1084 objlist_to_errlist($fade_errlist_objs),
1085 errors used by para_fade)
1087 for i in $mixers; do
1088 printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
1091 AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
1092 enum of supported mixers)
1093 AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
1094 use this mixer if none was specified)
1095 names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
1096 AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
1098 for i in $mixers; do
1099 printf 'extern void '$i'_mix_init(struct mixer *); '
1102 AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
1103 init functions of the supported mixers)
1104 array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
1105 AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
1106 mixer_summary="supported mixers:: $mixers, default: $default_mixer"
1108 AC_MSG_WARN([no mixer support])
1109 mixer_summary="para_fade: no"
1111 ########################################################################### libao
1112 OLD_CPPFLAGS="$CPPFLAGS"
1113 OLD_LD_FLAGS="$LDFLAGS"
1117 AC_ARG_WITH(ao_headers, [AS_HELP_STRING(--with-ao-headers=dir,
1118 [look for ao/ao.h also in dir])])
1119 if test -n "$with_ao_headers"; then
1120 ao_cppflags="-I$with_ao_headers"
1121 CPPFLAGS="$CPPFLAGS $ao_cppflags"
1123 AC_ARG_WITH(ao_libs, [AS_HELP_STRING(--with-ao-libs=dir,
1124 [look for libao also in dir])])
1125 if test -n "$with_ao_libs"; then
1126 ao_libs="-L$with_ao_libs"
1127 LDFLAGS="$LDFLAGS $ao_libs"
1129 msg="no libao support for para_audiod/para_write"
1130 AC_CHECK_HEADERS([ao/ao.h], [
1133 AC_MSG_WARN([ao.h not found, $msg])
1135 if test "$have_ao" = "yes"; then
1136 AC_CHECK_LIB([ao], [ao_initialize], [], [
1138 AC_MSG_WARN([ao lib not found or not working, $msg])
1141 if test "$have_ao" = "yes"; then
1142 AC_CHECK_HEADERS([pthread.h], [
1145 AC_MSG_WARN([pthread.h not found, $msg])
1148 if test "$have_ao" = "yes"; then
1149 AC_CHECK_LIB([pthread], [pthread_create], [], [
1151 AC_MSG_WARN([pthread lib not found or not working, $msg])
1154 if test "$have_ao" = "yes"; then
1155 all_errlist_objs="$all_errlist_objs ao_write"
1156 audiod_errlist_objs="$audiod_errlist_objs ao_write"
1157 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(ao_write)"
1158 audiod_ldflags="$audiod_ldflags -lao -lpthread"
1160 play_errlist_objs="$play_errlist_objs ao_write"
1161 play_cmdline_objs="$play_cmdline_objs add_cmdline(ao_write)"
1162 play_ldflags="$play_ldflags -lao -lpthread"
1164 write_errlist_objs="$write_errlist_objs ao_write"
1165 write_cmdline_objs="$write_cmdline_objs add_cmdline(ao_write)"
1166 write_ldflags="$write_ldflags $ao_libs -lao -lpthread"
1167 writers="$writers ao"
1168 AC_SUBST(ao_cppflags)
1171 CPPFLAGS="$OLD_CPPFLAGS"
1172 LDFLAGS="$OLD_LDFLAGS"
1174 ############################################################# readline
1175 OLD_CPPFLAGS="$CPPFLAGS"
1176 OLD_LD_FLAGS="$LDFLAGS"
1180 AC_ARG_WITH(readline_headers, [AS_HELP_STRING(--with-readline-headers=dir,
1181 [look for libreadline header files also in dir])])
1182 if test -n "$with_readline_headers"; then
1183 readline_cppflags="-I$with_readline_headers"
1184 CPPFLAGS="$CPPFLAGS $readline_cppflags"
1187 AC_ARG_WITH(readline_libs, [AS_HELP_STRING(--with-readline-libs=dir,
1188 [look for readline library also in dir])])
1189 if test -n "$with_readline_libs"; then
1190 readline_libs="-L$with_readline_libs"
1191 LDFLAGS="$LDFLAGS $readline_libs"
1193 msg="no interactive cli support"
1194 AC_CHECK_HEADERS([readline/readline.h], [
1197 AC_MSG_WARN([readline/readline.h not found, $msg])
1200 if test "$have_curses" != "yes"; then
1202 AC_MSG_WARN([interactive cli support depends on curses,])
1203 AC_MSG_WARN([but no curses lib was detected, $msg])
1206 if test "$have_readline" = "yes"; then
1207 readline_libs="$readline_libs -lreadline"
1208 AC_SEARCH_LIBS([rl_free_keymap], [readline], [], [have_readline="no"])
1209 if test "$have_readline" = "no"; then # try with -lcurses
1211 AC_MSG_NOTICE([trying again with -lcurses])
1212 unset ac_cv_search_rl_free_keymap 2> /dev/null
1213 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
1215 readline_libs="$readline_libs -lcurses"
1218 if test "$have_readline" = "no"; then # try with -ltermcap
1220 AC_MSG_NOTICE([trying again with -ltermcap])
1221 unset ac_cv_search_rl_free_keymap 2> /dev/null
1222 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
1224 readline_libs="$readline_libs -ltermcap"
1229 if test "$have_readline" = "yes"; then
1230 all_errlist_objs="$all_errlist_objs interactive"
1231 client_errlist_objs="$client_errlist_objs interactive"
1232 client_ldflags="$client_ldflags $readline_libs"
1233 audioc_errlist_objs="$audioc_errlist_objs buffer_tree interactive sched time"
1234 audioc_ldflags="$audioc_ldflags $readline_libs"
1235 play_errlist_objs="$play_errlist_objs interactive"
1236 play_ldflags="$play_ldflags $readline_libs"
1237 AC_SUBST(readline_cppflags)
1238 AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
1240 AC_MSG_WARN([libreadline not found or unusable])
1242 CPPFLAGS="$OLD_CPPFLAGS"
1243 LDFLAGS="$OLD_LDFLAGS"
1245 ############################################################# libsamplerate
1246 OLD_CPPFLAGS="$CPPFLAGS"
1247 OLD_LD_FLAGS="$LDFLAGS"
1250 have_samplerate="yes"
1251 AC_ARG_WITH(samplerate_headers, [AS_HELP_STRING(--with-samplerate-headers=dir,
1252 [look for samplerate headers also in dir])])
1253 if test -n "$with_samplerate_headers"; then
1254 samplerate_cppflags="-I$with_samplerate_headers"
1255 CPPFLAGS="$CPPFLAGS $samplerate_cppflags"
1257 AC_ARG_WITH(samplerate_libs, [AS_HELP_STRING(--with-samplerate-libs=dir,
1258 [look for samplerate libs also in dir])])
1259 if test -n "$with_samplerate_libs"; then
1260 samplerate_libs="-L$with_samplerate_libs"
1261 LDFLAGS="$LDFLAGS $samplerate_libs"
1264 AC_CHECK_HEADER(samplerate.h, [], have_samplerate=no)
1265 AC_CHECK_LIB([samplerate], [src_process], [], have_samplerate=no, [])
1267 if test "$have_samplerate" = "yes"; then
1268 all_errlist_objs="$all_errlist_objs resample_filter"
1269 filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
1270 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(resample_filter)"
1271 audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
1272 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(resample_filter)"
1273 play_errlist_objs="$play_errlist_objs resample_filter check_wav"
1274 play_cmdline_objs="$play_cmdline_objs add_cmdline(resample_filter)"
1275 filter_ldflags="$filter_ldflags $samplerate_libs -lsamplerate"
1276 audiod_ldflags="$audiod_ldflags $samplerate_libs -lsamplerate"
1277 play_ldflags="$play_ldflags $samplerate_libs -lsamplerate"
1278 filters="$filters resample"
1279 AC_SUBST(samplerate_cppflags)
1281 AC_MSG_WARN([no resample support in para_audiod/para_filter])
1283 CPPFLAGS="$OLD_CPPFLAGS"
1284 LDFLAGS="$OLD_LDFLAGS"
1286 ############################################################# error2.h
1287 AC_MSG_NOTICE(creating error2.h)
1288 for i in $executables; do
1290 eval echo \$${i}_errlist_objs
1291 done | ./error2.pl > error2.h
1292 for obj in $all_errlist_objs; do
1293 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
1295 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
1296 [enum {$SS NUM_SS}],
1297 [list of all objects that use the paraslash error facility]
1300 ################################################################## status items
1302 status_items="basename status num_played mtime bitrate frequency file_size
1303 status_flags format score techinfo afs_mode
1304 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
1305 offset seconds_total stream_start current_time audiod_uptime image_id
1306 lyrics_id duration directory lyrics_name image_name path hash channels
1307 last_played num_chunks chunk_time amplification artist title year album
1311 for i in $status_items; do
1312 result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
1314 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
1315 [enum of all status items])
1318 for i in $status_items; do
1319 result="$result \"$i\", "
1321 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
1322 [char * array of all status items])
1324 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
1325 [formats supported by para_server and para_afh])
1327 AC_SUBST(executables)
1329 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
1330 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
1331 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
1332 server_objs="$server_cmdline_objs $server_errlist_objs"
1333 write_objs="$write_cmdline_objs $write_errlist_objs"
1334 client_objs="$client_cmdline_objs $client_errlist_objs"
1335 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
1336 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
1337 play_objs="$play_cmdline_objs $play_errlist_objs"
1340 AC_SUBST(recv_objs, add_dot_o($recv_objs))
1341 AC_SUBST(recv_ldflags, $recv_ldflags)
1342 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
1343 errors used by para_recv)
1345 AC_SUBST(filter_objs, add_dot_o($filter_objs))
1346 AC_SUBST(filter_ldflags, $filter_ldflags)
1347 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
1348 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
1350 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
1351 AC_SUBST(audiod_ldflags, $audiod_ldflags)
1352 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
1353 errors used by para_audiod)
1355 AC_SUBST(server_objs, add_dot_o($server_objs))
1356 AC_SUBST(server_ldflags, $server_ldflags)
1357 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
1358 objlist_to_errlist($server_errlist_objs), errors used by para_server)
1360 AC_SUBST(afh_objs, add_dot_o($afh_objs))
1361 AC_SUBST(afh_ldflags, $afh_ldflags)
1362 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
1363 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
1365 AC_SUBST(write_objs, add_dot_o($write_objs))
1366 AC_SUBST(write_ldflags, $write_ldflags)
1367 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
1368 objlist_to_errlist($write_errlist_objs), errors used by para_write)
1370 AC_SUBST(client_objs, add_dot_o($client_objs))
1371 AC_SUBST(client_ldflags, $client_ldflags)
1372 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
1373 objlist_to_errlist($client_errlist_objs), errors used by para_client)
1375 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
1376 AC_SUBST(audioc_ldflags, $audioc_ldflags)
1377 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
1378 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
1380 AC_SUBST(gui_objs, add_dot_o($gui_objs))
1381 AC_SUBST(gui_ldflags, $gui_ldflags)
1382 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
1383 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
1385 AC_SUBST(play_objs, add_dot_o($play_objs))
1386 AC_SUBST(play_ldflags, $play_ldflags)
1387 AC_DEFINE_UNQUOTED(INIT_PLAY_ERRLISTS,
1388 objlist_to_errlist($play_errlist_objs), errors used by para_play)
1390 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
1391 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
1392 enum of supported filters)
1393 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
1394 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
1395 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
1396 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
1398 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
1399 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
1400 enum of supported writers)
1401 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
1402 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
1403 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
1404 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
1405 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
1406 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
1407 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
1409 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
1410 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
1411 enum of audio formats supported by audiod)
1412 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
1413 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
1417 paraslash configuration:
1418 ~~~~~~~~~~~~~~~~~~~~~~~~
1419 unix socket credentials: $have_ucred
1420 readline (interactive CLIs): $have_readline
1421 audio formats handlers: $audio_format_handlers
1422 id3 version2 support: $have_libid3tag
1425 optional executables: $extras