]> git.tuebingen.mpg.de Git - paraslash.git/blob - configure.ac
interactive: Init task status.
[paraslash.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.60)
5
6
7 AC_INIT(paraslash, [git], maan@systemlinux.org)
8 AC_CONFIG_HEADER([config.h])
9
10 AC_PATH_PROG(UNAMEPATH, uname, no)
11 if test "$UNAMEPATH" = "no"; then
12         AC_MSG_ERROR(unable to determine system type)
13 fi
14 AC_MSG_CHECKING(os type)
15 OSTYPE="`$UNAMEPATH -s`"
16 AC_MSG_RESULT("$OSTYPE")
17
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)
22 fi
23
24 AC_C_BIGENDIAN()
25
26 AC_PATH_PROG([gengetopt], [gengetopt])
27 test -z "$gengetopt" && AC_MSG_ERROR(
28         [gengetopt is required to build this package])
29
30 AC_PATH_PROG([help2man], [help2man])
31 test -z "$help2man" && AC_MSG_ERROR(
32         [help2man is required to build this package])
33
34 AC_PROG_CC
35 AC_PROG_CPP
36 AC_PROG_INSTALL
37 AC_REPLACE_FNMATCH
38
39 AC_HEADER_DIRENT
40 AC_HEADER_STDC
41 AC_HEADER_SYS_WAIT
42 AC_HEADER_STDBOOL
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])])
47
48 # Checks for typedefs, structures, and compiler characteristics.
49 AC_C_CONST
50 AC_C_INLINE
51 AC_TYPE_OFF_T
52 AC_TYPE_PID_T
53 AC_TYPE_SIZE_T
54 AC_HEADER_TIME
55 AC_STRUCT_TM
56 AC_TYPE_INT8_T
57 AC_TYPE_INT16_T
58 AC_TYPE_INT32_T
59 AC_TYPE_INT64_T
60 AC_TYPE_MODE_T
61 AC_TYPE_SSIZE_T
62 AC_TYPE_UID_T
63 AC_TYPE_UINT8_T
64 AC_TYPE_UINT16_T
65 AC_TYPE_UINT32_T
66 AC_TYPE_UINT64_T
67
68 # Checks for library functions.
69 AC_FUNC_FORK
70 AC_PROG_GCC_TRADITIONAL
71 AC_FUNC_MALLOC
72 AC_FUNC_MEMCMP
73 AC_FUNC_MKTIME
74 AC_FUNC_MMAP
75 AC_FUNC_REALLOC
76 AC_FUNC_SELECT_ARGTYPES
77 AC_TYPE_SIGNAL
78 AC_FUNC_STAT
79 AC_FUNC_STRFTIME
80 AC_FUNC_VPRINTF
81 AC_FUNC_CLOSEDIR_VOID
82 AC_FUNC_LSTAT
83
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])])
89
90 cmdline_dir="cmdline"
91 AC_SUBST(cmdline_dir)
92 AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; done)])
93
94
95 all_errlist_objs="mp3_afh afh_common net string signal time daemon
96         stat afh fade amp_filter fd ringbuffer sched audiod
97         grab_client filter_common wav_filter compress_filter http_recv
98         dccp_recv recv_common write_common file_write audiod_command
99         client_common recv stdout filter stdin audioc write client
100         exec send_common ggo udp_recv color fec fecdec_filter
101         prebuffer_filter audiod_command_list bitstream imdct
102         wma_afh wma_common wmadec_filter buffer_tree crypt_common
103         gui gui_theme"
104
105 executables="recv filter audioc write client afh audiod"
106
107 recv_cmdline_objs="add_cmdline(recv http_recv dccp_recv udp_recv)"
108
109 recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
110         fd sched stdout ggo udp_recv buffer_tree"
111 recv_ldflags=""
112
113 filter_cmdline_objs="add_cmdline(filter compress_filter amp_filter prebuffer_filter)"
114 filter_errlist_objs="filter_common wav_filter compress_filter filter string
115         stdin stdout sched fd amp_filter ggo fecdec_filter fec
116         prebuffer_filter time bitstream imdct wma_common wmadec_filter buffer_tree"
117 filter_ldflags="-lm"
118 filters=" compress wav amp fecdec wmadec prebuffer"
119
120 audioc_cmdline_objs="add_cmdline(audioc)"
121 audioc_errlist_objs="audioc string net fd"
122 audioc_ldflags=""
123
124 audiod_cmdline_objs="add_cmdline(audiod compress_filter http_recv dccp_recv file_write client amp_filter udp_recv prebuffer_filter)"
125 audiod_errlist_objs="audiod signal string daemon stat net crypt_common
126         time grab_client filter_common wav_filter compress_filter amp_filter http_recv dccp_recv
127         recv_common fd sched write_common file_write audiod_command fecdec_filter
128         client_common ggo udp_recv color fec prebuffer_filter audiod_command_list
129         bitstream imdct wma_common wmadec_filter buffer_tree"
130 audiod_ldflags="-lm"
131 audiod_audio_formats="wma"
132
133 afh_cmdline_objs="add_cmdline(afh)"
134 afh_errlist_objs="afh string fd mp3_afh afh_common time wma_afh wma_common"
135 afh_ldflags=""
136
137 write_cmdline_objs="add_cmdline(write file_write)"
138 write_errlist_objs="write write_common file_write time fd string sched stdin
139         buffer_tree ggo"
140 write_ldflags=""
141 writers=" file"
142 default_writer="FILE_WRITE"
143
144 client_cmdline_objs="add_cmdline(client)"
145 client_errlist_objs="client net string fd sched stdin stdout time
146         client_common buffer_tree crypt_common"
147 client_ldflags=""
148
149 gui_cmdline_objs="add_cmdline(gui)"
150 gui_errlist_objs="exec signal string stat ringbuffer fd gui gui_theme"
151 gui_objs="$gui_cmdline_objs $gui_errlist_objs"
152
153 fade_cmdline_objs="add_cmdline(fade)"
154 fade_errlist_objs="fade exec string fd"
155
156
157 ########################################################################### snprintf
158 # ===========================================================================
159 #        http://www.nongnu.org/autoconf-archive/ax_func_snprintf.html
160 # ===========================================================================
161 #
162 # SYNOPSIS
163 #
164 #   AX_FUNC_SNPRINTF
165 #
166 # DESCRIPTION
167 #
168 #   Checks for a fully C99 compliant snprintf, in particular checks whether
169 #   it does bounds checking and returns the correct string length; does the
170 #   same check for vsnprintf. If no working snprintf or vsnprintf is found,
171 #   it prints an error message and aborts.
172 #
173 # LICENSE
174 #
175 #   Copyright (c) 2008 Ruediger Kuhlmann <info@ruediger-kuhlmann.de>
176 #
177 #   Copying and distribution of this file, with or without modification, are
178 #   permitted in any medium without royalty provided the copyright notice
179 #   and this notice are preserved.
180
181 AU_ALIAS([AC_FUNC_SNPRINTF], [AX_FUNC_SNPRINTF])
182 AC_DEFUN([AX_FUNC_SNPRINTF],
183 [AC_CHECK_FUNCS(snprintf vsnprintf)
184 AC_MSG_CHECKING(for working snprintf)
185 AC_CACHE_VAL(ac_cv_have_working_snprintf,
186 [AC_TRY_RUN(
187 [#include <stdio.h>
188
189 int main(void)
190 {
191     char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
192     char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
193     int i;
194     i = snprintf (bufs, 2, "%s", "111");
195     if (strcmp (bufs, "1")) exit (1);
196     if (i != 3) exit (1);
197     i = snprintf (bufd, 2, "%d", 111);
198     if (strcmp (bufd, "1")) exit (1);
199     if (i != 3) exit (1);
200     exit(0);
201 }], ac_cv_have_working_snprintf=yes, ac_cv_have_working_snprintf=no, ac_cv_have_working_snprintf=cross)])
202 AC_MSG_RESULT([$ac_cv_have_working_snprintf])
203 AC_MSG_CHECKING(for working vsnprintf)
204 AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
205 [AC_TRY_RUN(
206 [#include <stdio.h>
207 #include <stdarg.h>
208
209 int my_vsnprintf (char *buf, const char *tmpl, ...)
210 {
211     int i;
212     va_list args;
213     va_start (args, tmpl);
214     i = vsnprintf (buf, 2, tmpl, args);
215     va_end (args);
216     return i;
217 }
218
219 int main(void)
220 {
221     char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
222     char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
223     int i;
224     i = my_vsnprintf (bufs, "%s", "111");
225     if (strcmp (bufs, "1")) exit (1);
226     if (i != 3) exit (1);
227     i = my_vsnprintf (bufd, "%d", 111);
228     if (strcmp (bufd, "1")) exit (1);
229     if (i != 3) exit (1);
230     exit(0);
231 }], ac_cv_have_working_vsnprintf=yes, ac_cv_have_working_vsnprintf=no, ac_cv_have_working_vsnprintf=cross)])
232 AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
233 if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
234 AC_MSG_ERROR([fatal: buggy snprintf() detected])
235 fi])
236 AX_FUNC_SNPRINTF()
237 ########################################################################### osl
238 have_osl=yes
239 OLD_CPPFLAGS="$CPPFLAGS"
240 OLD_LD_FLAGS="$LDFLAGS"
241 OLD_LIBS="$LIBS"
242 AC_ARG_WITH(osl_headers, [AC_HELP_STRING(--with-osl-headers=dir,
243         [look for osl.h also in dir])])
244 if test -n "$with_osl_headers"; then
245         osl_cppflags="-I$with_osl_headers"
246         CPPFLAGS="$CPPFLAGS $osl_cppflags"
247 fi
248 AC_ARG_WITH(osl_libs, [AC_HELP_STRING(--with-osl-libs=dir,
249         [look for libosl also in dir])])
250 if test -n "$with_osl_libs"; then
251         osl_libs="-L$with_osl_libs"
252         LDFLAGS="$LDFLAGS $osl_libs"
253 fi
254
255 AC_CHECK_HEADER(osl.h, [], have_osl=no)
256 AC_CHECK_LIB([osl], [osl_open_table], [], have_osl=no)
257 if test "$have_osl" = "no"; then
258         AC_MSG_WARN([libosl not found, can not build para_server.
259 Download libosl at
260         http://systemlinux.org/~maan/osl
261 or execute
262         git clone git://git.tuebingen.mpg.de/osl
263         ])
264 else
265         extras="$extras server"
266         executables="$executables server"
267         server_cmdline_objs="add_cmdline(server)"
268         server_errlist_objs="server afh_common mp3_afh vss command net
269                 string signal time daemon http_send close_on_fork mm
270                 crypt_common ipc dccp_send fd user_list chunk_queue
271                 afs aft mood score attribute blob playlist sched acl
272                 send_common udp_send color fec server_command_list
273                 afs_command_list wma_afh wma_common"
274
275         all_errlist_objs="$all_errlist_objs server vss command
276                 http_send close_on_fork mm ipc dccp_send user_list
277                 chunk_queue afs aft mood score attribute blob playlist
278                 acl udp_send server_command_list afs_command_list"
279
280         server_ldflags=""
281         server_audio_formats="mp3 wma"
282         AC_SUBST(osl_cppflags)
283         server_ldflags="$server_ldflags $osl_libs -losl"
284 fi
285 CPPFLAGS="$OLD_CPPFLAGS"
286 LDFLAGS="$OLD_LDFLAGS"
287 LIBS="$OLD_LIBS"
288 ########################################################################### crypto
289 AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
290         Force using crypto library "lib". This package requires either
291         openssl or libgcrypt being installed. Possible values for "lib"
292         are thus "openssl" and "gcrypt". If this option is not given,
293         openssl is tried first. If openssl was not found, gcrypt is
294         tried next.])])
295
296 case "$enable_cryptolib" in
297         "openssl") check_openssl="yes"; check_gcrypt="no";;
298         "gcrypt") check_openssl="no"; check_gcrypt="yes";;
299         "") check_openssl="yes"; check_gcrypt="yes";;
300         *) AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib]);;
301 esac
302 ###################################################################### openssl
303 if test "$check_openssl" = "yes"; then
304         OLD_CPPFLAGS="$CPPFLAGS"
305         OLD_LD_FLAGS="$LDFLAGS"
306         OLD_LIBS="$LIBS"
307         have_openssl="yes"
308         AC_ARG_WITH(openssl_headers, [AC_HELP_STRING(--with-openssl-headers=dir,
309                 [look for openssl headers also in dir])])
310         if test -n "$with_openssl_headers"; then
311                 openssl_cppflags="-I$with_openssl_headers"
312                 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
313         fi
314         AC_ARG_WITH(openssl_libs, [AC_HELP_STRING(--with-openssl-libs=dir,
315                 [look for openssl libraries also in dir])])
316         if test -n "$with_openssl_libs"; then
317                 openssl_libs="-L$with_openssl_libs"
318                 LDFLAGS="$LDFLAGS $openssl_libs"
319         fi
320         AC_CHECK_HEADER(openssl/ssl.h, [], [have_openssl="no"])
321         AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
322         if test "$have_openssl" = "no" -a -z "$with_openssl_headers$with_openssl_libs"; then
323                 # try harder: openssl is sometimes installed in /usr/local/ssl
324                 openssl_cppflags="-I/usr/local/ssl/include"
325                 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
326                 openssl_libs="-L/usr/local/ssl/lib"
327                 LDFLAGS="$LDFLAGS $openssl_libs"
328                 # clear cache
329                 unset ac_cv_header_openssl_ssl_h 2> /dev/null
330                 unset ac_cv_lib_crypto_RAND_bytes 2> /dev/null
331                 AC_CHECK_HEADER(openssl/ssl.h, [have_openssl="yes"], [])
332                 if test "$have_openssl" = "yes"; then
333                         AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
334                 fi
335         fi
336         if test "$have_openssl" = "yes"; then
337                 AC_DEFINE(HAVE_OPENSSL, 1, [define to 1 to turn on openssl support])
338                 AC_SUBST(openssl_cppflags)
339                 openssl_libs="$openssl_libs -lssl -lcrypto"
340                 server_ldflags="$server_ldflags $openssl_libs"
341                 client_ldflags="$client_ldflags $openssl_libs"
342                 audiod_ldflags="$audiod_ldflags $openssl_libs"
343
344                 all_errlist_objs="$all_errlist_objs crypt"
345                 server_errlist_objs="$server_errlist_objs crypt"
346                 client_errlist_objs="$client_errlist_objs crypt"
347                 audiod_errlist_objs="$audiod_errlist_objs crypt"
348
349                 check_gcrypt="no"
350         else
351                 AC_MSG_WARN([openssl libraries not found])
352         fi
353         CPPFLAGS="$OLD_CPPFLAGS"
354         LDFLAGS="$OLD_LDFLAGS"
355         LIBS="$OLD_LIBS"
356 else
357         have_openssl="no"
358 fi
359 ########################################################################### gcrypt
360 if test "$check_gcrypt" = "yes"; then
361         OLD_CPPFLAGS="$CPPFLAGS"
362         OLD_LD_FLAGS="$LDFLAGS"
363         OLD_LIBS="$LIBS"
364         have_gcrypt="yes"
365         AC_ARG_WITH(gcrypt_headers, [AC_HELP_STRING(--with-gcrypt-headers=dir,
366                 [look for gcrypt headers also in dir])])
367         if test -n "$with_gcrypt_headers"; then
368                 gcrypt_cppflags="-I$with_gcrypt_headers"
369                 CPPFLAGS="$CPPFLAGS $gcrypt_cppflags"
370         fi
371         AC_ARG_WITH(gcrypt_libs, [AC_HELP_STRING(--with-gcrypt-libs=dir,
372                 [look for libgcrypt also in dir])])
373         if test -n "$with_gcrypt_libs"; then
374                 gcrypt_libs="-L$with_gcrypt_libs"
375                 LDFLAGS="$LDFLAGS $gcrypt_libs"
376         fi
377         AC_CHECK_HEADER(gcrypt.h, [], [have_gcrypt="no"])
378         AC_CHECK_LIB([gcrypt], [gcry_randomize], [], [have_gcrypt="no"])
379         if test "$have_gcrypt" = "yes"; then
380                 AC_DEFINE(HAVE_GCRYPT, 1, [define to 1 to turn on gcrypt support])
381                 AC_SUBST(gcrypt_cppflags)
382                 gcrypt_libs="$gcrypt_libs -lgcrypt"
383                 server_ldflags="$server_ldflags $gcrypt_libs"
384                 client_ldflags="$client_ldflags $gcrypt_libs"
385                 audiod_ldflags="$audiod_ldflags $gcrypt_libs"
386
387                 all_errlist_objs="$all_errlist_objs gcrypt"
388                 server_errlist_objs="$server_errlist_objs gcrypt"
389                 client_errlist_objs="$client_errlist_objs gcrypt"
390                 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
391         else
392                 AC_MSG_WARN([gcrypt library not found])
393         fi
394         CPPFLAGS="$OLD_CPPFLAGS"
395         LDFLAGS="$OLD_LDFLAGS"
396         LIBS="$OLD_LIBS"
397 else
398         have_gcrypt="no"
399 fi
400 ###########################################################################
401 if test "$have_openssl" = "no" -a "$have_gcrypt" = "no"; then
402         AC_MSG_ERROR([neither openssl nor gcrypt usable])
403 fi
404 ########################################################################### libsocket
405 AC_CHECK_LIB([c], [socket],
406         [socket_lib=],
407         [socket_lib="-lsocket"]
408 )
409 server_ldflags="$server_ldflags $socket_lib"
410 client_ldflags="$client_ldflags $socket_lib"
411 audioc_ldflags="$audioc_ldflags $socket_lib"
412 audiod_ldflags="$audiod_ldflags $socket_lib"
413 recv_ldflags="$recv_ldflags $socket_lib"
414 AC_SEARCH_LIBS([connect],[socket],[],[
415         AC_MSG_ERROR([Fatal: Did not find connect().])
416 ],[])
417 ########################################################################### libnsl
418 AC_CHECK_LIB([c], [gethostbyname],
419         [nsl_lib=],
420         [nsl_lib="-lnsl"]
421 )
422 server_ldflags="$server_ldflags $nsl_lib"
423 client_ldflags="$client_ldflags $nsl_lib"
424 audioc_ldflags="$audioc_ldflags $nsl_lib"
425 recv_ldflags="$recv_ldflags $nsl_lib"
426 AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
427         AC_MSG_ERROR([Fatal: Did not find inet_ntoa().])
428 ],[])
429 ########################################################################### ucred
430 AC_MSG_CHECKING(for struct ucred)
431 AC_TRY_LINK([
432         #define _GNU_SOURCE
433         #include <sys/types.h>
434         #include <sys/socket.h>
435 ],[
436         struct ucred sucred; sucred.pid=0;
437 ],[have_ucred=yes],[have_ucred=no])
438 AC_MSG_RESULT($have_ucred)
439 if test ${have_ucred} = yes; then
440         AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
441 fi
442
443 ########################################################################### curses
444 have_curses="yes"
445 OLD_CPPFLAGS="$CPPFLAGS"
446 OLD_LD_FLAGS="$LDFLAGS"
447 OLD_LIBS="$LIBS"
448 AC_ARG_WITH(curses_headers, [AC_HELP_STRING(--with-curses-headers=dir,
449         [look for curses.h also in dir])])
450 if test -n "$with_curses_headers"; then
451         curses_cppflags="-I$with_curses_headers"
452         CPPFLAGS="$CPPFLAGS $curses_cppflags"
453 fi
454 AC_ARG_WITH(curses_libs, [AC_HELP_STRING(--with-curses-libs=dir,
455         [look for libcurses also in dir])])
456 if test -n "$with_curses_libs"; then
457         curses_libs="-L$with_curses_libs"
458         LDFLAGS="$LDFLAGS $curses_libs"
459 fi
460 AC_CHECK_HEADER(curses.h, [], [
461         have_curses="no"
462 ])
463 AC_CHECK_LIB([curses], [initscr], [], [
464         have_curses="no"
465 ])
466 if test "$have_curses" = "yes"; then
467         AC_SUBST(curses_cppflags)
468         AC_DEFINE(HAVE_NCURSES, 1, [define to 1 to turn on curses support])
469         extras="$extras gui"
470         executables="$executables gui"
471 else
472         AC_MSG_WARN([cannot build para_gui])
473 fi
474 CPPFLAGS="$OLD_CPPFLAGS"
475 LDFLAGS="$OLD_LDFLAGS"
476 LIBS="$OLD_LIBS"
477
478 ########################################################################### ip_mreqn
479 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
480 AC_TRY_LINK([
481         #include <netdb.h>
482         #include <net/if.h>
483 ],[
484         struct ip_mreqn mn;
485         mn.imr_ifindex = 0;
486 ],[have_ip_mreqn=yes],[have_ip_mreqn=no])
487 AC_MSG_RESULT($have_ip_mreqn)
488 if test ${have_ip_mreqn} = yes; then
489         AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
490 fi
491 ########################################################################### osx
492
493 AC_MSG_CHECKING(for CoreAudio (MacOs))
494 AC_TRY_LINK([
495         #include <CoreAudio/CoreAudio.h>
496 ],[
497         AudioDeviceID id;
498 ],[have_core_audio=yes],[have_core_audio=no])
499 AC_MSG_RESULT($have_core_audio)
500 if test ${have_core_audio} = yes; then
501         f1="-framework CoreAudio"
502         f2="-framework AudioToolbox"
503         f3="-framework AudioUnit"
504         f4="-framework CoreServices"
505         f="$f1 $f2 $f3 $f4"
506
507         all_errlist_objs="$all_errlist_objs osx_write"
508         # ipc is linked into para_server server and into the osx writer. If osl
509         # was not found, para_server will not be built and ipc has not yet been
510         # added to the list of all objects, so we must add it here.
511         if test "$have_osl" = "no"; then
512                 all_errlist_objs="$all_errlist_objs ipc"
513         fi
514         audiod_errlist_objs="$audiod_errlist_objs osx_write ipc"
515         audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
516         audiod_ldflags="$audiod_ldflags $f"
517
518         write_errlist_objs="$write_errlist_objs osx_write ipc"
519         write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
520         write_ldflags="$write_ldflags $f"
521         writers="$writers osx"
522         default_writer="OSX_WRITE"
523         AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
524 fi
525 ########################################################### ogg/vorbis/speex
526 have_ogg="yes"
527 OLD_CPPFLAGS="$CPPFLAGS"
528 OLD_LD_FLAGS="$LDFLAGS"
529 OLD_LIBS="$LIBS"
530 AC_ARG_WITH(ogg_headers, [AC_HELP_STRING(--with-ogg-headers=dir,
531         [look for ogg headers also in dir])])
532 AC_ARG_WITH(ogg_libs, [AC_HELP_STRING(--with-ogg-libs=dir,
533         [look for ogg libs also in dir])])
534 AC_ARG_WITH(vorbis_headers, [AC_HELP_STRING(--with-vorbis-headers=dir,
535         [look for vorbis headers also in dir])])
536 AC_ARG_WITH(vorbis_libs, [AC_HELP_STRING(--with-vorbis-libs=dir,
537         [look for vorbis libs also in dir])])
538 AC_ARG_WITH(speex_headers, [AC_HELP_STRING(--with-speex-headers=dir,
539         [look for speex headers also in dir])])
540 AC_ARG_WITH(speex_libs, [AC_HELP_STRING(--with-speex-libs=dir,
541         [look for speex libs also in dir])])
542
543 if test -n "$with_ogg_headers"; then
544         ogg_cppflags="-I$with_ogg_headers"
545         CPPFLAGS="$CPPFLAGS $ogg_cppflags"
546 fi
547 if test -n "$with_ogg_libs"; then
548         ogg_libs="-L$with_ogg_libs"
549         LDFLAGS="$LDFLAGS $ogg_libs"
550 fi
551 AC_CHECK_HEADERS([ogg/ogg.h], [], [ have_ogg="no"; ])
552 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
553
554 have_vorbis="yes"
555 have_speex="yes"
556 if test "$have_ogg" = "yes"; then
557         # vorbis
558         if test -n "$with_vorbis_headers"; then
559                 vorbis_cppflags="-I$with_vorbis_headers"
560                 CPPFLAGS="$CPPFLAGS $vorbis_cppflags"
561         fi
562         if test -n "$with_vorbis_libs"; then
563                 vorbis_libs="-L$with_vorbis_libs"
564                 LDFLAGS="$LDFLAGS $vorbis_libs"
565         fi
566         AC_CHECK_HEADERS([vorbis/codec.h], [], [ have_vorbis="no" ])
567         AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_vorbis="no" ])
568
569         # speex
570         if test -n "$with_speex_headers"; then
571                 speex_cppflags="-I$with_speex_headers"
572                 CPPFLAGS="$CPPFLAGS $speex_cppflags"
573         fi
574         if test -n "$with_speex_libs"; then
575                 speex_libs="-L$with_speex_libs"
576                 LDFLAGS="$LDFLAGS $speex_libs"
577         fi
578         AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ])
579         AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ])
580 else
581         AC_MSG_WARN([vorbis/speex depend on libogg, which was not detected])
582         have_vorbis="no"
583         have_speex="no"
584 fi
585
586 msg="support in para_server/para_filter/para_afh"
587 if test "$have_vorbis" = "yes" || test "$have_speex" = "yes"; then
588         AC_SUBST(ogg_cppflags)
589         ogg_libs="$ogg_libs -logg"
590         if test "$OSTYPE" = "Darwin"; then
591                 ogg_libs="-Wl,-bind_at_load $ogg_libs"
592         fi
593         server_ldflags="$server_ldflags $ogg_libs"
594         filter_ldflags="$filter_ldflags $ogg_libs"
595         audiod_ldflags="$audiod_ldflags $ogg_libs"
596         afh_ldflags="$afh_ldflags $ogg_libs"
597         all_errlist_objs="$all_errlist_objs ogg_afh_common"
598         afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
599         server_errlist_objs="$server_errlist_objs ogg_afh_common"
600 fi
601 if test "$have_vorbis" = "yes"; then
602         all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh"
603         AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support)
604         filters="$filters oggdec"
605         vorbis_libs="-lvorbis -lvorbisfile"
606         server_ldflags="$server_ldflags $vorbis_libs"
607         filter_ldflags="$filter_ldflags $vorbis_libs"
608         audiod_ldflags="$audiod_ldflags $vorbis_libs"
609         afh_ldflags="$afh_ldflags $vorbis_libs"
610
611         server_errlist_objs="$server_errlist_objs ogg_afh"
612         filter_errlist_objs="$filter_errlist_objs oggdec_filter"
613         audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
614         afh_errlist_objs="$afh_errlist_objs ogg_afh"
615
616         audiod_audio_formats="$audiod_audio_formats ogg"
617         server_audio_formats="$server_audio_formats ogg"
618 else
619         AC_MSG_WARN([no ogg/vorbis $msg])
620 fi
621 if test "$have_speex" = "yes"; then
622         all_errlist_objs="$all_errlist_objs spxdec_filter spx_afh spx_common"
623         AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support)
624         filters="$filters spxdec"
625         speex_libs="-lspeex"
626         server_ldflags="$server_ldflags $speex_libs"
627         filter_ldflags="$filter_ldflags $speex_libs"
628         audiod_ldflags="$audiod_ldflags $speex_libs"
629         afh_ldflags="$afh_ldflags $speex_libs"
630
631         server_errlist_objs="$server_errlist_objs spx_afh spx_common"
632         filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
633         audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
634         afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
635
636         audiod_audio_formats="$audiod_audio_formats spx"
637         server_audio_formats="$server_audio_formats spx"
638 else
639         AC_MSG_WARN([no ogg/speex $msg])
640 fi
641 CPPFLAGS="$OLD_CPPFLAGS"
642 LDFLAGS="$OLD_LDFLAGS"
643 LIBS="$OLD_LIBS"
644 ########################################################################### faad
645 have_faad=yes
646 OLD_CPPFLAGS="$CPPFLAGS"
647 OLD_LD_FLAGS="$LDFLAGS"
648 OLD_LIBS="$LIBS"
649 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
650         [look for neaacdec.h also in dir])])
651 if test -n "$with_faad_headers"; then
652         faad_cppflags="-I$with_faad_headers"
653         CPPFLAGS="$CPPFLAGS $faad_cppflags"
654 fi
655 AC_ARG_WITH(faad_libs, [AC_HELP_STRING(--with-faad-libs=dir,
656         [look for libfaad also in dir])])
657 if test -n "$with_faad_libs"; then
658         faad_libs="-L$with_faad_libs"
659         LDFLAGS="$LDFLAGS $faad_libs"
660 fi
661 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
662 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
663 if test "$have_faad" = "yes"; then
664         AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
665         all_errlist_objs="$all_errlist_objs aac_common aacdec_filter aac_afh"
666         filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
667         afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
668         audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
669         server_errlist_objs="$server_errlist_objs aac_afh aac_common"
670         server_ldflags="$server_ldflags $faad_libs -lfaad"
671         filter_ldflags="$filter_ldflags $faad_libs -lfaad"
672         audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
673         afh_ldflags="$afh_ldflags $faad_libs -lfaad"
674         audiod_audio_formats="$audiod_audio_formats aac"
675         server_audio_formats="$server_audio_formats aac"
676         filters="$filters aacdec"
677         AC_SUBST(faad_cppflags)
678 else
679         AC_MSG_WARN([no aac support in para_audiod/para_filter])
680 fi
681 CPPFLAGS="$OLD_CPPFLAGS"
682 LDFLAGS="$OLD_LDFLAGS"
683 LIBS="$OLD_LIBS"
684 ########################################################################### mad
685 have_mad="yes"
686 OLD_CPPFLAGS="$CPPFLAGS"
687 OLD_LD_FLAGS="$LDFLAGS"
688 OLD_LIBS="$LIBS"
689
690 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
691         [look for mad.h also in dir])])
692 if test -n "$with_mad_headers"; then
693         mad_cppflags="-I$with_mad_headers"
694         CPPFLAGS="$CPPFLAGS $mad_cppflags"
695 fi
696 AC_ARG_WITH(mad_libs, [AC_HELP_STRING(--with-mad-libs=dir,
697         [look for libmad also in dir])])
698 if test -n "$with_mad_libs"; then
699         mad_libs="-L$with_mad_libs"
700         LDFLAGS="$LDFLAGS $mad_libs"
701 fi
702 AC_CHECK_HEADERS([mad.h], [], [
703         have_mad="no"
704 ])
705 AC_CHECK_LIB([mad], [mad_stream_init], [], [
706         have_mad="no"
707 ])
708 if test "$have_mad" = "yes"; then
709         AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
710         filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
711         audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
712         all_errlist_objs="$all_errlist_objs mp3dec_filter"
713         filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
714         audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
715         filter_ldflags="$filter_ldflags $mad_libs -lmad"
716         audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
717         audiod_audio_formats="$audiod_audio_formats mp3"
718         filters="$filters mp3dec"
719         AC_SUBST(mad_cppflags)
720 else
721         AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
722 fi
723 CPPFLAGS="$OLD_CPPFLAGS"
724 LDFLAGS="$OLD_LDFLAGS"
725 LIBS="$OLD_LIBS"
726 ###################################################################### libid3tag
727 OLD_CPPFLAGS="$CPPFLAGS"
728 OLD_LD_FLAGS="$LDFLAGS"
729 OLD_LIBS="$LIBS"
730
731 have_libid3tag="yes"
732 AC_ARG_WITH(id3tag_headers, [AC_HELP_STRING(--with-id3tag-headers=dir,
733         [look for id3tag header files also in dir])])
734 if test -n "$with_id3tag_headers"; then
735         id3tag_cppflags="-I$with_id3tag_headers"
736         CPPFLAGS="$CPPFLAGS $id3tag_cppflags"
737 fi
738 AC_ARG_WITH(id3tag_libs, [AC_HELP_STRING(--with-id3tag-libs=dir,
739         [look for id3tag libs also in dir])])
740 if test -n "$with_id3tag_libs"; then
741         id3tag_libs="-L$with_id3tag_libs"
742         LDFLAGS="$LDFLAGS $id3tag_libs"
743 fi
744
745 AC_MSG_CHECKING(for libid3tag)
746 AC_TRY_LINK([
747         #include <id3tag.h>
748 ],[
749         struct id3_tag t = {.flags = 0};
750 ],[], [have_libid3tag=no])
751 AC_MSG_RESULT($have_libid3tag)
752
753 if test ${have_libid3tag} = yes; then
754         AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
755         server_ldflags="$server_ldflags $id3tag_libs -lid3tag -lz"
756         afh_ldflags="$afh_ldflags $id3tag_libs -lid3tag -lz"
757         AC_SUBST(id3tag_cppflags)
758 else
759         AC_MSG_WARN([no support for id3v2 tags])
760 fi
761 CPPFLAGS="$OLD_CPPFLAGS"
762 LDFLAGS="$OLD_LDFLAGS"
763 LIBS="$OLD_LIBS"
764 ########################################################################### flac
765 OLD_CPPFLAGS="$CPPFLAGS"
766 OLD_LD_FLAGS="$LDFLAGS"
767 OLD_LIBS="$LIBS"
768
769 have_flac="yes"
770 AC_ARG_WITH(flac_headers, [AC_HELP_STRING(--with-flac-headers=dir,
771         [look for flac headers also in dir])])
772 if test -n "$with_flac_headers"; then
773         flac_cppflags="-I$with_flac_headers"
774         CPPFLAGS="$CPPFLAGS $flac_cppflags"
775 fi
776 AC_ARG_WITH(flac_libs, [AC_HELP_STRING(--with-flac-libs=dir,
777         [look for flac libs also in dir])])
778 if test -n "$with_flac_libs"; then
779         flac_libs="-L$with_flac_libs"
780         LDFLAGS="$LDFLAGS $flac_libs"
781 fi
782 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no)
783 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], have_flac=no, -logg -lm)
784 if test "$have_flac" = "yes"; then
785         AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter)
786         all_errlist_objs="$all_errlist_objs flacdec_filter flac_afh"
787         filter_errlist_objs="$filter_errlist_objs flacdec_filter"
788         audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
789         afh_errlist_objs="$afh_errlist_objs flac_afh"
790         server_errlist_objs="$server_errlist_objs flac_afh"
791         filter_ldflags="$filter_ldflags $flac_libs -lFLAC"
792         audiod_ldflags="$audiod_ldflags $flac_libs -lFLAC"
793         server_ldflags="$server_ldflags $flac_libs -lFLAC"
794         afh_ldflags="$afh_ldflags $flac_libs -lFLAC"
795         filters="$filters flacdec"
796         server_audio_formats="$server_audio_formats flac"
797         audiod_audio_formats="$audiod_audio_formats flac"
798         AC_SUBST(flac_cppflags)
799 else
800         AC_MSG_WARN([no flac support in para_audiod/para_filter])
801 fi
802 CPPFLAGS="$OLD_CPPFLAGS"
803 LDFLAGS="$OLD_LDFLAGS"
804 LIBS="$OLD_LIBS"
805 ########################################################################### oss
806 OLD_CPPFLAGS="$CPPFLAGS"
807 OLD_LD_FLAGS="$LDFLAGS"
808 OLD_LIBS="$LIBS"
809
810 have_oss="yes"
811 msg="=> will not build para_fade/oss writer"
812
813 AC_CHECK_HEADER(sys/soundcard.h, [
814         extras="$extras fade"
815         executables="$executables fade"
816         all_errlist_objs="$all_errlist_objs oss_write"
817         audiod_errlist_objs="$audiod_errlist_objs oss_write"
818         audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
819
820         write_errlist_objs="$write_errlist_objs oss_write"
821         write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
822         writers="$writers oss"
823         default_writer="OSS_WRITE"
824         AC_CHECK_LIB(ossaudio, _oss_ioctl, [
825                         audiod_ldflags="$audiod_ldflags -lossaudio"
826                         write_ldflags="$write_ldflags -lossaudio"
827                         fade_ldflags="$write_ldflags -lossaudio"
828                 ]
829         )
830         ],
831         [
832                 have_oss="no"
833                 AC_MSG_WARN([no sys/soundcard.h $msg])
834         ]
835 )
836 CPPFLAGS="$OLD_CPPFLAGS"
837 LDFLAGS="$OLD_LDFLAGS"
838 LIBS="$OLD_LIBS"
839
840 ########################################################################### alsa
841 OLD_CPPFLAGS="$CPPFLAGS"
842 OLD_LD_FLAGS="$LDFLAGS"
843 OLD_LIBS="$LIBS"
844
845 msg="=> no alsa support for para_audiod/para_write"
846 if test "$OSTYPE" != "Linux"; then
847         have_alsa="no"
848 else
849         have_alsa="yes"
850 fi
851 if test "$have_alsa" = "yes"; then
852         AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
853                 have_alsa="no"
854                 AC_MSG_WARN([no alsa/asoundlib $msg])
855         ])
856 fi
857
858 if test "$have_alsa" = "yes"; then
859         AC_CHECK_LIB([asound], [snd_pcm_open], [], [
860                 have_alsa="no"
861                 AC_MSG_WARN([no libasound $msg])
862         ])
863 fi
864
865 if test "$have_alsa" = "yes"; then
866         all_errlist_objs="$all_errlist_objs alsa_write"
867         audiod_errlist_objs="$audiod_errlist_objs alsa_write"
868         audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
869         audiod_ldflags="$audiod_ldflags -lasound"
870
871         write_errlist_objs="$write_errlist_objs alsa_write"
872         write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
873         write_ldflags="$write_ldflags -lasound"
874         writers="$writers alsa"
875         default_writer="ALSA_WRITE"
876 fi
877
878 CPPFLAGS="$OLD_CPPFLAGS"
879 LDFLAGS="$OLD_LDFLAGS"
880 LIBS="$OLD_LIBS"
881 ########################################################################### libao
882 OLD_CPPFLAGS="$CPPFLAGS"
883 OLD_LD_FLAGS="$LDFLAGS"
884 OLD_LIBS="$LIBS"
885
886 have_ao="yes"
887 AC_ARG_WITH(ao_headers, [AC_HELP_STRING(--with-ao-headers=dir,
888         [look for ao/ao.h also in dir])])
889 if test -n "$with_ao_headers"; then
890         ao_cppflags="-I$with_ao_headers"
891         CPPFLAGS="$CPPFLAGS $ao_cppflags"
892 fi
893 AC_ARG_WITH(ao_libs, [AC_HELP_STRING(--with-ao-libs=dir,
894         [look for libao also in dir])])
895 if test -n "$with_ao_libs"; then
896         ao_libs="-L$with_ao_libs"
897         LDFLAGS="$LDFLAGS $ao_libs"
898 fi
899 msg="no libao support for para_audiod/para_write"
900 AC_CHECK_HEADERS([ao/ao.h], [
901         ], [
902         have_ao="no"
903         AC_MSG_WARN([ao.h not found, $msg])
904 ])
905 if test "$have_ao" = "yes"; then
906         AC_CHECK_LIB([ao], [ao_initialize], [], [
907                 have_ao="no"
908                 AC_MSG_WARN([ao lib not found or not working, $msg])
909         ])
910 fi
911 if test "$have_ao" = "yes"; then
912         AC_CHECK_HEADERS([pthread.h], [
913                 ], [
914                 have_ao="no"
915                 AC_MSG_WARN([pthread.h not found, $msg])
916         ])
917 fi
918 if test "$have_ao" = "yes"; then
919         AC_CHECK_LIB([pthread], [pthread_create], [], [
920                 have_ao="no"
921                 AC_MSG_WARN([pthread lib not found or not working, $msg])
922         ])
923 fi
924 if test "$have_ao" = "yes"; then
925         all_errlist_objs="$all_errlist_objs ao_write"
926         audiod_errlist_objs="$audiod_errlist_objs ao_write"
927         audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(ao_write)"
928         audiod_ldflags="$audiod_ldflags -lao -lpthread"
929
930         write_errlist_objs="$write_errlist_objs ao_write"
931         write_cmdline_objs="$write_cmdline_objs add_cmdline(ao_write)"
932         write_ldflags="$write_ldflags $ao_libs -lao -lpthread"
933         writers="$writers ao"
934         AC_SUBST(ao_cppflags)
935 fi
936
937 CPPFLAGS="$OLD_CPPFLAGS"
938 LDFLAGS="$OLD_LDFLAGS"
939 LIBS="$OLD_LIBS"
940 ############################################################# readline
941 OLD_CPPFLAGS="$CPPFLAGS"
942 OLD_LD_FLAGS="$LDFLAGS"
943 OLD_LIBS="$LIBS"
944
945 have_readline="yes"
946 AC_ARG_WITH(readline_headers, [AC_HELP_STRING(--with-readline-headers=dir,
947         [look for libreadline header files also in dir])])
948 if test -n "$with_readline_headers"; then
949         readline_cppflags="-I$with_readline_headers"
950         CPPFLAGS="$CPPFLAGS $readline_cppflags"
951 fi
952
953 AC_ARG_WITH(readline_libs, [AC_HELP_STRING(--with-readline-libs=dir,
954         [look for readline library also in dir])])
955 if test -n "$with_readline_libs"; then
956         readline_libs="-L$with_readline_libs"
957         LDFLAGS="$LDFLAGS $readline_libs"
958 fi
959 msg="no interactive cli support"
960 AC_CHECK_HEADERS([readline/readline.h], [
961         ], [
962         have_readline="no"
963         AC_MSG_WARN([readline/readline.h not found, $msg])
964 ])
965 if test "$have_readline" = "yes"; then
966         readline_libs="$readline_libs -lreadline"
967         AC_SEARCH_LIBS([rl_replace_line], [readline], [], [have_readline="no"])
968         if test "$have_readline" = "no"; then # try with -lcurses
969                 # clear cache
970                 AC_MSG_NOTICE([trying again with -lcurses])
971                 unset ac_cv_search_rl_replace_line 2> /dev/null
972                 AC_SEARCH_LIBS([rl_replace_line], [readline], [
973                         have_readline=yes
974                         readline_libs="$readline_libs -lcurses"
975                 ], [], [-lcurses])
976         fi
977         if test "$have_readline" = "no"; then # try with -ltermcap
978                 # clear cache
979                 AC_MSG_NOTICE([trying again with -ltermcap])
980                 unset ac_cv_search_rl_replace_line 2> /dev/null
981                 AC_SEARCH_LIBS([rl_replace_line], [readline], [
982                         have_readline=yes
983                         readline_libs="$readline_libs -ltermcap"
984                 ], [], [-ltermcap])
985         fi
986 fi
987
988 if test "$have_readline" = "yes"; then
989         all_errlist_objs="$all_errlist_objs interactive"
990         client_errlist_objs="$client_errlist_objs interactive"
991         client_ldflags="$client_ldflags $readline_libs"
992         audioc_errlist_objs="$audioc_errlist_objs buffer_tree interactive sched time"
993         audioc_ldflags="$audioc_ldflags $readline_libs"
994         AC_SUBST(readline_cppflags)
995         AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
996 else
997         AC_MSG_WARN([libreadline not found or unusable])
998 fi
999 CPPFLAGS="$OLD_CPPFLAGS"
1000 LDFLAGS="$OLD_LDFLAGS"
1001 LIBS="$OLD_LIBS"
1002 #############################################################
1003
1004
1005 AC_SUBST(install_sh, [$INSTALL])
1006 AC_CONFIG_FILES([Makefile])
1007
1008
1009 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
1010 AC_DEFUN([add_para],[$(for i in $@; do printf "para_$i "; done)])
1011 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) }])
1012 ############################################################# error2.h
1013 AC_MSG_NOTICE(creating error2.h)
1014 for i in $executables; do
1015         echo "$i: "
1016         eval echo \$${i}_errlist_objs
1017 done | ./error2.pl > error2.h
1018 for obj in $all_errlist_objs; do
1019         SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
1020 done
1021 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
1022         [enum {$SS NUM_SS}],
1023         [list of all objects that use the paraslash error facility]
1024 )
1025
1026 ################################################################## status items
1027
1028 status_items="basename status num_played mtime bitrate frequency file_size
1029 status_flags format score techinfo afs_mode
1030 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
1031 offset seconds_total stream_start current_time audiod_uptime image_id
1032 lyrics_id duration directory lyrics_name image_name path hash channels
1033 last_played num_chunks chunk_time amplification artist title year album
1034 comment"
1035
1036 result=
1037 for i in $status_items; do
1038         result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
1039 done
1040 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
1041         [enum of all status items])
1042
1043 result=
1044 for i in $status_items; do
1045         result="$result \"$i\", "
1046 done
1047 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
1048         [char * array of all status items])
1049
1050 AC_DEFINE_UNQUOTED(SERVER_AUDIO_FORMATS, "$server_audio_formats",
1051         [formats supported by para_server and para_afh])
1052
1053 AC_SUBST(executables, add_para($executables))
1054
1055 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
1056 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
1057 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
1058 server_objs="$server_cmdline_objs $server_errlist_objs"
1059 write_objs="$write_cmdline_objs $write_errlist_objs"
1060 client_objs="$client_cmdline_objs $client_errlist_objs"
1061 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
1062 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
1063 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
1064
1065 AC_SUBST(recv_objs, add_dot_o($recv_objs))
1066 AC_SUBST(recv_ldflags, $recv_ldflags)
1067 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
1068         errors used by para_recv)
1069
1070 AC_SUBST(filter_objs, add_dot_o($filter_objs))
1071 AC_SUBST(filter_ldflags, $filter_ldflags)
1072 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
1073         objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
1074
1075 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
1076 AC_SUBST(audiod_ldflags, $audiod_ldflags)
1077 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
1078         errors used by para_audiod)
1079
1080 AC_SUBST(server_objs, add_dot_o($server_objs))
1081 AC_SUBST(server_ldflags, $server_ldflags)
1082 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
1083         objlist_to_errlist($server_errlist_objs), errors used by para_server)
1084
1085 AC_SUBST(afh_objs, add_dot_o($afh_objs))
1086 AC_SUBST(afh_ldflags, $afh_ldflags)
1087 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
1088         objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
1089
1090 AC_SUBST(write_objs, add_dot_o($write_objs))
1091 AC_SUBST(write_ldflags, $write_ldflags)
1092 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
1093         objlist_to_errlist($write_errlist_objs), errors used by para_write)
1094
1095 AC_SUBST(client_objs, add_dot_o($client_objs))
1096 AC_SUBST(client_ldflags, $client_ldflags)
1097 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
1098         objlist_to_errlist($client_errlist_objs), errors used by para_client)
1099
1100 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
1101 AC_SUBST(audioc_ldflags, $audioc_ldflags)
1102 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
1103         objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
1104
1105 AC_SUBST(gui_objs, add_dot_o($gui_objs))
1106 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
1107         objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
1108
1109 AC_SUBST(fade_objs, add_dot_o($fade_objs))
1110 AC_SUBST(fade_ldflags, $fade_ldflags)
1111 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
1112         objlist_to_errlist($fade_errlist_objs), errors used by para_fade)
1113
1114
1115 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
1116 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
1117         enum of supported filters)
1118 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
1119 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
1120 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
1121 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
1122
1123 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
1124 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
1125         enum of supported writers)
1126 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
1127 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
1128 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
1129 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
1130 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
1131 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
1132 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
1133
1134 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
1135 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
1136         enum of audio formats supported by audiod)
1137 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
1138 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
1139
1140 AC_OUTPUT
1141 AC_MSG_NOTICE([
1142 paraslash configuration:
1143 ~~~~~~~~~~~~~~~~~~~~~~~~
1144 unix socket credentials: $have_ucred
1145 readline (interactive CLIs): $have_readline
1146 audio formats supported by para_server/para_afh: $server_audio_formats
1147 id3 version2 support: $have_libid3tag
1148 filters supported by para_audiod/para_filter: $filters
1149 writers supported by para_audiod/para_write: $writers
1150 optional executables: $extras
1151 ])