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
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 fec 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"
161 gui_other_objs="gui gui_theme"
162 gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
164 fade_cmdline_objs="add_cmdline(fade)"
165 fade_errlist_objs="fade exec string fd"
168 ########################################################################### snprintf
169 # ===========================================================================
170 # http://www.nongnu.org/autoconf-archive/ax_func_snprintf.html
171 # ===========================================================================
179 # Checks for a fully C99 compliant snprintf, in particular checks whether
180 # it does bounds checking and returns the correct string length; does the
181 # same check for vsnprintf. If no working snprintf or vsnprintf is found,
182 # it prints an error message and aborts.
186 # Copyright (c) 2008 Ruediger Kuhlmann <info@ruediger-kuhlmann.de>
188 # Copying and distribution of this file, with or without modification, are
189 # permitted in any medium without royalty provided the copyright notice
190 # and this notice are preserved.
192 AU_ALIAS([AC_FUNC_SNPRINTF], [AX_FUNC_SNPRINTF])
193 AC_DEFUN([AX_FUNC_SNPRINTF],
194 [AC_CHECK_FUNCS(snprintf vsnprintf)
195 AC_MSG_CHECKING(for working snprintf)
196 AC_CACHE_VAL(ac_cv_have_working_snprintf,
202 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
203 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
205 i = snprintf (bufs, 2, "%s", "111");
206 if (strcmp (bufs, "1")) exit (1);
207 if (i != 3) exit (1);
208 i = snprintf (bufd, 2, "%d", 111);
209 if (strcmp (bufd, "1")) exit (1);
210 if (i != 3) exit (1);
212 }], ac_cv_have_working_snprintf=yes, ac_cv_have_working_snprintf=no, ac_cv_have_working_snprintf=cross)])
213 AC_MSG_RESULT([$ac_cv_have_working_snprintf])
214 AC_MSG_CHECKING(for working vsnprintf)
215 AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
220 int my_vsnprintf (char *buf, const char *tmpl, ...)
224 va_start (args, tmpl);
225 i = vsnprintf (buf, 2, tmpl, args);
232 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
233 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
235 i = my_vsnprintf (bufs, "%s", "111");
236 if (strcmp (bufs, "1")) exit (1);
237 if (i != 3) exit (1);
238 i = my_vsnprintf (bufd, "%d", 111);
239 if (strcmp (bufd, "1")) exit (1);
240 if (i != 3) exit (1);
242 }], ac_cv_have_working_vsnprintf=yes, ac_cv_have_working_vsnprintf=no, ac_cv_have_working_vsnprintf=cross)])
243 AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
244 if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
245 AC_MSG_ERROR([fatal: buggy snprintf() detected])
248 ########################################################################### osl
250 OLD_CPPFLAGS="$CPPFLAGS"
251 OLD_LD_FLAGS="$LDFLAGS"
253 AC_ARG_WITH(osl_headers, [AC_HELP_STRING(--with-osl-headers=dir,
254 [look for osl.h also in dir])])
255 if test -n "$with_osl_headers"; then
256 osl_cppflags="-I$with_osl_headers"
257 CPPFLAGS="$CPPFLAGS $osl_cppflags"
259 AC_ARG_WITH(osl_libs, [AC_HELP_STRING(--with-osl-libs=dir,
260 [look for libosl also in dir])])
261 if test -n "$with_osl_libs"; then
262 osl_libs="-L$with_osl_libs"
263 LDFLAGS="$LDFLAGS $osl_libs"
266 AC_CHECK_HEADER(osl.h, [], have_osl=no)
267 AC_CHECK_LIB([osl], [osl_open_table], [], have_osl=no)
268 if test "$have_osl" = "no"; then
269 AC_MSG_WARN([libosl not found, can not build para_server.
271 http://systemlinux.org/~maan/osl
273 git clone git://git.tuebingen.mpg.de/osl
276 extras="$extras server"
277 executables="$executables server"
278 AC_SUBST(osl_cppflags)
279 server_ldflags="$server_ldflags $osl_libs -losl"
281 CPPFLAGS="$OLD_CPPFLAGS"
282 LDFLAGS="$OLD_LDFLAGS"
284 ########################################################################### crypto
285 AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
286 Force using crypto library "lib". This package requires either
287 openssl or libgcrypt being installed. Possible values for "lib"
288 are thus "openssl" and "gcrypt". If this option is not given,
289 openssl is tried first. If openssl was not found, gcrypt is
292 case "$enable_cryptolib" in
293 "openssl") check_openssl="yes"; check_gcrypt="no";;
294 "gcrypt") check_openssl="no"; check_gcrypt="yes";;
295 "") check_openssl="yes"; check_gcrypt="yes";;
296 *) AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib]);;
298 ###################################################################### openssl
299 if test "$check_openssl" = "yes"; then
300 OLD_CPPFLAGS="$CPPFLAGS"
301 OLD_LD_FLAGS="$LDFLAGS"
304 AC_ARG_WITH(openssl_headers, [AC_HELP_STRING(--with-openssl-headers=dir,
305 [look for openssl headers also in dir])])
306 if test -n "$with_openssl_headers"; then
307 openssl_cppflags="-I$with_openssl_headers"
308 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
310 AC_ARG_WITH(openssl_libs, [AC_HELP_STRING(--with-openssl-libs=dir,
311 [look for openssl libraries also in dir])])
312 if test -n "$with_openssl_libs"; then
313 openssl_libs="-L$with_openssl_libs"
314 LDFLAGS="$LDFLAGS $openssl_libs"
316 AC_CHECK_HEADER(openssl/ssl.h, [], [have_openssl="no"])
317 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
318 if test "$have_openssl" = "no" -a -z "$with_openssl_headers$with_openssl_libs"; then
319 # try harder: openssl is sometimes installed in /usr/local/ssl
320 openssl_cppflags="-I/usr/local/ssl/include"
321 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
322 openssl_libs="-L/usr/local/ssl/lib"
323 LDFLAGS="$LDFLAGS $openssl_libs"
325 unset ac_cv_header_openssl_ssl_h 2> /dev/null
326 unset ac_cv_lib_crypto_RAND_bytes 2> /dev/null
327 AC_CHECK_HEADER(openssl/ssl.h, [have_openssl="yes"], [])
328 if test "$have_openssl" = "yes"; then
329 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
332 if test "$have_openssl" = "yes"; then
333 AC_DEFINE(HAVE_OPENSSL, 1, [define to 1 to turn on openssl support])
334 AC_SUBST(openssl_cppflags)
335 openssl_libs="$openssl_libs -lssl -lcrypto"
336 server_ldflags="$server_ldflags $openssl_libs"
337 client_ldflags="$client_ldflags $openssl_libs"
338 audiod_ldflags="$audiod_ldflags $openssl_libs"
340 all_errlist_objs="$all_errlist_objs crypt"
341 server_errlist_objs="$server_errlist_objs crypt"
342 client_errlist_objs="$client_errlist_objs crypt"
343 audiod_errlist_objs="$audiod_errlist_objs crypt"
347 AC_MSG_WARN([openssl libraries not found])
349 CPPFLAGS="$OLD_CPPFLAGS"
350 LDFLAGS="$OLD_LDFLAGS"
355 ########################################################################### gcrypt
356 if test "$check_gcrypt" = "yes"; then
357 OLD_CPPFLAGS="$CPPFLAGS"
358 OLD_LD_FLAGS="$LDFLAGS"
361 AC_ARG_WITH(gcrypt_headers, [AC_HELP_STRING(--with-gcrypt-headers=dir,
362 [look for gcrypt headers also in dir])])
363 if test -n "$with_gcrypt_headers"; then
364 gcrypt_cppflags="-I$with_gcrypt_headers"
365 CPPFLAGS="$CPPFLAGS $gcrypt_cppflags"
367 AC_ARG_WITH(gcrypt_libs, [AC_HELP_STRING(--with-gcrypt-libs=dir,
368 [look for libgcrypt also in dir])])
369 if test -n "$with_gcrypt_libs"; then
370 gcrypt_libs="-L$with_gcrypt_libs"
371 LDFLAGS="$LDFLAGS $gcrypt_libs"
373 AC_CHECK_HEADER(gcrypt.h, [], [have_gcrypt="no"])
374 AC_CHECK_LIB([gcrypt], [gcry_randomize], [], [have_gcrypt="no"])
375 if test "$have_gcrypt" = "yes"; then
376 AC_DEFINE(HAVE_GCRYPT, 1, [define to 1 to turn on gcrypt support])
377 AC_SUBST(gcrypt_cppflags)
378 gcrypt_libs="$gcrypt_libs -lgcrypt"
379 server_ldflags="$server_ldflags $gcrypt_libs"
380 client_ldflags="$client_ldflags $gcrypt_libs"
381 audiod_ldflags="$audiod_ldflags $gcrypt_libs"
383 all_errlist_objs="$all_errlist_objs gcrypt"
384 server_errlist_objs="$server_errlist_objs gcrypt"
385 client_errlist_objs="$client_errlist_objs gcrypt"
386 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
388 AC_MSG_WARN([gcrypt library not found])
390 CPPFLAGS="$OLD_CPPFLAGS"
391 LDFLAGS="$OLD_LDFLAGS"
396 ###########################################################################
397 if test "$have_openssl" = "no" -a "$have_gcrypt" = "no"; then
398 AC_MSG_ERROR([neither openssl nor gcrypt usable])
400 ########################################################################### libsocket
401 AC_CHECK_LIB([c], [socket],
403 [socket_lib="-lsocket"]
405 server_ldflags="$server_ldflags $socket_lib"
406 client_ldflags="$client_ldflags $socket_lib"
407 audioc_ldflags="$audioc_ldflags $socket_lib"
408 audiod_ldflags="$audiod_ldflags $socket_lib"
409 recv_ldflags="$recv_ldflags $socket_lib"
410 AC_SEARCH_LIBS([connect],[socket],[],[
411 AC_MSG_ERROR([Fatal: Did not find connect().])
413 ########################################################################### libnsl
414 AC_CHECK_LIB([c], [gethostbyname],
418 server_ldflags="$server_ldflags $nsl_lib"
419 client_ldflags="$client_ldflags $nsl_lib"
420 audioc_ldflags="$audioc_ldflags $nsl_lib"
421 recv_ldflags="$recv_ldflags $nsl_lib"
422 AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
423 AC_MSG_ERROR([Fatal: Did not find inet_ntoa().])
425 ########################################################################### ucred
426 AC_MSG_CHECKING(for struct ucred)
429 #include <sys/types.h>
430 #include <sys/socket.h>
432 struct ucred sucred; sucred.pid=0;
433 ],[have_ucred=yes],[have_ucred=no])
434 AC_MSG_RESULT($have_ucred)
435 if test ${have_ucred} = yes; then
436 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
439 ########################################################################### curses
441 OLD_CPPFLAGS="$CPPFLAGS"
442 OLD_LD_FLAGS="$LDFLAGS"
444 AC_ARG_WITH(curses_headers, [AC_HELP_STRING(--with-curses-headers=dir,
445 [look for curses.h also in dir])])
446 if test -n "$with_curses_headers"; then
447 curses_cppflags="-I$with_curses_headers"
448 CPPFLAGS="$CPPFLAGS $curses_cppflags"
450 AC_ARG_WITH(curses_libs, [AC_HELP_STRING(--with-curses-libs=dir,
451 [look for libcurses also in dir])])
452 if test -n "$with_curses_libs"; then
453 curses_libs="-L$with_curses_libs"
454 LDFLAGS="$LDFLAGS $curses_libs"
456 AC_CHECK_HEADER(curses.h, [], [
459 AC_CHECK_LIB([curses], [initscr], [], [
462 if test "$have_curses" = "yes"; then
463 AC_SUBST(curses_cppflags)
464 AC_DEFINE(HAVE_NCURSES, 1, [define to 1 to turn on curses support])
466 executables="$executables gui"
468 AC_MSG_WARN([cannot build para_gui])
470 CPPFLAGS="$OLD_CPPFLAGS"
471 LDFLAGS="$OLD_LDFLAGS"
474 ########################################################################### ip_mreqn
475 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
482 ],[have_ip_mreqn=yes],[have_ip_mreqn=no])
483 AC_MSG_RESULT($have_ip_mreqn)
484 if test ${have_ip_mreqn} = yes; then
485 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
487 ########################################################################### osx
489 AC_MSG_CHECKING(for CoreAudio (MacOs))
491 #include <CoreAudio/CoreAudio.h>
494 ],[have_core_audio=yes],[have_core_audio=no])
495 AC_MSG_RESULT($have_core_audio)
496 if test ${have_core_audio} = yes; then
497 f1="-framework CoreAudio"
498 f2="-framework AudioToolbox"
499 f3="-framework AudioUnit"
500 f4="-framework CoreServices"
503 all_errlist_objs="$all_errlist_objs osx_write"
504 audiod_errlist_objs="$audiod_errlist_objs osx_write ipc"
505 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
506 audiod_ldflags="$audiod_ldflags $f"
508 write_errlist_objs="$write_errlist_objs osx_write ipc"
509 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
510 write_ldflags="$write_ldflags $f"
511 writers="$writers osx"
512 default_writer="OSX_WRITE"
513 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
515 ########################################################### ogg/vorbis/speex
517 OLD_CPPFLAGS="$CPPFLAGS"
518 OLD_LD_FLAGS="$LDFLAGS"
520 AC_ARG_WITH(ogg_headers, [AC_HELP_STRING(--with-ogg-headers=dir,
521 [look for ogg headers also in dir])])
522 AC_ARG_WITH(ogg_libs, [AC_HELP_STRING(--with-ogg-libs=dir,
523 [look for ogg libs also in dir])])
524 AC_ARG_WITH(vorbis_headers, [AC_HELP_STRING(--with-vorbis-headers=dir,
525 [look for vorbis headers also in dir])])
526 AC_ARG_WITH(vorbis_libs, [AC_HELP_STRING(--with-vorbis-libs=dir,
527 [look for vorbis libs also in dir])])
528 AC_ARG_WITH(speex_headers, [AC_HELP_STRING(--with-speex-headers=dir,
529 [look for speex headers also in dir])])
530 AC_ARG_WITH(speex_libs, [AC_HELP_STRING(--with-speex-libs=dir,
531 [look for speex libs also in dir])])
533 if test -n "$with_ogg_headers"; then
534 ogg_cppflags="-I$with_ogg_headers"
535 CPPFLAGS="$CPPFLAGS $ogg_cppflags"
537 if test -n "$with_ogg_libs"; then
538 ogg_libs="-L$with_ogg_libs"
539 LDFLAGS="$LDFLAGS $ogg_libs"
541 AC_CHECK_HEADERS([ogg/ogg.h], [], [ have_ogg="no"; ])
542 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
546 if test "$have_ogg" = "yes"; then
548 if test -n "$with_vorbis_headers"; then
549 vorbis_cppflags="-I$with_vorbis_headers"
550 CPPFLAGS="$CPPFLAGS $vorbis_cppflags"
552 if test -n "$with_vorbis_libs"; then
553 vorbis_libs="-L$with_vorbis_libs"
554 LDFLAGS="$LDFLAGS $vorbis_libs"
556 AC_CHECK_HEADERS([vorbis/codec.h], [], [ have_vorbis="no" ])
557 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_vorbis="no" ])
560 if test -n "$with_speex_headers"; then
561 speex_cppflags="-I$with_speex_headers"
562 CPPFLAGS="$CPPFLAGS $speex_cppflags"
564 if test -n "$with_speex_libs"; then
565 speex_libs="-L$with_speex_libs"
566 LDFLAGS="$LDFLAGS $speex_libs"
568 AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ])
569 AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ])
575 msg="support in para_server/para_filter/para_afh"
576 if test "$have_vorbis" = "yes" || test "$have_speex" = "yes"; then
577 AC_SUBST(ogg_cppflags)
578 ogg_libs="$ogg_libs -logg"
579 if test "$OSTYPE" = "Darwin"; then
580 ogg_libs="-Wl,-bind_at_load $ogg_libs"
582 server_ldflags="$server_ldflags $ogg_libs"
583 filter_ldflags="$filter_ldflags $ogg_libs"
584 audiod_ldflags="$audiod_ldflags $ogg_libs"
585 afh_ldflags="$afh_ldflags $ogg_libs"
586 all_errlist_objs="$all_errlist_objs ogg_afh_common"
587 afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
588 server_errlist_objs="$server_errlist_objs ogg_afh_common"
590 AC_MSG_WARN([vorbis/speex require ogg])
592 if test "$have_vorbis" = "yes"; then
593 all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh"
594 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support)
595 filters="$filters oggdec"
596 vorbis_libs="-lvorbis -lvorbisfile"
597 server_ldflags="$server_ldflags $vorbis_libs"
598 filter_ldflags="$filter_ldflags $vorbis_libs"
599 audiod_ldflags="$audiod_ldflags $vorbis_libs"
600 afh_ldflags="$afh_ldflags $vorbis_libs"
602 server_errlist_objs="$server_errlist_objs ogg_afh"
603 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
604 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
605 afh_errlist_objs="$afh_errlist_objs ogg_afh"
607 audiod_audio_formats="$audiod_audio_formats ogg"
608 server_audio_formats="$server_audio_formats ogg"
610 AC_MSG_WARN([no ogg/vorbis $msg])
612 if test "$have_speex" = "yes"; then
613 all_errlist_objs="$all_errlist_objs spxdec_filter spx_afh spx_common"
614 AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support)
615 filters="$filters spxdec"
617 server_ldflags="$server_ldflags $speex_libs"
618 filter_ldflags="$filter_ldflags $speex_libs"
619 audiod_ldflags="$audiod_ldflags $speex_libs"
620 afh_ldflags="$afh_ldflags $speex_libs"
622 server_errlist_objs="$server_errlist_objs spx_afh spx_common"
623 filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
624 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
625 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
627 audiod_audio_formats="$audiod_audio_formats spx"
628 server_audio_formats="$server_audio_formats spx"
630 AC_MSG_WARN([no ogg/speex $msg])
632 CPPFLAGS="$OLD_CPPFLAGS"
633 LDFLAGS="$OLD_LDFLAGS"
635 ########################################################################### faad
637 OLD_CPPFLAGS="$CPPFLAGS"
638 OLD_LD_FLAGS="$LDFLAGS"
640 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
641 [look for neaacdec.h also in dir])])
642 if test -n "$with_faad_headers"; then
643 faad_cppflags="-I$with_faad_headers"
644 CPPFLAGS="$CPPFLAGS $faad_cppflags"
646 AC_ARG_WITH(faad_libs, [AC_HELP_STRING(--with-faad-libs=dir,
647 [look for libfaad also in dir])])
648 if test -n "$with_faad_libs"; then
649 faad_libs="-L$with_faad_libs"
650 LDFLAGS="$LDFLAGS $faad_libs"
652 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
653 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
654 if test "$have_faad" = "yes"; then
655 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
656 all_errlist_objs="$all_errlist_objs aac_common aacdec_filter aac_afh"
657 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
658 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
659 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
660 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
661 server_ldflags="$server_ldflags $faad_libs -lfaad"
662 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
663 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
664 afh_ldflags="$afh_ldflags $faad_libs -lfaad"
665 audiod_audio_formats="$audiod_audio_formats aac"
666 server_audio_formats="$server_audio_formats aac"
667 filters="$filters aacdec"
668 AC_SUBST(faad_cppflags)
670 AC_MSG_WARN([no aac support in para_audiod/para_filter])
672 CPPFLAGS="$OLD_CPPFLAGS"
673 LDFLAGS="$OLD_LDFLAGS"
675 ########################################################################### mad
677 OLD_CPPFLAGS="$CPPFLAGS"
678 OLD_LD_FLAGS="$LDFLAGS"
681 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
682 [look for mad.h also in dir])])
683 if test -n "$with_mad_headers"; then
684 mad_cppflags="-I$with_mad_headers"
685 CPPFLAGS="$CPPFLAGS $mad_cppflags"
687 AC_ARG_WITH(mad_libs, [AC_HELP_STRING(--with-mad-libs=dir,
688 [look for libmad also in dir])])
689 if test -n "$with_mad_libs"; then
690 mad_libs="-L$with_mad_libs"
691 LDFLAGS="$LDFLAGS $mad_libs"
693 AC_CHECK_HEADERS([mad.h], [], [
696 AC_CHECK_LIB([mad], [mad_stream_init], [], [
699 if test "$have_mad" = "yes"; then
700 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
701 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
702 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
703 all_errlist_objs="$all_errlist_objs mp3dec_filter"
704 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
705 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
706 filter_ldflags="$filter_ldflags $mad_libs -lmad"
707 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
708 audiod_audio_formats="$audiod_audio_formats mp3"
709 filters="$filters mp3dec"
710 AC_SUBST(mad_cppflags)
712 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
714 CPPFLAGS="$OLD_CPPFLAGS"
715 LDFLAGS="$OLD_LDFLAGS"
717 ###################################################################### libid3tag
718 AC_MSG_CHECKING(for libid3tag)
722 struct id3_tag t = {.flags = 0};
723 ],[have_libid3tag=yes],[have_libid3tag=no])
724 AC_MSG_RESULT($have_libid3tag)
725 if test ${have_libid3tag} = yes; then
726 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
727 server_ldflags="$server_ldflags -lid3tag"
728 afh_ldflags="$afh_ldflags -lid3tag"
730 AC_MSG_WARN([no support for id3v2 tags])
732 ########################################################################### flac
733 OLD_CPPFLAGS="$CPPFLAGS"
734 OLD_LD_FLAGS="$LDFLAGS"
738 AC_ARG_WITH(flac_headers, [AC_HELP_STRING(--with-flac-headers=dir,
739 [look for flac headers also in dir])])
740 if test -n "$with_flac_headers"; then
741 flac_cppflags="-I$with_flac_headers"
742 CPPFLAGS="$CPPFLAGS $flac_cppflags"
744 AC_ARG_WITH(flac_libs, [AC_HELP_STRING(--with-flac-libs=dir,
745 [look for flac libs also in dir])])
746 if test -n "$with_flac_libs"; then
747 flac_libs="-L$with_flac_libs"
748 LDFLAGS="$LDFLAGS $flac_libs"
750 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no)
751 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], have_flac=no)
752 if test "$have_flac" = "yes"; then
753 AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter)
754 all_errlist_objs="$all_errlist_objs flacdec_filter flac_afh"
755 filter_errlist_objs="$filter_errlist_objs flacdec_filter"
756 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
757 afh_errlist_objs="$afh_errlist_objs flac_afh"
758 server_errlist_objs="$server_errlist_objs flac_afh"
759 filter_ldflags="$filter_ldflags $flac_libs -lFLAC"
760 audiod_ldflags="$audiod_ldflags $flac_libs -lFLAC"
761 server_ldflags="$server_ldflags $flac_libs -lFLAC"
762 afh_ldflags="$afh_ldflags $flac_libs -lFLAC"
763 filters="$filters flacdec"
764 server_audio_formats="$server_audio_formats flac"
765 audiod_audio_formats="$audiod_audio_formats flac"
766 AC_SUBST(flac_cppflags)
768 AC_MSG_WARN([no flac support in para_audiod/para_filter])
770 CPPFLAGS="$OLD_CPPFLAGS"
771 LDFLAGS="$OLD_LDFLAGS"
773 ########################################################################### oss
774 OLD_CPPFLAGS="$CPPFLAGS"
775 OLD_LD_FLAGS="$LDFLAGS"
779 msg="=> will not build para_fade/oss writer"
781 AC_CHECK_HEADER(sys/soundcard.h, [
782 extras="$extras fade"
783 executables="$executables fade"
784 all_errlist_objs="$all_errlist_objs oss_write"
785 audiod_errlist_objs="$audiod_errlist_objs oss_write"
786 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
788 write_errlist_objs="$write_errlist_objs oss_write"
789 write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
790 writers="$writers oss"
791 default_writer="OSS_WRITE"
792 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
793 audiod_ldflags="$audiod_ldflags -lossaudio"
794 write_ldflags="$write_ldflags -lossaudio"
795 fade_ldflags="$write_ldflags -lossaudio"
801 AC_MSG_WARN([no sys/soundcard.h $msg])
804 CPPFLAGS="$OLD_CPPFLAGS"
805 LDFLAGS="$OLD_LDFLAGS"
808 ########################################################################### alsa
809 OLD_CPPFLAGS="$CPPFLAGS"
810 OLD_LD_FLAGS="$LDFLAGS"
813 msg="=> no alsa support for para_audiod/para_write"
814 if test "$OSTYPE" != "Linux"; then
819 if test "$have_alsa" = "yes"; then
820 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
822 AC_MSG_WARN([no alsa/asoundlib $msg])
826 if test "$have_alsa" = "yes"; then
827 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
829 AC_MSG_WARN([no libasound $msg])
833 if test "$have_alsa" = "yes"; then
834 all_errlist_objs="$all_errlist_objs alsa_write"
835 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
836 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
837 audiod_ldflags="$audiod_ldflags -lasound"
839 write_errlist_objs="$write_errlist_objs alsa_write"
840 write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
841 write_ldflags="$write_ldflags -lasound"
842 writers="$writers alsa"
843 default_writer="ALSA_WRITE"
846 CPPFLAGS="$OLD_CPPFLAGS"
847 LDFLAGS="$OLD_LDFLAGS"
849 ########################################################################### libao
850 OLD_CPPFLAGS="$CPPFLAGS"
851 OLD_LD_FLAGS="$LDFLAGS"
855 AC_ARG_WITH(ao_headers, [AC_HELP_STRING(--with-ao-headers=dir,
856 [look for ao/ao.h also in dir])])
857 if test -n "$with_ao_headers"; then
858 ao_cppflags="-I$with_ao_headers"
859 CPPFLAGS="$CPPFLAGS $ao_cppflags"
861 AC_ARG_WITH(ao_libs, [AC_HELP_STRING(--with-ao-libs=dir,
862 [look for libao also in dir])])
863 if test -n "$with_ao_libs"; then
864 ao_libs="-L$with_ao_libs"
865 LDFLAGS="$LDFLAGS $ao_libs"
867 msg="no libao support for para_audiod/para_write"
868 AC_CHECK_HEADERS([ao/ao.h], [
871 AC_MSG_WARN([ao.h not found, $msg])
873 if test "$have_ao" = "yes"; then
874 AC_CHECK_LIB([ao], [ao_initialize], [], [
876 AC_MSG_WARN([ao lib not found or not working, $msg])
879 if test "$have_ao" = "yes"; then
880 AC_CHECK_HEADERS([pthread.h], [
883 AC_MSG_WARN([pthread.h not found, $msg])
886 if test "$have_ao" = "yes"; then
887 AC_CHECK_LIB([pthread], [pthread_create], [], [
889 AC_MSG_WARN([pthread lib not found or not working, $msg])
892 if test "$have_ao" = "yes"; then
893 all_errlist_objs="$all_errlist_objs ao_write"
894 audiod_errlist_objs="$audiod_errlist_objs ao_write"
895 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(ao_write)"
896 audiod_ldflags="$audiod_ldflags -lao -lpthread"
898 write_errlist_objs="$write_errlist_objs ao_write"
899 write_cmdline_objs="$write_cmdline_objs add_cmdline(ao_write)"
900 write_ldflags="$write_ldflags $ao_libs -lao -lpthread"
901 writers="$writers ao"
902 AC_SUBST(ao_cppflags)
905 CPPFLAGS="$OLD_CPPFLAGS"
906 LDFLAGS="$OLD_LDFLAGS"
908 ############################################################# readline
909 OLD_CPPFLAGS="$CPPFLAGS"
910 OLD_LD_FLAGS="$LDFLAGS"
914 AC_ARG_WITH(readline_headers, [AC_HELP_STRING(--with-readline-headers=dir,
915 [look for libreadline header files also in dir])])
916 if test -n "$with_readline_headers"; then
917 readline_cppflags="-I$with_readline_headers"
918 CPPFLAGS="$CPPFLAGS $readline_cppflags"
921 AC_ARG_WITH(readline_libs, [AC_HELP_STRING(--with-readline-libs=dir,
922 [look for readline library also in dir])])
923 if test -n "$with_readline_libs"; then
924 readline_libs="-L$with_readline_libs"
925 LDFLAGS="$LDFLAGS $readline_libs"
927 msg="no interactive cli support"
928 AC_CHECK_HEADERS([readline/readline.h], [
931 AC_MSG_WARN([readline/readline.h not found, $msg])
933 if test "$have_readline" = "yes"; then
934 readline_libs="$readline_libs -lreadline"
935 AC_SEARCH_LIBS([rl_replace_line], [readline], [], [have_readline="no"])
936 if test "$have_readline" = "no"; then # try with -lcurses
938 AC_MSG_NOTICE([trying again with -lcurses])
939 unset ac_cv_search_rl_replace_line 2> /dev/null
940 AC_SEARCH_LIBS([rl_replace_line], [readline], [
942 readline_libs="$readline_libs -lcurses"
945 if test "$have_readline" = "no"; then # try with -ltermcap
947 AC_MSG_NOTICE([trying again with -ltermcap])
948 unset ac_cv_search_rl_replace_line 2> /dev/null
949 AC_SEARCH_LIBS([rl_replace_line], [readline], [
951 readline_libs="$readline_libs -ltermcap"
956 if test "$have_readline" = "yes"; then
957 all_errlist_objs="$all_errlist_objs interactive"
958 client_errlist_objs="$client_errlist_objs interactive"
959 client_ldflags="$client_ldflags $readline_libs"
960 audioc_errlist_objs="$audioc_errlist_objs buffer_tree interactive sched time"
961 audioc_ldflags="$audioc_ldflags $readline_libs"
962 AC_SUBST(readline_cppflags)
963 AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
965 AC_MSG_WARN([libreadline not found or unusable])
967 CPPFLAGS="$OLD_CPPFLAGS"
968 LDFLAGS="$OLD_LDFLAGS"
970 #############################################################
973 AC_SUBST(install_sh, [$INSTALL])
974 AC_CONFIG_FILES([Makefile])
977 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
978 AC_DEFUN([add_para],[$(for i in $@; do printf "para_$i "; done)])
979 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) }])
980 ############################################################# error2.h
981 AC_MSG_NOTICE(creating error2.h)
982 for i in $executables; do
984 eval echo \$${i}_errlist_objs
985 done | ./error2.pl > error2.h
986 for obj in $all_errlist_objs; do
987 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
989 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
991 [list of all objects that use the paraslash error facility]
994 ################################################################## status items
996 status_items="basename status num_played mtime bitrate frequency file_size
997 status_flags format score techinfo afs_mode
998 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
999 offset seconds_total stream_start current_time audiod_uptime image_id
1000 lyrics_id duration directory lyrics_name image_name path hash channels
1001 last_played num_chunks chunk_time amplification artist title year album
1005 for i in $status_items; do
1006 result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
1008 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
1009 [enum of all status items])
1012 for i in $status_items; do
1013 result="$result \"$i\", "
1015 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
1016 [char * array of all status items])
1018 AC_DEFINE_UNQUOTED(SERVER_AUDIO_FORMATS, "$server_audio_formats",
1019 [formats supported by para_server and para_afh])
1021 AC_SUBST(executables, add_para($executables))
1023 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
1024 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
1025 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
1026 server_objs="$server_cmdline_objs $server_errlist_objs"
1027 write_objs="$write_cmdline_objs $write_errlist_objs"
1028 client_objs="$client_cmdline_objs $client_errlist_objs"
1029 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
1030 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
1031 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
1033 AC_SUBST(recv_objs, add_dot_o($recv_objs))
1034 AC_SUBST(recv_ldflags, $recv_ldflags)
1035 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
1036 errors used by para_recv)
1038 AC_SUBST(filter_objs, add_dot_o($filter_objs))
1039 AC_SUBST(filter_ldflags, $filter_ldflags)
1040 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
1041 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
1043 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
1044 AC_SUBST(audiod_ldflags, $audiod_ldflags)
1045 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
1046 errors used by para_audiod)
1048 AC_SUBST(server_objs, add_dot_o($server_objs))
1049 AC_SUBST(server_ldflags, $server_ldflags)
1050 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
1051 objlist_to_errlist($server_errlist_objs), errors used by para_server)
1053 AC_SUBST(afh_objs, add_dot_o($afh_objs))
1054 AC_SUBST(afh_ldflags, $afh_ldflags)
1055 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
1056 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
1058 AC_SUBST(write_objs, add_dot_o($write_objs))
1059 AC_SUBST(write_ldflags, $write_ldflags)
1060 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
1061 objlist_to_errlist($write_errlist_objs), errors used by para_write)
1063 AC_SUBST(client_objs, add_dot_o($client_objs))
1064 AC_SUBST(client_ldflags, $client_ldflags)
1065 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
1066 objlist_to_errlist($client_errlist_objs), errors used by para_client)
1068 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
1069 AC_SUBST(audioc_ldflags, $audioc_ldflags)
1070 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
1071 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
1073 AC_SUBST(gui_objs, add_dot_o($gui_objs))
1074 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
1075 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
1077 AC_SUBST(fade_objs, add_dot_o($fade_objs))
1078 AC_SUBST(fade_ldflags, $fade_ldflags)
1079 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
1080 objlist_to_errlist($fade_errlist_objs), errors used by para_fade)
1083 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
1084 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
1085 enum of supported filters)
1086 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
1087 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
1088 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
1089 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
1091 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
1092 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
1093 enum of supported writers)
1094 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
1095 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
1096 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
1097 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
1098 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
1099 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
1100 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
1102 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
1103 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
1104 enum of audio formats supported by audiod)
1105 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
1106 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
1110 paraslash configuration:
1111 ~~~~~~~~~~~~~~~~~~~~~~~~
1112 unix socket credentials: $have_ucred
1113 readline (interactive CLIs): $have_readline
1114 audio formats supported by para_server/para_afh: $server_audio_formats
1115 id3 version2 support: $have_libid3tag
1116 filters supported by para_audiod/para_filter: $filters
1117 writers supported by para_audiod/para_write: $writers
1118 optional executables: $extras