Allow switching between different log methods at runtime.
[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 ########################################################################### oss
733 OLD_CPPFLAGS="$CPPFLAGS"
734 OLD_LD_FLAGS="$LDFLAGS"
735 OLD_LIBS="$LIBS"
736
737 have_oss="yes"
738 msg="=> will not build para_fade/oss writer"
739
740 AC_CHECK_HEADER(sys/soundcard.h, [
741         extras="$extras fade"
742         executables="$executables fade"
743         all_errlist_objs="$all_errlist_objs oss_write"
744         audiod_errlist_objs="$audiod_errlist_objs oss_write"
745         audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
746
747         write_errlist_objs="$write_errlist_objs oss_write"
748         write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
749         writers="$writers oss"
750         default_writer="OSS_WRITE"
751         AC_CHECK_LIB(ossaudio, _oss_ioctl, [
752                         audiod_ldflags="$audiod_ldflags -lossaudio"
753                         write_ldflags="$write_ldflags -lossaudio"
754                         fade_ldflags="$write_ldflags -lossaudio"
755                 ]
756         )
757         ],
758         [
759                 have_oss="no"
760                 AC_MSG_WARN([no sys/soundcard.h $msg])
761         ]
762 )
763 CPPFLAGS="$OLD_CPPFLAGS"
764 LDFLAGS="$OLD_LDFLAGS"
765 LIBS="$OLD_LIBS"
766
767 ########################################################################### alsa
768 OLD_CPPFLAGS="$CPPFLAGS"
769 OLD_LD_FLAGS="$LDFLAGS"
770 OLD_LIBS="$LIBS"
771
772 msg="=> no alsa support for para_audiod/para_write"
773 if test "$OSTYPE" != "Linux"; then
774         have_alsa="no"
775 else
776         have_alsa="yes"
777 fi
778 if test "$have_alsa" = "yes"; then
779         AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
780                 have_alsa="no"
781                 AC_MSG_WARN([no alsa/asoundlib $msg])
782         ])
783 fi
784
785 if test "$have_alsa" = "yes"; then
786         AC_CHECK_LIB([asound], [snd_pcm_open], [], [
787                 have_alsa="no"
788                 AC_MSG_WARN([no libasound $msg])
789         ])
790 fi
791
792 if test "$have_alsa" = "yes"; then
793         all_errlist_objs="$all_errlist_objs alsa_write"
794         audiod_errlist_objs="$audiod_errlist_objs alsa_write"
795         audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
796         audiod_ldflags="$audiod_ldflags -lasound"
797
798         write_errlist_objs="$write_errlist_objs alsa_write"
799         write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
800         write_ldflags="$write_ldflags -lasound"
801         writers="$writers alsa"
802         default_writer="ALSA_WRITE"
803 fi
804
805 CPPFLAGS="$OLD_CPPFLAGS"
806 LDFLAGS="$OLD_LDFLAGS"
807 LIBS="$OLD_LIBS"
808 ########################################################################### libao
809 OLD_CPPFLAGS="$CPPFLAGS"
810 OLD_LD_FLAGS="$LDFLAGS"
811 OLD_LIBS="$LIBS"
812
813 have_ao="yes"
814 AC_ARG_WITH(ao_headers, [AC_HELP_STRING(--with-ao-headers=dir,
815         [look for ao/ao.h also in dir])])
816 if test -n "$with_ao_headers"; then
817         ao_cppflags="-I$with_ao_headers"
818         CPPFLAGS="$CPPFLAGS $ao_cppflags"
819 fi
820 AC_ARG_WITH(ao_libs, [AC_HELP_STRING(--with-ao-libs=dir,
821         [look for libao also in dir])])
822 if test -n "$with_ao_libs"; then
823         ao_libs="-L$with_ao_libs"
824         LDFLAGS="$LDFLAGS $ao_libs"
825 fi
826 msg="no libao support for para_audiod/para_write"
827 AC_CHECK_HEADERS([ao/ao.h], [
828         ], [
829         have_ao="no"
830         AC_MSG_WARN([ao.h not found, $msg])
831 ])
832 if test "$have_ao" = "yes"; then
833         AC_CHECK_LIB([ao], [ao_initialize], [], [
834                 have_ao="no"
835                 AC_MSG_WARN([ao lib not found or not working, $msg])
836         ])
837 fi
838 if test "$have_ao" = "yes"; then
839         AC_CHECK_HEADERS([pthread.h], [
840                 ], [
841                 have_ao="no"
842                 AC_MSG_WARN([pthread.h not found, $msg])
843         ])
844 fi
845 if test "$have_ao" = "yes"; then
846         AC_CHECK_LIB([pthread], [pthread_create], [], [
847                 have_ao="no"
848                 AC_MSG_WARN([pthread lib not found or not working, $msg])
849         ])
850 fi
851 if test "$have_ao" = "yes"; then
852         all_errlist_objs="$all_errlist_objs ao_write"
853         audiod_errlist_objs="$audiod_errlist_objs ao_write"
854         audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(ao_write)"
855         audiod_ldflags="$audiod_ldflags -lao -lpthread"
856
857         write_errlist_objs="$write_errlist_objs ao_write"
858         write_cmdline_objs="$write_cmdline_objs add_cmdline(ao_write)"
859         write_ldflags="$write_ldflags $ao_libs -lao -lpthread"
860         writers="$writers ao"
861         AC_SUBST(ao_cppflags)
862 fi
863
864 CPPFLAGS="$OLD_CPPFLAGS"
865 LDFLAGS="$OLD_LDFLAGS"
866 LIBS="$OLD_LIBS"
867
868
869
870 AC_SUBST(install_sh, [$INSTALL])
871 AC_CONFIG_FILES([Makefile])
872
873
874 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
875 AC_DEFUN([add_para],[$(for i in $@; do printf "para_$i "; done)])
876 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) }])
877 ############################################################# error2.h
878 AC_MSG_NOTICE(creating error2.h)
879 for i in $executables; do
880         echo "$i: "
881         eval echo \$${i}_errlist_objs
882 done | ./error2.pl > error2.h
883 for obj in $all_errlist_objs; do
884         SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
885 done
886 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
887         [enum {$SS NUM_SS}],
888         [list of all objects that use the paraslash error facility]
889 )
890
891 ################################################################## status items
892
893 status_items="basename status num_played mtime bitrate frequency file_size
894 status_flags format score techinfo afs_mode
895 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
896 offset seconds_total stream_start current_time audiod_uptime image_id
897 lyrics_id duration directory lyrics_name image_name path hash channels
898 last_played num_chunks chunk_time amplification artist title year album
899 comment"
900
901 result=
902 for i in $status_items; do
903         result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
904 done
905 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
906         [enum of all status items])
907
908 result=
909 for i in $status_items; do
910         result="$result \"$i\", "
911 done
912 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
913         [char * array of all status items])
914
915 AC_DEFINE_UNQUOTED(SERVER_AUDIO_FORMATS, "$server_audio_formats",
916         [formats supported by para_server and para_afh])
917
918 AC_SUBST(executables, add_para($executables))
919
920 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
921 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
922 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
923 server_objs="$server_cmdline_objs $server_errlist_objs"
924 write_objs="$write_cmdline_objs $write_errlist_objs"
925 client_objs="$client_cmdline_objs $client_errlist_objs"
926 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
927 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
928 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
929
930 AC_SUBST(recv_objs, add_dot_o($recv_objs))
931 AC_SUBST(recv_ldflags, $recv_ldflags)
932 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
933         errors used by para_recv)
934
935 AC_SUBST(filter_objs, add_dot_o($filter_objs))
936 AC_SUBST(filter_ldflags, $filter_ldflags)
937 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
938         objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
939
940 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
941 AC_SUBST(audiod_ldflags, $audiod_ldflags)
942 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
943         errors used by para_audiod)
944
945 AC_SUBST(server_objs, add_dot_o($server_objs))
946 AC_SUBST(server_ldflags, $server_ldflags)
947 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
948         objlist_to_errlist($server_errlist_objs), errors used by para_server)
949
950 AC_SUBST(afh_objs, add_dot_o($afh_objs))
951 AC_SUBST(afh_ldflags, $afh_ldflags)
952 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
953         objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
954
955 AC_SUBST(write_objs, add_dot_o($write_objs))
956 AC_SUBST(write_ldflags, $write_ldflags)
957 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
958         objlist_to_errlist($write_errlist_objs), errors used by para_write)
959
960 AC_SUBST(client_objs, add_dot_o($client_objs))
961 AC_SUBST(client_ldflags, $client_ldflags)
962 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
963         objlist_to_errlist($client_errlist_objs), errors used by para_client)
964
965 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
966 AC_SUBST(audioc_ldflags, $audioc_ldflags)
967 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
968         objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
969
970 AC_SUBST(gui_objs, add_dot_o($gui_objs))
971 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
972         objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
973
974 AC_SUBST(fade_objs, add_dot_o($fade_objs))
975 AC_SUBST(fade_ldflags, $fade_ldflags)
976 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
977         objlist_to_errlist($fade_errlist_objs), errors used by para_fade)
978
979
980 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
981 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
982         enum of supported filters)
983 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
984 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
985 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
986 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
987
988 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
989 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
990         enum of supported writers)
991 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
992 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
993 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
994 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
995 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
996 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
997 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
998
999 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
1000 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
1001         enum of audio formats supported by audiod)
1002 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
1003 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
1004
1005 AC_OUTPUT
1006 AC_MSG_NOTICE([
1007 paraslash configuration:
1008 ~~~~~~~~~~~~~~~~~~~~~~~~
1009 unix socket credentials: $have_ucred
1010 audio formats supported by para_server/para_afh: $server_audio_formats
1011 id3 version2 support: $have_libid3tag
1012 filters supported by para_audiod/para_filter: $filters
1013 writers supported by para_audiod/para_write: $writers
1014 optional executables: $extras
1015 ])