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)
34 AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h \
35 stdlib.h string.h sys/socket.h sys/time.h sys/timeb.h sys/un.h \
36 sys/ipc.h unistd.h utime.h stddef.h],
37 [], [AC_MSG_ERROR([$ac_header not found])])
40 # Checks for typedefs, structures, and compiler characteristics.
59 # Checks for library functions.
61 AC_PROG_GCC_TRADITIONAL
67 AC_FUNC_SELECT_ARGTYPES
75 AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
76 regcomp select strchr strdup strerror strstr strtol uname \
77 fchdir gettimeofday localtime_r munmap strcasecmp strcspn \
78 strncasecmp strrchr strspn alarm mkdir rmdir], [],
79 [AC_MSG_ERROR([function not found, cannot live without it])])
83 AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; done)])
86 all_errlist_objs="server mp3_afh afh_common vss command net string signal time
87 daemon stat crypt http_send close_on_fork ipc acl afh fade amp_filter
88 dccp_send fd user_list chunk_queue afs aft mood score attribute blob ringbuffer
89 playlist sha1 sched audiod grab_client filter_common wav_filter compress_filter
90 http_recv dccp_recv recv_common write_common file_write audiod_command
91 client_common recv stdout filter stdin audioc write client exec send_common ggo
92 udp_recv udp_send color fec fecdec_filter prebuffer_filter mm
93 server_command_list afs_command_list audiod_command_list bitstream imdct wma_afh
94 wma_common wmadec_filter buffer_tree
97 executables="server recv filter audioc write client afh audiod"
99 recv_cmdline_objs="add_cmdline(recv http_recv dccp_recv udp_recv)"
101 recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
102 fd sched stdout ggo udp_recv fec buffer_tree"
105 filter_cmdline_objs="add_cmdline(filter compress_filter amp_filter prebuffer_filter)"
106 filter_errlist_objs="filter_common wav_filter compress_filter filter string
107 stdin stdout sched fd amp_filter ggo fecdec_filter fec
108 prebuffer_filter time bitstream imdct wma_common wmadec_filter buffer_tree"
110 filters=" compress wav amp fecdec wmadec prebuffer"
112 audioc_cmdline_objs="add_cmdline(audioc)"
113 audioc_errlist_objs="audioc string net fd"
116 audiod_cmdline_objs="add_cmdline(audiod compress_filter http_recv dccp_recv file_write client amp_filter udp_recv prebuffer_filter)"
117 audiod_errlist_objs="audiod signal string daemon stat net
118 time grab_client filter_common wav_filter compress_filter amp_filter http_recv dccp_recv
119 recv_common fd sched write_common file_write audiod_command crypt fecdec_filter
120 client_common ggo udp_recv color fec prebuffer_filter sha1 audiod_command_list
121 bitstream imdct wma_common wmadec_filter buffer_tree"
123 audiod_audio_formats="wma"
125 afh_cmdline_objs="add_cmdline(afh)"
126 afh_errlist_objs="afh string fd mp3_afh afh_common time wma_afh wma_common"
129 server_cmdline_objs="add_cmdline(server)"
130 server_errlist_objs="server afh_common mp3_afh vss command net string signal
131 time daemon crypt http_send close_on_fork mm
132 ipc dccp_send fd user_list chunk_queue afs aft mood score attribute
133 blob playlist sha1 sched acl send_common udp_send color fec
134 server_command_list afs_command_list wma_afh wma_common"
135 server_ldflags="-losl"
136 server_audio_formats=" mp3 wma"
138 write_cmdline_objs="add_cmdline(write file_write)"
139 write_errlist_objs="write write_common file_write time fd string sched stdin
143 default_writer="FILE_WRITE"
145 client_cmdline_objs="add_cmdline(client)"
146 client_errlist_objs="client net string crypt fd sched stdin stdout time
147 client_common sha1 buffer_tree"
150 gui_cmdline_objs="add_cmdline(gui)"
151 gui_errlist_objs="exec signal string stat ringbuffer fd"
152 gui_other_objs="gui gui_theme"
153 gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
155 fade_cmdline_objs="add_cmdline(fade)"
156 fade_errlist_objs="fade exec string fd"
159 ########################################################################### snprintf
160 # ===========================================================================
161 # http://www.nongnu.org/autoconf-archive/ax_func_snprintf.html
162 # ===========================================================================
170 # Checks for a fully C99 compliant snprintf, in particular checks whether
171 # it does bounds checking and returns the correct string length; does the
172 # same check for vsnprintf. If no working snprintf or vsnprintf is found,
173 # it prints an error message and aborts.
177 # Copyright (c) 2008 Ruediger Kuhlmann <info@ruediger-kuhlmann.de>
179 # Copying and distribution of this file, with or without modification, are
180 # permitted in any medium without royalty provided the copyright notice
181 # and this notice are preserved.
183 AU_ALIAS([AC_FUNC_SNPRINTF], [AX_FUNC_SNPRINTF])
184 AC_DEFUN([AX_FUNC_SNPRINTF],
185 [AC_CHECK_FUNCS(snprintf vsnprintf)
186 AC_MSG_CHECKING(for working snprintf)
187 AC_CACHE_VAL(ac_cv_have_working_snprintf,
193 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
194 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
196 i = snprintf (bufs, 2, "%s", "111");
197 if (strcmp (bufs, "1")) exit (1);
198 if (i != 3) exit (1);
199 i = snprintf (bufd, 2, "%d", 111);
200 if (strcmp (bufd, "1")) exit (1);
201 if (i != 3) exit (1);
203 }], ac_cv_have_working_snprintf=yes, ac_cv_have_working_snprintf=no, ac_cv_have_working_snprintf=cross)])
204 AC_MSG_RESULT([$ac_cv_have_working_snprintf])
205 AC_MSG_CHECKING(for working vsnprintf)
206 AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
211 int my_vsnprintf (char *buf, const char *tmpl, ...)
215 va_start (args, tmpl);
216 i = vsnprintf (buf, 2, tmpl, args);
223 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
224 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
226 i = my_vsnprintf (bufs, "%s", "111");
227 if (strcmp (bufs, "1")) exit (1);
228 if (i != 3) exit (1);
229 i = my_vsnprintf (bufd, "%d", 111);
230 if (strcmp (bufd, "1")) exit (1);
231 if (i != 3) exit (1);
233 }], ac_cv_have_working_vsnprintf=yes, ac_cv_have_working_vsnprintf=no, ac_cv_have_working_vsnprintf=cross)])
234 AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
235 if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
236 AC_MSG_ERROR([fatal: buggy snprintf() detected])
239 ########################################################################### osl
241 OLD_CPPFLAGS="$CPPFLAGS"
242 OLD_LD_FLAGS="$LDFLAGS"
244 AC_ARG_WITH(osl_headers, [AC_HELP_STRING(--with-osl-headers=dir,
245 [look for osl.h also in dir])])
246 if test -n "$with_osl_headers"; then
247 osl_cppflags="-I$with_osl_headers"
248 CPPFLAGS="$CPPFLAGS $osl_cppflags"
250 AC_ARG_WITH(osl_libs, [AC_HELP_STRING(--with-osl-libs=dir,
251 [look for libosl also in dir])])
252 if test -n "$with_osl_libs"; then
253 osl_libs="-L$with_osl_libs"
254 LDFLAGS="$LDFLAGS $osl_libs"
257 AC_CHECK_HEADER(osl.h, [], have_osl=no)
258 AC_CHECK_LIB([osl], [osl_open_table], [], have_osl=no)
259 if test "$have_osl" = "no"; then
260 AC_MSG_ERROR([libosl not found, download it at
261 http://systemlinux.org/~maan/osl
263 git clone git://git.tuebingen.mpg.de/osl
266 AC_SUBST(osl_cppflags)
267 server_ldflags="$server_ldflags -L$with_osl_libs"
268 CPPFLAGS="$OLD_CPPFLAGS"
269 LDFLAGS="$OLD_LDFLAGS"
271 ########################################################################### ssl
272 dnl @synopsis CHECK_SSL
274 dnl based on the follwing macro from the autoconf archive
276 dnl @category InstalledPackages
277 dnl @author Mark Ethan Trostler <trostler@juniper.net>
278 dnl @version 2003-01-28
279 dnl @license AllPermissive
281 AC_DEFUN([CHECK_SSL],
283 for ssldir in $1 /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
284 AC_MSG_CHECKING(for openssl in $ssldir)
285 if test -f "$ssldir/include/openssl/ssl.h"; then
288 SSL_CFLAGS="-I$ssldir/include"
289 SSL_CPPFLAGS="-I$ssldir/include"
294 if test x_$found_ssl != x_yes; then
295 AC_MSG_ERROR(Cannot find ssl libraries)
297 SSL_LIBS="-lssl -lcrypto";
298 SSL_LDFLAGS="-L$ssldir/lib";
300 AC_SUBST(SSL_CPPFLAGS)
303 AC_ARG_ENABLE(ssldir, [AS_HELP_STRING(--enable-ssldir=path,
304 [Search for openssl also in path.])])
305 if test "$enable_ssldir" = "yes"; then enable_ssldir=""; fi
306 CHECK_SSL($enable_ssldir)
307 server_ldflags="$server_ldflags $SSL_LDFLAGS $SSL_LIBS"
308 client_ldflags="$client_ldflags $SSL_LDFLAGS $SSL_LIBS"
309 audiod_ldflags="$audiod_ldflags $SSL_LDFLAGS $SSL_LIBS"
311 ########################################################################### libsocket
312 AC_CHECK_LIB([c], [socket],
314 [socket_lib="-lsocket"]
316 server_ldflags="$server_ldflags $socket_lib"
317 client_ldflags="$client_ldflags $socket_lib"
318 audioc_ldflags="$audioc_ldflags $socket_lib"
319 audiod_ldflags="$audiod_ldflags $socket_lib"
320 recv_ldflags="$recv_ldflags $socket_lib"
321 AC_SEARCH_LIBS([connect],[socket],[],[
322 AC_MSG_ERROR([Fatal: Did not find connect().])
324 ########################################################################### libnsl
325 AC_CHECK_LIB([c], [gethostbyname],
329 server_ldflags="$server_ldflags $nsl_lib"
330 client_ldflags="$client_ldflags $nsl_lib"
331 audioc_ldflags="$audioc_ldflags $nsl_lib"
332 recv_ldflags="$recv_ldflags $nsl_lib"
333 AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
334 AC_MSG_ERROR([Fatal: Did not find inet_ntoa().])
336 ########################################################################### ucred
337 AC_MSG_CHECKING(for struct ucred)
340 #include <sys/types.h>
341 #include <sys/socket.h>
343 struct ucred sucred; sucred.pid=0;
344 ],[have_ucred=yes],[have_ucred=no])
345 AC_MSG_RESULT($have_ucred)
346 if test ${have_ucred} = yes; then
347 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
350 ########################################################################### curses
352 OLD_CPPFLAGS="$CPPFLAGS"
353 OLD_LD_FLAGS="$LDFLAGS"
355 AC_ARG_WITH(ncurses_headers, [AC_HELP_STRING(--with-ncurses-headers=dir,
356 [look for ncurses.h also in dir])])
357 if test -n "$with_ncurses_headers"; then
358 ncurses_cppflags="-I$with_ncurses_headers"
359 CPPFLAGS="$CPPFLAGS $ncurses_cppflags"
361 AC_ARG_WITH(ncurses_libs, [AC_HELP_STRING(--with-ncurses-libs=dir,
362 [look for libncurses also in dir])])
363 if test -n "$with_ncurses_libs"; then
364 ncurses_libs="-L$with_ncurses_libs"
365 LDFLAGS="$LDFLAGS $ncurses_libs"
367 AC_CHECK_HEADER(curses.h, [], [
370 AC_CHECK_LIB([ncurses], [initscr], [], [
373 if test "$have_ncurses" = "yes"; then
374 AC_SUBST(ncurses_cppflags)
375 AC_DEFINE(HAVE_NCURSES, 1, [define to 1 to turn on ncurses support])
377 executables="$executables gui"
379 AC_MSG_WARN([cannot build para_gui])
381 CPPFLAGS="$OLD_CPPFLAGS"
382 LDFLAGS="$OLD_LDFLAGS"
385 ########################################################################### ip_mreqn
386 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
393 ],[have_ip_mreqn=yes],[have_ip_mreqn=no])
394 AC_MSG_RESULT($have_ip_mreqn)
395 if test ${have_ip_mreqn} = yes; then
396 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
398 ########################################################################### osx
400 AC_MSG_CHECKING(for CoreAudio (MacOs))
402 #include <CoreAudio/CoreAudio.h>
405 ],[have_core_audio=yes],[have_core_audio=no])
406 AC_MSG_RESULT($have_core_audio)
407 if test ${have_core_audio} = yes; then
408 f1="-framework CoreAudio"
409 f2="-framework AudioToolbox"
410 f3="-framework AudioUnit"
411 f4="-framework CoreServices"
414 all_errlist_objs="$all_errlist_objs osx_write"
415 audiod_errlist_objs="$audiod_errlist_objs osx_write"
416 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
417 audiod_ldflags="$audiod_ldflags $f"
419 write_errlist_objs="$write_errlist_objs osx_write"
420 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
421 write_ldflags="$write_ldflags $f"
422 writers="$writers osx"
423 default_writer="OSX_WRITE"
424 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
426 ########################################################################### ogg
428 OLD_CPPFLAGS="$CPPFLAGS"
429 OLD_LD_FLAGS="$LDFLAGS"
431 AC_ARG_WITH(oggvorbis_headers, [AC_HELP_STRING(--with-oggvorbis-headers=dir,
432 [look for vorbis/codec.h also in dir])])
433 if test -n "$with_oggvorbis_headers"; then
434 oggvorbis_cppflags="-I$with_oggvorbis_headers"
435 CPPFLAGS="$CPPFLAGS $oggvorbis_cppflags"
437 AC_ARG_WITH(oggvorbis_libs, [AC_HELP_STRING(--with-oggvorbis-libs=dir,
438 [look for oggvorbis libs also in dir])])
439 if test -n "$with_oggvorbis_libs"; then
440 oggvorbis_libs="-L$with_oggvorbis_libs"
441 LDFLAGS="$LDFLAGS $oggvorbis_libs"
444 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
445 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_ogg="no" ])
446 AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [ have_ogg="no" ])
447 if test "$have_ogg" = "yes"; then
448 all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh"
449 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support)
450 filters="$filters oggdec"
451 if test "$OSTYPE" = "Darwin"; then
452 oggvorbis_libs="-Wl,-bind_at_load $oggvorbis_libs"
454 server_ldflags="$server_ldflags $oggvorbis_libs -logg -lvorbis -lvorbisfile"
455 filter_ldflags="$filter_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
456 audiod_ldflags="$audiod_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
457 afh_ldflags="$afh_ldflags $oggvorbis_libs -logg -lvorbis -lvorbisfile"
459 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(oggdec_filter)"
460 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oggdec_filter)"
462 server_errlist_objs="$server_errlist_objs ogg_afh"
463 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
464 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
465 afh_errlist_objs="$afh_errlist_objs ogg_afh"
467 audiod_audio_formats="$audiod_audio_formats ogg"
468 server_audio_formats="$server_audio_formats ogg"
469 AC_SUBST(oggvorbis_cppflags)
471 AC_MSG_WARN([no ogg vorbis support in para_server/para_filter])
473 CPPFLAGS="$OLD_CPPFLAGS"
474 LDFLAGS="$OLD_LDFLAGS"
476 ########################################################################### faad
478 OLD_CPPFLAGS="$CPPFLAGS"
479 OLD_LD_FLAGS="$LDFLAGS"
481 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
482 [look for neaacdec.h also in dir])])
483 if test -n "$with_faad_headers"; then
484 faad_cppflags="-I$with_faad_headers"
485 CPPFLAGS="$CPPFLAGS $faad_cppflags"
487 AC_ARG_WITH(faad_libs, [AC_HELP_STRING(--with-faad-libs=dir,
488 [look for libfaad also in dir])])
489 if test -n "$with_faad_libs"; then
490 faad_libs="-L$with_faad_libs"
491 LDFLAGS="$LDFLAGS $faad_libs"
493 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
494 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
495 if test "$have_faad" = "yes"; then
496 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
497 all_errlist_objs="$all_errlist_objs aac_common aacdec_filter aac_afh"
498 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
499 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
500 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
501 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
502 server_ldflags="$server_ldflags $faad_libs -lfaad"
503 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
504 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
505 afh_ldflags="$afh_ldflags $faad_libs -lfaad"
506 audiod_audio_formats="$audiod_audio_formats aac"
507 server_audio_formats="$server_audio_formats aac"
508 filters="$filters aacdec"
509 AC_SUBST(faad_cppflags)
511 AC_MSG_WARN([no aac support in para_audiod/para_filter])
513 CPPFLAGS="$OLD_CPPFLAGS"
514 LDFLAGS="$OLD_LDFLAGS"
516 ########################################################################### mad
518 OLD_CPPFLAGS="$CPPFLAGS"
519 OLD_LD_FLAGS="$LDFLAGS"
522 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
523 [look for mad.h also in dir])])
524 if test -n "$with_mad_headers"; then
525 mad_cppflags="-I$with_mad_headers"
526 CPPFLAGS="$CPPFLAGS $mad_cppflags"
528 AC_ARG_WITH(mad_libs, [AC_HELP_STRING(--with-mad-libs=dir,
529 [look for libmad also in dir])])
530 if test -n "$with_mad_libs"; then
531 mad_libs="-L$with_mad_libs"
532 LDFLAGS="$LDFLAGS $mad_libs"
534 AC_CHECK_HEADERS([mad.h], [], [
537 AC_CHECK_LIB([mad], [mad_stream_init], [], [
540 if test "$have_mad" = "yes"; then
541 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
542 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
543 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
544 all_errlist_objs="$all_errlist_objs mp3dec_filter"
545 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
546 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
547 filter_ldflags="$filter_ldflags $mad_libs -lmad"
548 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
549 audiod_audio_formats="$audiod_audio_formats mp3"
550 filters="$filters mp3dec"
551 AC_SUBST(mad_cppflags)
553 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
555 CPPFLAGS="$OLD_CPPFLAGS"
556 LDFLAGS="$OLD_LDFLAGS"
558 ###################################################################### libid3tag
559 AC_MSG_CHECKING(for libid3tag)
563 struct id3_tag t = {.flags = 0};
564 ],[have_libid3tag=yes],[have_libid3tag=no])
565 AC_MSG_RESULT($have_libid3tag)
566 if test ${have_libid3tag} = yes; then
567 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
568 server_ldflags="$server_ldflags -lid3tag"
569 afh_ldflags="$afh_ldflags -lid3tag"
571 AC_MSG_WARN([no support for id3v2 tags])
573 ########################################################################### oss
574 OLD_CPPFLAGS="$CPPFLAGS"
575 OLD_LD_FLAGS="$LDFLAGS"
579 msg="=> will not build para_fade/oss writer"
581 AC_CHECK_HEADER(sys/soundcard.h, [
582 extras="$extras fade"
583 executables="$executables fade"
584 all_errlist_objs="$all_errlist_objs oss_write"
585 audiod_errlist_objs="$audiod_errlist_objs oss_write"
586 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
588 write_errlist_objs="$write_errlist_objs oss_write"
589 write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
590 writers="$writers oss"
591 default_writer="OSS_WRITE"
592 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
593 audiod_ldflags="$audiod_ldflags -lossaudio"
594 write_ldflags="$write_ldflags -lossaudio"
595 fade_ldflags="$write_ldflags -lossaudio"
601 AC_MSG_WARN([no sys/soundcard.h $msg])
604 CPPFLAGS="$OLD_CPPFLAGS"
605 LDFLAGS="$OLD_LDFLAGS"
608 ########################################################################### alsa
609 OLD_CPPFLAGS="$CPPFLAGS"
610 OLD_LD_FLAGS="$LDFLAGS"
613 msg="=> no alsa support for para_audiod/para_write"
614 if test "$OSTYPE" != "Linux"; then
619 if test "$have_alsa" = "yes"; then
620 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
622 AC_MSG_WARN([no alsa/asoundlib $msg])
626 if test "$have_alsa" = "yes"; then
627 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
629 AC_MSG_WARN([no libasound $msg])
633 if test "$have_alsa" = "yes"; then
634 all_errlist_objs="$all_errlist_objs alsa_write"
635 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
636 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
637 audiod_ldflags="$audiod_ldflags -lasound"
639 write_errlist_objs="$write_errlist_objs alsa_write"
640 write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
641 write_ldflags="$write_ldflags -lasound"
642 writers="$writers alsa"
643 default_writer="ALSA_WRITE"
646 CPPFLAGS="$OLD_CPPFLAGS"
647 LDFLAGS="$OLD_LDFLAGS"
650 AC_SUBST(install_sh, [$INSTALL])
651 AC_CONFIG_FILES([Makefile])
654 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
655 AC_DEFUN([add_para],[$(for i in $@; do printf "para_$i "; done)])
656 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) }])
657 ############################################################# error2.h
658 AC_DEFUN([define_safe_error_enums],
661 for i in $executables; do
662 # eval echo checking if $1 is linked into $i
663 for j in $(eval echo \$${i}_errlist_objs); do
664 if test $j = $1; then
670 #echo "$1 gets linked into $exe"
672 for i in $all_errlist_objs; do
675 for k in $(eval echo \$${j}_errlist_objs); do
676 if test $k = $i; then
681 if test $found -eq 0; then
685 if test $found -eq 1; then
686 safe_errlists="$safe_errlists $i"
689 #echo "safe errlists for $1: $safe_errlists"
691 for i in $safe_errlists; do
692 echo "SS_ENUM($(echo $i | tr 'a-z' 'A-Z'));"
698 AC_MSG_NOTICE(creating error2.h)
699 for obj in $all_errlist_objs; do
700 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
701 echo "#ifdef MAIN_INPUT_FILE_IS_$obj"
702 define_safe_error_enums($obj)
705 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
707 [list of all objects that use paraslash's error facility]
710 ################################################################## status items
712 status_items="basename status num_played mtime bitrate frequency file_size
713 status_flags format score techinfo afs_mode
714 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
715 offset seconds_total stream_start current_time audiod_uptime image_id
716 lyrics_id duration directory lyrics_name image_name path hash channels
717 last_played num_chunks chunk_time amplification artist title year album
720 # $1: prefix, $2: items
721 AC_DEFUN([make_enum_items], [$(
723 printf "$1_$(echo $i | tr 'a-z' 'A-Z'), "
727 # $1: prefix, $2: items
728 AC_DEFUN([make_enum_array], [$(
734 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM,
735 make_enum_items(SI, $status_items),
736 [enum of all status items]
738 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY,
739 make_enum_array(SI, $status_items),
740 [char * array of all status items]
744 AC_SUBST(executables, add_para($executables))
746 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
747 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
748 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
749 server_objs="$server_cmdline_objs $server_errlist_objs"
750 write_objs="$write_cmdline_objs $write_errlist_objs"
751 client_objs="$client_cmdline_objs $client_errlist_objs"
752 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
753 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
754 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
756 AC_SUBST(recv_objs, add_dot_o($recv_objs))
757 AC_SUBST(recv_ldflags, $recv_ldflags)
758 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
759 errors used by para_recv)
761 AC_SUBST(filter_objs, add_dot_o($filter_objs))
762 AC_SUBST(filter_ldflags, $filter_ldflags)
763 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
764 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
766 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
767 AC_SUBST(audiod_ldflags, $audiod_ldflags)
768 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
769 errors used by para_audiod)
771 AC_SUBST(server_objs, add_dot_o($server_objs))
772 AC_SUBST(server_ldflags, $server_ldflags)
773 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
774 objlist_to_errlist($server_errlist_objs), errors used by para_server)
776 AC_SUBST(afh_objs, add_dot_o($afh_objs))
777 AC_SUBST(afh_ldflags, $afh_ldflags)
778 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
779 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
781 AC_SUBST(write_objs, add_dot_o($write_objs))
782 AC_SUBST(write_ldflags, $write_ldflags)
783 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
784 objlist_to_errlist($write_errlist_objs), errors used by para_write)
786 AC_SUBST(client_objs, add_dot_o($client_objs))
787 AC_SUBST(client_ldflags, $client_ldflags)
788 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
789 objlist_to_errlist($client_errlist_objs), errors used by para_client)
791 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
792 AC_SUBST(audioc_ldflags, $audioc_ldflags)
793 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
794 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
796 AC_SUBST(gui_objs, add_dot_o($gui_objs))
797 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
798 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
800 AC_SUBST(fade_objs, add_dot_o($fade_objs))
801 AC_SUBST(fade_ldflags, $fade_ldflags)
802 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
803 objlist_to_errlist($fade_errlist_objs), errors used by para_fade)
806 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
807 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
808 enum of supported filters)
809 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
810 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
811 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
812 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
814 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
815 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
816 enum of supported writers)
817 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
818 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
819 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
820 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
821 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
822 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
823 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
825 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
826 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
827 enum of audio formats supported by audiod)
828 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
829 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
833 paraslash configuration:
834 ~~~~~~~~~~~~~~~~~~~~~~~~
835 unix socket credentials: $have_ucred
836 audio formats supported by para_server/para_afh: $server_audio_formats
837 id3 version2 support: $have_libid3tag
838 filters supported by para_audiod/para_filter: $filters
839 writers supported by para_audiod/para_write: $writers
840 optional executables: $extras