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 crypt 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
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
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 crypt 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 crypt http_send close_on_fork mm
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 crypt fd sched stdin stdout time
156 client_common buffer_tree"
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 ###################################################################### openssl
285 OLD_CPPFLAGS="$CPPFLAGS"
286 OLD_LD_FLAGS="$LDFLAGS"
289 AC_ARG_WITH(openssl_headers, [AC_HELP_STRING(--with-openssl-headers=dir,
290 [look for openssl headers also in dir])])
291 if test -n "$with_openssl_headers"; then
292 openssl_cppflags="-I$with_openssl_headers"
293 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
295 AC_ARG_WITH(openssl_libs, [AC_HELP_STRING(--with-openssl-libs=dir,
296 [look for openssl libraries also in dir])])
297 if test -n "$with_openssl_libs"; then
298 openssl_libs="-L$with_openssl_libs"
299 LDFLAGS="$LDFLAGS $openssl_libs"
301 AC_CHECK_HEADER(openssl/ssl.h, [], [have_openssl="no"])
302 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
303 if test "$have_openssl" = "no" -a -z "$with_openssl_headers$with_openssl_libs"; then
304 # try harder: openssl is sometimes installed in /usr/local/ssl
305 openssl_cppflags="-I/usr/local/ssl/include"
306 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
307 openssl_libs="-L/usr/local/ssl/lib"
308 LDFLAGS="$LDFLAGS $openssl_libs"
310 unset ac_cv_header_openssl_ssl_h 2> /dev/null
311 unset ac_cv_lib_crypto_RAND_bytes 2> /dev/null
312 AC_CHECK_HEADER(openssl/ssl.h, [have_openssl="yes"], [])
313 if test "$have_openssl" = "yes"; then
314 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
317 if test "$have_openssl" = "yes"; then
318 AC_DEFINE(HAVE_OPENSSL, 1, [define to 1 to turn on openssl support])
319 AC_SUBST(openssl_cppflags)
320 openssl_libs="$openssl_libs -lssl -lcrypto"
321 server_ldflags="$server_ldflags $openssl_libs"
322 client_ldflags="$client_ldflags $openssl_libs"
323 audiod_ldflags="$audiod_ldflags $openssl_libs"
325 AC_MSG_ERROR([openssl libraries not found])
327 CPPFLAGS="$OLD_CPPFLAGS"
328 LDFLAGS="$OLD_LDFLAGS"
330 ########################################################################### libsocket
331 AC_CHECK_LIB([c], [socket],
333 [socket_lib="-lsocket"]
335 server_ldflags="$server_ldflags $socket_lib"
336 client_ldflags="$client_ldflags $socket_lib"
337 audioc_ldflags="$audioc_ldflags $socket_lib"
338 audiod_ldflags="$audiod_ldflags $socket_lib"
339 recv_ldflags="$recv_ldflags $socket_lib"
340 AC_SEARCH_LIBS([connect],[socket],[],[
341 AC_MSG_ERROR([Fatal: Did not find connect().])
343 ########################################################################### libnsl
344 AC_CHECK_LIB([c], [gethostbyname],
348 server_ldflags="$server_ldflags $nsl_lib"
349 client_ldflags="$client_ldflags $nsl_lib"
350 audioc_ldflags="$audioc_ldflags $nsl_lib"
351 recv_ldflags="$recv_ldflags $nsl_lib"
352 AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
353 AC_MSG_ERROR([Fatal: Did not find inet_ntoa().])
355 ########################################################################### ucred
356 AC_MSG_CHECKING(for struct ucred)
359 #include <sys/types.h>
360 #include <sys/socket.h>
362 struct ucred sucred; sucred.pid=0;
363 ],[have_ucred=yes],[have_ucred=no])
364 AC_MSG_RESULT($have_ucred)
365 if test ${have_ucred} = yes; then
366 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
369 ########################################################################### curses
371 OLD_CPPFLAGS="$CPPFLAGS"
372 OLD_LD_FLAGS="$LDFLAGS"
374 AC_ARG_WITH(curses_headers, [AC_HELP_STRING(--with-curses-headers=dir,
375 [look for curses.h also in dir])])
376 if test -n "$with_curses_headers"; then
377 curses_cppflags="-I$with_curses_headers"
378 CPPFLAGS="$CPPFLAGS $curses_cppflags"
380 AC_ARG_WITH(curses_libs, [AC_HELP_STRING(--with-curses-libs=dir,
381 [look for libcurses also in dir])])
382 if test -n "$with_curses_libs"; then
383 curses_libs="-L$with_curses_libs"
384 LDFLAGS="$LDFLAGS $curses_libs"
386 AC_CHECK_HEADER(curses.h, [], [
389 AC_CHECK_LIB([curses], [initscr], [], [
392 if test "$have_curses" = "yes"; then
393 AC_SUBST(curses_cppflags)
394 AC_DEFINE(HAVE_NCURSES, 1, [define to 1 to turn on curses support])
396 executables="$executables gui"
398 AC_MSG_WARN([cannot build para_gui])
400 CPPFLAGS="$OLD_CPPFLAGS"
401 LDFLAGS="$OLD_LDFLAGS"
404 ########################################################################### ip_mreqn
405 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
412 ],[have_ip_mreqn=yes],[have_ip_mreqn=no])
413 AC_MSG_RESULT($have_ip_mreqn)
414 if test ${have_ip_mreqn} = yes; then
415 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
417 ########################################################################### osx
419 AC_MSG_CHECKING(for CoreAudio (MacOs))
421 #include <CoreAudio/CoreAudio.h>
424 ],[have_core_audio=yes],[have_core_audio=no])
425 AC_MSG_RESULT($have_core_audio)
426 if test ${have_core_audio} = yes; then
427 f1="-framework CoreAudio"
428 f2="-framework AudioToolbox"
429 f3="-framework AudioUnit"
430 f4="-framework CoreServices"
433 all_errlist_objs="$all_errlist_objs osx_write"
434 audiod_errlist_objs="$audiod_errlist_objs osx_write"
435 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
436 audiod_ldflags="$audiod_ldflags $f"
438 write_errlist_objs="$write_errlist_objs osx_write"
439 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
440 write_ldflags="$write_ldflags $f"
441 writers="$writers osx"
442 default_writer="OSX_WRITE"
443 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
445 ########################################################### ogg/vorbis/speex
447 OLD_CPPFLAGS="$CPPFLAGS"
448 OLD_LD_FLAGS="$LDFLAGS"
450 AC_ARG_WITH(ogg_headers, [AC_HELP_STRING(--with-ogg-headers=dir,
451 [look for ogg headers also in dir])])
452 AC_ARG_WITH(ogg_libs, [AC_HELP_STRING(--with-ogg-libs=dir,
453 [look for ogg libs also in dir])])
454 AC_ARG_WITH(vorbis_headers, [AC_HELP_STRING(--with-vorbis-headers=dir,
455 [look for vorbis headers also in dir])])
456 AC_ARG_WITH(vorbis_libs, [AC_HELP_STRING(--with-vorbis-libs=dir,
457 [look for vorbis libs also in dir])])
458 AC_ARG_WITH(speex_headers, [AC_HELP_STRING(--with-speex-headers=dir,
459 [look for speex headers also in dir])])
460 AC_ARG_WITH(speex_libs, [AC_HELP_STRING(--with-speex-libs=dir,
461 [look for speex libs also in dir])])
463 if test -n "$with_ogg_headers"; then
464 ogg_cppflags="-I$with_ogg_headers"
465 CPPFLAGS="$CPPFLAGS $ogg_cppflags"
467 if test -n "$with_ogg_libs"; then
468 ogg_libs="-L$with_ogg_libs"
469 LDFLAGS="$LDFLAGS $ogg_libs"
471 AC_CHECK_HEADERS([ogg/ogg.h], [], [ have_ogg="no"; ])
472 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
476 if test "$have_ogg" = "yes"; then
478 if test -n "$with_vorbis_headers"; then
479 vorbis_cppflags="-I$with_vorbis_headers"
480 CPPFLAGS="$CPPFLAGS $vorbis_cppflags"
482 if test -n "$with_vorbis_libs"; then
483 vorbis_libs="-L$with_vorbis_libs"
484 LDFLAGS="$LDFLAGS $vorbis_libs"
486 AC_CHECK_HEADERS([vorbis/codec.h], [], [ have_vorbis="no" ])
487 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_vorbis="no" ])
490 if test -n "$with_speex_headers"; then
491 speex_cppflags="-I$with_speex_headers"
492 CPPFLAGS="$CPPFLAGS $speex_cppflags"
494 if test -n "$with_speex_libs"; then
495 speex_libs="-L$with_speex_libs"
496 LDFLAGS="$LDFLAGS $speex_libs"
498 AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ])
499 AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ])
505 msg="support in para_server/para_filter/para_afh"
506 if test "$have_vorbis" = "yes" || test "$have_speex" = "yes"; then
507 AC_SUBST(ogg_cppflags)
508 ogg_libs="$ogg_libs -logg"
509 if test "$OSTYPE" = "Darwin"; then
510 ogg_libs="-Wl,-bind_at_load $ogg_libs"
512 server_ldflags="$server_ldflags $ogg_libs"
513 filter_ldflags="$filter_ldflags $ogg_libs"
514 audiod_ldflags="$audiod_ldflags $ogg_libs"
515 afh_ldflags="$afh_ldflags $ogg_libs"
516 all_errlist_objs="$all_errlist_objs ogg_afh_common"
517 afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
518 server_errlist_objs="$server_errlist_objs ogg_afh_common"
520 AC_MSG_WARN([vorbis/speex require ogg])
522 if test "$have_vorbis" = "yes"; then
523 all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh"
524 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support)
525 filters="$filters oggdec"
526 vorbis_libs="-lvorbis -lvorbisfile"
527 server_ldflags="$server_ldflags $vorbis_libs"
528 filter_ldflags="$filter_ldflags $vorbis_libs"
529 audiod_ldflags="$audiod_ldflags $vorbis_libs"
530 afh_ldflags="$afh_ldflags $vorbis_libs"
532 server_errlist_objs="$server_errlist_objs ogg_afh"
533 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
534 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
535 afh_errlist_objs="$afh_errlist_objs ogg_afh"
537 audiod_audio_formats="$audiod_audio_formats ogg"
538 server_audio_formats="$server_audio_formats ogg"
540 AC_MSG_WARN([no ogg/vorbis $msg])
542 if test "$have_speex" = "yes"; then
543 all_errlist_objs="$all_errlist_objs spxdec_filter spx_afh spx_common"
544 AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support)
545 filters="$filters spxdec"
547 server_ldflags="$server_ldflags $speex_libs"
548 filter_ldflags="$filter_ldflags $speex_libs"
549 audiod_ldflags="$audiod_ldflags $speex_libs"
550 afh_ldflags="$afh_ldflags $speex_libs"
552 server_errlist_objs="$server_errlist_objs spx_afh spx_common"
553 filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
554 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
555 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
557 audiod_audio_formats="$audiod_audio_formats spx"
558 server_audio_formats="$server_audio_formats spx"
560 AC_MSG_WARN([no ogg/speex $msg])
562 CPPFLAGS="$OLD_CPPFLAGS"
563 LDFLAGS="$OLD_LDFLAGS"
565 ########################################################################### faad
567 OLD_CPPFLAGS="$CPPFLAGS"
568 OLD_LD_FLAGS="$LDFLAGS"
570 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
571 [look for neaacdec.h also in dir])])
572 if test -n "$with_faad_headers"; then
573 faad_cppflags="-I$with_faad_headers"
574 CPPFLAGS="$CPPFLAGS $faad_cppflags"
576 AC_ARG_WITH(faad_libs, [AC_HELP_STRING(--with-faad-libs=dir,
577 [look for libfaad also in dir])])
578 if test -n "$with_faad_libs"; then
579 faad_libs="-L$with_faad_libs"
580 LDFLAGS="$LDFLAGS $faad_libs"
582 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
583 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
584 if test "$have_faad" = "yes"; then
585 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
586 all_errlist_objs="$all_errlist_objs aac_common aacdec_filter aac_afh"
587 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
588 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
589 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
590 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
591 server_ldflags="$server_ldflags $faad_libs -lfaad"
592 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
593 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
594 afh_ldflags="$afh_ldflags $faad_libs -lfaad"
595 audiod_audio_formats="$audiod_audio_formats aac"
596 server_audio_formats="$server_audio_formats aac"
597 filters="$filters aacdec"
598 AC_SUBST(faad_cppflags)
600 AC_MSG_WARN([no aac support in para_audiod/para_filter])
602 CPPFLAGS="$OLD_CPPFLAGS"
603 LDFLAGS="$OLD_LDFLAGS"
605 ########################################################################### mad
607 OLD_CPPFLAGS="$CPPFLAGS"
608 OLD_LD_FLAGS="$LDFLAGS"
611 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
612 [look for mad.h also in dir])])
613 if test -n "$with_mad_headers"; then
614 mad_cppflags="-I$with_mad_headers"
615 CPPFLAGS="$CPPFLAGS $mad_cppflags"
617 AC_ARG_WITH(mad_libs, [AC_HELP_STRING(--with-mad-libs=dir,
618 [look for libmad also in dir])])
619 if test -n "$with_mad_libs"; then
620 mad_libs="-L$with_mad_libs"
621 LDFLAGS="$LDFLAGS $mad_libs"
623 AC_CHECK_HEADERS([mad.h], [], [
626 AC_CHECK_LIB([mad], [mad_stream_init], [], [
629 if test "$have_mad" = "yes"; then
630 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
631 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
632 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
633 all_errlist_objs="$all_errlist_objs mp3dec_filter"
634 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
635 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
636 filter_ldflags="$filter_ldflags $mad_libs -lmad"
637 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
638 audiod_audio_formats="$audiod_audio_formats mp3"
639 filters="$filters mp3dec"
640 AC_SUBST(mad_cppflags)
642 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
644 CPPFLAGS="$OLD_CPPFLAGS"
645 LDFLAGS="$OLD_LDFLAGS"
647 ###################################################################### libid3tag
648 AC_MSG_CHECKING(for libid3tag)
652 struct id3_tag t = {.flags = 0};
653 ],[have_libid3tag=yes],[have_libid3tag=no])
654 AC_MSG_RESULT($have_libid3tag)
655 if test ${have_libid3tag} = yes; then
656 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
657 server_ldflags="$server_ldflags -lid3tag"
658 afh_ldflags="$afh_ldflags -lid3tag"
660 AC_MSG_WARN([no support for id3v2 tags])
662 ########################################################################### oss
663 OLD_CPPFLAGS="$CPPFLAGS"
664 OLD_LD_FLAGS="$LDFLAGS"
668 msg="=> will not build para_fade/oss writer"
670 AC_CHECK_HEADER(sys/soundcard.h, [
671 extras="$extras fade"
672 executables="$executables fade"
673 all_errlist_objs="$all_errlist_objs oss_write"
674 audiod_errlist_objs="$audiod_errlist_objs oss_write"
675 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
677 write_errlist_objs="$write_errlist_objs oss_write"
678 write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
679 writers="$writers oss"
680 default_writer="OSS_WRITE"
681 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
682 audiod_ldflags="$audiod_ldflags -lossaudio"
683 write_ldflags="$write_ldflags -lossaudio"
684 fade_ldflags="$write_ldflags -lossaudio"
690 AC_MSG_WARN([no sys/soundcard.h $msg])
693 CPPFLAGS="$OLD_CPPFLAGS"
694 LDFLAGS="$OLD_LDFLAGS"
697 ########################################################################### alsa
698 OLD_CPPFLAGS="$CPPFLAGS"
699 OLD_LD_FLAGS="$LDFLAGS"
702 msg="=> no alsa support for para_audiod/para_write"
703 if test "$OSTYPE" != "Linux"; then
708 if test "$have_alsa" = "yes"; then
709 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
711 AC_MSG_WARN([no alsa/asoundlib $msg])
715 if test "$have_alsa" = "yes"; then
716 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
718 AC_MSG_WARN([no libasound $msg])
722 if test "$have_alsa" = "yes"; then
723 all_errlist_objs="$all_errlist_objs alsa_write"
724 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
725 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
726 audiod_ldflags="$audiod_ldflags -lasound"
728 write_errlist_objs="$write_errlist_objs alsa_write"
729 write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
730 write_ldflags="$write_ldflags -lasound"
731 writers="$writers alsa"
732 default_writer="ALSA_WRITE"
735 CPPFLAGS="$OLD_CPPFLAGS"
736 LDFLAGS="$OLD_LDFLAGS"
738 ########################################################################### libao
739 OLD_CPPFLAGS="$CPPFLAGS"
740 OLD_LD_FLAGS="$LDFLAGS"
744 AC_ARG_WITH(ao_headers, [AC_HELP_STRING(--with-ao-headers=dir,
745 [look for ao/ao.h also in dir])])
746 if test -n "$with_ao_headers"; then
747 ao_cppflags="-I$with_ao_headers"
748 CPPFLAGS="$CPPFLAGS $ao_cppflags"
750 AC_ARG_WITH(ao_libs, [AC_HELP_STRING(--with-ao-libs=dir,
751 [look for libao also in dir])])
752 if test -n "$with_ao_libs"; then
753 ao_libs="-L$with_ao_libs"
754 LDFLAGS="$LDFLAGS $ao_libs"
756 msg="no libao support for para_audiod/para_write"
757 AC_CHECK_HEADERS([ao/ao.h], [
760 AC_MSG_WARN([ao.h not found, $msg])
762 if test "$have_ao" = "yes"; then
763 AC_CHECK_LIB([ao], [ao_initialize], [], [
765 AC_MSG_WARN([ao lib not found or not working, $msg])
768 if test "$have_ao" = "yes"; then
769 AC_CHECK_HEADERS([pthread.h], [
772 AC_MSG_WARN([pthread.h not found, $msg])
775 if test "$have_ao" = "yes"; then
776 AC_CHECK_LIB([pthread], [pthread_create], [], [
778 AC_MSG_WARN([pthread lib not found or not working, $msg])
781 if test "$have_ao" = "yes"; then
782 all_errlist_objs="$all_errlist_objs ao_write"
783 audiod_errlist_objs="$audiod_errlist_objs ao_write"
784 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(ao_write)"
785 audiod_ldflags="$audiod_ldflags -lao -lpthread"
787 write_errlist_objs="$write_errlist_objs ao_write"
788 write_cmdline_objs="$write_cmdline_objs add_cmdline(ao_write)"
789 write_ldflags="$write_ldflags $ao_libs -lao -lpthread"
790 writers="$writers ao"
791 AC_SUBST(ao_cppflags)
794 CPPFLAGS="$OLD_CPPFLAGS"
795 LDFLAGS="$OLD_LDFLAGS"
800 AC_SUBST(install_sh, [$INSTALL])
801 AC_CONFIG_FILES([Makefile])
804 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
805 AC_DEFUN([add_para],[$(for i in $@; do printf "para_$i "; done)])
806 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) }])
807 ############################################################# error2.h
808 AC_MSG_NOTICE(creating error2.h)
809 for i in $executables; do
811 eval echo \$${i}_errlist_objs
812 done | ./error2.pl > error2.h
813 for obj in $all_errlist_objs; do
814 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
816 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
818 [list of all objects that use paraslash's error facility]
821 ################################################################## status items
823 status_items="basename status num_played mtime bitrate frequency file_size
824 status_flags format score techinfo afs_mode
825 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
826 offset seconds_total stream_start current_time audiod_uptime image_id
827 lyrics_id duration directory lyrics_name image_name path hash channels
828 last_played num_chunks chunk_time amplification artist title year album
832 for i in $status_items; do
833 result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
835 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
836 [enum of all status items])
839 for i in $status_items; do
840 result="$result \"$i\", "
842 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
843 [char * array of all status items])
845 AC_DEFINE_UNQUOTED(SERVER_AUDIO_FORMATS, "$server_audio_formats",
846 [formats supported by para_server and para_afh])
848 AC_SUBST(executables, add_para($executables))
850 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
851 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
852 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
853 server_objs="$server_cmdline_objs $server_errlist_objs"
854 write_objs="$write_cmdline_objs $write_errlist_objs"
855 client_objs="$client_cmdline_objs $client_errlist_objs"
856 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
857 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
858 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
860 AC_SUBST(recv_objs, add_dot_o($recv_objs))
861 AC_SUBST(recv_ldflags, $recv_ldflags)
862 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
863 errors used by para_recv)
865 AC_SUBST(filter_objs, add_dot_o($filter_objs))
866 AC_SUBST(filter_ldflags, $filter_ldflags)
867 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
868 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
870 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
871 AC_SUBST(audiod_ldflags, $audiod_ldflags)
872 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
873 errors used by para_audiod)
875 AC_SUBST(server_objs, add_dot_o($server_objs))
876 AC_SUBST(server_ldflags, $server_ldflags)
877 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
878 objlist_to_errlist($server_errlist_objs), errors used by para_server)
880 AC_SUBST(afh_objs, add_dot_o($afh_objs))
881 AC_SUBST(afh_ldflags, $afh_ldflags)
882 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
883 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
885 AC_SUBST(write_objs, add_dot_o($write_objs))
886 AC_SUBST(write_ldflags, $write_ldflags)
887 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
888 objlist_to_errlist($write_errlist_objs), errors used by para_write)
890 AC_SUBST(client_objs, add_dot_o($client_objs))
891 AC_SUBST(client_ldflags, $client_ldflags)
892 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
893 objlist_to_errlist($client_errlist_objs), errors used by para_client)
895 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
896 AC_SUBST(audioc_ldflags, $audioc_ldflags)
897 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
898 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
900 AC_SUBST(gui_objs, add_dot_o($gui_objs))
901 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
902 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
904 AC_SUBST(fade_objs, add_dot_o($fade_objs))
905 AC_SUBST(fade_ldflags, $fade_ldflags)
906 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
907 objlist_to_errlist($fade_errlist_objs), errors used by para_fade)
910 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
911 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
912 enum of supported filters)
913 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
914 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
915 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
916 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
918 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
919 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
920 enum of supported writers)
921 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
922 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
923 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
924 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
925 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
926 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
927 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
929 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
930 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
931 enum of audio formats supported by audiod)
932 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
933 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
937 paraslash configuration:
938 ~~~~~~~~~~~~~~~~~~~~~~~~
939 unix socket credentials: $have_ucred
940 audio formats supported by para_server/para_afh: $server_audio_formats
941 id3 version2 support: $have_libid3tag
942 filters supported by para_audiod/para_filter: $filters
943 writers supported by para_audiod/para_write: $writers
944 optional executables: $extras