2 # Process this file with autoconf to produce a configure script.
6 AC_INIT([paraslash],[git],[maan@systemlinux.org])
7 AC_CONFIG_HEADER([config.h])
9 AC_CONFIG_FILES([Makefile])
10 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
11 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) }])
12 AC_PATH_PROG(UNAMEPATH, uname, no)
13 if test "$UNAMEPATH" = "no"; then
14 AC_MSG_ERROR(unable to determine system type)
16 AC_MSG_CHECKING(os type)
17 OSTYPE="`$UNAMEPATH -s`"
18 AC_MSG_RESULT("$OSTYPE")
20 if test "$OSTYPE" = "SunOS"; then
21 # needed on SunOS for socket magic
22 arch_cppflags="-D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
23 AC_SUBST(arch_cppflags)
28 AC_PATH_PROG([gengetopt], [gengetopt])
29 test -z "$gengetopt" && AC_MSG_ERROR(
30 [gengetopt is required to build this package])
32 AC_PATH_PROG([help2man], [help2man])
33 test -z "$help2man" && AC_MSG_ERROR(
34 [help2man is required to build this package])
39 AC_SUBST(install_sh, [$INSTALL])
46 AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h \
47 stdlib.h string.h sys/socket.h sys/time.h sys/timeb.h sys/un.h \
48 sys/ipc.h unistd.h utime.h stddef.h],
49 [], [AC_MSG_ERROR([$ac_header not found])])
51 # Checks for typedefs, structures, and compiler characteristics.
71 # Checks for library functions.
73 AC_PROG_GCC_TRADITIONAL
79 AC_FUNC_SELECT_ARGTYPES
86 AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
87 regcomp select strchr strdup strerror strstr strtol uname \
88 fchdir gettimeofday localtime_r munmap strcasecmp strcspn \
89 strncasecmp strrchr strspn alarm mkdir inet_ntoa socket], [],
90 [AC_MSG_ERROR([function not found, cannot live without it])])
92 AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; done)])
95 all_errlist_objs="mp3_afh afh_common net string signal time daemon
96 stat afh amp_filter fd ringbuffer sched audiod
97 grab_client filter_common wav_filter compress_filter http_recv
98 dccp_recv recv_common write_common file_write audiod_command
99 client_common recv stdout filter stdin audioc write client
100 exec send_common ggo udp_recv color fec fecdec_filter
101 prebuffer_filter bitstream imdct check_wav
102 wma_afh wma_common wmadec_filter buffer_tree crypt_common
103 gui gui_theme sideband afh_recv play version"
105 executables="recv filter audioc write client afh audiod play"
107 recv_cmdline_objs="add_cmdline(recv http_recv dccp_recv udp_recv afh_recv)"
110 http_recv recv_common recv time string net dccp_recv fd
111 sched stdout ggo udp_recv buffer_tree afh_recv afh_common
112 wma_afh wma_common mp3_afh version
117 filter_cmdline_objs="add_cmdline(filter compress_filter amp_filter prebuffer_filter)"
118 filter_errlist_objs="filter_common wav_filter compress_filter filter string
119 stdin stdout sched fd amp_filter ggo fecdec_filter fec version
120 prebuffer_filter time bitstream imdct wma_common wmadec_filter buffer_tree"
122 filters=" compress wav amp fecdec wmadec prebuffer"
124 audioc_cmdline_objs="add_cmdline(audioc)"
125 audioc_errlist_objs="
135 audiod_cmdline_objs="add_cmdline(audiod compress_filter http_recv dccp_recv file_write client amp_filter udp_recv prebuffer_filter)"
136 audiod_errlist_objs="audiod signal string daemon stat net crypt_common sideband
137 time grab_client filter_common wav_filter compress_filter amp_filter http_recv dccp_recv
138 recv_common fd sched write_common file_write audiod_command fecdec_filter
139 client_common ggo udp_recv color fec prebuffer_filter version
140 bitstream imdct wma_common wmadec_filter buffer_tree"
142 audiod_audio_formats="wma"
144 afh_cmdline_objs="add_cmdline(afh)"
145 afh_errlist_objs="afh string fd mp3_afh afh_common time wma_afh wma_common
149 write_cmdline_objs="add_cmdline(write file_write)"
150 write_errlist_objs="write write_common file_write time fd string sched stdin
151 buffer_tree ggo check_wav version"
154 default_writer="FILE_WRITE"
156 client_cmdline_objs="add_cmdline(client)"
157 client_errlist_objs="
175 gui_cmdline_objs="add_cmdline(gui)"
189 gui_objs="$gui_cmdline_objs $gui_errlist_objs"
190 play_errlist_objs="play fd sched ggo buffer_tree time string net
192 wma_afh wma_common mp3_afh
193 recv_common udp_recv http_recv dccp_recv
194 filter_common fec bitstream imdct
195 wav_filter compress_filter amp_filter prebuffer_filter fecdec_filter
197 write_common file_write
200 play_cmdline_objs="add_cmdline(http_recv dccp_recv udp_recv afh_recv compress_filter amp_filter prebuffer_filter file_write play)"
202 ########################################################################### snprintf
203 # ===========================================================================
204 # http://www.nongnu.org/autoconf-archive/ax_func_snprintf.html
205 # ===========================================================================
213 # Checks for a fully C99 compliant snprintf, in particular checks whether
214 # it does bounds checking and returns the correct string length; does the
215 # same check for vsnprintf. If no working snprintf or vsnprintf is found,
216 # it prints an error message and aborts.
220 # Copyright (c) 2008 Ruediger Kuhlmann <info@ruediger-kuhlmann.de>
222 # Copying and distribution of this file, with or without modification, are
223 # permitted in any medium without royalty provided the copyright notice
224 # and this notice are preserved.
226 AU_ALIAS([AC_FUNC_SNPRINTF], [AX_FUNC_SNPRINTF])
227 AC_DEFUN([AX_FUNC_SNPRINTF],
228 [AC_CHECK_FUNCS(snprintf vsnprintf)
229 AC_MSG_CHECKING(for working snprintf)
230 AC_CACHE_VAL(ac_cv_have_working_snprintf,
231 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
236 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
237 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
239 i = snprintf (bufs, 2, "%s", "111");
240 if (strcmp (bufs, "1")) exit (1);
241 if (i != 3) exit (1);
242 i = snprintf (bufd, 2, "%d", 111);
243 if (strcmp (bufd, "1")) exit (1);
244 if (i != 3) exit (1);
246 }]])],[ac_cv_have_working_snprintf=yes],
247 [ac_cv_have_working_snprintf=no],[ac_cv_have_working_snprintf=cross])])
248 AC_MSG_RESULT([$ac_cv_have_working_snprintf])
249 AC_MSG_CHECKING(for working vsnprintf)
250 AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
251 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
254 int my_vsnprintf (char *buf, const char *tmpl, ...)
258 va_start (args, tmpl);
259 i = vsnprintf (buf, 2, tmpl, args);
266 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
267 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
269 i = my_vsnprintf (bufs, "%s", "111");
270 if (strcmp (bufs, "1")) exit (1);
271 if (i != 3) exit (1);
272 i = my_vsnprintf (bufd, "%d", 111);
273 if (strcmp (bufd, "1")) exit (1);
274 if (i != 3) exit (1);
276 }]])],[ac_cv_have_working_vsnprintf=yes],
277 [ac_cv_have_working_vsnprintf=no],[ac_cv_have_working_vsnprintf=cross])])
278 AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
279 if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
280 AC_MSG_ERROR([fatal: buggy snprintf() detected])
283 ################################################################## clock_gettime
285 AC_CHECK_LIB([c], [clock_gettime], [clock_gettime_lib=c], [
286 AC_CHECK_LIB([rt], [clock_gettime], [clock_gettime_lib=rt], [], [])
288 if test -n "$clock_gettime_lib"; then
289 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [
290 define to 1 if clock_gettime() is supported])
292 if test "$clock_gettime_lib" = "rt"; then
293 AC_SUBST(clock_gettime_ldflags, -lrt)
295 ########################################################################### osl
297 OLD_CPPFLAGS="$CPPFLAGS"
298 OLD_LDFLAGS="$LDFLAGS"
300 AC_ARG_WITH(osl_headers, [AS_HELP_STRING(--with-osl-headers=dir,
301 [look for osl.h also in dir])])
302 if test -n "$with_osl_headers"; then
303 osl_cppflags="-I$with_osl_headers"
304 CPPFLAGS="$CPPFLAGS $osl_cppflags"
306 AC_ARG_WITH(osl_libs, [AS_HELP_STRING(--with-osl-libs=dir,
307 [look for libosl also in dir])])
308 if test -n "$with_osl_libs"; then
309 osl_libs="-L$with_osl_libs"
310 LDFLAGS="$LDFLAGS $osl_libs"
313 AC_CHECK_HEADER(osl.h, [], have_osl=no)
314 AC_CHECK_LIB([osl], [osl_open_table], [], have_osl=no)
315 if test "$have_osl" = "no"; then
316 AC_MSG_WARN([libosl not found, can not build para_server.
318 http://systemlinux.org/~maan/osl
320 git clone git://git.tuebingen.mpg.de/osl
323 extras="$extras server"
324 executables="$executables server"
325 server_cmdline_objs="add_cmdline(server)"
326 server_errlist_objs="
363 all_errlist_objs="$all_errlist_objs server vss command
364 http_send close_on_fork mm ipc dccp_send user_list
365 chunk_queue afs aft mood score attribute blob playlist
369 audio_format_handlers="mp3 wma"
370 AC_SUBST(osl_cppflags)
371 server_ldflags="$server_ldflags $osl_libs -losl"
373 CPPFLAGS="$OLD_CPPFLAGS"
374 LDFLAGS="$OLD_LDFLAGS"
376 ########################################################################### crypto
377 AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
378 Force using crypto library "lib". This package requires either
379 openssl or libgcrypt being installed. Possible values for "lib"
380 are thus "openssl" and "gcrypt". If this option is not given,
381 openssl is tried first. If openssl was not found, gcrypt is
384 case "$enable_cryptolib" in
385 "openssl") check_openssl="yes"; check_gcrypt="no";;
386 "gcrypt") check_openssl="no"; check_gcrypt="yes";;
387 "") check_openssl="yes"; check_gcrypt="yes";;
388 *) AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib]);;
390 ###################################################################### openssl
391 if test "$check_openssl" = "yes"; then
392 OLD_CPPFLAGS="$CPPFLAGS"
393 OLD_LDFLAGS="$LDFLAGS"
396 AC_ARG_WITH(openssl_headers, [AS_HELP_STRING(--with-openssl-headers=dir,
397 [look for openssl headers also in dir])])
398 if test -n "$with_openssl_headers"; then
399 openssl_cppflags="-I$with_openssl_headers"
400 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
402 AC_ARG_WITH(openssl_libs, [AS_HELP_STRING(--with-openssl-libs=dir,
403 [look for openssl libraries also in dir])])
404 if test -n "$with_openssl_libs"; then
405 openssl_libs="-L$with_openssl_libs"
406 LDFLAGS="$LDFLAGS $openssl_libs"
408 AC_CHECK_HEADER(openssl/ssl.h, [], [have_openssl="no"])
409 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
410 if test "$have_openssl" = "no" -a -z "$with_openssl_headers$with_openssl_libs"; then
411 # try harder: openssl is sometimes installed in /usr/local/ssl
412 openssl_cppflags="-I/usr/local/ssl/include"
413 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
414 openssl_libs="-L/usr/local/ssl/lib"
415 LDFLAGS="$LDFLAGS $openssl_libs"
417 unset ac_cv_header_openssl_ssl_h 2> /dev/null
418 unset ac_cv_lib_crypto_RAND_bytes 2> /dev/null
419 AC_CHECK_HEADER(openssl/ssl.h, [have_openssl="yes"], [])
420 if test "$have_openssl" = "yes"; then
421 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
424 if test "$have_openssl" = "yes"; then
425 AC_DEFINE(HAVE_OPENSSL, 1, [define to 1 to turn on openssl support])
426 AC_SUBST(openssl_cppflags)
427 openssl_libs="$openssl_libs -lssl -lcrypto"
428 server_ldflags="$server_ldflags $openssl_libs"
429 client_ldflags="$client_ldflags $openssl_libs"
430 audiod_ldflags="$audiod_ldflags $openssl_libs"
432 all_errlist_objs="$all_errlist_objs crypt"
433 server_errlist_objs="$server_errlist_objs crypt"
434 client_errlist_objs="$client_errlist_objs crypt"
435 audiod_errlist_objs="$audiod_errlist_objs crypt"
439 AC_MSG_WARN([openssl libraries not found])
441 CPPFLAGS="$OLD_CPPFLAGS"
442 LDFLAGS="$OLD_LDFLAGS"
447 ########################################################################### gcrypt
448 if test "$check_gcrypt" = "yes"; then
449 OLD_CPPFLAGS="$CPPFLAGS"
450 OLD_LDFLAGS="$LDFLAGS"
453 AC_ARG_WITH(gcrypt_headers, [AS_HELP_STRING(--with-gcrypt-headers=dir,
454 [look for gcrypt headers also in dir])])
455 if test -n "$with_gcrypt_headers"; then
456 gcrypt_cppflags="-I$with_gcrypt_headers"
457 CPPFLAGS="$CPPFLAGS $gcrypt_cppflags"
459 AC_ARG_WITH(gcrypt_libs, [AS_HELP_STRING(--with-gcrypt-libs=dir,
460 [look for libgcrypt also in dir])])
461 if test -n "$with_gcrypt_libs"; then
462 gcrypt_libs="-L$with_gcrypt_libs"
463 LDFLAGS="$LDFLAGS $gcrypt_libs"
465 AC_CHECK_HEADER(gcrypt.h, [], [have_gcrypt="no"])
466 AC_CHECK_LIB([gcrypt], [gcry_randomize], [], [have_gcrypt="no"])
467 if test "$have_gcrypt" = "yes"; then
468 AC_DEFINE(HAVE_GCRYPT, 1, [define to 1 to turn on gcrypt support])
469 AC_SUBST(gcrypt_cppflags)
470 gcrypt_libs="$gcrypt_libs -lgcrypt"
471 server_ldflags="$server_ldflags $gcrypt_libs"
472 client_ldflags="$client_ldflags $gcrypt_libs"
473 audiod_ldflags="$audiod_ldflags $gcrypt_libs"
475 all_errlist_objs="$all_errlist_objs gcrypt"
476 server_errlist_objs="$server_errlist_objs gcrypt"
477 client_errlist_objs="$client_errlist_objs gcrypt"
478 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
480 AC_MSG_WARN([gcrypt library not found])
482 CPPFLAGS="$OLD_CPPFLAGS"
483 LDFLAGS="$OLD_LDFLAGS"
488 ###########################################################################
489 if test "$have_openssl" = "no" -a "$have_gcrypt" = "no"; then
490 AC_MSG_ERROR([neither openssl nor gcrypt usable])
492 ########################################################################### libsocket
493 AC_CHECK_LIB([c], [socket],
495 [socket_lib="-lsocket"]
497 server_ldflags="$server_ldflags $socket_lib"
498 client_ldflags="$client_ldflags $socket_lib"
499 audioc_ldflags="$audioc_ldflags $socket_lib"
500 audiod_ldflags="$audiod_ldflags $socket_lib"
501 recv_ldflags="$recv_ldflags $socket_lib"
502 AC_SEARCH_LIBS([connect],[socket],[],[
503 AC_MSG_ERROR([Fatal: Did not find connect().])
505 ########################################################################### libnsl
506 AC_CHECK_LIB([c], [gethostbyname],
510 server_ldflags="$server_ldflags $nsl_lib"
511 client_ldflags="$client_ldflags $nsl_lib"
512 audioc_ldflags="$audioc_ldflags $nsl_lib"
513 recv_ldflags="$recv_ldflags $nsl_lib"
514 AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
515 AC_MSG_ERROR([Fatal: Did not find inet_ntoa().])
517 ########################################################################### ucred
518 AC_MSG_CHECKING(for struct ucred)
519 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
521 #include <sys/types.h>
522 #include <sys/socket.h>
524 struct ucred sucred; sucred.pid=0;
525 ]])],[have_ucred=yes],[have_ucred=no])
526 AC_MSG_RESULT($have_ucred)
527 if test ${have_ucred} = yes; then
528 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
530 ########################################################################### gengetopt
531 echo 'option "z" z "" flag off' | $gengetopt --file-name conftest-ggo &&
533 [gengetopt_args_info_description],
534 [ggo_descriptions_declared=yes],
535 [ggo_descriptions_declared=no],
536 [#include "conftest-ggo.h"]
538 AC_SUBST(ggo_descriptions_declared)
539 ########################################################################### curses
541 OLD_CPPFLAGS="$CPPFLAGS"
542 OLD_LDFLAGS="$LDFLAGS"
544 AC_ARG_WITH(curses_headers, [AS_HELP_STRING(--with-curses-headers=dir,
545 [look for curses.h also in dir])])
546 if test -n "$with_curses_headers"; then
547 curses_cppflags="-I$with_curses_headers"
548 CPPFLAGS="$CPPFLAGS $curses_cppflags"
550 AC_ARG_WITH(curses_libs, [AS_HELP_STRING(--with-curses-libs=dir,
551 [look for libcurses also in dir])])
552 if test -n "$with_curses_libs"; then
553 curses_libs="-L$with_curses_libs"
554 LDFLAGS="$LDFLAGS $curses_libs"
556 AC_CHECK_HEADER(curses.h, [], [
559 gui_ldflags="$curses_libs"
560 AC_CHECK_LIB([ncursesw], [initscr],
561 [gui_ldflags="$curses_libs -lncursesw"], [
562 AC_CHECK_LIB([curses], [initscr],
563 [gui_ldflags="$curses_libs -lcurses"],
568 if test "$have_curses" = "yes"; then
569 AC_SUBST(curses_cppflags)
571 executables="$executables gui"
573 AC_MSG_WARN([no curses lib, cannot build para_gui])
575 CPPFLAGS="$OLD_CPPFLAGS"
576 LDFLAGS="$OLD_LDFLAGS"
579 ########################################################################### ip_mreqn
580 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
581 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
587 ]])],[have_ip_mreqn=yes],[have_ip_mreqn=no])
588 AC_MSG_RESULT($have_ip_mreqn)
589 if test ${have_ip_mreqn} = yes; then
590 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
592 ########################################################################### osx
594 AC_MSG_CHECKING(for CoreAudio (MacOs))
595 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
596 #include <CoreAudio/CoreAudio.h>
599 ]])],[have_core_audio=yes],[have_core_audio=no])
600 AC_MSG_RESULT($have_core_audio)
601 if test ${have_core_audio} = yes; then
602 f1="-framework CoreAudio"
603 f2="-framework AudioToolbox"
604 f3="-framework AudioUnit"
605 f4="-framework CoreServices"
608 all_errlist_objs="$all_errlist_objs osx_write"
609 # ipc is linked into para_server server and into the osx writer. If osl
610 # was not found, para_server will not be built and ipc has not yet been
611 # added to the list of all objects, so we must add it here.
612 if test "$have_osl" = "no"; then
613 all_errlist_objs="$all_errlist_objs ipc"
615 audiod_errlist_objs="$audiod_errlist_objs osx_write ipc"
616 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
617 audiod_ldflags="$audiod_ldflags $f"
619 play_errlist_objs="$play_errlist_objs osx_write ipc"
620 play_cmdline_objs="$play_cmdline_objs osx_write.cmdline"
621 play_ldflags="$play_ldflags $f"
623 write_errlist_objs="$write_errlist_objs osx_write ipc"
624 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
625 write_ldflags="$write_ldflags $f"
626 writers="$writers osx"
627 default_writer="OSX_WRITE"
628 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
630 ####################################################### ogg/vorbis/speex/opus
632 OLD_CPPFLAGS="$CPPFLAGS"
633 OLD_LDFLAGS="$LDFLAGS"
635 AC_ARG_WITH(ogg_headers, [AS_HELP_STRING(--with-ogg-headers=dir,
636 [look for ogg headers also in dir])])
637 AC_ARG_WITH(ogg_libs, [AS_HELP_STRING(--with-ogg-libs=dir,
638 [look for ogg libs also in dir])])
639 AC_ARG_WITH(vorbis_headers, [AS_HELP_STRING(--with-vorbis-headers=dir,
640 [look for vorbis headers also in dir])])
641 AC_ARG_WITH(vorbis_libs, [AS_HELP_STRING(--with-vorbis-libs=dir,
642 [look for vorbis libs also in dir])])
643 AC_ARG_WITH(speex_headers, [AS_HELP_STRING(--with-speex-headers=dir,
644 [look for speex headers also in dir])])
645 AC_ARG_WITH(speex_libs, [AS_HELP_STRING(--with-speex-libs=dir,
646 [look for speex libs also in dir])])
647 AC_ARG_WITH(opus_headers, [AS_HELP_STRING(--with-opus-headers=dir,
648 [look for opus headers also in dir])])
649 AC_ARG_WITH(opus_libs, [AS_HELP_STRING(--with-opus-libs=dir,
650 [look for opus libs also in dir])])
652 if test -n "$with_ogg_headers"; then
653 ogg_cppflags="-I$with_ogg_headers"
654 CPPFLAGS="$CPPFLAGS $ogg_cppflags"
656 if test -n "$with_ogg_libs"; then
657 ogg_libs="-L$with_ogg_libs"
658 LDFLAGS="$LDFLAGS $ogg_libs"
660 AC_CHECK_HEADERS([ogg/ogg.h], [], [ have_ogg="no"; ])
661 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
666 if test "$have_ogg" = "yes"; then
668 if test -n "$with_vorbis_headers"; then
669 vorbis_cppflags="-I$with_vorbis_headers"
670 CPPFLAGS="$CPPFLAGS $vorbis_cppflags"
672 if test -n "$with_vorbis_libs"; then
673 vorbis_libs="-L$with_vorbis_libs"
674 LDFLAGS="$LDFLAGS $vorbis_libs"
676 AC_CHECK_HEADERS([vorbis/codec.h], [], [ have_vorbis="no" ])
677 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_vorbis="no" ])
680 if test -n "$with_speex_headers"; then
681 speex_cppflags="-I$with_speex_headers"
682 CPPFLAGS="$CPPFLAGS $speex_cppflags"
684 if test -n "$with_speex_libs"; then
685 speex_libs="-L$with_speex_libs"
686 LDFLAGS="$LDFLAGS $speex_libs"
688 AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ])
689 AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ])
692 if test -n "$with_opus_headers"; then
693 opus_cppflags="-I$with_opus_headers"
694 CPPFLAGS="$CPPFLAGS $opus_cppflags"
696 if test -n "$with_opus_libs"; then
697 speex_libs="-L$with_opus_libs"
698 LDFLAGS="$LDFLAGS $opus_libs"
700 AC_CHECK_LIB([opus], [opus_multistream_decode], [], [ have_opus="no" ])
701 AC_CHECK_HEADERS([opus/opus.h], [], [ have_opus="no" ])
703 AC_MSG_WARN([vorbis/speex/opus depend on libogg, which was not detected])
709 msg="support in para_server/para_filter/para_afh"
710 if test "$have_vorbis" = "yes" || \
711 test "$have_speex" = "yes" || \
712 test "$have_opus" = "yes"; then
713 AC_SUBST(ogg_cppflags)
714 ogg_libs="$ogg_libs -logg"
715 if test "$OSTYPE" = "Darwin"; then
716 ogg_libs="-Wl,-bind_at_load $ogg_libs"
718 server_ldflags="$server_ldflags $ogg_libs"
719 filter_ldflags="$filter_ldflags $ogg_libs"
720 audiod_ldflags="$audiod_ldflags $ogg_libs"
721 play_ldflags="$play_ldflags $ogg_libs"
722 afh_ldflags="$afh_ldflags $ogg_libs"
723 recv_ldflags="$recv_ldflags $ogg_libs"
724 all_errlist_objs="$all_errlist_objs ogg_afh_common"
725 afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
726 recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
727 server_errlist_objs="$server_errlist_objs ogg_afh_common"
728 play_errlist_objs="$play_errlist_objs ogg_afh_common"
730 if test "$have_vorbis" = "yes"; then
731 all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh"
732 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support)
733 filters="$filters oggdec"
734 vorbis_libs="-lvorbis -lvorbisfile"
735 server_ldflags="$server_ldflags $vorbis_libs"
736 filter_ldflags="$filter_ldflags $vorbis_libs"
737 audiod_ldflags="$audiod_ldflags $vorbis_libs"
738 play_ldflags="$play_ldflags $vorbis_libs"
739 afh_ldflags="$afh_ldflags $vorbis_libs"
740 recv_ldflags="$recv_ldflags $vorbis_libs"
742 server_errlist_objs="$server_errlist_objs ogg_afh"
743 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
744 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
745 play_errlist_objs="$play_errlist_objs oggdec_filter ogg_afh"
746 afh_errlist_objs="$afh_errlist_objs ogg_afh"
747 recv_errlist_objs="$recv_errlist_objs ogg_afh"
749 audiod_audio_formats="$audiod_audio_formats ogg"
750 audio_format_handlers="$audio_format_handlers ogg"
752 AC_MSG_WARN([no ogg/vorbis $msg])
754 if test "$have_speex" = "yes"; then
755 all_errlist_objs="$all_errlist_objs spxdec_filter spx_afh spx_common"
756 AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support)
757 filters="$filters spxdec"
759 server_ldflags="$server_ldflags $speex_libs"
760 filter_ldflags="$filter_ldflags $speex_libs"
761 audiod_ldflags="$audiod_ldflags $speex_libs"
762 play_ldflags="$play_ldflags $speex_libs"
763 afh_ldflags="$afh_ldflags $speex_libs"
764 recv_ldflags="$recv_ldflags $speex_libs"
766 server_errlist_objs="$server_errlist_objs spx_afh spx_common"
767 filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
768 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
769 play_errlist_objs="$play_errlist_objs spxdec_filter spx_afh spx_common"
770 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
771 recv_errlist_objs="$recv_errlist_objs spx_afh spx_common"
773 audiod_audio_formats="$audiod_audio_formats spx"
774 audio_format_handlers="$audio_format_handlers spx"
776 AC_MSG_WARN([no ogg/speex $msg])
778 if test "$have_opus" = "yes"; then
779 all_errlist_objs="$all_errlist_objs opusdec_filter opus_afh opus_common"
780 AC_DEFINE(HAVE_OPUS, 1, define to 1 to turn on ogg/opus support)
781 filters="$filters opusdec"
783 server_ldflags="$server_ldflags $opus_libs"
784 filter_ldflags="$filter_ldflags $opus_libs"
785 audiod_ldflags="$audiod_ldflags $opus_libs"
786 afh_ldflags="$afh_ldflags $opus_libs"
787 play_ldflags="$play_ldflags $opus_libs"
788 recv_ldflags="$recv_ldflags $opus_libs"
790 server_errlist_objs="$server_errlist_objs opus_afh opus_common"
791 filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
792 audiod_errlist_objs="$audiod_errlist_objs opusdec_filter opus_common"
793 afh_errlist_objs="$afh_errlist_objs opus_afh opus_common"
794 play_errlist_objs="$play_errlist_objs opusdec_filter opus_afh opus_common"
795 recv_errlist_objs="$recv_errlist_objs opus_afh opus_common"
797 audiod_audio_formats="$audiod_audio_formats opus"
798 audio_format_handlers="$audio_format_handlers opus"
800 AC_MSG_WARN([no ogg/opus $msg])
802 CPPFLAGS="$OLD_CPPFLAGS"
803 LDFLAGS="$OLD_LDFLAGS"
805 ########################################################################### faad
807 OLD_CPPFLAGS="$CPPFLAGS"
808 OLD_LDFLAGS="$LDFLAGS"
810 AC_ARG_WITH(faad_headers, [AS_HELP_STRING(--with-faad-headers=dir,
811 [look for neaacdec.h also in dir])])
812 if test -n "$with_faad_headers"; then
813 faad_cppflags="-I$with_faad_headers"
814 CPPFLAGS="$CPPFLAGS $faad_cppflags"
816 AC_ARG_WITH(faad_libs, [AS_HELP_STRING(--with-faad-libs=dir,
817 [look for libfaad also in dir])])
818 if test -n "$with_faad_libs"; then
819 faad_libs="-L$with_faad_libs"
820 LDFLAGS="$LDFLAGS $faad_libs"
822 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
823 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
824 if test "$have_faad" = "yes"; then
825 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
826 all_errlist_objs="$all_errlist_objs aac_common aacdec_filter aac_afh"
827 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
828 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
829 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
830 play_errlist_objs="$play_errlist_objs aacdec_filter aac_afh aac_common"
831 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
832 recv_errlist_objs="$recv_errlist_objs aac_afh aac_common"
834 server_ldflags="$server_ldflags $faad_libs -lfaad"
835 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
836 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
837 play_ldflags="$play_ldflags $faad_libs -lfaad"
838 afh_ldflags="$afh_ldflags $faad_libs -lfaad"
839 recv_ldflags="$afh_ldflags $faad_libs -lfaad"
841 audiod_audio_formats="$audiod_audio_formats aac"
842 audio_format_handlers="$audio_format_handlers aac"
843 filters="$filters aacdec"
844 AC_SUBST(faad_cppflags)
846 AC_MSG_WARN([no aac support in para_audiod/para_filter])
848 CPPFLAGS="$OLD_CPPFLAGS"
849 LDFLAGS="$OLD_LDFLAGS"
851 ########################################################################### mad
853 OLD_CPPFLAGS="$CPPFLAGS"
854 OLD_LDFLAGS="$LDFLAGS"
857 AC_ARG_WITH(mad_headers, [AS_HELP_STRING(--with-mad-headers=dir,
858 [look for mad.h also in dir])])
859 if test -n "$with_mad_headers"; then
860 mad_cppflags="-I$with_mad_headers"
861 CPPFLAGS="$CPPFLAGS $mad_cppflags"
863 AC_ARG_WITH(mad_libs, [AS_HELP_STRING(--with-mad-libs=dir,
864 [look for libmad also in dir])])
865 if test -n "$with_mad_libs"; then
866 mad_libs="-L$with_mad_libs"
867 LDFLAGS="$LDFLAGS $mad_libs"
869 AC_CHECK_HEADERS([mad.h], [], [
872 AC_CHECK_LIB([mad], [mad_stream_init], [], [
875 if test "$have_mad" = "yes"; then
876 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
877 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
878 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
879 play_cmdline_objs="$play_cmdline_objs add_cmdline(mp3dec_filter)"
880 all_errlist_objs="$all_errlist_objs mp3dec_filter"
881 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
882 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
883 play_errlist_objs="$play_errlist_objs mp3dec_filter"
884 filter_ldflags="$filter_ldflags $mad_libs -lmad"
885 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
886 play_ldflags="$play_ldflags $mad_libs -lmad"
887 audiod_audio_formats="$audiod_audio_formats mp3"
888 filters="$filters mp3dec"
889 AC_SUBST(mad_cppflags)
891 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
893 CPPFLAGS="$OLD_CPPFLAGS"
894 LDFLAGS="$OLD_LDFLAGS"
896 ###################################################################### libid3tag
897 OLD_CPPFLAGS="$CPPFLAGS"
898 OLD_LDFLAGS="$LDFLAGS"
902 AC_ARG_WITH(id3tag_headers, [AS_HELP_STRING(--with-id3tag-headers=dir,
903 [look for id3tag header files also in dir])])
904 if test -n "$with_id3tag_headers"; then
905 id3tag_cppflags="-I$with_id3tag_headers"
906 CPPFLAGS="$CPPFLAGS $id3tag_cppflags"
908 AC_ARG_WITH(id3tag_libs, [AS_HELP_STRING(--with-id3tag-libs=dir,
909 [look for id3tag libs also in dir])])
910 if test -n "$with_id3tag_libs"; then
911 id3tag_libs="-L$with_id3tag_libs"
912 LDFLAGS="$LDFLAGS $id3tag_libs"
915 AC_MSG_CHECKING(for libid3tag)
916 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
919 struct id3_tag t = {.flags = 0};
920 ]])],[],[have_libid3tag=no])
921 AC_MSG_RESULT($have_libid3tag)
923 if test ${have_libid3tag} = yes; then
924 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
925 server_ldflags="$server_ldflags $id3tag_libs -lid3tag -lz"
926 afh_ldflags="$afh_ldflags $id3tag_libs -lid3tag -lz"
927 play_ldflags="$play_ldflags -lz"
928 recv_ldflags="$recv_ldflags $id3tag_libs -lid3tag"
929 play_ldflags="$play_ldflags $id3tag_libs -lid3tag"
930 AC_SUBST(id3tag_cppflags)
932 AC_MSG_WARN([no support for id3v2 tags])
934 CPPFLAGS="$OLD_CPPFLAGS"
935 LDFLAGS="$OLD_LDFLAGS"
937 ########################################################################### flac
938 OLD_CPPFLAGS="$CPPFLAGS"
939 OLD_LDFLAGS="$LDFLAGS"
943 AC_ARG_WITH(flac_headers, [AS_HELP_STRING(--with-flac-headers=dir,
944 [look for flac headers also in dir])])
945 if test -n "$with_flac_headers"; then
946 flac_cppflags="-I$with_flac_headers"
947 CPPFLAGS="$CPPFLAGS $flac_cppflags"
949 AC_ARG_WITH(flac_libs, [AS_HELP_STRING(--with-flac-libs=dir,
950 [look for flac libs also in dir])])
951 if test -n "$with_flac_libs"; then
952 flac_libs="-L$with_flac_libs"
953 LDFLAGS="$LDFLAGS $flac_libs"
955 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no)
956 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], have_flac=no, -logg -lm)
957 if test "$have_flac" = "yes"; then
958 AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter)
959 all_errlist_objs="$all_errlist_objs flacdec_filter flac_afh"
960 filter_errlist_objs="$filter_errlist_objs flacdec_filter"
961 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
962 play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
963 afh_errlist_objs="$afh_errlist_objs flac_afh"
964 server_errlist_objs="$server_errlist_objs flac_afh"
965 recv_errlist_objs="$recv_errlist_objs flac_afh"
966 filter_ldflags="$filter_ldflags $flac_libs -lFLAC"
967 audiod_ldflags="$audiod_ldflags $flac_libs -lFLAC"
968 play_ldflags="$play_ldflags $flac_libs -lFLAC"
969 server_ldflags="$server_ldflags $flac_libs -lFLAC"
970 afh_ldflags="$afh_ldflags $flac_libs -lFLAC"
971 recv_ldflags="$afh_ldflags $flac_libs -lFLAC"
972 filters="$filters flacdec"
973 audio_format_handlers="$audio_format_handlers flac"
974 audiod_audio_formats="$audiod_audio_formats flac"
975 AC_SUBST(flac_cppflags)
977 AC_MSG_WARN([no flac support in para_audiod/para_filter/para_afh/para_server])
979 CPPFLAGS="$OLD_CPPFLAGS"
980 LDFLAGS="$OLD_LDFLAGS"
982 ########################################################################### oss
983 OLD_CPPFLAGS="$CPPFLAGS"
984 OLD_LDFLAGS="$LDFLAGS"
988 msg="=> will not build oss writer"
990 AC_CHECK_HEADER(sys/soundcard.h, [
991 audiod_errlist_objs="$audiod_errlist_objs oss_write"
992 play_errlist_objs="$play_errlist_objs oss_write"
993 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
994 play_cmdline_objs="$play_cmdline_objs add_cmdline(oss_write)"
996 write_errlist_objs="$write_errlist_objs oss_write"
997 write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
998 fade_errlist_objs="$fade_errlist_objs oss_mix"
999 all_errlist_objs="$all_errlist_objs oss_write oss_mix"
1001 writers="$writers oss"
1002 default_writer="OSS_WRITE"
1003 mixers="${mixers}oss "
1004 default_mixer="OSS_MIX"
1006 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
1007 audiod_ldflags="$audiod_ldflags -lossaudio"
1008 play_ldflags="$play_ldflags -lossaudio"
1009 write_ldflags="$write_ldflags -lossaudio"
1010 fade_ldflags="$fade_ldflags -lossaudio"
1016 AC_MSG_WARN([no sys/soundcard.h $msg])
1019 CPPFLAGS="$OLD_CPPFLAGS"
1020 LDFLAGS="$OLD_LDFLAGS"
1023 ########################################################################### alsa
1024 OLD_CPPFLAGS="$CPPFLAGS"
1025 OLD_LDFLAGS="$LDFLAGS"
1028 msg="=> no alsa support for para_audiod/para_write"
1029 if test "$OSTYPE" != "Linux"; then
1034 if test "$have_alsa" = "yes"; then
1035 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
1037 AC_MSG_WARN([no alsa/asoundlib $msg])
1041 if test "$have_alsa" = "yes"; then
1042 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
1044 AC_MSG_WARN([no libasound $msg])
1048 if test "$have_alsa" = "yes"; then
1049 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
1050 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
1051 audiod_ldflags="$audiod_ldflags -lasound"
1052 play_errlist_objs="$play_errlist_objs alsa_write"
1053 play_cmdline_objs="$play_cmdline_objs add_cmdline(alsa_write)"
1054 play_ldflags="$play_ldflags -lasound"
1056 write_errlist_objs="$write_errlist_objs alsa_write"
1057 write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
1058 write_ldflags="$write_ldflags -lasound"
1059 fade_errlist_objs="$fade_errlist_objs alsa_mix"
1060 fade_ldflags="$fade_ldflags -lasound"
1061 all_errlist_objs="$all_errlist_objs alsa_write alsa_mix"
1063 writers="$writers alsa"
1064 default_writer="ALSA_WRITE"
1065 mixers="${mixers}alsa "
1066 default_mixer="ALSA_MIX"
1069 CPPFLAGS="$OLD_CPPFLAGS"
1070 LDFLAGS="$OLD_LDFLAGS"
1072 ########################################################################### fade
1073 if test -n "$mixers"; then
1074 extras="$extras fade"
1075 executables="$executables fade"
1076 all_errlist_objs="$all_errlist_objs fade"
1077 fade_errlist_objs="$fade_errlist_objs fade exec string fd version ggo"
1078 fade_cmdline_objs="add_cmdline(fade)"
1079 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
1080 AC_SUBST(fade_objs, add_dot_o($fade_objs))
1081 AC_SUBST(fade_ldflags, $fade_ldflags)
1082 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
1083 objlist_to_errlist($fade_errlist_objs),
1084 errors used by para_fade)
1086 for i in $mixers; do
1087 printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
1090 AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
1091 enum of supported mixers)
1092 AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
1093 use this mixer if none was specified)
1094 names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
1095 AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
1097 for i in $mixers; do
1098 printf 'extern void '$i'_mix_init(struct mixer *); '
1101 AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
1102 init functions of the supported mixers)
1103 array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
1104 AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
1105 mixer_summary="supported mixers:: $mixers, default: $default_mixer"
1107 AC_MSG_WARN([no mixer support])
1108 mixer_summary="para_fade: no"
1110 ########################################################################### libao
1111 OLD_CPPFLAGS="$CPPFLAGS"
1112 OLD_LDFLAGS="$LDFLAGS"
1116 AC_ARG_WITH(ao_headers, [AS_HELP_STRING(--with-ao-headers=dir,
1117 [look for ao/ao.h also in dir])])
1118 if test -n "$with_ao_headers"; then
1119 ao_cppflags="-I$with_ao_headers"
1120 CPPFLAGS="$CPPFLAGS $ao_cppflags"
1122 AC_ARG_WITH(ao_libs, [AS_HELP_STRING(--with-ao-libs=dir,
1123 [look for libao also in dir])])
1124 if test -n "$with_ao_libs"; then
1125 ao_libs="-L$with_ao_libs"
1126 LDFLAGS="$LDFLAGS $ao_libs"
1128 msg="no libao support for para_audiod/para_write"
1129 AC_CHECK_HEADERS([ao/ao.h], [
1132 AC_MSG_WARN([ao.h not found, $msg])
1134 if test "$have_ao" = "yes"; then
1135 AC_CHECK_LIB([ao], [ao_initialize], [], [
1137 AC_MSG_WARN([ao lib not found or not working, $msg])
1140 if test "$have_ao" = "yes"; then
1141 AC_CHECK_HEADERS([pthread.h], [
1144 AC_MSG_WARN([pthread.h not found, $msg])
1147 if test "$have_ao" = "yes"; then
1148 AC_CHECK_LIB([pthread], [pthread_create], [], [
1150 AC_MSG_WARN([pthread lib not found or not working, $msg])
1153 if test "$have_ao" = "yes"; then
1154 all_errlist_objs="$all_errlist_objs ao_write"
1155 audiod_errlist_objs="$audiod_errlist_objs ao_write"
1156 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(ao_write)"
1157 audiod_ldflags="$audiod_ldflags -lao -lpthread"
1159 play_errlist_objs="$play_errlist_objs ao_write"
1160 play_cmdline_objs="$play_cmdline_objs add_cmdline(ao_write)"
1161 play_ldflags="$play_ldflags -lao -lpthread"
1163 write_errlist_objs="$write_errlist_objs ao_write"
1164 write_cmdline_objs="$write_cmdline_objs add_cmdline(ao_write)"
1165 write_ldflags="$write_ldflags $ao_libs -lao -lpthread"
1166 writers="$writers ao"
1167 AC_SUBST(ao_cppflags)
1170 CPPFLAGS="$OLD_CPPFLAGS"
1171 LDFLAGS="$OLD_LDFLAGS"
1173 ############################################################# readline
1174 OLD_CPPFLAGS="$CPPFLAGS"
1175 OLD_LDFLAGS="$LDFLAGS"
1179 AC_ARG_WITH(readline_headers, [AS_HELP_STRING(--with-readline-headers=dir,
1180 [look for libreadline header files also in dir])])
1181 if test -n "$with_readline_headers"; then
1182 readline_cppflags="-I$with_readline_headers"
1183 CPPFLAGS="$CPPFLAGS $readline_cppflags"
1186 AC_ARG_WITH(readline_libs, [AS_HELP_STRING(--with-readline-libs=dir,
1187 [look for readline library also in dir])])
1188 if test -n "$with_readline_libs"; then
1189 readline_libs="-L$with_readline_libs"
1190 LDFLAGS="$LDFLAGS $readline_libs"
1192 msg="no interactive cli support"
1193 AC_CHECK_HEADERS([readline/readline.h], [
1196 AC_MSG_WARN([readline/readline.h not found, $msg])
1199 if test "$have_curses" != "yes"; then
1201 AC_MSG_WARN([interactive cli support depends on curses,])
1202 AC_MSG_WARN([but no curses lib was detected, $msg])
1205 if test "$have_readline" = "yes"; then
1206 readline_libs="$readline_libs -lreadline"
1207 AC_SEARCH_LIBS([rl_free_keymap], [readline], [], [have_readline="no"])
1208 if test "$have_readline" = "no"; then # try with -lcurses
1210 AC_MSG_NOTICE([trying again with -lcurses])
1211 unset ac_cv_search_rl_free_keymap 2> /dev/null
1212 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
1214 readline_libs="$readline_libs -lcurses"
1217 if test "$have_readline" = "no"; then # try with -ltermcap
1219 AC_MSG_NOTICE([trying again with -ltermcap])
1220 unset ac_cv_search_rl_free_keymap 2> /dev/null
1221 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
1223 readline_libs="$readline_libs -ltermcap"
1228 if test "$have_readline" = "yes"; then
1229 all_errlist_objs="$all_errlist_objs interactive"
1230 client_errlist_objs="$client_errlist_objs interactive"
1231 client_ldflags="$client_ldflags $readline_libs"
1232 audioc_errlist_objs="$audioc_errlist_objs buffer_tree interactive sched time"
1233 audioc_ldflags="$audioc_ldflags $readline_libs"
1234 play_errlist_objs="$play_errlist_objs interactive"
1235 play_ldflags="$play_ldflags $readline_libs"
1236 AC_SUBST(readline_cppflags)
1237 AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
1239 AC_MSG_WARN([libreadline not found or unusable])
1241 CPPFLAGS="$OLD_CPPFLAGS"
1242 LDFLAGS="$OLD_LDFLAGS"
1244 ############################################################# libsamplerate
1245 OLD_CPPFLAGS="$CPPFLAGS"
1246 OLD_LDFLAGS="$LDFLAGS"
1249 have_samplerate="yes"
1250 AC_ARG_WITH(samplerate_headers, [AS_HELP_STRING(--with-samplerate-headers=dir,
1251 [look for samplerate headers also in dir])])
1252 if test -n "$with_samplerate_headers"; then
1253 samplerate_cppflags="-I$with_samplerate_headers"
1254 CPPFLAGS="$CPPFLAGS $samplerate_cppflags"
1256 AC_ARG_WITH(samplerate_libs, [AS_HELP_STRING(--with-samplerate-libs=dir,
1257 [look for samplerate libs also in dir])])
1258 if test -n "$with_samplerate_libs"; then
1259 samplerate_libs="-L$with_samplerate_libs"
1260 LDFLAGS="$LDFLAGS $samplerate_libs"
1263 AC_CHECK_HEADER(samplerate.h, [], have_samplerate=no)
1264 AC_CHECK_LIB([samplerate], [src_process], [], have_samplerate=no, [])
1266 if test "$have_samplerate" = "yes"; then
1267 all_errlist_objs="$all_errlist_objs resample_filter"
1268 filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
1269 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(resample_filter)"
1270 audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
1271 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(resample_filter)"
1272 play_errlist_objs="$play_errlist_objs resample_filter check_wav"
1273 play_cmdline_objs="$play_cmdline_objs add_cmdline(resample_filter)"
1274 filter_ldflags="$filter_ldflags $samplerate_libs -lsamplerate"
1275 audiod_ldflags="$audiod_ldflags $samplerate_libs -lsamplerate"
1276 play_ldflags="$play_ldflags $samplerate_libs -lsamplerate"
1277 filters="$filters resample"
1278 AC_SUBST(samplerate_cppflags)
1280 AC_MSG_WARN([no resample support in para_audiod/para_filter])
1282 CPPFLAGS="$OLD_CPPFLAGS"
1283 LDFLAGS="$OLD_LDFLAGS"
1285 ############################################################# error2.h
1286 AC_MSG_NOTICE(creating error2.h)
1287 for i in $executables; do
1289 eval echo \$${i}_errlist_objs
1290 done | ./error2.pl > error2.h
1291 for obj in $all_errlist_objs; do
1292 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
1294 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
1295 [enum {$SS NUM_SS}],
1296 [list of all objects that use the paraslash error facility]
1299 ################################################################## status items
1301 status_items="basename status num_played mtime bitrate frequency file_size
1302 status_flags format score techinfo afs_mode
1303 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
1304 offset seconds_total stream_start current_time audiod_uptime image_id
1305 lyrics_id duration directory lyrics_name image_name path hash channels
1306 last_played num_chunks chunk_time amplification artist title year album
1310 for i in $status_items; do
1311 result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
1313 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
1314 [enum of all status items])
1317 for i in $status_items; do
1318 result="$result \"$i\", "
1320 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
1321 [char * array of all status items])
1323 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
1324 [formats supported by para_server and para_afh])
1326 AC_SUBST(executables)
1328 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
1329 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
1330 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
1331 server_objs="$server_cmdline_objs $server_errlist_objs"
1332 write_objs="$write_cmdline_objs $write_errlist_objs"
1333 client_objs="$client_cmdline_objs $client_errlist_objs"
1334 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
1335 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
1336 play_objs="$play_cmdline_objs $play_errlist_objs"
1339 AC_SUBST(recv_objs, add_dot_o($recv_objs))
1340 AC_SUBST(recv_ldflags, $recv_ldflags)
1341 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
1342 errors used by para_recv)
1344 AC_SUBST(filter_objs, add_dot_o($filter_objs))
1345 AC_SUBST(filter_ldflags, $filter_ldflags)
1346 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
1347 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
1349 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
1350 AC_SUBST(audiod_ldflags, $audiod_ldflags)
1351 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
1352 errors used by para_audiod)
1354 AC_SUBST(server_objs, add_dot_o($server_objs))
1355 AC_SUBST(server_ldflags, $server_ldflags)
1356 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
1357 objlist_to_errlist($server_errlist_objs), errors used by para_server)
1359 AC_SUBST(afh_objs, add_dot_o($afh_objs))
1360 AC_SUBST(afh_ldflags, $afh_ldflags)
1361 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
1362 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
1364 AC_SUBST(write_objs, add_dot_o($write_objs))
1365 AC_SUBST(write_ldflags, $write_ldflags)
1366 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
1367 objlist_to_errlist($write_errlist_objs), errors used by para_write)
1369 AC_SUBST(client_objs, add_dot_o($client_objs))
1370 AC_SUBST(client_ldflags, $client_ldflags)
1371 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
1372 objlist_to_errlist($client_errlist_objs), errors used by para_client)
1374 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
1375 AC_SUBST(audioc_ldflags, $audioc_ldflags)
1376 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
1377 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
1379 AC_SUBST(gui_objs, add_dot_o($gui_objs))
1380 AC_SUBST(gui_ldflags, $gui_ldflags)
1381 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
1382 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
1384 AC_SUBST(play_objs, add_dot_o($play_objs))
1385 AC_SUBST(play_ldflags, $play_ldflags)
1386 AC_DEFINE_UNQUOTED(INIT_PLAY_ERRLISTS,
1387 objlist_to_errlist($play_errlist_objs), errors used by para_play)
1389 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
1390 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
1391 enum of supported filters)
1392 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
1393 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
1394 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
1395 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
1397 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
1398 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
1399 enum of supported writers)
1400 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
1401 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
1402 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
1403 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
1404 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
1405 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
1406 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
1408 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
1409 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
1410 enum of audio formats supported by audiod)
1411 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
1412 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
1416 paraslash configuration:
1417 ~~~~~~~~~~~~~~~~~~~~~~~~
1418 unix socket credentials: $have_ucred
1419 readline (interactive CLIs): $have_readline
1420 audio formats handlers: $audio_format_handlers
1421 id3 version2 support: $have_libid3tag
1424 optional executables: $extras