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="audioc string net fd version"
130 audiod_cmdline_objs="add_cmdline(audiod compress_filter http_recv dccp_recv file_write client amp_filter udp_recv prebuffer_filter)"
131 audiod_errlist_objs="audiod signal string daemon stat net crypt_common sideband
132 time grab_client filter_common wav_filter compress_filter amp_filter http_recv dccp_recv
133 recv_common fd sched write_common file_write audiod_command fecdec_filter
134 client_common ggo udp_recv color fec prebuffer_filter version
135 bitstream imdct wma_common wmadec_filter buffer_tree"
137 audiod_audio_formats="wma"
139 afh_cmdline_objs="add_cmdline(afh)"
140 afh_errlist_objs="afh string fd mp3_afh afh_common time wma_afh wma_common
144 write_cmdline_objs="add_cmdline(write file_write)"
145 write_errlist_objs="write write_common file_write time fd string sched stdin
146 buffer_tree ggo check_wav version"
149 default_writer="FILE_WRITE"
151 client_cmdline_objs="add_cmdline(client)"
152 client_errlist_objs="client net string fd sched stdin stdout time sideband
153 client_common buffer_tree crypt_common version"
156 gui_cmdline_objs="add_cmdline(gui)"
157 gui_errlist_objs="exec signal string stat ringbuffer fd gui gui_theme version time"
158 gui_objs="$gui_cmdline_objs $gui_errlist_objs"
159 play_errlist_objs="play fd sched ggo buffer_tree time string net
161 wma_afh wma_common mp3_afh
162 recv_common udp_recv http_recv dccp_recv
163 filter_common fec bitstream imdct
164 wav_filter compress_filter amp_filter prebuffer_filter fecdec_filter
166 write_common file_write
169 play_cmdline_objs="add_cmdline(http_recv dccp_recv udp_recv afh_recv compress_filter amp_filter prebuffer_filter file_write play)"
171 ########################################################################### snprintf
172 # ===========================================================================
173 # http://www.nongnu.org/autoconf-archive/ax_func_snprintf.html
174 # ===========================================================================
182 # Checks for a fully C99 compliant snprintf, in particular checks whether
183 # it does bounds checking and returns the correct string length; does the
184 # same check for vsnprintf. If no working snprintf or vsnprintf is found,
185 # it prints an error message and aborts.
189 # Copyright (c) 2008 Ruediger Kuhlmann <info@ruediger-kuhlmann.de>
191 # Copying and distribution of this file, with or without modification, are
192 # permitted in any medium without royalty provided the copyright notice
193 # and this notice are preserved.
195 AU_ALIAS([AC_FUNC_SNPRINTF], [AX_FUNC_SNPRINTF])
196 AC_DEFUN([AX_FUNC_SNPRINTF],
197 [AC_CHECK_FUNCS(snprintf vsnprintf)
198 AC_MSG_CHECKING(for working snprintf)
199 AC_CACHE_VAL(ac_cv_have_working_snprintf,
200 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
205 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
206 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
208 i = snprintf (bufs, 2, "%s", "111");
209 if (strcmp (bufs, "1")) exit (1);
210 if (i != 3) exit (1);
211 i = snprintf (bufd, 2, "%d", 111);
212 if (strcmp (bufd, "1")) exit (1);
213 if (i != 3) exit (1);
215 }]])],[ac_cv_have_working_snprintf=yes],
216 [ac_cv_have_working_snprintf=no],[ac_cv_have_working_snprintf=cross])])
217 AC_MSG_RESULT([$ac_cv_have_working_snprintf])
218 AC_MSG_CHECKING(for working vsnprintf)
219 AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
220 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
223 int my_vsnprintf (char *buf, const char *tmpl, ...)
227 va_start (args, tmpl);
228 i = vsnprintf (buf, 2, tmpl, args);
235 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
236 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
238 i = my_vsnprintf (bufs, "%s", "111");
239 if (strcmp (bufs, "1")) exit (1);
240 if (i != 3) exit (1);
241 i = my_vsnprintf (bufd, "%d", 111);
242 if (strcmp (bufd, "1")) exit (1);
243 if (i != 3) exit (1);
245 }]])],[ac_cv_have_working_vsnprintf=yes],
246 [ac_cv_have_working_vsnprintf=no],[ac_cv_have_working_vsnprintf=cross])])
247 AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
248 if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
249 AC_MSG_ERROR([fatal: buggy snprintf() detected])
252 ################################################################## clock_gettime
254 AC_CHECK_LIB([c], [clock_gettime], [clock_gettime_lib=c], [
255 AC_CHECK_LIB([rt], [clock_gettime], [clock_gettime_lib=rt], [], [])
257 if test -n "$clock_gettime_lib"; then
258 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [
259 define to 1 if clock_gettime() is supported])
261 if test "$clock_gettime_lib" = "rt"; then
262 AC_SUBST(clock_gettime_ldflags, -lrt)
264 ########################################################################### osl
266 OLD_CPPFLAGS="$CPPFLAGS"
267 OLD_LD_FLAGS="$LDFLAGS"
269 AC_ARG_WITH(osl_headers, [AS_HELP_STRING(--with-osl-headers=dir,
270 [look for osl.h also in dir])])
271 if test -n "$with_osl_headers"; then
272 osl_cppflags="-I$with_osl_headers"
273 CPPFLAGS="$CPPFLAGS $osl_cppflags"
275 AC_ARG_WITH(osl_libs, [AS_HELP_STRING(--with-osl-libs=dir,
276 [look for libosl also in dir])])
277 if test -n "$with_osl_libs"; then
278 osl_libs="-L$with_osl_libs"
279 LDFLAGS="$LDFLAGS $osl_libs"
282 AC_CHECK_HEADER(osl.h, [], have_osl=no)
283 AC_CHECK_LIB([osl], [osl_open_table], [], have_osl=no)
284 if test "$have_osl" = "no"; then
285 AC_MSG_WARN([libosl not found, can not build para_server.
287 http://systemlinux.org/~maan/osl
289 git clone git://git.tuebingen.mpg.de/osl
292 extras="$extras server"
293 executables="$executables server"
294 server_cmdline_objs="add_cmdline(server)"
295 server_errlist_objs="server afh_common mp3_afh vss command net
296 string signal time daemon http_send close_on_fork mm
297 crypt_common ipc dccp_send fd user_list chunk_queue
298 afs aft mood score attribute blob playlist sched acl
299 send_common udp_send color fec wma_afh wma_common sideband
301 all_errlist_objs="$all_errlist_objs server vss command
302 http_send close_on_fork mm ipc dccp_send user_list
303 chunk_queue afs aft mood score attribute blob playlist
307 audio_format_handlers="mp3 wma"
308 AC_SUBST(osl_cppflags)
309 server_ldflags="$server_ldflags $osl_libs -losl"
311 CPPFLAGS="$OLD_CPPFLAGS"
312 LDFLAGS="$OLD_LDFLAGS"
314 ########################################################################### crypto
315 AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
316 Force using crypto library "lib". This package requires either
317 openssl or libgcrypt being installed. Possible values for "lib"
318 are thus "openssl" and "gcrypt". If this option is not given,
319 openssl is tried first. If openssl was not found, gcrypt is
322 case "$enable_cryptolib" in
323 "openssl") check_openssl="yes"; check_gcrypt="no";;
324 "gcrypt") check_openssl="no"; check_gcrypt="yes";;
325 "") check_openssl="yes"; check_gcrypt="yes";;
326 *) AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib]);;
328 ###################################################################### openssl
329 if test "$check_openssl" = "yes"; then
330 OLD_CPPFLAGS="$CPPFLAGS"
331 OLD_LD_FLAGS="$LDFLAGS"
334 AC_ARG_WITH(openssl_headers, [AS_HELP_STRING(--with-openssl-headers=dir,
335 [look for openssl headers also in dir])])
336 if test -n "$with_openssl_headers"; then
337 openssl_cppflags="-I$with_openssl_headers"
338 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
340 AC_ARG_WITH(openssl_libs, [AS_HELP_STRING(--with-openssl-libs=dir,
341 [look for openssl libraries also in dir])])
342 if test -n "$with_openssl_libs"; then
343 openssl_libs="-L$with_openssl_libs"
344 LDFLAGS="$LDFLAGS $openssl_libs"
346 AC_CHECK_HEADER(openssl/ssl.h, [], [have_openssl="no"])
347 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
348 if test "$have_openssl" = "no" -a -z "$with_openssl_headers$with_openssl_libs"; then
349 # try harder: openssl is sometimes installed in /usr/local/ssl
350 openssl_cppflags="-I/usr/local/ssl/include"
351 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
352 openssl_libs="-L/usr/local/ssl/lib"
353 LDFLAGS="$LDFLAGS $openssl_libs"
355 unset ac_cv_header_openssl_ssl_h 2> /dev/null
356 unset ac_cv_lib_crypto_RAND_bytes 2> /dev/null
357 AC_CHECK_HEADER(openssl/ssl.h, [have_openssl="yes"], [])
358 if test "$have_openssl" = "yes"; then
359 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
362 if test "$have_openssl" = "yes"; then
363 AC_DEFINE(HAVE_OPENSSL, 1, [define to 1 to turn on openssl support])
364 AC_SUBST(openssl_cppflags)
365 openssl_libs="$openssl_libs -lssl -lcrypto"
366 server_ldflags="$server_ldflags $openssl_libs"
367 client_ldflags="$client_ldflags $openssl_libs"
368 audiod_ldflags="$audiod_ldflags $openssl_libs"
370 all_errlist_objs="$all_errlist_objs crypt"
371 server_errlist_objs="$server_errlist_objs crypt"
372 client_errlist_objs="$client_errlist_objs crypt"
373 audiod_errlist_objs="$audiod_errlist_objs crypt"
377 AC_MSG_WARN([openssl libraries not found])
379 CPPFLAGS="$OLD_CPPFLAGS"
380 LDFLAGS="$OLD_LDFLAGS"
385 ########################################################################### gcrypt
386 if test "$check_gcrypt" = "yes"; then
387 OLD_CPPFLAGS="$CPPFLAGS"
388 OLD_LD_FLAGS="$LDFLAGS"
391 AC_ARG_WITH(gcrypt_headers, [AS_HELP_STRING(--with-gcrypt-headers=dir,
392 [look for gcrypt headers also in dir])])
393 if test -n "$with_gcrypt_headers"; then
394 gcrypt_cppflags="-I$with_gcrypt_headers"
395 CPPFLAGS="$CPPFLAGS $gcrypt_cppflags"
397 AC_ARG_WITH(gcrypt_libs, [AS_HELP_STRING(--with-gcrypt-libs=dir,
398 [look for libgcrypt also in dir])])
399 if test -n "$with_gcrypt_libs"; then
400 gcrypt_libs="-L$with_gcrypt_libs"
401 LDFLAGS="$LDFLAGS $gcrypt_libs"
403 AC_CHECK_HEADER(gcrypt.h, [], [have_gcrypt="no"])
404 AC_CHECK_LIB([gcrypt], [gcry_randomize], [], [have_gcrypt="no"])
405 if test "$have_gcrypt" = "yes"; then
406 AC_DEFINE(HAVE_GCRYPT, 1, [define to 1 to turn on gcrypt support])
407 AC_SUBST(gcrypt_cppflags)
408 gcrypt_libs="$gcrypt_libs -lgcrypt"
409 server_ldflags="$server_ldflags $gcrypt_libs"
410 client_ldflags="$client_ldflags $gcrypt_libs"
411 audiod_ldflags="$audiod_ldflags $gcrypt_libs"
413 all_errlist_objs="$all_errlist_objs gcrypt"
414 server_errlist_objs="$server_errlist_objs gcrypt"
415 client_errlist_objs="$client_errlist_objs gcrypt"
416 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
418 AC_MSG_WARN([gcrypt library not found])
420 CPPFLAGS="$OLD_CPPFLAGS"
421 LDFLAGS="$OLD_LDFLAGS"
426 ###########################################################################
427 if test "$have_openssl" = "no" -a "$have_gcrypt" = "no"; then
428 AC_MSG_ERROR([neither openssl nor gcrypt usable])
430 ########################################################################### libsocket
431 AC_CHECK_LIB([c], [socket],
433 [socket_lib="-lsocket"]
435 server_ldflags="$server_ldflags $socket_lib"
436 client_ldflags="$client_ldflags $socket_lib"
437 audioc_ldflags="$audioc_ldflags $socket_lib"
438 audiod_ldflags="$audiod_ldflags $socket_lib"
439 recv_ldflags="$recv_ldflags $socket_lib"
440 AC_SEARCH_LIBS([connect],[socket],[],[
441 AC_MSG_ERROR([Fatal: Did not find connect().])
443 ########################################################################### libnsl
444 AC_CHECK_LIB([c], [gethostbyname],
448 server_ldflags="$server_ldflags $nsl_lib"
449 client_ldflags="$client_ldflags $nsl_lib"
450 audioc_ldflags="$audioc_ldflags $nsl_lib"
451 recv_ldflags="$recv_ldflags $nsl_lib"
452 AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
453 AC_MSG_ERROR([Fatal: Did not find inet_ntoa().])
455 ########################################################################### ucred
456 AC_MSG_CHECKING(for struct ucred)
457 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
459 #include <sys/types.h>
460 #include <sys/socket.h>
462 struct ucred sucred; sucred.pid=0;
463 ]])],[have_ucred=yes],[have_ucred=no])
464 AC_MSG_RESULT($have_ucred)
465 if test ${have_ucred} = yes; then
466 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
469 ########################################################################### curses
471 OLD_CPPFLAGS="$CPPFLAGS"
472 OLD_LD_FLAGS="$LDFLAGS"
474 AC_ARG_WITH(curses_headers, [AS_HELP_STRING(--with-curses-headers=dir,
475 [look for curses.h also in dir])])
476 if test -n "$with_curses_headers"; then
477 curses_cppflags="-I$with_curses_headers"
478 CPPFLAGS="$CPPFLAGS $curses_cppflags"
480 AC_ARG_WITH(curses_libs, [AS_HELP_STRING(--with-curses-libs=dir,
481 [look for libcurses also in dir])])
482 if test -n "$with_curses_libs"; then
483 curses_libs="-L$with_curses_libs"
484 LDFLAGS="$LDFLAGS $curses_libs"
486 AC_CHECK_HEADER(curses.h, [], [
489 gui_ldflags="$curses_libs"
490 AC_CHECK_LIB([ncursesw], [initscr],
491 [gui_ldflags="$curses_libs -lncursesw"], [
492 AC_CHECK_LIB([curses], [initscr],
493 [gui_ldflags="$curses_libs -lcurses"],
498 if test "$have_curses" = "yes"; then
499 AC_SUBST(curses_cppflags)
501 executables="$executables gui"
503 AC_MSG_WARN([no curses lib, cannot build para_gui])
505 CPPFLAGS="$OLD_CPPFLAGS"
506 LDFLAGS="$OLD_LDFLAGS"
509 ########################################################################### ip_mreqn
510 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
511 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
517 ]])],[have_ip_mreqn=yes],[have_ip_mreqn=no])
518 AC_MSG_RESULT($have_ip_mreqn)
519 if test ${have_ip_mreqn} = yes; then
520 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
522 ########################################################################### osx
524 AC_MSG_CHECKING(for CoreAudio (MacOs))
525 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
526 #include <CoreAudio/CoreAudio.h>
529 ]])],[have_core_audio=yes],[have_core_audio=no])
530 AC_MSG_RESULT($have_core_audio)
531 if test ${have_core_audio} = yes; then
532 f1="-framework CoreAudio"
533 f2="-framework AudioToolbox"
534 f3="-framework AudioUnit"
535 f4="-framework CoreServices"
538 all_errlist_objs="$all_errlist_objs osx_write"
539 # ipc is linked into para_server server and into the osx writer. If osl
540 # was not found, para_server will not be built and ipc has not yet been
541 # added to the list of all objects, so we must add it here.
542 if test "$have_osl" = "no"; then
543 all_errlist_objs="$all_errlist_objs ipc"
545 audiod_errlist_objs="$audiod_errlist_objs osx_write ipc"
546 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
547 audiod_ldflags="$audiod_ldflags $f"
549 play_errlist_objs="$play_errlist_objs osx_write ipc"
550 play_cmdline_objs="$play_cmdline_objs osx_write.cmdline"
551 play_ldflags="$play_ldflags $f"
553 write_errlist_objs="$write_errlist_objs osx_write ipc"
554 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
555 write_ldflags="$write_ldflags $f"
556 writers="$writers osx"
557 default_writer="OSX_WRITE"
558 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
560 ########################################################### ogg/vorbis/speex
562 OLD_CPPFLAGS="$CPPFLAGS"
563 OLD_LD_FLAGS="$LDFLAGS"
565 AC_ARG_WITH(ogg_headers, [AS_HELP_STRING(--with-ogg-headers=dir,
566 [look for ogg headers also in dir])])
567 AC_ARG_WITH(ogg_libs, [AS_HELP_STRING(--with-ogg-libs=dir,
568 [look for ogg libs also in dir])])
569 AC_ARG_WITH(vorbis_headers, [AS_HELP_STRING(--with-vorbis-headers=dir,
570 [look for vorbis headers also in dir])])
571 AC_ARG_WITH(vorbis_libs, [AS_HELP_STRING(--with-vorbis-libs=dir,
572 [look for vorbis libs also in dir])])
573 AC_ARG_WITH(speex_headers, [AS_HELP_STRING(--with-speex-headers=dir,
574 [look for speex headers also in dir])])
575 AC_ARG_WITH(speex_libs, [AS_HELP_STRING(--with-speex-libs=dir,
576 [look for speex libs also in dir])])
578 if test -n "$with_ogg_headers"; then
579 ogg_cppflags="-I$with_ogg_headers"
580 CPPFLAGS="$CPPFLAGS $ogg_cppflags"
582 if test -n "$with_ogg_libs"; then
583 ogg_libs="-L$with_ogg_libs"
584 LDFLAGS="$LDFLAGS $ogg_libs"
586 AC_CHECK_HEADERS([ogg/ogg.h], [], [ have_ogg="no"; ])
587 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
591 if test "$have_ogg" = "yes"; then
593 if test -n "$with_vorbis_headers"; then
594 vorbis_cppflags="-I$with_vorbis_headers"
595 CPPFLAGS="$CPPFLAGS $vorbis_cppflags"
597 if test -n "$with_vorbis_libs"; then
598 vorbis_libs="-L$with_vorbis_libs"
599 LDFLAGS="$LDFLAGS $vorbis_libs"
601 AC_CHECK_HEADERS([vorbis/codec.h], [], [ have_vorbis="no" ])
602 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_vorbis="no" ])
605 if test -n "$with_speex_headers"; then
606 speex_cppflags="-I$with_speex_headers"
607 CPPFLAGS="$CPPFLAGS $speex_cppflags"
609 if test -n "$with_speex_libs"; then
610 speex_libs="-L$with_speex_libs"
611 LDFLAGS="$LDFLAGS $speex_libs"
613 AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ])
614 AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ])
616 AC_MSG_WARN([vorbis/speex depend on libogg, which was not detected])
621 msg="support in para_server/para_filter/para_afh"
622 if test "$have_vorbis" = "yes" || test "$have_speex" = "yes"; then
623 AC_SUBST(ogg_cppflags)
624 ogg_libs="$ogg_libs -logg"
625 if test "$OSTYPE" = "Darwin"; then
626 ogg_libs="-Wl,-bind_at_load $ogg_libs"
628 server_ldflags="$server_ldflags $ogg_libs"
629 filter_ldflags="$filter_ldflags $ogg_libs"
630 audiod_ldflags="$audiod_ldflags $ogg_libs"
631 play_ldflags="$play_ldflags $ogg_libs"
632 afh_ldflags="$afh_ldflags $ogg_libs"
633 recv_ldflags="$recv_ldflags $ogg_libs"
634 all_errlist_objs="$all_errlist_objs ogg_afh_common"
635 afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
636 recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
637 server_errlist_objs="$server_errlist_objs ogg_afh_common"
638 play_errlist_objs="$play_errlist_objs ogg_afh_common"
640 if test "$have_vorbis" = "yes"; then
641 all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh"
642 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support)
643 filters="$filters oggdec"
644 vorbis_libs="-lvorbis -lvorbisfile"
645 server_ldflags="$server_ldflags $vorbis_libs"
646 filter_ldflags="$filter_ldflags $vorbis_libs"
647 audiod_ldflags="$audiod_ldflags $vorbis_libs"
648 play_ldflags="$play_ldflags $vorbis_libs"
649 afh_ldflags="$afh_ldflags $vorbis_libs"
650 recv_ldflags="$recv_ldflags $vorbis_libs"
652 server_errlist_objs="$server_errlist_objs ogg_afh"
653 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
654 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
655 play_errlist_objs="$play_errlist_objs oggdec_filter ogg_afh"
656 afh_errlist_objs="$afh_errlist_objs ogg_afh"
657 recv_errlist_objs="$recv_errlist_objs ogg_afh"
659 audiod_audio_formats="$audiod_audio_formats ogg"
660 audio_format_handlers="$audio_format_handlers ogg"
662 AC_MSG_WARN([no ogg/vorbis $msg])
664 if test "$have_speex" = "yes"; then
665 all_errlist_objs="$all_errlist_objs spxdec_filter spx_afh spx_common"
666 AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support)
667 filters="$filters spxdec"
669 server_ldflags="$server_ldflags $speex_libs"
670 filter_ldflags="$filter_ldflags $speex_libs"
671 audiod_ldflags="$audiod_ldflags $speex_libs"
672 play_ldflags="$play_ldflags $speex_libs"
673 afh_ldflags="$afh_ldflags $speex_libs"
674 recv_ldflags="$recv_ldflags $speex_libs"
676 server_errlist_objs="$server_errlist_objs spx_afh spx_common"
677 filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
678 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
679 play_errlist_objs="$play_errlist_objs spxdec_filter spx_afh spx_common"
680 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
681 recv_errlist_objs="$recv_errlist_objs spx_afh spx_common"
683 audiod_audio_formats="$audiod_audio_formats spx"
684 audio_format_handlers="$audio_format_handlers spx"
686 AC_MSG_WARN([no ogg/speex $msg])
688 CPPFLAGS="$OLD_CPPFLAGS"
689 LDFLAGS="$OLD_LDFLAGS"
691 ########################################################################### faad
693 OLD_CPPFLAGS="$CPPFLAGS"
694 OLD_LD_FLAGS="$LDFLAGS"
696 AC_ARG_WITH(faad_headers, [AS_HELP_STRING(--with-faad-headers=dir,
697 [look for neaacdec.h also in dir])])
698 if test -n "$with_faad_headers"; then
699 faad_cppflags="-I$with_faad_headers"
700 CPPFLAGS="$CPPFLAGS $faad_cppflags"
702 AC_ARG_WITH(faad_libs, [AS_HELP_STRING(--with-faad-libs=dir,
703 [look for libfaad also in dir])])
704 if test -n "$with_faad_libs"; then
705 faad_libs="-L$with_faad_libs"
706 LDFLAGS="$LDFLAGS $faad_libs"
708 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
709 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
710 if test "$have_faad" = "yes"; then
711 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
712 all_errlist_objs="$all_errlist_objs aac_common aacdec_filter aac_afh"
713 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
714 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
715 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
716 play_errlist_objs="$play_errlist_objs aacdec_filter aac_afh aac_common"
717 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
718 recv_errlist_objs="$recv_errlist_objs aac_afh aac_common"
720 server_ldflags="$server_ldflags $faad_libs -lfaad"
721 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
722 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
723 play_ldflags="$play_ldflags $faad_libs -lfaad"
724 afh_ldflags="$afh_ldflags $faad_libs -lfaad"
725 recv_ldflags="$afh_ldflags $faad_libs -lfaad"
727 audiod_audio_formats="$audiod_audio_formats aac"
728 audio_format_handlers="$audio_format_handlers aac"
729 filters="$filters aacdec"
730 AC_SUBST(faad_cppflags)
732 AC_MSG_WARN([no aac support in para_audiod/para_filter])
734 CPPFLAGS="$OLD_CPPFLAGS"
735 LDFLAGS="$OLD_LDFLAGS"
737 ########################################################################### mad
739 OLD_CPPFLAGS="$CPPFLAGS"
740 OLD_LD_FLAGS="$LDFLAGS"
743 AC_ARG_WITH(mad_headers, [AS_HELP_STRING(--with-mad-headers=dir,
744 [look for mad.h also in dir])])
745 if test -n "$with_mad_headers"; then
746 mad_cppflags="-I$with_mad_headers"
747 CPPFLAGS="$CPPFLAGS $mad_cppflags"
749 AC_ARG_WITH(mad_libs, [AS_HELP_STRING(--with-mad-libs=dir,
750 [look for libmad also in dir])])
751 if test -n "$with_mad_libs"; then
752 mad_libs="-L$with_mad_libs"
753 LDFLAGS="$LDFLAGS $mad_libs"
755 AC_CHECK_HEADERS([mad.h], [], [
758 AC_CHECK_LIB([mad], [mad_stream_init], [], [
761 if test "$have_mad" = "yes"; then
762 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
763 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
764 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
765 play_cmdline_objs="$play_cmdline_objs add_cmdline(mp3dec_filter)"
766 all_errlist_objs="$all_errlist_objs mp3dec_filter"
767 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
768 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
769 play_errlist_objs="$play_errlist_objs mp3dec_filter"
770 filter_ldflags="$filter_ldflags $mad_libs -lmad"
771 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
772 play_ldflags="$play_ldflags $mad_libs -lmad"
773 audiod_audio_formats="$audiod_audio_formats mp3"
774 filters="$filters mp3dec"
775 AC_SUBST(mad_cppflags)
777 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
779 CPPFLAGS="$OLD_CPPFLAGS"
780 LDFLAGS="$OLD_LDFLAGS"
782 ###################################################################### libid3tag
783 OLD_CPPFLAGS="$CPPFLAGS"
784 OLD_LD_FLAGS="$LDFLAGS"
788 AC_ARG_WITH(id3tag_headers, [AS_HELP_STRING(--with-id3tag-headers=dir,
789 [look for id3tag header files also in dir])])
790 if test -n "$with_id3tag_headers"; then
791 id3tag_cppflags="-I$with_id3tag_headers"
792 CPPFLAGS="$CPPFLAGS $id3tag_cppflags"
794 AC_ARG_WITH(id3tag_libs, [AS_HELP_STRING(--with-id3tag-libs=dir,
795 [look for id3tag libs also in dir])])
796 if test -n "$with_id3tag_libs"; then
797 id3tag_libs="-L$with_id3tag_libs"
798 LDFLAGS="$LDFLAGS $id3tag_libs"
801 AC_MSG_CHECKING(for libid3tag)
802 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
805 struct id3_tag t = {.flags = 0};
806 ]])],[],[have_libid3tag=no])
807 AC_MSG_RESULT($have_libid3tag)
809 if test ${have_libid3tag} = yes; then
810 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
811 server_ldflags="$server_ldflags $id3tag_libs -lid3tag -lz"
812 afh_ldflags="$afh_ldflags $id3tag_libs -lid3tag -lz"
813 play_ldflags="$play_ldflags -lz"
814 recv_ldflags="$recv_ldflags $id3tag_libs -lid3tag"
815 play_ldflags="$play_ldflags $id3tag_libs -lid3tag"
816 AC_SUBST(id3tag_cppflags)
818 AC_MSG_WARN([no support for id3v2 tags])
820 CPPFLAGS="$OLD_CPPFLAGS"
821 LDFLAGS="$OLD_LDFLAGS"
823 ########################################################################### flac
824 OLD_CPPFLAGS="$CPPFLAGS"
825 OLD_LD_FLAGS="$LDFLAGS"
829 AC_ARG_WITH(flac_headers, [AS_HELP_STRING(--with-flac-headers=dir,
830 [look for flac headers also in dir])])
831 if test -n "$with_flac_headers"; then
832 flac_cppflags="-I$with_flac_headers"
833 CPPFLAGS="$CPPFLAGS $flac_cppflags"
835 AC_ARG_WITH(flac_libs, [AS_HELP_STRING(--with-flac-libs=dir,
836 [look for flac libs also in dir])])
837 if test -n "$with_flac_libs"; then
838 flac_libs="-L$with_flac_libs"
839 LDFLAGS="$LDFLAGS $flac_libs"
841 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no)
842 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], have_flac=no, -logg -lm)
843 if test "$have_flac" = "yes"; then
844 AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter)
845 all_errlist_objs="$all_errlist_objs flacdec_filter flac_afh"
846 filter_errlist_objs="$filter_errlist_objs flacdec_filter"
847 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
848 play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
849 afh_errlist_objs="$afh_errlist_objs flac_afh"
850 server_errlist_objs="$server_errlist_objs flac_afh"
851 recv_errlist_objs="$recv_errlist_objs flac_afh"
852 filter_ldflags="$filter_ldflags $flac_libs -lFLAC"
853 audiod_ldflags="$audiod_ldflags $flac_libs -lFLAC"
854 play_ldflags="$play_ldflags $flac_libs -lFLAC"
855 server_ldflags="$server_ldflags $flac_libs -lFLAC"
856 afh_ldflags="$afh_ldflags $flac_libs -lFLAC"
857 recv_ldflags="$afh_ldflags $flac_libs -lFLAC"
858 filters="$filters flacdec"
859 audio_format_handlers="$audio_format_handlers flac"
860 audiod_audio_formats="$audiod_audio_formats flac"
861 AC_SUBST(flac_cppflags)
863 AC_MSG_WARN([no flac support in para_audiod/para_filter/para_afh/para_server])
865 CPPFLAGS="$OLD_CPPFLAGS"
866 LDFLAGS="$OLD_LDFLAGS"
868 ########################################################################### oss
869 OLD_CPPFLAGS="$CPPFLAGS"
870 OLD_LD_FLAGS="$LDFLAGS"
874 msg="=> will not build oss writer"
876 AC_CHECK_HEADER(sys/soundcard.h, [
877 audiod_errlist_objs="$audiod_errlist_objs oss_write"
878 play_errlist_objs="$play_errlist_objs oss_write"
879 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
880 play_cmdline_objs="$play_cmdline_objs add_cmdline(oss_write)"
882 write_errlist_objs="$write_errlist_objs oss_write"
883 write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
884 fade_errlist_objs="$fade_errlist_objs oss_mix version"
885 all_errlist_objs="$all_errlist_objs oss_write oss_mix"
887 writers="$writers oss"
888 default_writer="OSS_WRITE"
889 mixers="${mixers}oss "
890 default_mixer="OSS_MIX"
892 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
893 audiod_ldflags="$audiod_ldflags -lossaudio"
894 play_ldflags="$play_ldflags -lossaudio"
895 write_ldflags="$write_ldflags -lossaudio"
896 fade_ldflags="$fade_ldflags -lossaudio"
902 AC_MSG_WARN([no sys/soundcard.h $msg])
905 CPPFLAGS="$OLD_CPPFLAGS"
906 LDFLAGS="$OLD_LDFLAGS"
909 ########################################################################### alsa
910 OLD_CPPFLAGS="$CPPFLAGS"
911 OLD_LD_FLAGS="$LDFLAGS"
914 msg="=> no alsa support for para_audiod/para_write"
915 if test "$OSTYPE" != "Linux"; then
920 if test "$have_alsa" = "yes"; then
921 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
923 AC_MSG_WARN([no alsa/asoundlib $msg])
927 if test "$have_alsa" = "yes"; then
928 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
930 AC_MSG_WARN([no libasound $msg])
934 if test "$have_alsa" = "yes"; then
935 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
936 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
937 audiod_ldflags="$audiod_ldflags -lasound"
938 play_errlist_objs="$play_errlist_objs alsa_write"
939 play_cmdline_objs="$play_cmdline_objs add_cmdline(alsa_write)"
940 play_ldflags="$play_ldflags -lasound"
942 write_errlist_objs="$write_errlist_objs alsa_write"
943 write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
944 write_ldflags="$write_ldflags -lasound"
945 fade_errlist_objs="$fade_errlist_objs alsa_mix"
946 fade_ldflags="$fade_ldflags -lasound"
947 all_errlist_objs="$all_errlist_objs alsa_write alsa_mix"
949 writers="$writers alsa"
950 default_writer="ALSA_WRITE"
951 mixers="${mixers}alsa "
952 default_mixer="ALSA_MIX"
955 CPPFLAGS="$OLD_CPPFLAGS"
956 LDFLAGS="$OLD_LDFLAGS"
958 ########################################################################### fade
959 if test -n "$mixers"; then
960 extras="$extras fade"
961 executables="$executables fade"
962 all_errlist_objs="$all_errlist_objs fade"
963 fade_errlist_objs="$fade_errlist_objs fade exec string fd"
964 fade_cmdline_objs="add_cmdline(fade)"
965 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
966 AC_SUBST(fade_objs, add_dot_o($fade_objs))
967 AC_SUBST(fade_ldflags, $fade_ldflags)
968 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
969 objlist_to_errlist($fade_errlist_objs),
970 errors used by para_fade)
973 printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
976 AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
977 enum of supported mixers)
978 AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
979 use this mixer if none was specified)
980 names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
981 AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
984 printf 'extern void '$i'_mix_init(struct mixer *); '
987 AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
988 init functions of the supported mixers)
989 array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
990 AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
991 mixer_summary="supported mixers:: $mixers, default: $default_mixer"
993 AC_MSG_WARN([no mixer support])
994 mixer_summary="para_fade: no"
996 ########################################################################### libao
997 OLD_CPPFLAGS="$CPPFLAGS"
998 OLD_LD_FLAGS="$LDFLAGS"
1002 AC_ARG_WITH(ao_headers, [AS_HELP_STRING(--with-ao-headers=dir,
1003 [look for ao/ao.h also in dir])])
1004 if test -n "$with_ao_headers"; then
1005 ao_cppflags="-I$with_ao_headers"
1006 CPPFLAGS="$CPPFLAGS $ao_cppflags"
1008 AC_ARG_WITH(ao_libs, [AS_HELP_STRING(--with-ao-libs=dir,
1009 [look for libao also in dir])])
1010 if test -n "$with_ao_libs"; then
1011 ao_libs="-L$with_ao_libs"
1012 LDFLAGS="$LDFLAGS $ao_libs"
1014 msg="no libao support for para_audiod/para_write"
1015 AC_CHECK_HEADERS([ao/ao.h], [
1018 AC_MSG_WARN([ao.h not found, $msg])
1020 if test "$have_ao" = "yes"; then
1021 AC_CHECK_LIB([ao], [ao_initialize], [], [
1023 AC_MSG_WARN([ao lib not found or not working, $msg])
1026 if test "$have_ao" = "yes"; then
1027 AC_CHECK_HEADERS([pthread.h], [
1030 AC_MSG_WARN([pthread.h not found, $msg])
1033 if test "$have_ao" = "yes"; then
1034 AC_CHECK_LIB([pthread], [pthread_create], [], [
1036 AC_MSG_WARN([pthread lib not found or not working, $msg])
1039 if test "$have_ao" = "yes"; then
1040 all_errlist_objs="$all_errlist_objs ao_write"
1041 audiod_errlist_objs="$audiod_errlist_objs ao_write"
1042 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(ao_write)"
1043 audiod_ldflags="$audiod_ldflags -lao -lpthread"
1045 play_errlist_objs="$play_errlist_objs ao_write"
1046 play_cmdline_objs="$play_cmdline_objs add_cmdline(ao_write)"
1047 play_ldflags="$play_ldflags -lao -lpthread"
1049 write_errlist_objs="$write_errlist_objs ao_write"
1050 write_cmdline_objs="$write_cmdline_objs add_cmdline(ao_write)"
1051 write_ldflags="$write_ldflags $ao_libs -lao -lpthread"
1052 writers="$writers ao"
1053 AC_SUBST(ao_cppflags)
1056 CPPFLAGS="$OLD_CPPFLAGS"
1057 LDFLAGS="$OLD_LDFLAGS"
1059 ############################################################# readline
1060 OLD_CPPFLAGS="$CPPFLAGS"
1061 OLD_LD_FLAGS="$LDFLAGS"
1065 AC_ARG_WITH(readline_headers, [AS_HELP_STRING(--with-readline-headers=dir,
1066 [look for libreadline header files also in dir])])
1067 if test -n "$with_readline_headers"; then
1068 readline_cppflags="-I$with_readline_headers"
1069 CPPFLAGS="$CPPFLAGS $readline_cppflags"
1072 AC_ARG_WITH(readline_libs, [AS_HELP_STRING(--with-readline-libs=dir,
1073 [look for readline library also in dir])])
1074 if test -n "$with_readline_libs"; then
1075 readline_libs="-L$with_readline_libs"
1076 LDFLAGS="$LDFLAGS $readline_libs"
1078 msg="no interactive cli support"
1079 AC_CHECK_HEADERS([readline/readline.h], [
1082 AC_MSG_WARN([readline/readline.h not found, $msg])
1085 if test "$have_curses" != "yes"; then
1087 AC_MSG_WARN([interactive cli support depends on curses,])
1088 AC_MSG_WARN([but no curses lib was detected, $msg])
1091 if test "$have_readline" = "yes"; then
1092 readline_libs="$readline_libs -lreadline"
1093 AC_SEARCH_LIBS([rl_free_keymap], [readline], [], [have_readline="no"])
1094 if test "$have_readline" = "no"; then # try with -lcurses
1096 AC_MSG_NOTICE([trying again with -lcurses])
1097 unset ac_cv_search_rl_free_keymap 2> /dev/null
1098 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
1100 readline_libs="$readline_libs -lcurses"
1103 if test "$have_readline" = "no"; then # try with -ltermcap
1105 AC_MSG_NOTICE([trying again with -ltermcap])
1106 unset ac_cv_search_rl_free_keymap 2> /dev/null
1107 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
1109 readline_libs="$readline_libs -ltermcap"
1114 if test "$have_readline" = "yes"; then
1115 all_errlist_objs="$all_errlist_objs interactive"
1116 client_errlist_objs="$client_errlist_objs interactive"
1117 client_ldflags="$client_ldflags $readline_libs"
1118 audioc_errlist_objs="$audioc_errlist_objs buffer_tree interactive sched time"
1119 audioc_ldflags="$audioc_ldflags $readline_libs"
1120 play_errlist_objs="$play_errlist_objs interactive"
1121 play_ldflags="$play_ldflags $readline_libs"
1122 AC_SUBST(readline_cppflags)
1123 AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
1125 AC_MSG_WARN([libreadline not found or unusable])
1127 CPPFLAGS="$OLD_CPPFLAGS"
1128 LDFLAGS="$OLD_LDFLAGS"
1130 ############################################################# libsamplerate
1131 OLD_CPPFLAGS="$CPPFLAGS"
1132 OLD_LD_FLAGS="$LDFLAGS"
1135 have_samplerate="yes"
1136 AC_ARG_WITH(samplerate_headers, [AS_HELP_STRING(--with-samplerate-headers=dir,
1137 [look for samplerate headers also in dir])])
1138 if test -n "$with_samplerate_headers"; then
1139 samplerate_cppflags="-I$with_samplerate_headers"
1140 CPPFLAGS="$CPPFLAGS $samplerate_cppflags"
1142 AC_ARG_WITH(samplerate_libs, [AS_HELP_STRING(--with-samplerate-libs=dir,
1143 [look for samplerate libs also in dir])])
1144 if test -n "$with_samplerate_libs"; then
1145 samplerate_libs="-L$with_samplerate_libs"
1146 LDFLAGS="$LDFLAGS $samplerate_libs"
1149 AC_CHECK_HEADER(samplerate.h, [], have_samplerate=no)
1150 AC_CHECK_LIB([samplerate], [src_process], [], have_samplerate=no, [])
1152 if test "$have_samplerate" = "yes"; then
1153 all_errlist_objs="$all_errlist_objs resample_filter"
1154 filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
1155 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(resample_filter)"
1156 audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
1157 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(resample_filter)"
1158 play_errlist_objs="$play_errlist_objs resample_filter check_wav"
1159 play_cmdline_objs="$play_cmdline_objs add_cmdline(resample_filter)"
1160 filter_ldflags="$filter_ldflags $samplerate_libs -lsamplerate"
1161 audiod_ldflags="$audiod_ldflags $samplerate_libs -lsamplerate"
1162 play_ldflags="$play_ldflags $samplerate_libs -lsamplerate"
1163 filters="$filters resample"
1164 AC_SUBST(samplerate_cppflags)
1166 AC_MSG_WARN([no resample support in para_audiod/para_filter])
1168 CPPFLAGS="$OLD_CPPFLAGS"
1169 LDFLAGS="$OLD_LDFLAGS"
1171 ############################################################# error2.h
1172 AC_MSG_NOTICE(creating error2.h)
1173 for i in $executables; do
1175 eval echo \$${i}_errlist_objs
1176 done | ./error2.pl > error2.h
1177 for obj in $all_errlist_objs; do
1178 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
1180 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
1181 [enum {$SS NUM_SS}],
1182 [list of all objects that use the paraslash error facility]
1185 ################################################################## status items
1187 status_items="basename status num_played mtime bitrate frequency file_size
1188 status_flags format score techinfo afs_mode
1189 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
1190 offset seconds_total stream_start current_time audiod_uptime image_id
1191 lyrics_id duration directory lyrics_name image_name path hash channels
1192 last_played num_chunks chunk_time amplification artist title year album
1196 for i in $status_items; do
1197 result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
1199 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
1200 [enum of all status items])
1203 for i in $status_items; do
1204 result="$result \"$i\", "
1206 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
1207 [char * array of all status items])
1209 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
1210 [formats supported by para_server and para_afh])
1212 AC_SUBST(executables, add_para($executables))
1214 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
1215 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
1216 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
1217 server_objs="$server_cmdline_objs $server_errlist_objs"
1218 write_objs="$write_cmdline_objs $write_errlist_objs"
1219 client_objs="$client_cmdline_objs $client_errlist_objs"
1220 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
1221 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
1222 play_objs="$play_cmdline_objs $play_errlist_objs"
1225 AC_SUBST(recv_objs, add_dot_o($recv_objs))
1226 AC_SUBST(recv_ldflags, $recv_ldflags)
1227 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
1228 errors used by para_recv)
1230 AC_SUBST(filter_objs, add_dot_o($filter_objs))
1231 AC_SUBST(filter_ldflags, $filter_ldflags)
1232 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
1233 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
1235 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
1236 AC_SUBST(audiod_ldflags, $audiod_ldflags)
1237 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
1238 errors used by para_audiod)
1240 AC_SUBST(server_objs, add_dot_o($server_objs))
1241 AC_SUBST(server_ldflags, $server_ldflags)
1242 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
1243 objlist_to_errlist($server_errlist_objs), errors used by para_server)
1245 AC_SUBST(afh_objs, add_dot_o($afh_objs))
1246 AC_SUBST(afh_ldflags, $afh_ldflags)
1247 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
1248 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
1250 AC_SUBST(write_objs, add_dot_o($write_objs))
1251 AC_SUBST(write_ldflags, $write_ldflags)
1252 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
1253 objlist_to_errlist($write_errlist_objs), errors used by para_write)
1255 AC_SUBST(client_objs, add_dot_o($client_objs))
1256 AC_SUBST(client_ldflags, $client_ldflags)
1257 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
1258 objlist_to_errlist($client_errlist_objs), errors used by para_client)
1260 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
1261 AC_SUBST(audioc_ldflags, $audioc_ldflags)
1262 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
1263 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
1265 AC_SUBST(gui_objs, add_dot_o($gui_objs))
1266 AC_SUBST(gui_ldflags, $gui_ldflags)
1267 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
1268 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
1270 AC_SUBST(play_objs, add_dot_o($play_objs))
1271 AC_SUBST(play_ldflags, $play_ldflags)
1272 AC_DEFINE_UNQUOTED(INIT_PLAY_ERRLISTS,
1273 objlist_to_errlist($play_errlist_objs), errors used by para_play)
1275 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
1276 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
1277 enum of supported filters)
1278 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
1279 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
1280 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
1281 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
1283 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
1284 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
1285 enum of supported writers)
1286 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
1287 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
1288 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
1289 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
1290 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
1291 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
1292 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
1294 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
1295 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
1296 enum of audio formats supported by audiod)
1297 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
1298 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
1302 paraslash configuration:
1303 ~~~~~~~~~~~~~~~~~~~~~~~~
1304 unix socket credentials: $have_ucred
1305 readline (interactive CLIs): $have_readline
1306 audio formats handlers: $audio_format_handlers
1307 id3 version2 support: $have_libid3tag
1310 optional executables: $extras