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