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_PATH_PROG(UNAMEPATH, uname, no)
11 if test "$UNAMEPATH" = "no"; then
12 AC_MSG_ERROR(unable to determine system type)
14 AC_MSG_CHECKING(os type)
15 OSTYPE="`$UNAMEPATH -s`"
16 AC_MSG_RESULT("$OSTYPE")
18 if test "$OSTYPE" = "SunOS"; then
19 # needed on SunOS for socket magic
20 arch_cppflags="-D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
21 AC_SUBST(arch_cppflags)
26 AC_PATH_PROG([gengetopt], [gengetopt])
27 test -z "$gengetopt" && AC_MSG_ERROR(
28 [gengetopt is required to build this package])
30 AC_PATH_PROG([help2man], [help2man])
31 test -z "$help2man" && AC_MSG_ERROR(
32 [help2man is required to build this package])
43 AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h \
44 stdlib.h string.h sys/socket.h sys/time.h sys/timeb.h sys/un.h \
45 sys/ipc.h unistd.h utime.h stddef.h],
46 [], [AC_MSG_ERROR([$ac_header not found])])
48 # Checks for typedefs, structures, and compiler characteristics.
68 # Checks for library functions.
70 AC_PROG_GCC_TRADITIONAL
76 AC_FUNC_SELECT_ARGTYPES
84 AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
85 regcomp select strchr strdup strerror strstr strtol uname \
86 fchdir gettimeofday localtime_r munmap strcasecmp strcspn \
87 strncasecmp strrchr strspn alarm mkdir inet_ntoa socket], [],
88 [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="server mp3_afh afh_common vss command net string signal time
96 daemon stat http_send close_on_fork ipc acl afh fade amp_filter
97 dccp_send fd user_list chunk_queue afs aft mood score attribute blob ringbuffer
98 playlist sched audiod grab_client filter_common wav_filter compress_filter
99 http_recv dccp_recv recv_common write_common file_write audiod_command
100 client_common recv stdout filter stdin audioc write client exec send_common ggo
101 udp_recv udp_send color fec fecdec_filter prebuffer_filter mm
102 server_command_list afs_command_list audiod_command_list bitstream imdct wma_afh
103 wma_common wmadec_filter buffer_tree crypt_common gui gui_theme
106 executables="recv filter audioc write client afh audiod"
108 recv_cmdline_objs="add_cmdline(recv http_recv dccp_recv udp_recv)"
110 recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
111 fd sched stdout ggo udp_recv buffer_tree"
114 filter_cmdline_objs="add_cmdline(filter compress_filter amp_filter prebuffer_filter)"
115 filter_errlist_objs="filter_common wav_filter compress_filter filter string
116 stdin stdout sched fd amp_filter ggo fecdec_filter fec
117 prebuffer_filter time bitstream imdct wma_common wmadec_filter buffer_tree"
119 filters=" compress wav amp fecdec wmadec prebuffer"
121 audioc_cmdline_objs="add_cmdline(audioc)"
122 audioc_errlist_objs="audioc string net fd"
125 audiod_cmdline_objs="add_cmdline(audiod compress_filter http_recv dccp_recv file_write client amp_filter udp_recv prebuffer_filter)"
126 audiod_errlist_objs="audiod signal string daemon stat net crypt_common
127 time grab_client filter_common wav_filter compress_filter amp_filter http_recv dccp_recv
128 recv_common fd sched write_common file_write audiod_command fecdec_filter
129 client_common ggo udp_recv color fec prebuffer_filter audiod_command_list
130 bitstream imdct wma_common wmadec_filter buffer_tree"
132 audiod_audio_formats="wma"
134 afh_cmdline_objs="add_cmdline(afh)"
135 afh_errlist_objs="afh string fd mp3_afh afh_common time wma_afh wma_common"
138 server_cmdline_objs="add_cmdline(server)"
139 server_errlist_objs="server afh_common mp3_afh vss command net string signal
140 time daemon http_send close_on_fork mm crypt_common
141 ipc dccp_send fd user_list chunk_queue afs aft mood score attribute
142 blob playlist sched acl send_common udp_send color fec
143 server_command_list afs_command_list wma_afh wma_common"
145 server_audio_formats="mp3 wma"
147 write_cmdline_objs="add_cmdline(write file_write)"
148 write_errlist_objs="write write_common file_write time fd string sched stdin
152 default_writer="FILE_WRITE"
154 client_cmdline_objs="add_cmdline(client)"
155 client_errlist_objs="client net string fd sched stdin stdout time
156 client_common buffer_tree crypt_common"
159 gui_cmdline_objs="add_cmdline(gui)"
160 gui_errlist_objs="exec signal string stat ringbuffer fd gui gui_theme"
161 gui_objs="$gui_cmdline_objs $gui_errlist_objs"
163 fade_cmdline_objs="add_cmdline(fade)"
164 fade_errlist_objs="fade exec string fd"
167 ########################################################################### snprintf
168 # ===========================================================================
169 # http://www.nongnu.org/autoconf-archive/ax_func_snprintf.html
170 # ===========================================================================
178 # Checks for a fully C99 compliant snprintf, in particular checks whether
179 # it does bounds checking and returns the correct string length; does the
180 # same check for vsnprintf. If no working snprintf or vsnprintf is found,
181 # it prints an error message and aborts.
185 # Copyright (c) 2008 Ruediger Kuhlmann <info@ruediger-kuhlmann.de>
187 # Copying and distribution of this file, with or without modification, are
188 # permitted in any medium without royalty provided the copyright notice
189 # and this notice are preserved.
191 AU_ALIAS([AC_FUNC_SNPRINTF], [AX_FUNC_SNPRINTF])
192 AC_DEFUN([AX_FUNC_SNPRINTF],
193 [AC_CHECK_FUNCS(snprintf vsnprintf)
194 AC_MSG_CHECKING(for working snprintf)
195 AC_CACHE_VAL(ac_cv_have_working_snprintf,
201 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
202 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
204 i = snprintf (bufs, 2, "%s", "111");
205 if (strcmp (bufs, "1")) exit (1);
206 if (i != 3) exit (1);
207 i = snprintf (bufd, 2, "%d", 111);
208 if (strcmp (bufd, "1")) exit (1);
209 if (i != 3) exit (1);
211 }], ac_cv_have_working_snprintf=yes, ac_cv_have_working_snprintf=no, ac_cv_have_working_snprintf=cross)])
212 AC_MSG_RESULT([$ac_cv_have_working_snprintf])
213 AC_MSG_CHECKING(for working vsnprintf)
214 AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
219 int my_vsnprintf (char *buf, const char *tmpl, ...)
223 va_start (args, tmpl);
224 i = vsnprintf (buf, 2, tmpl, args);
231 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
232 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
234 i = my_vsnprintf (bufs, "%s", "111");
235 if (strcmp (bufs, "1")) exit (1);
236 if (i != 3) exit (1);
237 i = my_vsnprintf (bufd, "%d", 111);
238 if (strcmp (bufd, "1")) exit (1);
239 if (i != 3) exit (1);
241 }], ac_cv_have_working_vsnprintf=yes, ac_cv_have_working_vsnprintf=no, ac_cv_have_working_vsnprintf=cross)])
242 AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
243 if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
244 AC_MSG_ERROR([fatal: buggy snprintf() detected])
247 ########################################################################### osl
249 OLD_CPPFLAGS="$CPPFLAGS"
250 OLD_LD_FLAGS="$LDFLAGS"
252 AC_ARG_WITH(osl_headers, [AC_HELP_STRING(--with-osl-headers=dir,
253 [look for osl.h also in dir])])
254 if test -n "$with_osl_headers"; then
255 osl_cppflags="-I$with_osl_headers"
256 CPPFLAGS="$CPPFLAGS $osl_cppflags"
258 AC_ARG_WITH(osl_libs, [AC_HELP_STRING(--with-osl-libs=dir,
259 [look for libosl also in dir])])
260 if test -n "$with_osl_libs"; then
261 osl_libs="-L$with_osl_libs"
262 LDFLAGS="$LDFLAGS $osl_libs"
265 AC_CHECK_HEADER(osl.h, [], have_osl=no)
266 AC_CHECK_LIB([osl], [osl_open_table], [], have_osl=no)
267 if test "$have_osl" = "no"; then
268 AC_MSG_WARN([libosl not found, can not build para_server.
270 http://systemlinux.org/~maan/osl
272 git clone git://git.tuebingen.mpg.de/osl
275 extras="$extras server"
276 executables="$executables server"
277 AC_SUBST(osl_cppflags)
278 server_ldflags="$server_ldflags $osl_libs -losl"
280 CPPFLAGS="$OLD_CPPFLAGS"
281 LDFLAGS="$OLD_LDFLAGS"
283 ########################################################################### crypto
284 AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
285 Force using crypto library "lib". This package requires either
286 openssl or libgcrypt being installed. Possible values for "lib"
287 are thus "openssl" and "gcrypt". If this option is not given,
288 openssl is tried first. If openssl was not found, gcrypt is
291 case "$enable_cryptolib" in
292 "openssl") check_openssl="yes"; check_gcrypt="no";;
293 "gcrypt") check_openssl="no"; check_gcrypt="yes";;
294 "") check_openssl="yes"; check_gcrypt="yes";;
295 *) AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib]);;
297 ###################################################################### openssl
298 if test "$check_openssl" = "yes"; then
299 OLD_CPPFLAGS="$CPPFLAGS"
300 OLD_LD_FLAGS="$LDFLAGS"
303 AC_ARG_WITH(openssl_headers, [AC_HELP_STRING(--with-openssl-headers=dir,
304 [look for openssl headers also in dir])])
305 if test -n "$with_openssl_headers"; then
306 openssl_cppflags="-I$with_openssl_headers"
307 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
309 AC_ARG_WITH(openssl_libs, [AC_HELP_STRING(--with-openssl-libs=dir,
310 [look for openssl libraries also in dir])])
311 if test -n "$with_openssl_libs"; then
312 openssl_libs="-L$with_openssl_libs"
313 LDFLAGS="$LDFLAGS $openssl_libs"
315 AC_CHECK_HEADER(openssl/ssl.h, [], [have_openssl="no"])
316 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
317 if test "$have_openssl" = "no" -a -z "$with_openssl_headers$with_openssl_libs"; then
318 # try harder: openssl is sometimes installed in /usr/local/ssl
319 openssl_cppflags="-I/usr/local/ssl/include"
320 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
321 openssl_libs="-L/usr/local/ssl/lib"
322 LDFLAGS="$LDFLAGS $openssl_libs"
324 unset ac_cv_header_openssl_ssl_h 2> /dev/null
325 unset ac_cv_lib_crypto_RAND_bytes 2> /dev/null
326 AC_CHECK_HEADER(openssl/ssl.h, [have_openssl="yes"], [])
327 if test "$have_openssl" = "yes"; then
328 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
331 if test "$have_openssl" = "yes"; then
332 AC_DEFINE(HAVE_OPENSSL, 1, [define to 1 to turn on openssl support])
333 AC_SUBST(openssl_cppflags)
334 openssl_libs="$openssl_libs -lssl -lcrypto"
335 server_ldflags="$server_ldflags $openssl_libs"
336 client_ldflags="$client_ldflags $openssl_libs"
337 audiod_ldflags="$audiod_ldflags $openssl_libs"
339 all_errlist_objs="$all_errlist_objs crypt"
340 server_errlist_objs="$server_errlist_objs crypt"
341 client_errlist_objs="$client_errlist_objs crypt"
342 audiod_errlist_objs="$audiod_errlist_objs crypt"
346 AC_MSG_WARN([openssl libraries not found])
348 CPPFLAGS="$OLD_CPPFLAGS"
349 LDFLAGS="$OLD_LDFLAGS"
354 ########################################################################### gcrypt
355 if test "$check_gcrypt" = "yes"; then
356 OLD_CPPFLAGS="$CPPFLAGS"
357 OLD_LD_FLAGS="$LDFLAGS"
360 AC_ARG_WITH(gcrypt_headers, [AC_HELP_STRING(--with-gcrypt-headers=dir,
361 [look for gcrypt headers also in dir])])
362 if test -n "$with_gcrypt_headers"; then
363 gcrypt_cppflags="-I$with_gcrypt_headers"
364 CPPFLAGS="$CPPFLAGS $gcrypt_cppflags"
366 AC_ARG_WITH(gcrypt_libs, [AC_HELP_STRING(--with-gcrypt-libs=dir,
367 [look for libgcrypt also in dir])])
368 if test -n "$with_gcrypt_libs"; then
369 gcrypt_libs="-L$with_gcrypt_libs"
370 LDFLAGS="$LDFLAGS $gcrypt_libs"
372 AC_CHECK_HEADER(gcrypt.h, [], [have_gcrypt="no"])
373 AC_CHECK_LIB([gcrypt], [gcry_randomize], [], [have_gcrypt="no"])
374 if test "$have_gcrypt" = "yes"; then
375 AC_DEFINE(HAVE_GCRYPT, 1, [define to 1 to turn on gcrypt support])
376 AC_SUBST(gcrypt_cppflags)
377 gcrypt_libs="$gcrypt_libs -lgcrypt"
378 server_ldflags="$server_ldflags $gcrypt_libs"
379 client_ldflags="$client_ldflags $gcrypt_libs"
380 audiod_ldflags="$audiod_ldflags $gcrypt_libs"
382 all_errlist_objs="$all_errlist_objs gcrypt"
383 server_errlist_objs="$server_errlist_objs gcrypt"
384 client_errlist_objs="$client_errlist_objs gcrypt"
385 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
387 AC_MSG_WARN([gcrypt library not found])
389 CPPFLAGS="$OLD_CPPFLAGS"
390 LDFLAGS="$OLD_LDFLAGS"
395 ###########################################################################
396 if test "$have_openssl" = "no" -a "$have_gcrypt" = "no"; then
397 AC_MSG_ERROR([neither openssl nor gcrypt usable])
399 ########################################################################### libsocket
400 AC_CHECK_LIB([c], [socket],
402 [socket_lib="-lsocket"]
404 server_ldflags="$server_ldflags $socket_lib"
405 client_ldflags="$client_ldflags $socket_lib"
406 audioc_ldflags="$audioc_ldflags $socket_lib"
407 audiod_ldflags="$audiod_ldflags $socket_lib"
408 recv_ldflags="$recv_ldflags $socket_lib"
409 AC_SEARCH_LIBS([connect],[socket],[],[
410 AC_MSG_ERROR([Fatal: Did not find connect().])
412 ########################################################################### libnsl
413 AC_CHECK_LIB([c], [gethostbyname],
417 server_ldflags="$server_ldflags $nsl_lib"
418 client_ldflags="$client_ldflags $nsl_lib"
419 audioc_ldflags="$audioc_ldflags $nsl_lib"
420 recv_ldflags="$recv_ldflags $nsl_lib"
421 AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
422 AC_MSG_ERROR([Fatal: Did not find inet_ntoa().])
424 ########################################################################### ucred
425 AC_MSG_CHECKING(for struct ucred)
428 #include <sys/types.h>
429 #include <sys/socket.h>
431 struct ucred sucred; sucred.pid=0;
432 ],[have_ucred=yes],[have_ucred=no])
433 AC_MSG_RESULT($have_ucred)
434 if test ${have_ucred} = yes; then
435 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
438 ########################################################################### curses
440 OLD_CPPFLAGS="$CPPFLAGS"
441 OLD_LD_FLAGS="$LDFLAGS"
443 AC_ARG_WITH(curses_headers, [AC_HELP_STRING(--with-curses-headers=dir,
444 [look for curses.h also in dir])])
445 if test -n "$with_curses_headers"; then
446 curses_cppflags="-I$with_curses_headers"
447 CPPFLAGS="$CPPFLAGS $curses_cppflags"
449 AC_ARG_WITH(curses_libs, [AC_HELP_STRING(--with-curses-libs=dir,
450 [look for libcurses also in dir])])
451 if test -n "$with_curses_libs"; then
452 curses_libs="-L$with_curses_libs"
453 LDFLAGS="$LDFLAGS $curses_libs"
455 AC_CHECK_HEADER(curses.h, [], [
458 AC_CHECK_LIB([curses], [initscr], [], [
461 if test "$have_curses" = "yes"; then
462 AC_SUBST(curses_cppflags)
463 AC_DEFINE(HAVE_NCURSES, 1, [define to 1 to turn on curses support])
465 executables="$executables gui"
467 AC_MSG_WARN([cannot build para_gui])
469 CPPFLAGS="$OLD_CPPFLAGS"
470 LDFLAGS="$OLD_LDFLAGS"
473 ########################################################################### ip_mreqn
474 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
481 ],[have_ip_mreqn=yes],[have_ip_mreqn=no])
482 AC_MSG_RESULT($have_ip_mreqn)
483 if test ${have_ip_mreqn} = yes; then
484 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
486 ########################################################################### osx
488 AC_MSG_CHECKING(for CoreAudio (MacOs))
490 #include <CoreAudio/CoreAudio.h>
493 ],[have_core_audio=yes],[have_core_audio=no])
494 AC_MSG_RESULT($have_core_audio)
495 if test ${have_core_audio} = yes; then
496 f1="-framework CoreAudio"
497 f2="-framework AudioToolbox"
498 f3="-framework AudioUnit"
499 f4="-framework CoreServices"
502 all_errlist_objs="$all_errlist_objs osx_write"
503 audiod_errlist_objs="$audiod_errlist_objs osx_write ipc"
504 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
505 audiod_ldflags="$audiod_ldflags $f"
507 write_errlist_objs="$write_errlist_objs osx_write ipc"
508 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
509 write_ldflags="$write_ldflags $f"
510 writers="$writers osx"
511 default_writer="OSX_WRITE"
512 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
514 ########################################################### ogg/vorbis/speex
516 OLD_CPPFLAGS="$CPPFLAGS"
517 OLD_LD_FLAGS="$LDFLAGS"
519 AC_ARG_WITH(ogg_headers, [AC_HELP_STRING(--with-ogg-headers=dir,
520 [look for ogg headers also in dir])])
521 AC_ARG_WITH(ogg_libs, [AC_HELP_STRING(--with-ogg-libs=dir,
522 [look for ogg libs also in dir])])
523 AC_ARG_WITH(vorbis_headers, [AC_HELP_STRING(--with-vorbis-headers=dir,
524 [look for vorbis headers also in dir])])
525 AC_ARG_WITH(vorbis_libs, [AC_HELP_STRING(--with-vorbis-libs=dir,
526 [look for vorbis libs also in dir])])
527 AC_ARG_WITH(speex_headers, [AC_HELP_STRING(--with-speex-headers=dir,
528 [look for speex headers also in dir])])
529 AC_ARG_WITH(speex_libs, [AC_HELP_STRING(--with-speex-libs=dir,
530 [look for speex libs also in dir])])
532 if test -n "$with_ogg_headers"; then
533 ogg_cppflags="-I$with_ogg_headers"
534 CPPFLAGS="$CPPFLAGS $ogg_cppflags"
536 if test -n "$with_ogg_libs"; then
537 ogg_libs="-L$with_ogg_libs"
538 LDFLAGS="$LDFLAGS $ogg_libs"
540 AC_CHECK_HEADERS([ogg/ogg.h], [], [ have_ogg="no"; ])
541 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
545 if test "$have_ogg" = "yes"; then
547 if test -n "$with_vorbis_headers"; then
548 vorbis_cppflags="-I$with_vorbis_headers"
549 CPPFLAGS="$CPPFLAGS $vorbis_cppflags"
551 if test -n "$with_vorbis_libs"; then
552 vorbis_libs="-L$with_vorbis_libs"
553 LDFLAGS="$LDFLAGS $vorbis_libs"
555 AC_CHECK_HEADERS([vorbis/codec.h], [], [ have_vorbis="no" ])
556 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_vorbis="no" ])
559 if test -n "$with_speex_headers"; then
560 speex_cppflags="-I$with_speex_headers"
561 CPPFLAGS="$CPPFLAGS $speex_cppflags"
563 if test -n "$with_speex_libs"; then
564 speex_libs="-L$with_speex_libs"
565 LDFLAGS="$LDFLAGS $speex_libs"
567 AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ])
568 AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ])
574 msg="support in para_server/para_filter/para_afh"
575 if test "$have_vorbis" = "yes" || test "$have_speex" = "yes"; then
576 AC_SUBST(ogg_cppflags)
577 ogg_libs="$ogg_libs -logg"
578 if test "$OSTYPE" = "Darwin"; then
579 ogg_libs="-Wl,-bind_at_load $ogg_libs"
581 server_ldflags="$server_ldflags $ogg_libs"
582 filter_ldflags="$filter_ldflags $ogg_libs"
583 audiod_ldflags="$audiod_ldflags $ogg_libs"
584 afh_ldflags="$afh_ldflags $ogg_libs"
585 all_errlist_objs="$all_errlist_objs ogg_afh_common"
586 afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
587 server_errlist_objs="$server_errlist_objs ogg_afh_common"
589 AC_MSG_WARN([vorbis/speex require ogg])
591 if test "$have_vorbis" = "yes"; then
592 all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh"
593 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support)
594 filters="$filters oggdec"
595 vorbis_libs="-lvorbis -lvorbisfile"
596 server_ldflags="$server_ldflags $vorbis_libs"
597 filter_ldflags="$filter_ldflags $vorbis_libs"
598 audiod_ldflags="$audiod_ldflags $vorbis_libs"
599 afh_ldflags="$afh_ldflags $vorbis_libs"
601 server_errlist_objs="$server_errlist_objs ogg_afh"
602 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
603 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
604 afh_errlist_objs="$afh_errlist_objs ogg_afh"
606 audiod_audio_formats="$audiod_audio_formats ogg"
607 server_audio_formats="$server_audio_formats ogg"
609 AC_MSG_WARN([no ogg/vorbis $msg])
611 if test "$have_speex" = "yes"; then
612 all_errlist_objs="$all_errlist_objs spxdec_filter spx_afh spx_common"
613 AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support)
614 filters="$filters spxdec"
616 server_ldflags="$server_ldflags $speex_libs"
617 filter_ldflags="$filter_ldflags $speex_libs"
618 audiod_ldflags="$audiod_ldflags $speex_libs"
619 afh_ldflags="$afh_ldflags $speex_libs"
621 server_errlist_objs="$server_errlist_objs spx_afh spx_common"
622 filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
623 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
624 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
626 audiod_audio_formats="$audiod_audio_formats spx"
627 server_audio_formats="$server_audio_formats spx"
629 AC_MSG_WARN([no ogg/speex $msg])
631 CPPFLAGS="$OLD_CPPFLAGS"
632 LDFLAGS="$OLD_LDFLAGS"
634 ########################################################################### faad
636 OLD_CPPFLAGS="$CPPFLAGS"
637 OLD_LD_FLAGS="$LDFLAGS"
639 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
640 [look for neaacdec.h also in dir])])
641 if test -n "$with_faad_headers"; then
642 faad_cppflags="-I$with_faad_headers"
643 CPPFLAGS="$CPPFLAGS $faad_cppflags"
645 AC_ARG_WITH(faad_libs, [AC_HELP_STRING(--with-faad-libs=dir,
646 [look for libfaad also in dir])])
647 if test -n "$with_faad_libs"; then
648 faad_libs="-L$with_faad_libs"
649 LDFLAGS="$LDFLAGS $faad_libs"
651 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
652 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
653 if test "$have_faad" = "yes"; then
654 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
655 all_errlist_objs="$all_errlist_objs aac_common aacdec_filter aac_afh"
656 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
657 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
658 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
659 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
660 server_ldflags="$server_ldflags $faad_libs -lfaad"
661 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
662 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
663 afh_ldflags="$afh_ldflags $faad_libs -lfaad"
664 audiod_audio_formats="$audiod_audio_formats aac"
665 server_audio_formats="$server_audio_formats aac"
666 filters="$filters aacdec"
667 AC_SUBST(faad_cppflags)
669 AC_MSG_WARN([no aac support in para_audiod/para_filter])
671 CPPFLAGS="$OLD_CPPFLAGS"
672 LDFLAGS="$OLD_LDFLAGS"
674 ########################################################################### mad
676 OLD_CPPFLAGS="$CPPFLAGS"
677 OLD_LD_FLAGS="$LDFLAGS"
680 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
681 [look for mad.h also in dir])])
682 if test -n "$with_mad_headers"; then
683 mad_cppflags="-I$with_mad_headers"
684 CPPFLAGS="$CPPFLAGS $mad_cppflags"
686 AC_ARG_WITH(mad_libs, [AC_HELP_STRING(--with-mad-libs=dir,
687 [look for libmad also in dir])])
688 if test -n "$with_mad_libs"; then
689 mad_libs="-L$with_mad_libs"
690 LDFLAGS="$LDFLAGS $mad_libs"
692 AC_CHECK_HEADERS([mad.h], [], [
695 AC_CHECK_LIB([mad], [mad_stream_init], [], [
698 if test "$have_mad" = "yes"; then
699 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
700 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
701 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
702 all_errlist_objs="$all_errlist_objs mp3dec_filter"
703 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
704 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
705 filter_ldflags="$filter_ldflags $mad_libs -lmad"
706 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
707 audiod_audio_formats="$audiod_audio_formats mp3"
708 filters="$filters mp3dec"
709 AC_SUBST(mad_cppflags)
711 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
713 CPPFLAGS="$OLD_CPPFLAGS"
714 LDFLAGS="$OLD_LDFLAGS"
716 ###################################################################### libid3tag
717 AC_MSG_CHECKING(for libid3tag)
721 struct id3_tag t = {.flags = 0};
722 ],[have_libid3tag=yes],[have_libid3tag=no])
723 AC_MSG_RESULT($have_libid3tag)
724 if test ${have_libid3tag} = yes; then
725 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
726 server_ldflags="$server_ldflags -lid3tag"
727 afh_ldflags="$afh_ldflags -lid3tag"
729 AC_MSG_WARN([no support for id3v2 tags])
731 ########################################################################### flac
732 OLD_CPPFLAGS="$CPPFLAGS"
733 OLD_LD_FLAGS="$LDFLAGS"
737 AC_ARG_WITH(flac_headers, [AC_HELP_STRING(--with-flac-headers=dir,
738 [look for flac headers also in dir])])
739 if test -n "$with_flac_headers"; then
740 flac_cppflags="-I$with_flac_headers"
741 CPPFLAGS="$CPPFLAGS $flac_cppflags"
743 AC_ARG_WITH(flac_libs, [AC_HELP_STRING(--with-flac-libs=dir,
744 [look for flac libs also in dir])])
745 if test -n "$with_flac_libs"; then
746 flac_libs="-L$with_flac_libs"
747 LDFLAGS="$LDFLAGS $flac_libs"
749 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no)
750 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], have_flac=no)
751 if test "$have_flac" = "yes"; then
752 AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter)
753 all_errlist_objs="$all_errlist_objs flacdec_filter flac_afh"
754 filter_errlist_objs="$filter_errlist_objs flacdec_filter"
755 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
756 afh_errlist_objs="$afh_errlist_objs flac_afh"
757 server_errlist_objs="$server_errlist_objs flac_afh"
758 filter_ldflags="$filter_ldflags $flac_libs -lFLAC"
759 audiod_ldflags="$audiod_ldflags $flac_libs -lFLAC"
760 server_ldflags="$server_ldflags $flac_libs -lFLAC"
761 afh_ldflags="$afh_ldflags $flac_libs -lFLAC"
762 filters="$filters flacdec"
763 server_audio_formats="$server_audio_formats flac"
764 audiod_audio_formats="$audiod_audio_formats flac"
765 AC_SUBST(flac_cppflags)
767 AC_MSG_WARN([no flac support in para_audiod/para_filter])
769 CPPFLAGS="$OLD_CPPFLAGS"
770 LDFLAGS="$OLD_LDFLAGS"
772 ########################################################################### oss
773 OLD_CPPFLAGS="$CPPFLAGS"
774 OLD_LD_FLAGS="$LDFLAGS"
778 msg="=> will not build para_fade/oss writer"
780 AC_CHECK_HEADER(sys/soundcard.h, [
781 extras="$extras fade"
782 executables="$executables fade"
783 all_errlist_objs="$all_errlist_objs oss_write"
784 audiod_errlist_objs="$audiod_errlist_objs oss_write"
785 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
787 write_errlist_objs="$write_errlist_objs oss_write"
788 write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
789 writers="$writers oss"
790 default_writer="OSS_WRITE"
791 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
792 audiod_ldflags="$audiod_ldflags -lossaudio"
793 write_ldflags="$write_ldflags -lossaudio"
794 fade_ldflags="$write_ldflags -lossaudio"
800 AC_MSG_WARN([no sys/soundcard.h $msg])
803 CPPFLAGS="$OLD_CPPFLAGS"
804 LDFLAGS="$OLD_LDFLAGS"
807 ########################################################################### alsa
808 OLD_CPPFLAGS="$CPPFLAGS"
809 OLD_LD_FLAGS="$LDFLAGS"
812 msg="=> no alsa support for para_audiod/para_write"
813 if test "$OSTYPE" != "Linux"; then
818 if test "$have_alsa" = "yes"; then
819 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
821 AC_MSG_WARN([no alsa/asoundlib $msg])
825 if test "$have_alsa" = "yes"; then
826 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
828 AC_MSG_WARN([no libasound $msg])
832 if test "$have_alsa" = "yes"; then
833 all_errlist_objs="$all_errlist_objs alsa_write"
834 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
835 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
836 audiod_ldflags="$audiod_ldflags -lasound"
838 write_errlist_objs="$write_errlist_objs alsa_write"
839 write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
840 write_ldflags="$write_ldflags -lasound"
841 writers="$writers alsa"
842 default_writer="ALSA_WRITE"
845 CPPFLAGS="$OLD_CPPFLAGS"
846 LDFLAGS="$OLD_LDFLAGS"
848 ########################################################################### libao
849 OLD_CPPFLAGS="$CPPFLAGS"
850 OLD_LD_FLAGS="$LDFLAGS"
854 AC_ARG_WITH(ao_headers, [AC_HELP_STRING(--with-ao-headers=dir,
855 [look for ao/ao.h also in dir])])
856 if test -n "$with_ao_headers"; then
857 ao_cppflags="-I$with_ao_headers"
858 CPPFLAGS="$CPPFLAGS $ao_cppflags"
860 AC_ARG_WITH(ao_libs, [AC_HELP_STRING(--with-ao-libs=dir,
861 [look for libao also in dir])])
862 if test -n "$with_ao_libs"; then
863 ao_libs="-L$with_ao_libs"
864 LDFLAGS="$LDFLAGS $ao_libs"
866 msg="no libao support for para_audiod/para_write"
867 AC_CHECK_HEADERS([ao/ao.h], [
870 AC_MSG_WARN([ao.h not found, $msg])
872 if test "$have_ao" = "yes"; then
873 AC_CHECK_LIB([ao], [ao_initialize], [], [
875 AC_MSG_WARN([ao lib not found or not working, $msg])
878 if test "$have_ao" = "yes"; then
879 AC_CHECK_HEADERS([pthread.h], [
882 AC_MSG_WARN([pthread.h not found, $msg])
885 if test "$have_ao" = "yes"; then
886 AC_CHECK_LIB([pthread], [pthread_create], [], [
888 AC_MSG_WARN([pthread lib not found or not working, $msg])
891 if test "$have_ao" = "yes"; then
892 all_errlist_objs="$all_errlist_objs ao_write"
893 audiod_errlist_objs="$audiod_errlist_objs ao_write"
894 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(ao_write)"
895 audiod_ldflags="$audiod_ldflags -lao -lpthread"
897 write_errlist_objs="$write_errlist_objs ao_write"
898 write_cmdline_objs="$write_cmdline_objs add_cmdline(ao_write)"
899 write_ldflags="$write_ldflags $ao_libs -lao -lpthread"
900 writers="$writers ao"
901 AC_SUBST(ao_cppflags)
904 CPPFLAGS="$OLD_CPPFLAGS"
905 LDFLAGS="$OLD_LDFLAGS"
907 ############################################################# readline
908 OLD_CPPFLAGS="$CPPFLAGS"
909 OLD_LD_FLAGS="$LDFLAGS"
913 AC_ARG_WITH(readline_headers, [AC_HELP_STRING(--with-readline-headers=dir,
914 [look for libreadline header files also in dir])])
915 if test -n "$with_readline_headers"; then
916 readline_cppflags="-I$with_readline_headers"
917 CPPFLAGS="$CPPFLAGS $readline_cppflags"
920 AC_ARG_WITH(readline_libs, [AC_HELP_STRING(--with-readline-libs=dir,
921 [look for readline library also in dir])])
922 if test -n "$with_readline_libs"; then
923 readline_libs="-L$with_readline_libs"
924 LDFLAGS="$LDFLAGS $readline_libs"
926 msg="no interactive cli support"
927 AC_CHECK_HEADERS([readline/readline.h], [
930 AC_MSG_WARN([readline/readline.h not found, $msg])
932 if test "$have_readline" = "yes"; then
933 readline_libs="$readline_libs -lreadline"
934 AC_SEARCH_LIBS([rl_replace_line], [readline], [], [have_readline="no"])
935 if test "$have_readline" = "no"; then # try with -lcurses
937 AC_MSG_NOTICE([trying again with -lcurses])
938 unset ac_cv_search_rl_replace_line 2> /dev/null
939 AC_SEARCH_LIBS([rl_replace_line], [readline], [
941 readline_libs="$readline_libs -lcurses"
944 if test "$have_readline" = "no"; then # try with -ltermcap
946 AC_MSG_NOTICE([trying again with -ltermcap])
947 unset ac_cv_search_rl_replace_line 2> /dev/null
948 AC_SEARCH_LIBS([rl_replace_line], [readline], [
950 readline_libs="$readline_libs -ltermcap"
955 if test "$have_readline" = "yes"; then
956 all_errlist_objs="$all_errlist_objs interactive"
957 client_errlist_objs="$client_errlist_objs interactive"
958 client_ldflags="$client_ldflags $readline_libs"
959 audioc_errlist_objs="$audioc_errlist_objs buffer_tree interactive sched time"
960 audioc_ldflags="$audioc_ldflags $readline_libs"
961 AC_SUBST(readline_cppflags)
962 AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
964 AC_MSG_WARN([libreadline not found or unusable])
966 CPPFLAGS="$OLD_CPPFLAGS"
967 LDFLAGS="$OLD_LDFLAGS"
969 #############################################################
972 AC_SUBST(install_sh, [$INSTALL])
973 AC_CONFIG_FILES([Makefile])
976 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
977 AC_DEFUN([add_para],[$(for i in $@; do printf "para_$i "; done)])
978 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) }])
979 ############################################################# error2.h
980 AC_MSG_NOTICE(creating error2.h)
981 for i in $executables; do
983 eval echo \$${i}_errlist_objs
984 done | ./error2.pl > error2.h
985 for obj in $all_errlist_objs; do
986 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
988 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
990 [list of all objects that use the paraslash error facility]
993 ################################################################## status items
995 status_items="basename status num_played mtime bitrate frequency file_size
996 status_flags format score techinfo afs_mode
997 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
998 offset seconds_total stream_start current_time audiod_uptime image_id
999 lyrics_id duration directory lyrics_name image_name path hash channels
1000 last_played num_chunks chunk_time amplification artist title year album
1004 for i in $status_items; do
1005 result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
1007 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
1008 [enum of all status items])
1011 for i in $status_items; do
1012 result="$result \"$i\", "
1014 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
1015 [char * array of all status items])
1017 AC_DEFINE_UNQUOTED(SERVER_AUDIO_FORMATS, "$server_audio_formats",
1018 [formats supported by para_server and para_afh])
1020 AC_SUBST(executables, add_para($executables))
1022 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
1023 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
1024 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
1025 server_objs="$server_cmdline_objs $server_errlist_objs"
1026 write_objs="$write_cmdline_objs $write_errlist_objs"
1027 client_objs="$client_cmdline_objs $client_errlist_objs"
1028 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
1029 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
1030 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
1032 AC_SUBST(recv_objs, add_dot_o($recv_objs))
1033 AC_SUBST(recv_ldflags, $recv_ldflags)
1034 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
1035 errors used by para_recv)
1037 AC_SUBST(filter_objs, add_dot_o($filter_objs))
1038 AC_SUBST(filter_ldflags, $filter_ldflags)
1039 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
1040 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
1042 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
1043 AC_SUBST(audiod_ldflags, $audiod_ldflags)
1044 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
1045 errors used by para_audiod)
1047 AC_SUBST(server_objs, add_dot_o($server_objs))
1048 AC_SUBST(server_ldflags, $server_ldflags)
1049 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
1050 objlist_to_errlist($server_errlist_objs), errors used by para_server)
1052 AC_SUBST(afh_objs, add_dot_o($afh_objs))
1053 AC_SUBST(afh_ldflags, $afh_ldflags)
1054 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
1055 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
1057 AC_SUBST(write_objs, add_dot_o($write_objs))
1058 AC_SUBST(write_ldflags, $write_ldflags)
1059 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
1060 objlist_to_errlist($write_errlist_objs), errors used by para_write)
1062 AC_SUBST(client_objs, add_dot_o($client_objs))
1063 AC_SUBST(client_ldflags, $client_ldflags)
1064 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
1065 objlist_to_errlist($client_errlist_objs), errors used by para_client)
1067 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
1068 AC_SUBST(audioc_ldflags, $audioc_ldflags)
1069 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
1070 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
1072 AC_SUBST(gui_objs, add_dot_o($gui_objs))
1073 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
1074 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
1076 AC_SUBST(fade_objs, add_dot_o($fade_objs))
1077 AC_SUBST(fade_ldflags, $fade_ldflags)
1078 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
1079 objlist_to_errlist($fade_errlist_objs), errors used by para_fade)
1082 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
1083 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
1084 enum of supported filters)
1085 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
1086 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
1087 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
1088 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
1090 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
1091 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
1092 enum of supported writers)
1093 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
1094 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
1095 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
1096 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
1097 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
1098 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
1099 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
1101 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
1102 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
1103 enum of audio formats supported by audiod)
1104 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
1105 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
1109 paraslash configuration:
1110 ~~~~~~~~~~~~~~~~~~~~~~~~
1111 unix socket credentials: $have_ucred
1112 readline (interactive CLIs): $have_readline
1113 audio formats supported by para_server/para_afh: $server_audio_formats
1114 id3 version2 support: $have_libid3tag
1115 filters supported by para_audiod/para_filter: $filters
1116 writers supported by para_audiod/para_write: $writers
1117 optional executables: $extras