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([add_para],[$(for i in $@; do printf "para_$i "; done)])
13 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) }])
14 AC_PATH_PROG(UNAMEPATH, uname, no)
15 if test "$UNAMEPATH" = "no"; then
16 AC_MSG_ERROR(unable to determine system type)
18 AC_MSG_CHECKING(os type)
19 OSTYPE="`$UNAMEPATH -s`"
20 AC_MSG_RESULT("$OSTYPE")
22 if test "$OSTYPE" = "SunOS"; then
23 # needed on SunOS for socket magic
24 arch_cppflags="-D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
25 AC_SUBST(arch_cppflags)
30 AC_PATH_PROG([gengetopt], [gengetopt])
31 test -z "$gengetopt" && AC_MSG_ERROR(
32 [gengetopt is required to build this package])
34 AC_PATH_PROG([help2man], [help2man])
35 test -z "$help2man" && AC_MSG_ERROR(
36 [help2man is required to build this package])
41 AC_SUBST(install_sh, [$INSTALL])
48 AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h \
49 stdlib.h string.h sys/socket.h sys/time.h sys/timeb.h sys/un.h \
50 sys/ipc.h unistd.h utime.h stddef.h],
51 [], [AC_MSG_ERROR([$ac_header not found])])
53 # Checks for typedefs, structures, and compiler characteristics.
73 # Checks for library functions.
75 AC_PROG_GCC_TRADITIONAL
81 AC_FUNC_SELECT_ARGTYPES
88 AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
89 regcomp select strchr strdup strerror strstr strtol uname \
90 fchdir gettimeofday localtime_r munmap strcasecmp strcspn \
91 strncasecmp strrchr strspn alarm mkdir inet_ntoa socket], [],
92 [AC_MSG_ERROR([function not found, cannot live without it])])
94 AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; done)])
97 all_errlist_objs="mp3_afh afh_common net string signal time daemon
98 stat afh amp_filter fd ringbuffer sched audiod
99 grab_client filter_common wav_filter compress_filter http_recv
100 dccp_recv recv_common write_common file_write audiod_command
101 client_common recv stdout filter stdin audioc write client
102 exec send_common ggo udp_recv color fec fecdec_filter
103 prebuffer_filter bitstream imdct check_wav
104 wma_afh wma_common wmadec_filter buffer_tree crypt_common
105 gui gui_theme sideband afh_recv play version"
107 executables="recv filter audioc write client afh audiod play"
109 recv_cmdline_objs="add_cmdline(recv http_recv dccp_recv udp_recv afh_recv)"
112 http_recv recv_common recv time string net dccp_recv fd
113 sched stdout ggo udp_recv buffer_tree afh_recv afh_common
114 wma_afh wma_common mp3_afh version
119 filter_cmdline_objs="add_cmdline(filter compress_filter amp_filter prebuffer_filter)"
120 filter_errlist_objs="filter_common wav_filter compress_filter filter string
121 stdin stdout sched fd amp_filter ggo fecdec_filter fec version
122 prebuffer_filter time bitstream imdct wma_common wmadec_filter buffer_tree"
124 filters=" compress wav amp fecdec wmadec prebuffer"
126 audioc_cmdline_objs="add_cmdline(audioc)"
127 audioc_errlist_objs="
137 audiod_cmdline_objs="add_cmdline(audiod compress_filter http_recv dccp_recv file_write client amp_filter udp_recv prebuffer_filter)"
138 audiod_errlist_objs="audiod signal string daemon stat net crypt_common sideband
139 time grab_client filter_common wav_filter compress_filter amp_filter http_recv dccp_recv
140 recv_common fd sched write_common file_write audiod_command fecdec_filter
141 client_common ggo udp_recv color fec prebuffer_filter version
142 bitstream imdct wma_common wmadec_filter buffer_tree"
144 audiod_audio_formats="wma"
146 afh_cmdline_objs="add_cmdline(afh)"
147 afh_errlist_objs="afh string fd mp3_afh afh_common time wma_afh wma_common
151 write_cmdline_objs="add_cmdline(write file_write)"
152 write_errlist_objs="write write_common file_write time fd string sched stdin
153 buffer_tree ggo check_wav version"
156 default_writer="FILE_WRITE"
158 client_cmdline_objs="add_cmdline(client)"
159 client_errlist_objs="
177 gui_cmdline_objs="add_cmdline(gui)"
191 gui_objs="$gui_cmdline_objs $gui_errlist_objs"
192 play_errlist_objs="play fd sched ggo buffer_tree time string net
194 wma_afh wma_common mp3_afh
195 recv_common udp_recv http_recv dccp_recv
196 filter_common fec bitstream imdct
197 wav_filter compress_filter amp_filter prebuffer_filter fecdec_filter
199 write_common file_write
202 play_cmdline_objs="add_cmdline(http_recv dccp_recv udp_recv afh_recv compress_filter amp_filter prebuffer_filter file_write play)"
204 ########################################################################### snprintf
205 # ===========================================================================
206 # http://www.nongnu.org/autoconf-archive/ax_func_snprintf.html
207 # ===========================================================================
215 # Checks for a fully C99 compliant snprintf, in particular checks whether
216 # it does bounds checking and returns the correct string length; does the
217 # same check for vsnprintf. If no working snprintf or vsnprintf is found,
218 # it prints an error message and aborts.
222 # Copyright (c) 2008 Ruediger Kuhlmann <info@ruediger-kuhlmann.de>
224 # Copying and distribution of this file, with or without modification, are
225 # permitted in any medium without royalty provided the copyright notice
226 # and this notice are preserved.
228 AU_ALIAS([AC_FUNC_SNPRINTF], [AX_FUNC_SNPRINTF])
229 AC_DEFUN([AX_FUNC_SNPRINTF],
230 [AC_CHECK_FUNCS(snprintf vsnprintf)
231 AC_MSG_CHECKING(for working snprintf)
232 AC_CACHE_VAL(ac_cv_have_working_snprintf,
233 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
238 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
239 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
241 i = snprintf (bufs, 2, "%s", "111");
242 if (strcmp (bufs, "1")) exit (1);
243 if (i != 3) exit (1);
244 i = snprintf (bufd, 2, "%d", 111);
245 if (strcmp (bufd, "1")) exit (1);
246 if (i != 3) exit (1);
248 }]])],[ac_cv_have_working_snprintf=yes],
249 [ac_cv_have_working_snprintf=no],[ac_cv_have_working_snprintf=cross])])
250 AC_MSG_RESULT([$ac_cv_have_working_snprintf])
251 AC_MSG_CHECKING(for working vsnprintf)
252 AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
253 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
256 int my_vsnprintf (char *buf, const char *tmpl, ...)
260 va_start (args, tmpl);
261 i = vsnprintf (buf, 2, tmpl, args);
268 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
269 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
271 i = my_vsnprintf (bufs, "%s", "111");
272 if (strcmp (bufs, "1")) exit (1);
273 if (i != 3) exit (1);
274 i = my_vsnprintf (bufd, "%d", 111);
275 if (strcmp (bufd, "1")) exit (1);
276 if (i != 3) exit (1);
278 }]])],[ac_cv_have_working_vsnprintf=yes],
279 [ac_cv_have_working_vsnprintf=no],[ac_cv_have_working_vsnprintf=cross])])
280 AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
281 if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
282 AC_MSG_ERROR([fatal: buggy snprintf() detected])
285 ################################################################## clock_gettime
287 AC_CHECK_LIB([c], [clock_gettime], [clock_gettime_lib=c], [
288 AC_CHECK_LIB([rt], [clock_gettime], [clock_gettime_lib=rt], [], [])
290 if test -n "$clock_gettime_lib"; then
291 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [
292 define to 1 if clock_gettime() is supported])
294 if test "$clock_gettime_lib" = "rt"; then
295 AC_SUBST(clock_gettime_ldflags, -lrt)
297 ########################################################################### osl
299 OLD_CPPFLAGS="$CPPFLAGS"
300 OLD_LD_FLAGS="$LDFLAGS"
302 AC_ARG_WITH(osl_headers, [AS_HELP_STRING(--with-osl-headers=dir,
303 [look for osl.h also in dir])])
304 if test -n "$with_osl_headers"; then
305 osl_cppflags="-I$with_osl_headers"
306 CPPFLAGS="$CPPFLAGS $osl_cppflags"
308 AC_ARG_WITH(osl_libs, [AS_HELP_STRING(--with-osl-libs=dir,
309 [look for libosl also in dir])])
310 if test -n "$with_osl_libs"; then
311 osl_libs="-L$with_osl_libs"
312 LDFLAGS="$LDFLAGS $osl_libs"
315 AC_CHECK_HEADER(osl.h, [], have_osl=no)
316 AC_CHECK_LIB([osl], [osl_open_table], [], have_osl=no)
317 if test "$have_osl" = "no"; then
318 AC_MSG_WARN([libosl not found, can not build para_server.
320 http://systemlinux.org/~maan/osl
322 git clone git://git.tuebingen.mpg.de/osl
325 extras="$extras server"
326 executables="$executables server"
327 server_cmdline_objs="add_cmdline(server)"
328 server_errlist_objs="
365 all_errlist_objs="$all_errlist_objs server vss command
366 http_send close_on_fork mm ipc dccp_send user_list
367 chunk_queue afs aft mood score attribute blob playlist
371 audio_format_handlers="mp3 wma"
372 AC_SUBST(osl_cppflags)
373 server_ldflags="$server_ldflags $osl_libs -losl"
375 CPPFLAGS="$OLD_CPPFLAGS"
376 LDFLAGS="$OLD_LDFLAGS"
378 ########################################################################### crypto
379 AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
380 Force using crypto library "lib". This package requires either
381 openssl or libgcrypt being installed. Possible values for "lib"
382 are thus "openssl" and "gcrypt". If this option is not given,
383 openssl is tried first. If openssl was not found, gcrypt is
386 case "$enable_cryptolib" in
387 "openssl") check_openssl="yes"; check_gcrypt="no";;
388 "gcrypt") check_openssl="no"; check_gcrypt="yes";;
389 "") check_openssl="yes"; check_gcrypt="yes";;
390 *) AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib]);;
392 ###################################################################### openssl
393 if test "$check_openssl" = "yes"; then
394 OLD_CPPFLAGS="$CPPFLAGS"
395 OLD_LD_FLAGS="$LDFLAGS"
398 AC_ARG_WITH(openssl_headers, [AS_HELP_STRING(--with-openssl-headers=dir,
399 [look for openssl headers also in dir])])
400 if test -n "$with_openssl_headers"; then
401 openssl_cppflags="-I$with_openssl_headers"
402 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
404 AC_ARG_WITH(openssl_libs, [AS_HELP_STRING(--with-openssl-libs=dir,
405 [look for openssl libraries also in dir])])
406 if test -n "$with_openssl_libs"; then
407 openssl_libs="-L$with_openssl_libs"
408 LDFLAGS="$LDFLAGS $openssl_libs"
410 AC_CHECK_HEADER(openssl/ssl.h, [], [have_openssl="no"])
411 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
412 if test "$have_openssl" = "no" -a -z "$with_openssl_headers$with_openssl_libs"; then
413 # try harder: openssl is sometimes installed in /usr/local/ssl
414 openssl_cppflags="-I/usr/local/ssl/include"
415 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
416 openssl_libs="-L/usr/local/ssl/lib"
417 LDFLAGS="$LDFLAGS $openssl_libs"
419 unset ac_cv_header_openssl_ssl_h 2> /dev/null
420 unset ac_cv_lib_crypto_RAND_bytes 2> /dev/null
421 AC_CHECK_HEADER(openssl/ssl.h, [have_openssl="yes"], [])
422 if test "$have_openssl" = "yes"; then
423 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
426 if test "$have_openssl" = "yes"; then
427 AC_DEFINE(HAVE_OPENSSL, 1, [define to 1 to turn on openssl support])
428 AC_SUBST(openssl_cppflags)
429 openssl_libs="$openssl_libs -lssl -lcrypto"
430 server_ldflags="$server_ldflags $openssl_libs"
431 client_ldflags="$client_ldflags $openssl_libs"
432 audiod_ldflags="$audiod_ldflags $openssl_libs"
434 all_errlist_objs="$all_errlist_objs crypt"
435 server_errlist_objs="$server_errlist_objs crypt"
436 client_errlist_objs="$client_errlist_objs crypt"
437 audiod_errlist_objs="$audiod_errlist_objs crypt"
441 AC_MSG_WARN([openssl libraries not found])
443 CPPFLAGS="$OLD_CPPFLAGS"
444 LDFLAGS="$OLD_LDFLAGS"
449 ########################################################################### gcrypt
450 if test "$check_gcrypt" = "yes"; then
451 OLD_CPPFLAGS="$CPPFLAGS"
452 OLD_LD_FLAGS="$LDFLAGS"
455 AC_ARG_WITH(gcrypt_headers, [AS_HELP_STRING(--with-gcrypt-headers=dir,
456 [look for gcrypt headers also in dir])])
457 if test -n "$with_gcrypt_headers"; then
458 gcrypt_cppflags="-I$with_gcrypt_headers"
459 CPPFLAGS="$CPPFLAGS $gcrypt_cppflags"
461 AC_ARG_WITH(gcrypt_libs, [AS_HELP_STRING(--with-gcrypt-libs=dir,
462 [look for libgcrypt also in dir])])
463 if test -n "$with_gcrypt_libs"; then
464 gcrypt_libs="-L$with_gcrypt_libs"
465 LDFLAGS="$LDFLAGS $gcrypt_libs"
467 AC_CHECK_HEADER(gcrypt.h, [], [have_gcrypt="no"])
468 AC_CHECK_LIB([gcrypt], [gcry_randomize], [], [have_gcrypt="no"])
469 if test "$have_gcrypt" = "yes"; then
470 AC_DEFINE(HAVE_GCRYPT, 1, [define to 1 to turn on gcrypt support])
471 AC_SUBST(gcrypt_cppflags)
472 gcrypt_libs="$gcrypt_libs -lgcrypt"
473 server_ldflags="$server_ldflags $gcrypt_libs"
474 client_ldflags="$client_ldflags $gcrypt_libs"
475 audiod_ldflags="$audiod_ldflags $gcrypt_libs"
477 all_errlist_objs="$all_errlist_objs gcrypt"
478 server_errlist_objs="$server_errlist_objs gcrypt"
479 client_errlist_objs="$client_errlist_objs gcrypt"
480 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
482 AC_MSG_WARN([gcrypt library not found])
484 CPPFLAGS="$OLD_CPPFLAGS"
485 LDFLAGS="$OLD_LDFLAGS"
490 ###########################################################################
491 if test "$have_openssl" = "no" -a "$have_gcrypt" = "no"; then
492 AC_MSG_ERROR([neither openssl nor gcrypt usable])
494 ########################################################################### libsocket
495 AC_CHECK_LIB([c], [socket],
497 [socket_lib="-lsocket"]
499 server_ldflags="$server_ldflags $socket_lib"
500 client_ldflags="$client_ldflags $socket_lib"
501 audioc_ldflags="$audioc_ldflags $socket_lib"
502 audiod_ldflags="$audiod_ldflags $socket_lib"
503 recv_ldflags="$recv_ldflags $socket_lib"
504 AC_SEARCH_LIBS([connect],[socket],[],[
505 AC_MSG_ERROR([Fatal: Did not find connect().])
507 ########################################################################### libnsl
508 AC_CHECK_LIB([c], [gethostbyname],
512 server_ldflags="$server_ldflags $nsl_lib"
513 client_ldflags="$client_ldflags $nsl_lib"
514 audioc_ldflags="$audioc_ldflags $nsl_lib"
515 recv_ldflags="$recv_ldflags $nsl_lib"
516 AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
517 AC_MSG_ERROR([Fatal: Did not find inet_ntoa().])
519 ########################################################################### ucred
520 AC_MSG_CHECKING(for struct ucred)
521 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
523 #include <sys/types.h>
524 #include <sys/socket.h>
526 struct ucred sucred; sucred.pid=0;
527 ]])],[have_ucred=yes],[have_ucred=no])
528 AC_MSG_RESULT($have_ucred)
529 if test ${have_ucred} = yes; then
530 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
532 ########################################################################### gengetopt
533 echo 'option "z" z "" flag off' | $gengetopt --file-name conftest-ggo &&
535 [gengetopt_args_info_description],
536 [ggo_descriptions_declared=yes],
537 [ggo_descriptions_declared=no],
538 [#include "conftest-ggo.h"]
540 AC_SUBST(ggo_descriptions_declared)
541 ########################################################################### curses
543 OLD_CPPFLAGS="$CPPFLAGS"
544 OLD_LD_FLAGS="$LDFLAGS"
546 AC_ARG_WITH(curses_headers, [AS_HELP_STRING(--with-curses-headers=dir,
547 [look for curses.h also in dir])])
548 if test -n "$with_curses_headers"; then
549 curses_cppflags="-I$with_curses_headers"
550 CPPFLAGS="$CPPFLAGS $curses_cppflags"
552 AC_ARG_WITH(curses_libs, [AS_HELP_STRING(--with-curses-libs=dir,
553 [look for libcurses also in dir])])
554 if test -n "$with_curses_libs"; then
555 curses_libs="-L$with_curses_libs"
556 LDFLAGS="$LDFLAGS $curses_libs"
558 AC_CHECK_HEADER(curses.h, [], [
561 gui_ldflags="$curses_libs"
562 AC_CHECK_LIB([ncursesw], [initscr],
563 [gui_ldflags="$curses_libs -lncursesw"], [
564 AC_CHECK_LIB([curses], [initscr],
565 [gui_ldflags="$curses_libs -lcurses"],
570 if test "$have_curses" = "yes"; then
571 AC_SUBST(curses_cppflags)
573 executables="$executables gui"
575 AC_MSG_WARN([no curses lib, cannot build para_gui])
577 CPPFLAGS="$OLD_CPPFLAGS"
578 LDFLAGS="$OLD_LDFLAGS"
581 ########################################################################### ip_mreqn
582 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
583 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
589 ]])],[have_ip_mreqn=yes],[have_ip_mreqn=no])
590 AC_MSG_RESULT($have_ip_mreqn)
591 if test ${have_ip_mreqn} = yes; then
592 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
594 ########################################################################### osx
596 AC_MSG_CHECKING(for CoreAudio (MacOs))
597 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
598 #include <CoreAudio/CoreAudio.h>
601 ]])],[have_core_audio=yes],[have_core_audio=no])
602 AC_MSG_RESULT($have_core_audio)
603 if test ${have_core_audio} = yes; then
604 f1="-framework CoreAudio"
605 f2="-framework AudioToolbox"
606 f3="-framework AudioUnit"
607 f4="-framework CoreServices"
610 all_errlist_objs="$all_errlist_objs osx_write"
611 # ipc is linked into para_server server and into the osx writer. If osl
612 # was not found, para_server will not be built and ipc has not yet been
613 # added to the list of all objects, so we must add it here.
614 if test "$have_osl" = "no"; then
615 all_errlist_objs="$all_errlist_objs ipc"
617 audiod_errlist_objs="$audiod_errlist_objs osx_write ipc"
618 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
619 audiod_ldflags="$audiod_ldflags $f"
621 play_errlist_objs="$play_errlist_objs osx_write ipc"
622 play_cmdline_objs="$play_cmdline_objs osx_write.cmdline"
623 play_ldflags="$play_ldflags $f"
625 write_errlist_objs="$write_errlist_objs osx_write ipc"
626 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
627 write_ldflags="$write_ldflags $f"
628 writers="$writers osx"
629 default_writer="OSX_WRITE"
630 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
632 ########################################################### ogg/vorbis/speex
634 OLD_CPPFLAGS="$CPPFLAGS"
635 OLD_LD_FLAGS="$LDFLAGS"
637 AC_ARG_WITH(ogg_headers, [AS_HELP_STRING(--with-ogg-headers=dir,
638 [look for ogg headers also in dir])])
639 AC_ARG_WITH(ogg_libs, [AS_HELP_STRING(--with-ogg-libs=dir,
640 [look for ogg libs also in dir])])
641 AC_ARG_WITH(vorbis_headers, [AS_HELP_STRING(--with-vorbis-headers=dir,
642 [look for vorbis headers also in dir])])
643 AC_ARG_WITH(vorbis_libs, [AS_HELP_STRING(--with-vorbis-libs=dir,
644 [look for vorbis libs also in dir])])
645 AC_ARG_WITH(speex_headers, [AS_HELP_STRING(--with-speex-headers=dir,
646 [look for speex headers also in dir])])
647 AC_ARG_WITH(speex_libs, [AS_HELP_STRING(--with-speex-libs=dir,
648 [look for speex libs also in dir])])
650 if test -n "$with_ogg_headers"; then
651 ogg_cppflags="-I$with_ogg_headers"
652 CPPFLAGS="$CPPFLAGS $ogg_cppflags"
654 if test -n "$with_ogg_libs"; then
655 ogg_libs="-L$with_ogg_libs"
656 LDFLAGS="$LDFLAGS $ogg_libs"
658 AC_CHECK_HEADERS([ogg/ogg.h], [], [ have_ogg="no"; ])
659 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
663 if test "$have_ogg" = "yes"; then
665 if test -n "$with_vorbis_headers"; then
666 vorbis_cppflags="-I$with_vorbis_headers"
667 CPPFLAGS="$CPPFLAGS $vorbis_cppflags"
669 if test -n "$with_vorbis_libs"; then
670 vorbis_libs="-L$with_vorbis_libs"
671 LDFLAGS="$LDFLAGS $vorbis_libs"
673 AC_CHECK_HEADERS([vorbis/codec.h], [], [ have_vorbis="no" ])
674 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_vorbis="no" ])
677 if test -n "$with_speex_headers"; then
678 speex_cppflags="-I$with_speex_headers"
679 CPPFLAGS="$CPPFLAGS $speex_cppflags"
681 if test -n "$with_speex_libs"; then
682 speex_libs="-L$with_speex_libs"
683 LDFLAGS="$LDFLAGS $speex_libs"
685 AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ])
686 AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ])
688 AC_MSG_WARN([vorbis/speex depend on libogg, which was not detected])
693 msg="support in para_server/para_filter/para_afh"
694 if test "$have_vorbis" = "yes" || test "$have_speex" = "yes"; then
695 AC_SUBST(ogg_cppflags)
696 ogg_libs="$ogg_libs -logg"
697 if test "$OSTYPE" = "Darwin"; then
698 ogg_libs="-Wl,-bind_at_load $ogg_libs"
700 server_ldflags="$server_ldflags $ogg_libs"
701 filter_ldflags="$filter_ldflags $ogg_libs"
702 audiod_ldflags="$audiod_ldflags $ogg_libs"
703 play_ldflags="$play_ldflags $ogg_libs"
704 afh_ldflags="$afh_ldflags $ogg_libs"
705 recv_ldflags="$recv_ldflags $ogg_libs"
706 all_errlist_objs="$all_errlist_objs ogg_afh_common"
707 afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
708 recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
709 server_errlist_objs="$server_errlist_objs ogg_afh_common"
710 play_errlist_objs="$play_errlist_objs ogg_afh_common"
712 if test "$have_vorbis" = "yes"; then
713 all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh"
714 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support)
715 filters="$filters oggdec"
716 vorbis_libs="-lvorbis -lvorbisfile"
717 server_ldflags="$server_ldflags $vorbis_libs"
718 filter_ldflags="$filter_ldflags $vorbis_libs"
719 audiod_ldflags="$audiod_ldflags $vorbis_libs"
720 play_ldflags="$play_ldflags $vorbis_libs"
721 afh_ldflags="$afh_ldflags $vorbis_libs"
722 recv_ldflags="$recv_ldflags $vorbis_libs"
724 server_errlist_objs="$server_errlist_objs ogg_afh"
725 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
726 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
727 play_errlist_objs="$play_errlist_objs oggdec_filter ogg_afh"
728 afh_errlist_objs="$afh_errlist_objs ogg_afh"
729 recv_errlist_objs="$recv_errlist_objs ogg_afh"
731 audiod_audio_formats="$audiod_audio_formats ogg"
732 audio_format_handlers="$audio_format_handlers ogg"
734 AC_MSG_WARN([no ogg/vorbis $msg])
736 if test "$have_speex" = "yes"; then
737 all_errlist_objs="$all_errlist_objs spxdec_filter spx_afh spx_common"
738 AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support)
739 filters="$filters spxdec"
741 server_ldflags="$server_ldflags $speex_libs"
742 filter_ldflags="$filter_ldflags $speex_libs"
743 audiod_ldflags="$audiod_ldflags $speex_libs"
744 play_ldflags="$play_ldflags $speex_libs"
745 afh_ldflags="$afh_ldflags $speex_libs"
746 recv_ldflags="$recv_ldflags $speex_libs"
748 server_errlist_objs="$server_errlist_objs spx_afh spx_common"
749 filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
750 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
751 play_errlist_objs="$play_errlist_objs spxdec_filter spx_afh spx_common"
752 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
753 recv_errlist_objs="$recv_errlist_objs spx_afh spx_common"
755 audiod_audio_formats="$audiod_audio_formats spx"
756 audio_format_handlers="$audio_format_handlers spx"
758 AC_MSG_WARN([no ogg/speex $msg])
760 CPPFLAGS="$OLD_CPPFLAGS"
761 LDFLAGS="$OLD_LDFLAGS"
763 ########################################################################### faad
765 OLD_CPPFLAGS="$CPPFLAGS"
766 OLD_LD_FLAGS="$LDFLAGS"
768 AC_ARG_WITH(faad_headers, [AS_HELP_STRING(--with-faad-headers=dir,
769 [look for neaacdec.h also in dir])])
770 if test -n "$with_faad_headers"; then
771 faad_cppflags="-I$with_faad_headers"
772 CPPFLAGS="$CPPFLAGS $faad_cppflags"
774 AC_ARG_WITH(faad_libs, [AS_HELP_STRING(--with-faad-libs=dir,
775 [look for libfaad also in dir])])
776 if test -n "$with_faad_libs"; then
777 faad_libs="-L$with_faad_libs"
778 LDFLAGS="$LDFLAGS $faad_libs"
780 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
781 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
782 if test "$have_faad" = "yes"; then
783 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
784 all_errlist_objs="$all_errlist_objs aac_common aacdec_filter aac_afh"
785 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
786 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
787 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
788 play_errlist_objs="$play_errlist_objs aacdec_filter aac_afh aac_common"
789 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
790 recv_errlist_objs="$recv_errlist_objs aac_afh aac_common"
792 server_ldflags="$server_ldflags $faad_libs -lfaad"
793 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
794 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
795 play_ldflags="$play_ldflags $faad_libs -lfaad"
796 afh_ldflags="$afh_ldflags $faad_libs -lfaad"
797 recv_ldflags="$afh_ldflags $faad_libs -lfaad"
799 audiod_audio_formats="$audiod_audio_formats aac"
800 audio_format_handlers="$audio_format_handlers aac"
801 filters="$filters aacdec"
802 AC_SUBST(faad_cppflags)
804 AC_MSG_WARN([no aac support in para_audiod/para_filter])
806 CPPFLAGS="$OLD_CPPFLAGS"
807 LDFLAGS="$OLD_LDFLAGS"
809 ########################################################################### mad
811 OLD_CPPFLAGS="$CPPFLAGS"
812 OLD_LD_FLAGS="$LDFLAGS"
815 AC_ARG_WITH(mad_headers, [AS_HELP_STRING(--with-mad-headers=dir,
816 [look for mad.h also in dir])])
817 if test -n "$with_mad_headers"; then
818 mad_cppflags="-I$with_mad_headers"
819 CPPFLAGS="$CPPFLAGS $mad_cppflags"
821 AC_ARG_WITH(mad_libs, [AS_HELP_STRING(--with-mad-libs=dir,
822 [look for libmad also in dir])])
823 if test -n "$with_mad_libs"; then
824 mad_libs="-L$with_mad_libs"
825 LDFLAGS="$LDFLAGS $mad_libs"
827 AC_CHECK_HEADERS([mad.h], [], [
830 AC_CHECK_LIB([mad], [mad_stream_init], [], [
833 if test "$have_mad" = "yes"; then
834 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
835 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
836 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
837 play_cmdline_objs="$play_cmdline_objs add_cmdline(mp3dec_filter)"
838 all_errlist_objs="$all_errlist_objs mp3dec_filter"
839 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
840 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
841 play_errlist_objs="$play_errlist_objs mp3dec_filter"
842 filter_ldflags="$filter_ldflags $mad_libs -lmad"
843 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
844 play_ldflags="$play_ldflags $mad_libs -lmad"
845 audiod_audio_formats="$audiod_audio_formats mp3"
846 filters="$filters mp3dec"
847 AC_SUBST(mad_cppflags)
849 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
851 CPPFLAGS="$OLD_CPPFLAGS"
852 LDFLAGS="$OLD_LDFLAGS"
854 ###################################################################### libid3tag
855 OLD_CPPFLAGS="$CPPFLAGS"
856 OLD_LD_FLAGS="$LDFLAGS"
860 AC_ARG_WITH(id3tag_headers, [AS_HELP_STRING(--with-id3tag-headers=dir,
861 [look for id3tag header files also in dir])])
862 if test -n "$with_id3tag_headers"; then
863 id3tag_cppflags="-I$with_id3tag_headers"
864 CPPFLAGS="$CPPFLAGS $id3tag_cppflags"
866 AC_ARG_WITH(id3tag_libs, [AS_HELP_STRING(--with-id3tag-libs=dir,
867 [look for id3tag libs also in dir])])
868 if test -n "$with_id3tag_libs"; then
869 id3tag_libs="-L$with_id3tag_libs"
870 LDFLAGS="$LDFLAGS $id3tag_libs"
873 AC_MSG_CHECKING(for libid3tag)
874 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
877 struct id3_tag t = {.flags = 0};
878 ]])],[],[have_libid3tag=no])
879 AC_MSG_RESULT($have_libid3tag)
881 if test ${have_libid3tag} = yes; then
882 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
883 server_ldflags="$server_ldflags $id3tag_libs -lid3tag -lz"
884 afh_ldflags="$afh_ldflags $id3tag_libs -lid3tag -lz"
885 play_ldflags="$play_ldflags -lz"
886 recv_ldflags="$recv_ldflags $id3tag_libs -lid3tag"
887 play_ldflags="$play_ldflags $id3tag_libs -lid3tag"
888 AC_SUBST(id3tag_cppflags)
890 AC_MSG_WARN([no support for id3v2 tags])
892 CPPFLAGS="$OLD_CPPFLAGS"
893 LDFLAGS="$OLD_LDFLAGS"
895 ########################################################################### flac
896 OLD_CPPFLAGS="$CPPFLAGS"
897 OLD_LD_FLAGS="$LDFLAGS"
901 AC_ARG_WITH(flac_headers, [AS_HELP_STRING(--with-flac-headers=dir,
902 [look for flac headers also in dir])])
903 if test -n "$with_flac_headers"; then
904 flac_cppflags="-I$with_flac_headers"
905 CPPFLAGS="$CPPFLAGS $flac_cppflags"
907 AC_ARG_WITH(flac_libs, [AS_HELP_STRING(--with-flac-libs=dir,
908 [look for flac libs also in dir])])
909 if test -n "$with_flac_libs"; then
910 flac_libs="-L$with_flac_libs"
911 LDFLAGS="$LDFLAGS $flac_libs"
913 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no)
914 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], have_flac=no, -logg -lm)
915 if test "$have_flac" = "yes"; then
916 AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter)
917 all_errlist_objs="$all_errlist_objs flacdec_filter flac_afh"
918 filter_errlist_objs="$filter_errlist_objs flacdec_filter"
919 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
920 play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
921 afh_errlist_objs="$afh_errlist_objs flac_afh"
922 server_errlist_objs="$server_errlist_objs flac_afh"
923 recv_errlist_objs="$recv_errlist_objs flac_afh"
924 filter_ldflags="$filter_ldflags $flac_libs -lFLAC"
925 audiod_ldflags="$audiod_ldflags $flac_libs -lFLAC"
926 play_ldflags="$play_ldflags $flac_libs -lFLAC"
927 server_ldflags="$server_ldflags $flac_libs -lFLAC"
928 afh_ldflags="$afh_ldflags $flac_libs -lFLAC"
929 recv_ldflags="$afh_ldflags $flac_libs -lFLAC"
930 filters="$filters flacdec"
931 audio_format_handlers="$audio_format_handlers flac"
932 audiod_audio_formats="$audiod_audio_formats flac"
933 AC_SUBST(flac_cppflags)
935 AC_MSG_WARN([no flac support in para_audiod/para_filter/para_afh/para_server])
937 CPPFLAGS="$OLD_CPPFLAGS"
938 LDFLAGS="$OLD_LDFLAGS"
940 ########################################################################### oss
941 OLD_CPPFLAGS="$CPPFLAGS"
942 OLD_LD_FLAGS="$LDFLAGS"
946 msg="=> will not build oss writer"
948 AC_CHECK_HEADER(sys/soundcard.h, [
949 audiod_errlist_objs="$audiod_errlist_objs oss_write"
950 play_errlist_objs="$play_errlist_objs oss_write"
951 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
952 play_cmdline_objs="$play_cmdline_objs add_cmdline(oss_write)"
954 write_errlist_objs="$write_errlist_objs oss_write"
955 write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
956 fade_errlist_objs="$fade_errlist_objs oss_mix"
957 all_errlist_objs="$all_errlist_objs oss_write oss_mix"
959 writers="$writers oss"
960 default_writer="OSS_WRITE"
961 mixers="${mixers}oss "
962 default_mixer="OSS_MIX"
964 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
965 audiod_ldflags="$audiod_ldflags -lossaudio"
966 play_ldflags="$play_ldflags -lossaudio"
967 write_ldflags="$write_ldflags -lossaudio"
968 fade_ldflags="$fade_ldflags -lossaudio"
974 AC_MSG_WARN([no sys/soundcard.h $msg])
977 CPPFLAGS="$OLD_CPPFLAGS"
978 LDFLAGS="$OLD_LDFLAGS"
981 ########################################################################### alsa
982 OLD_CPPFLAGS="$CPPFLAGS"
983 OLD_LD_FLAGS="$LDFLAGS"
986 msg="=> no alsa support for para_audiod/para_write"
987 if test "$OSTYPE" != "Linux"; then
992 if test "$have_alsa" = "yes"; then
993 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
995 AC_MSG_WARN([no alsa/asoundlib $msg])
999 if test "$have_alsa" = "yes"; then
1000 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
1002 AC_MSG_WARN([no libasound $msg])
1006 if test "$have_alsa" = "yes"; then
1007 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
1008 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
1009 audiod_ldflags="$audiod_ldflags -lasound"
1010 play_errlist_objs="$play_errlist_objs alsa_write"
1011 play_cmdline_objs="$play_cmdline_objs add_cmdline(alsa_write)"
1012 play_ldflags="$play_ldflags -lasound"
1014 write_errlist_objs="$write_errlist_objs alsa_write"
1015 write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
1016 write_ldflags="$write_ldflags -lasound"
1017 fade_errlist_objs="$fade_errlist_objs alsa_mix"
1018 fade_ldflags="$fade_ldflags -lasound"
1019 all_errlist_objs="$all_errlist_objs alsa_write alsa_mix"
1021 writers="$writers alsa"
1022 default_writer="ALSA_WRITE"
1023 mixers="${mixers}alsa "
1024 default_mixer="ALSA_MIX"
1027 CPPFLAGS="$OLD_CPPFLAGS"
1028 LDFLAGS="$OLD_LDFLAGS"
1030 ########################################################################### fade
1031 if test -n "$mixers"; then
1032 extras="$extras fade"
1033 executables="$executables fade"
1034 all_errlist_objs="$all_errlist_objs fade"
1035 fade_errlist_objs="$fade_errlist_objs fade exec string fd version ggo"
1036 fade_cmdline_objs="add_cmdline(fade)"
1037 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
1038 AC_SUBST(fade_objs, add_dot_o($fade_objs))
1039 AC_SUBST(fade_ldflags, $fade_ldflags)
1040 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
1041 objlist_to_errlist($fade_errlist_objs),
1042 errors used by para_fade)
1044 for i in $mixers; do
1045 printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
1048 AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
1049 enum of supported mixers)
1050 AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
1051 use this mixer if none was specified)
1052 names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
1053 AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
1055 for i in $mixers; do
1056 printf 'extern void '$i'_mix_init(struct mixer *); '
1059 AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
1060 init functions of the supported mixers)
1061 array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
1062 AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
1063 mixer_summary="supported mixers:: $mixers, default: $default_mixer"
1065 AC_MSG_WARN([no mixer support])
1066 mixer_summary="para_fade: no"
1068 ########################################################################### libao
1069 OLD_CPPFLAGS="$CPPFLAGS"
1070 OLD_LD_FLAGS="$LDFLAGS"
1074 AC_ARG_WITH(ao_headers, [AS_HELP_STRING(--with-ao-headers=dir,
1075 [look for ao/ao.h also in dir])])
1076 if test -n "$with_ao_headers"; then
1077 ao_cppflags="-I$with_ao_headers"
1078 CPPFLAGS="$CPPFLAGS $ao_cppflags"
1080 AC_ARG_WITH(ao_libs, [AS_HELP_STRING(--with-ao-libs=dir,
1081 [look for libao also in dir])])
1082 if test -n "$with_ao_libs"; then
1083 ao_libs="-L$with_ao_libs"
1084 LDFLAGS="$LDFLAGS $ao_libs"
1086 msg="no libao support for para_audiod/para_write"
1087 AC_CHECK_HEADERS([ao/ao.h], [
1090 AC_MSG_WARN([ao.h not found, $msg])
1092 if test "$have_ao" = "yes"; then
1093 AC_CHECK_LIB([ao], [ao_initialize], [], [
1095 AC_MSG_WARN([ao lib not found or not working, $msg])
1098 if test "$have_ao" = "yes"; then
1099 AC_CHECK_HEADERS([pthread.h], [
1102 AC_MSG_WARN([pthread.h not found, $msg])
1105 if test "$have_ao" = "yes"; then
1106 AC_CHECK_LIB([pthread], [pthread_create], [], [
1108 AC_MSG_WARN([pthread lib not found or not working, $msg])
1111 if test "$have_ao" = "yes"; then
1112 all_errlist_objs="$all_errlist_objs ao_write"
1113 audiod_errlist_objs="$audiod_errlist_objs ao_write"
1114 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(ao_write)"
1115 audiod_ldflags="$audiod_ldflags -lao -lpthread"
1117 play_errlist_objs="$play_errlist_objs ao_write"
1118 play_cmdline_objs="$play_cmdline_objs add_cmdline(ao_write)"
1119 play_ldflags="$play_ldflags -lao -lpthread"
1121 write_errlist_objs="$write_errlist_objs ao_write"
1122 write_cmdline_objs="$write_cmdline_objs add_cmdline(ao_write)"
1123 write_ldflags="$write_ldflags $ao_libs -lao -lpthread"
1124 writers="$writers ao"
1125 AC_SUBST(ao_cppflags)
1128 CPPFLAGS="$OLD_CPPFLAGS"
1129 LDFLAGS="$OLD_LDFLAGS"
1131 ############################################################# readline
1132 OLD_CPPFLAGS="$CPPFLAGS"
1133 OLD_LD_FLAGS="$LDFLAGS"
1137 AC_ARG_WITH(readline_headers, [AS_HELP_STRING(--with-readline-headers=dir,
1138 [look for libreadline header files also in dir])])
1139 if test -n "$with_readline_headers"; then
1140 readline_cppflags="-I$with_readline_headers"
1141 CPPFLAGS="$CPPFLAGS $readline_cppflags"
1144 AC_ARG_WITH(readline_libs, [AS_HELP_STRING(--with-readline-libs=dir,
1145 [look for readline library also in dir])])
1146 if test -n "$with_readline_libs"; then
1147 readline_libs="-L$with_readline_libs"
1148 LDFLAGS="$LDFLAGS $readline_libs"
1150 msg="no interactive cli support"
1151 AC_CHECK_HEADERS([readline/readline.h], [
1154 AC_MSG_WARN([readline/readline.h not found, $msg])
1157 if test "$have_curses" != "yes"; then
1159 AC_MSG_WARN([interactive cli support depends on curses,])
1160 AC_MSG_WARN([but no curses lib was detected, $msg])
1163 if test "$have_readline" = "yes"; then
1164 readline_libs="$readline_libs -lreadline"
1165 AC_SEARCH_LIBS([rl_free_keymap], [readline], [], [have_readline="no"])
1166 if test "$have_readline" = "no"; then # try with -lcurses
1168 AC_MSG_NOTICE([trying again with -lcurses])
1169 unset ac_cv_search_rl_free_keymap 2> /dev/null
1170 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
1172 readline_libs="$readline_libs -lcurses"
1175 if test "$have_readline" = "no"; then # try with -ltermcap
1177 AC_MSG_NOTICE([trying again with -ltermcap])
1178 unset ac_cv_search_rl_free_keymap 2> /dev/null
1179 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
1181 readline_libs="$readline_libs -ltermcap"
1186 if test "$have_readline" = "yes"; then
1187 all_errlist_objs="$all_errlist_objs interactive"
1188 client_errlist_objs="$client_errlist_objs interactive"
1189 client_ldflags="$client_ldflags $readline_libs"
1190 audioc_errlist_objs="$audioc_errlist_objs buffer_tree interactive sched time"
1191 audioc_ldflags="$audioc_ldflags $readline_libs"
1192 play_errlist_objs="$play_errlist_objs interactive"
1193 play_ldflags="$play_ldflags $readline_libs"
1194 AC_SUBST(readline_cppflags)
1195 AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
1197 AC_MSG_WARN([libreadline not found or unusable])
1199 CPPFLAGS="$OLD_CPPFLAGS"
1200 LDFLAGS="$OLD_LDFLAGS"
1202 ############################################################# libsamplerate
1203 OLD_CPPFLAGS="$CPPFLAGS"
1204 OLD_LD_FLAGS="$LDFLAGS"
1207 have_samplerate="yes"
1208 AC_ARG_WITH(samplerate_headers, [AS_HELP_STRING(--with-samplerate-headers=dir,
1209 [look for samplerate headers also in dir])])
1210 if test -n "$with_samplerate_headers"; then
1211 samplerate_cppflags="-I$with_samplerate_headers"
1212 CPPFLAGS="$CPPFLAGS $samplerate_cppflags"
1214 AC_ARG_WITH(samplerate_libs, [AS_HELP_STRING(--with-samplerate-libs=dir,
1215 [look for samplerate libs also in dir])])
1216 if test -n "$with_samplerate_libs"; then
1217 samplerate_libs="-L$with_samplerate_libs"
1218 LDFLAGS="$LDFLAGS $samplerate_libs"
1221 AC_CHECK_HEADER(samplerate.h, [], have_samplerate=no)
1222 AC_CHECK_LIB([samplerate], [src_process], [], have_samplerate=no, [])
1224 if test "$have_samplerate" = "yes"; then
1225 all_errlist_objs="$all_errlist_objs resample_filter"
1226 filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
1227 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(resample_filter)"
1228 audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
1229 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(resample_filter)"
1230 play_errlist_objs="$play_errlist_objs resample_filter check_wav"
1231 play_cmdline_objs="$play_cmdline_objs add_cmdline(resample_filter)"
1232 filter_ldflags="$filter_ldflags $samplerate_libs -lsamplerate"
1233 audiod_ldflags="$audiod_ldflags $samplerate_libs -lsamplerate"
1234 play_ldflags="$play_ldflags $samplerate_libs -lsamplerate"
1235 filters="$filters resample"
1236 AC_SUBST(samplerate_cppflags)
1238 AC_MSG_WARN([no resample support in para_audiod/para_filter])
1240 CPPFLAGS="$OLD_CPPFLAGS"
1241 LDFLAGS="$OLD_LDFLAGS"
1243 ############################################################# error2.h
1244 AC_MSG_NOTICE(creating error2.h)
1245 for i in $executables; do
1247 eval echo \$${i}_errlist_objs
1248 done | ./error2.pl > error2.h
1249 for obj in $all_errlist_objs; do
1250 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
1252 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
1253 [enum {$SS NUM_SS}],
1254 [list of all objects that use the paraslash error facility]
1257 ################################################################## status items
1259 status_items="basename status num_played mtime bitrate frequency file_size
1260 status_flags format score techinfo afs_mode
1261 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
1262 offset seconds_total stream_start current_time audiod_uptime image_id
1263 lyrics_id duration directory lyrics_name image_name path hash channels
1264 last_played num_chunks chunk_time amplification artist title year album
1268 for i in $status_items; do
1269 result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
1271 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
1272 [enum of all status items])
1275 for i in $status_items; do
1276 result="$result \"$i\", "
1278 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
1279 [char * array of all status items])
1281 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
1282 [formats supported by para_server and para_afh])
1284 AC_SUBST(executables, add_para($executables))
1286 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
1287 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
1288 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
1289 server_objs="$server_cmdline_objs $server_errlist_objs"
1290 write_objs="$write_cmdline_objs $write_errlist_objs"
1291 client_objs="$client_cmdline_objs $client_errlist_objs"
1292 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
1293 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
1294 play_objs="$play_cmdline_objs $play_errlist_objs"
1297 AC_SUBST(recv_objs, add_dot_o($recv_objs))
1298 AC_SUBST(recv_ldflags, $recv_ldflags)
1299 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
1300 errors used by para_recv)
1302 AC_SUBST(filter_objs, add_dot_o($filter_objs))
1303 AC_SUBST(filter_ldflags, $filter_ldflags)
1304 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
1305 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
1307 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
1308 AC_SUBST(audiod_ldflags, $audiod_ldflags)
1309 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
1310 errors used by para_audiod)
1312 AC_SUBST(server_objs, add_dot_o($server_objs))
1313 AC_SUBST(server_ldflags, $server_ldflags)
1314 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
1315 objlist_to_errlist($server_errlist_objs), errors used by para_server)
1317 AC_SUBST(afh_objs, add_dot_o($afh_objs))
1318 AC_SUBST(afh_ldflags, $afh_ldflags)
1319 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
1320 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
1322 AC_SUBST(write_objs, add_dot_o($write_objs))
1323 AC_SUBST(write_ldflags, $write_ldflags)
1324 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
1325 objlist_to_errlist($write_errlist_objs), errors used by para_write)
1327 AC_SUBST(client_objs, add_dot_o($client_objs))
1328 AC_SUBST(client_ldflags, $client_ldflags)
1329 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
1330 objlist_to_errlist($client_errlist_objs), errors used by para_client)
1332 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
1333 AC_SUBST(audioc_ldflags, $audioc_ldflags)
1334 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
1335 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
1337 AC_SUBST(gui_objs, add_dot_o($gui_objs))
1338 AC_SUBST(gui_ldflags, $gui_ldflags)
1339 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
1340 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
1342 AC_SUBST(play_objs, add_dot_o($play_objs))
1343 AC_SUBST(play_ldflags, $play_ldflags)
1344 AC_DEFINE_UNQUOTED(INIT_PLAY_ERRLISTS,
1345 objlist_to_errlist($play_errlist_objs), errors used by para_play)
1347 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
1348 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
1349 enum of supported filters)
1350 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
1351 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
1352 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
1353 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
1355 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
1356 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
1357 enum of supported writers)
1358 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
1359 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
1360 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
1361 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
1362 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
1363 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
1364 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
1366 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
1367 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
1368 enum of audio formats supported by audiod)
1369 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
1370 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
1374 paraslash configuration:
1375 ~~~~~~~~~~~~~~~~~~~~~~~~
1376 unix socket credentials: $have_ucred
1377 readline (interactive CLIs): $have_readline
1378 audio formats handlers: $audio_format_handlers
1379 id3 version2 support: $have_libid3tag
1382 optional executables: $extras