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