bc9c36047790106ddcf58a38ca358f1b9caa296c
[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_FUNC_STAT
78 AC_FUNC_STRFTIME
79 AC_FUNC_VPRINTF
80 AC_FUNC_CLOSEDIR_VOID
81 AC_FUNC_LSTAT
82
83 AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
84 regcomp select strchr strdup strerror strstr strtol uname \
85 fchdir gettimeofday localtime_r munmap strcasecmp strcspn \
86 strncasecmp strrchr strspn alarm mkdir inet_ntoa socket], [],
87 [AC_MSG_ERROR([function not found, cannot live without it])])
88
89 AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; done)])
90
91
92 all_errlist_objs="mp3_afh afh_common net string signal time daemon
93 stat afh fade amp_filter fd ringbuffer sched audiod
94 grab_client filter_common wav_filter compress_filter http_recv
95 dccp_recv recv_common write_common file_write audiod_command
96 client_common recv stdout filter stdin audioc write client
97 exec send_common ggo udp_recv color fec fecdec_filter
98 prebuffer_filter bitstream imdct
99 wma_afh wma_common wmadec_filter buffer_tree crypt_common
100 gui gui_theme sideband"
101
102 executables="recv filter audioc write client afh audiod"
103
104 recv_cmdline_objs="add_cmdline(recv http_recv dccp_recv udp_recv)"
105
106 recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
107 fd sched stdout ggo udp_recv buffer_tree"
108 recv_ldflags=""
109
110 filter_cmdline_objs="add_cmdline(filter compress_filter amp_filter prebuffer_filter)"
111 filter_errlist_objs="filter_common wav_filter compress_filter filter string
112 stdin stdout sched fd amp_filter ggo fecdec_filter fec
113 prebuffer_filter time bitstream imdct wma_common wmadec_filter buffer_tree"
114 filter_ldflags="-lm"
115 filters=" compress wav amp fecdec wmadec prebuffer"
116
117 audioc_cmdline_objs="add_cmdline(audioc)"
118 audioc_errlist_objs="audioc string net fd"
119 audioc_ldflags=""
120
121 audiod_cmdline_objs="add_cmdline(audiod compress_filter http_recv dccp_recv file_write client amp_filter udp_recv prebuffer_filter)"
122 audiod_errlist_objs="audiod signal string daemon stat net crypt_common sideband
123 time grab_client filter_common wav_filter compress_filter amp_filter http_recv dccp_recv
124 recv_common fd sched write_common file_write audiod_command fecdec_filter
125 client_common ggo udp_recv color fec prebuffer_filter
126 bitstream imdct wma_common wmadec_filter buffer_tree"
127 audiod_ldflags="-lm"
128 audiod_audio_formats="wma"
129
130 afh_cmdline_objs="add_cmdline(afh)"
131 afh_errlist_objs="afh string fd mp3_afh afh_common time wma_afh wma_common"
132 afh_ldflags=""
133
134 write_cmdline_objs="add_cmdline(write file_write)"
135 write_errlist_objs="write write_common file_write time fd string sched stdin
136 buffer_tree ggo"
137 write_ldflags=""
138 writers=" file"
139 default_writer="FILE_WRITE"
140
141 client_cmdline_objs="add_cmdline(client)"
142 client_errlist_objs="client net string fd sched stdin stdout time sideband
143 client_common buffer_tree crypt_common"
144 client_ldflags=""
145
146 gui_cmdline_objs="add_cmdline(gui)"
147 gui_errlist_objs="exec signal string stat ringbuffer fd gui gui_theme"
148 gui_objs="$gui_cmdline_objs $gui_errlist_objs"
149
150 fade_cmdline_objs="add_cmdline(fade)"
151 fade_errlist_objs="fade exec string fd"
152
153
154 ########################################################################### snprintf
155 # ===========================================================================
156 # http://www.nongnu.org/autoconf-archive/ax_func_snprintf.html
157 # ===========================================================================
158 #
159 # SYNOPSIS
160 #
161 # AX_FUNC_SNPRINTF
162 #
163 # DESCRIPTION
164 #
165 # Checks for a fully C99 compliant snprintf, in particular checks whether
166 # it does bounds checking and returns the correct string length; does the
167 # same check for vsnprintf. If no working snprintf or vsnprintf is found,
168 # it prints an error message and aborts.
169 #
170 # LICENSE
171 #
172 # Copyright (c) 2008 Ruediger Kuhlmann <info@ruediger-kuhlmann.de>
173 #
174 # Copying and distribution of this file, with or without modification, are
175 # permitted in any medium without royalty provided the copyright notice
176 # and this notice are preserved.
177
178 AU_ALIAS([AC_FUNC_SNPRINTF], [AX_FUNC_SNPRINTF])
179 AC_DEFUN([AX_FUNC_SNPRINTF],
180 [AC_CHECK_FUNCS(snprintf vsnprintf)
181 AC_MSG_CHECKING(for working snprintf)
182 AC_CACHE_VAL(ac_cv_have_working_snprintf,
183 [AC_TRY_RUN(
184 [#include <stdio.h>
185
186 int main(void)
187 {
188 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
189 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
190 int i;
191 i = snprintf (bufs, 2, "%s", "111");
192 if (strcmp (bufs, "1")) exit (1);
193 if (i != 3) exit (1);
194 i = snprintf (bufd, 2, "%d", 111);
195 if (strcmp (bufd, "1")) exit (1);
196 if (i != 3) exit (1);
197 exit(0);
198 }], ac_cv_have_working_snprintf=yes, ac_cv_have_working_snprintf=no, ac_cv_have_working_snprintf=cross)])
199 AC_MSG_RESULT([$ac_cv_have_working_snprintf])
200 AC_MSG_CHECKING(for working vsnprintf)
201 AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
202 [AC_TRY_RUN(
203 [#include <stdio.h>
204 #include <stdarg.h>
205
206 int my_vsnprintf (char *buf, const char *tmpl, ...)
207 {
208 int i;
209 va_list args;
210 va_start (args, tmpl);
211 i = vsnprintf (buf, 2, tmpl, args);
212 va_end (args);
213 return i;
214 }
215
216 int main(void)
217 {
218 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
219 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
220 int i;
221 i = my_vsnprintf (bufs, "%s", "111");
222 if (strcmp (bufs, "1")) exit (1);
223 if (i != 3) exit (1);
224 i = my_vsnprintf (bufd, "%d", 111);
225 if (strcmp (bufd, "1")) exit (1);
226 if (i != 3) exit (1);
227 exit(0);
228 }], ac_cv_have_working_vsnprintf=yes, ac_cv_have_working_vsnprintf=no, ac_cv_have_working_vsnprintf=cross)])
229 AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
230 if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
231 AC_MSG_ERROR([fatal: buggy snprintf() detected])
232 fi])
233 AX_FUNC_SNPRINTF()
234 ########################################################################### osl
235 have_osl=yes
236 OLD_CPPFLAGS="$CPPFLAGS"
237 OLD_LD_FLAGS="$LDFLAGS"
238 OLD_LIBS="$LIBS"
239 AC_ARG_WITH(osl_headers, [AC_HELP_STRING(--with-osl-headers=dir,
240 [look for osl.h also in dir])])
241 if test -n "$with_osl_headers"; then
242 osl_cppflags="-I$with_osl_headers"
243 CPPFLAGS="$CPPFLAGS $osl_cppflags"
244 fi
245 AC_ARG_WITH(osl_libs, [AC_HELP_STRING(--with-osl-libs=dir,
246 [look for libosl also in dir])])
247 if test -n "$with_osl_libs"; then
248 osl_libs="-L$with_osl_libs"
249 LDFLAGS="$LDFLAGS $osl_libs"
250 fi
251
252 AC_CHECK_HEADER(osl.h, [], have_osl=no)
253 AC_CHECK_LIB([osl], [osl_open_table], [], have_osl=no)
254 if test "$have_osl" = "no"; then
255 AC_MSG_WARN([libosl not found, can not build para_server.
256 Download libosl at
257 http://systemlinux.org/~maan/osl
258 or execute
259 git clone git://git.tuebingen.mpg.de/osl
260 ])
261 else
262 extras="$extras server"
263 executables="$executables server"
264 server_cmdline_objs="add_cmdline(server)"
265 server_errlist_objs="server afh_common mp3_afh vss command net
266 string signal time daemon http_send close_on_fork mm
267 crypt_common ipc dccp_send fd user_list chunk_queue
268 afs aft mood score attribute blob playlist sched acl
269 send_common udp_send color fec wma_afh wma_common sideband"
270 all_errlist_objs="$all_errlist_objs server vss command
271 http_send close_on_fork mm ipc dccp_send user_list
272 chunk_queue afs aft mood score attribute blob playlist
273 acl udp_send"
274
275 server_ldflags=""
276 server_audio_formats="mp3 wma"
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 # ipc is linked into para_server server and into the osx writer. If osl
504 # was not found, para_server will not be built and ipc has not yet been
505 # added to the list of all objects, so we must add it here.
506 if test "$have_osl" = "no"; then
507 all_errlist_objs="$all_errlist_objs ipc"
508 fi
509 audiod_errlist_objs="$audiod_errlist_objs osx_write ipc"
510 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
511 audiod_ldflags="$audiod_ldflags $f"
512
513 write_errlist_objs="$write_errlist_objs osx_write ipc"
514 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
515 write_ldflags="$write_ldflags $f"
516 writers="$writers osx"
517 default_writer="OSX_WRITE"
518 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
519 fi
520 ########################################################### ogg/vorbis/speex
521 have_ogg="yes"
522 OLD_CPPFLAGS="$CPPFLAGS"
523 OLD_LD_FLAGS="$LDFLAGS"
524 OLD_LIBS="$LIBS"
525 AC_ARG_WITH(ogg_headers, [AC_HELP_STRING(--with-ogg-headers=dir,
526 [look for ogg headers also in dir])])
527 AC_ARG_WITH(ogg_libs, [AC_HELP_STRING(--with-ogg-libs=dir,
528 [look for ogg libs also in dir])])
529 AC_ARG_WITH(vorbis_headers, [AC_HELP_STRING(--with-vorbis-headers=dir,
530 [look for vorbis headers also in dir])])
531 AC_ARG_WITH(vorbis_libs, [AC_HELP_STRING(--with-vorbis-libs=dir,
532 [look for vorbis libs also in dir])])
533 AC_ARG_WITH(speex_headers, [AC_HELP_STRING(--with-speex-headers=dir,
534 [look for speex headers also in dir])])
535 AC_ARG_WITH(speex_libs, [AC_HELP_STRING(--with-speex-libs=dir,
536 [look for speex libs also in dir])])
537
538 if test -n "$with_ogg_headers"; then
539 ogg_cppflags="-I$with_ogg_headers"
540 CPPFLAGS="$CPPFLAGS $ogg_cppflags"
541 fi
542 if test -n "$with_ogg_libs"; then
543 ogg_libs="-L$with_ogg_libs"
544 LDFLAGS="$LDFLAGS $ogg_libs"
545 fi
546 AC_CHECK_HEADERS([ogg/ogg.h], [], [ have_ogg="no"; ])
547 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
548
549 have_vorbis="yes"
550 have_speex="yes"
551 if test "$have_ogg" = "yes"; then
552 # vorbis
553 if test -n "$with_vorbis_headers"; then
554 vorbis_cppflags="-I$with_vorbis_headers"
555 CPPFLAGS="$CPPFLAGS $vorbis_cppflags"
556 fi
557 if test -n "$with_vorbis_libs"; then
558 vorbis_libs="-L$with_vorbis_libs"
559 LDFLAGS="$LDFLAGS $vorbis_libs"
560 fi
561 AC_CHECK_HEADERS([vorbis/codec.h], [], [ have_vorbis="no" ])
562 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_vorbis="no" ])
563
564 # speex
565 if test -n "$with_speex_headers"; then
566 speex_cppflags="-I$with_speex_headers"
567 CPPFLAGS="$CPPFLAGS $speex_cppflags"
568 fi
569 if test -n "$with_speex_libs"; then
570 speex_libs="-L$with_speex_libs"
571 LDFLAGS="$LDFLAGS $speex_libs"
572 fi
573 AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ])
574 AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ])
575 else
576 AC_MSG_WARN([vorbis/speex depend on libogg, which was not detected])
577 have_vorbis="no"
578 have_speex="no"
579 fi
580
581 msg="support in para_server/para_filter/para_afh"
582 if test "$have_vorbis" = "yes" || test "$have_speex" = "yes"; then
583 AC_SUBST(ogg_cppflags)
584 ogg_libs="$ogg_libs -logg"
585 if test "$OSTYPE" = "Darwin"; then
586 ogg_libs="-Wl,-bind_at_load $ogg_libs"
587 fi
588 server_ldflags="$server_ldflags $ogg_libs"
589 filter_ldflags="$filter_ldflags $ogg_libs"
590 audiod_ldflags="$audiod_ldflags $ogg_libs"
591 afh_ldflags="$afh_ldflags $ogg_libs"
592 all_errlist_objs="$all_errlist_objs ogg_afh_common"
593 afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
594 server_errlist_objs="$server_errlist_objs ogg_afh_common"
595 fi
596 if test "$have_vorbis" = "yes"; then
597 all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh"
598 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support)
599 filters="$filters oggdec"
600 vorbis_libs="-lvorbis -lvorbisfile"
601 server_ldflags="$server_ldflags $vorbis_libs"
602 filter_ldflags="$filter_ldflags $vorbis_libs"
603 audiod_ldflags="$audiod_ldflags $vorbis_libs"
604 afh_ldflags="$afh_ldflags $vorbis_libs"
605
606 server_errlist_objs="$server_errlist_objs ogg_afh"
607 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
608 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
609 afh_errlist_objs="$afh_errlist_objs ogg_afh"
610
611 audiod_audio_formats="$audiod_audio_formats ogg"
612 server_audio_formats="$server_audio_formats ogg"
613 else
614 AC_MSG_WARN([no ogg/vorbis $msg])
615 fi
616 if test "$have_speex" = "yes"; then
617 all_errlist_objs="$all_errlist_objs spxdec_filter spx_afh spx_common"
618 AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support)
619 filters="$filters spxdec"
620 speex_libs="-lspeex"
621 server_ldflags="$server_ldflags $speex_libs"
622 filter_ldflags="$filter_ldflags $speex_libs"
623 audiod_ldflags="$audiod_ldflags $speex_libs"
624 afh_ldflags="$afh_ldflags $speex_libs"
625
626 server_errlist_objs="$server_errlist_objs spx_afh spx_common"
627 filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
628 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
629 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
630
631 audiod_audio_formats="$audiod_audio_formats spx"
632 server_audio_formats="$server_audio_formats spx"
633 else
634 AC_MSG_WARN([no ogg/speex $msg])
635 fi
636 CPPFLAGS="$OLD_CPPFLAGS"
637 LDFLAGS="$OLD_LDFLAGS"
638 LIBS="$OLD_LIBS"
639 ########################################################################### faad
640 have_faad=yes
641 OLD_CPPFLAGS="$CPPFLAGS"
642 OLD_LD_FLAGS="$LDFLAGS"
643 OLD_LIBS="$LIBS"
644 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
645 [look for neaacdec.h also in dir])])
646 if test -n "$with_faad_headers"; then
647 faad_cppflags="-I$with_faad_headers"
648 CPPFLAGS="$CPPFLAGS $faad_cppflags"
649 fi
650 AC_ARG_WITH(faad_libs, [AC_HELP_STRING(--with-faad-libs=dir,
651 [look for libfaad also in dir])])
652 if test -n "$with_faad_libs"; then
653 faad_libs="-L$with_faad_libs"
654 LDFLAGS="$LDFLAGS $faad_libs"
655 fi
656 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
657 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
658 if test "$have_faad" = "yes"; then
659 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
660 all_errlist_objs="$all_errlist_objs aac_common aacdec_filter aac_afh"
661 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
662 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
663 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
664 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
665 server_ldflags="$server_ldflags $faad_libs -lfaad"
666 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
667 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
668 afh_ldflags="$afh_ldflags $faad_libs -lfaad"
669 audiod_audio_formats="$audiod_audio_formats aac"
670 server_audio_formats="$server_audio_formats aac"
671 filters="$filters aacdec"
672 AC_SUBST(faad_cppflags)
673 else
674 AC_MSG_WARN([no aac support in para_audiod/para_filter])
675 fi
676 CPPFLAGS="$OLD_CPPFLAGS"
677 LDFLAGS="$OLD_LDFLAGS"
678 LIBS="$OLD_LIBS"
679 ########################################################################### mad
680 have_mad="yes"
681 OLD_CPPFLAGS="$CPPFLAGS"
682 OLD_LD_FLAGS="$LDFLAGS"
683 OLD_LIBS="$LIBS"
684
685 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
686 [look for mad.h also in dir])])
687 if test -n "$with_mad_headers"; then
688 mad_cppflags="-I$with_mad_headers"
689 CPPFLAGS="$CPPFLAGS $mad_cppflags"
690 fi
691 AC_ARG_WITH(mad_libs, [AC_HELP_STRING(--with-mad-libs=dir,
692 [look for libmad also in dir])])
693 if test -n "$with_mad_libs"; then
694 mad_libs="-L$with_mad_libs"
695 LDFLAGS="$LDFLAGS $mad_libs"
696 fi
697 AC_CHECK_HEADERS([mad.h], [], [
698 have_mad="no"
699 ])
700 AC_CHECK_LIB([mad], [mad_stream_init], [], [
701 have_mad="no"
702 ])
703 if test "$have_mad" = "yes"; then
704 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
705 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
706 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
707 all_errlist_objs="$all_errlist_objs mp3dec_filter"
708 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
709 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
710 filter_ldflags="$filter_ldflags $mad_libs -lmad"
711 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
712 audiod_audio_formats="$audiod_audio_formats mp3"
713 filters="$filters mp3dec"
714 AC_SUBST(mad_cppflags)
715 else
716 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
717 fi
718 CPPFLAGS="$OLD_CPPFLAGS"
719 LDFLAGS="$OLD_LDFLAGS"
720 LIBS="$OLD_LIBS"
721 ###################################################################### libid3tag
722 OLD_CPPFLAGS="$CPPFLAGS"
723 OLD_LD_FLAGS="$LDFLAGS"
724 OLD_LIBS="$LIBS"
725
726 have_libid3tag="yes"
727 AC_ARG_WITH(id3tag_headers, [AC_HELP_STRING(--with-id3tag-headers=dir,
728 [look for id3tag header files also in dir])])
729 if test -n "$with_id3tag_headers"; then
730 id3tag_cppflags="-I$with_id3tag_headers"
731 CPPFLAGS="$CPPFLAGS $id3tag_cppflags"
732 fi
733 AC_ARG_WITH(id3tag_libs, [AC_HELP_STRING(--with-id3tag-libs=dir,
734 [look for id3tag libs also in dir])])
735 if test -n "$with_id3tag_libs"; then
736 id3tag_libs="-L$with_id3tag_libs"
737 LDFLAGS="$LDFLAGS $id3tag_libs"
738 fi
739
740 AC_MSG_CHECKING(for libid3tag)
741 AC_TRY_LINK([
742 #include <id3tag.h>
743 ],[
744 struct id3_tag t = {.flags = 0};
745 ],[], [have_libid3tag=no])
746 AC_MSG_RESULT($have_libid3tag)
747
748 if test ${have_libid3tag} = yes; then
749 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
750 server_ldflags="$server_ldflags $id3tag_libs -lid3tag -lz"
751 afh_ldflags="$afh_ldflags $id3tag_libs -lid3tag -lz"
752 AC_SUBST(id3tag_cppflags)
753 else
754 AC_MSG_WARN([no support for id3v2 tags])
755 fi
756 CPPFLAGS="$OLD_CPPFLAGS"
757 LDFLAGS="$OLD_LDFLAGS"
758 LIBS="$OLD_LIBS"
759 ########################################################################### flac
760 OLD_CPPFLAGS="$CPPFLAGS"
761 OLD_LD_FLAGS="$LDFLAGS"
762 OLD_LIBS="$LIBS"
763
764 have_flac="yes"
765 AC_ARG_WITH(flac_headers, [AC_HELP_STRING(--with-flac-headers=dir,
766 [look for flac headers also in dir])])
767 if test -n "$with_flac_headers"; then
768 flac_cppflags="-I$with_flac_headers"
769 CPPFLAGS="$CPPFLAGS $flac_cppflags"
770 fi
771 AC_ARG_WITH(flac_libs, [AC_HELP_STRING(--with-flac-libs=dir,
772 [look for flac libs also in dir])])
773 if test -n "$with_flac_libs"; then
774 flac_libs="-L$with_flac_libs"
775 LDFLAGS="$LDFLAGS $flac_libs"
776 fi
777 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no)
778 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], have_flac=no, -logg -lm)
779 if test "$have_flac" = "yes"; then
780 AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter)
781 all_errlist_objs="$all_errlist_objs flacdec_filter flac_afh"
782 filter_errlist_objs="$filter_errlist_objs flacdec_filter"
783 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
784 afh_errlist_objs="$afh_errlist_objs flac_afh"
785 server_errlist_objs="$server_errlist_objs flac_afh"
786 filter_ldflags="$filter_ldflags $flac_libs -lFLAC"
787 audiod_ldflags="$audiod_ldflags $flac_libs -lFLAC"
788 server_ldflags="$server_ldflags $flac_libs -lFLAC"
789 afh_ldflags="$afh_ldflags $flac_libs -lFLAC"
790 filters="$filters flacdec"
791 server_audio_formats="$server_audio_formats flac"
792 audiod_audio_formats="$audiod_audio_formats flac"
793 AC_SUBST(flac_cppflags)
794 else
795 AC_MSG_WARN([no flac support in para_audiod/para_filter])
796 fi
797 CPPFLAGS="$OLD_CPPFLAGS"
798 LDFLAGS="$OLD_LDFLAGS"
799 LIBS="$OLD_LIBS"
800 ########################################################################### oss
801 OLD_CPPFLAGS="$CPPFLAGS"
802 OLD_LD_FLAGS="$LDFLAGS"
803 OLD_LIBS="$LIBS"
804
805 have_oss="yes"
806 msg="=> will not build para_fade/oss writer"
807
808 AC_CHECK_HEADER(sys/soundcard.h, [
809 extras="$extras fade"
810 executables="$executables fade"
811 all_errlist_objs="$all_errlist_objs oss_write"
812 audiod_errlist_objs="$audiod_errlist_objs oss_write"
813 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
814
815 write_errlist_objs="$write_errlist_objs oss_write"
816 write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
817 writers="$writers oss"
818 default_writer="OSS_WRITE"
819 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
820 audiod_ldflags="$audiod_ldflags -lossaudio"
821 write_ldflags="$write_ldflags -lossaudio"
822 fade_ldflags="$fade_ldflags -lossaudio"
823 ]
824 )
825 ],
826 [
827 have_oss="no"
828 AC_MSG_WARN([no sys/soundcard.h $msg])
829 ]
830 )
831 CPPFLAGS="$OLD_CPPFLAGS"
832 LDFLAGS="$OLD_LDFLAGS"
833 LIBS="$OLD_LIBS"
834
835 ########################################################################### alsa
836 OLD_CPPFLAGS="$CPPFLAGS"
837 OLD_LD_FLAGS="$LDFLAGS"
838 OLD_LIBS="$LIBS"
839
840 msg="=> no alsa support for para_audiod/para_write"
841 if test "$OSTYPE" != "Linux"; then
842 have_alsa="no"
843 else
844 have_alsa="yes"
845 fi
846 if test "$have_alsa" = "yes"; then
847 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
848 have_alsa="no"
849 AC_MSG_WARN([no alsa/asoundlib $msg])
850 ])
851 fi
852
853 if test "$have_alsa" = "yes"; then
854 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
855 have_alsa="no"
856 AC_MSG_WARN([no libasound $msg])
857 ])
858 fi
859
860 if test "$have_alsa" = "yes"; then
861 all_errlist_objs="$all_errlist_objs alsa_write"
862 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
863 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
864 audiod_ldflags="$audiod_ldflags -lasound"
865
866 write_errlist_objs="$write_errlist_objs alsa_write"
867 write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
868 write_ldflags="$write_ldflags -lasound"
869 writers="$writers alsa"
870 default_writer="ALSA_WRITE"
871 fi
872
873 CPPFLAGS="$OLD_CPPFLAGS"
874 LDFLAGS="$OLD_LDFLAGS"
875 LIBS="$OLD_LIBS"
876 ########################################################################### libao
877 OLD_CPPFLAGS="$CPPFLAGS"
878 OLD_LD_FLAGS="$LDFLAGS"
879 OLD_LIBS="$LIBS"
880
881 have_ao="yes"
882 AC_ARG_WITH(ao_headers, [AC_HELP_STRING(--with-ao-headers=dir,
883 [look for ao/ao.h also in dir])])
884 if test -n "$with_ao_headers"; then
885 ao_cppflags="-I$with_ao_headers"
886 CPPFLAGS="$CPPFLAGS $ao_cppflags"
887 fi
888 AC_ARG_WITH(ao_libs, [AC_HELP_STRING(--with-ao-libs=dir,
889 [look for libao also in dir])])
890 if test -n "$with_ao_libs"; then
891 ao_libs="-L$with_ao_libs"
892 LDFLAGS="$LDFLAGS $ao_libs"
893 fi
894 msg="no libao support for para_audiod/para_write"
895 AC_CHECK_HEADERS([ao/ao.h], [
896 ], [
897 have_ao="no"
898 AC_MSG_WARN([ao.h not found, $msg])
899 ])
900 if test "$have_ao" = "yes"; then
901 AC_CHECK_LIB([ao], [ao_initialize], [], [
902 have_ao="no"
903 AC_MSG_WARN([ao lib not found or not working, $msg])
904 ])
905 fi
906 if test "$have_ao" = "yes"; then
907 AC_CHECK_HEADERS([pthread.h], [
908 ], [
909 have_ao="no"
910 AC_MSG_WARN([pthread.h not found, $msg])
911 ])
912 fi
913 if test "$have_ao" = "yes"; then
914 AC_CHECK_LIB([pthread], [pthread_create], [], [
915 have_ao="no"
916 AC_MSG_WARN([pthread lib not found or not working, $msg])
917 ])
918 fi
919 if test "$have_ao" = "yes"; then
920 all_errlist_objs="$all_errlist_objs ao_write"
921 audiod_errlist_objs="$audiod_errlist_objs ao_write"
922 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(ao_write)"
923 audiod_ldflags="$audiod_ldflags -lao -lpthread"
924
925 write_errlist_objs="$write_errlist_objs ao_write"
926 write_cmdline_objs="$write_cmdline_objs add_cmdline(ao_write)"
927 write_ldflags="$write_ldflags $ao_libs -lao -lpthread"
928 writers="$writers ao"
929 AC_SUBST(ao_cppflags)
930 fi
931
932 CPPFLAGS="$OLD_CPPFLAGS"
933 LDFLAGS="$OLD_LDFLAGS"
934 LIBS="$OLD_LIBS"
935 ############################################################# readline
936 OLD_CPPFLAGS="$CPPFLAGS"
937 OLD_LD_FLAGS="$LDFLAGS"
938 OLD_LIBS="$LIBS"
939
940 have_readline="yes"
941 AC_ARG_WITH(readline_headers, [AC_HELP_STRING(--with-readline-headers=dir,
942 [look for libreadline header files also in dir])])
943 if test -n "$with_readline_headers"; then
944 readline_cppflags="-I$with_readline_headers"
945 CPPFLAGS="$CPPFLAGS $readline_cppflags"
946 fi
947
948 AC_ARG_WITH(readline_libs, [AC_HELP_STRING(--with-readline-libs=dir,
949 [look for readline library also in dir])])
950 if test -n "$with_readline_libs"; then
951 readline_libs="-L$with_readline_libs"
952 LDFLAGS="$LDFLAGS $readline_libs"
953 fi
954 msg="no interactive cli support"
955 AC_CHECK_HEADERS([readline/readline.h], [
956 ], [
957 have_readline="no"
958 AC_MSG_WARN([readline/readline.h not found, $msg])
959 ])
960 if test "$have_readline" = "yes"; then
961 readline_libs="$readline_libs -lreadline"
962 AC_SEARCH_LIBS([rl_replace_line], [readline], [], [have_readline="no"])
963 if test "$have_readline" = "no"; then # try with -lcurses
964 # clear cache
965 AC_MSG_NOTICE([trying again with -lcurses])
966 unset ac_cv_search_rl_replace_line 2> /dev/null
967 AC_SEARCH_LIBS([rl_replace_line], [readline], [
968 have_readline=yes
969 readline_libs="$readline_libs -lcurses"
970 ], [], [-lcurses])
971 fi
972 if test "$have_readline" = "no"; then # try with -ltermcap
973 # clear cache
974 AC_MSG_NOTICE([trying again with -ltermcap])
975 unset ac_cv_search_rl_replace_line 2> /dev/null
976 AC_SEARCH_LIBS([rl_replace_line], [readline], [
977 have_readline=yes
978 readline_libs="$readline_libs -ltermcap"
979 ], [], [-ltermcap])
980 fi
981 fi
982
983 if test "$have_readline" = "yes"; then
984 all_errlist_objs="$all_errlist_objs interactive"
985 client_errlist_objs="$client_errlist_objs interactive"
986 client_ldflags="$client_ldflags $readline_libs"
987 audioc_errlist_objs="$audioc_errlist_objs buffer_tree interactive sched time"
988 audioc_ldflags="$audioc_ldflags $readline_libs"
989 AC_SUBST(readline_cppflags)
990 AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
991 else
992 AC_MSG_WARN([libreadline not found or unusable])
993 fi
994 CPPFLAGS="$OLD_CPPFLAGS"
995 LDFLAGS="$OLD_LDFLAGS"
996 LIBS="$OLD_LIBS"
997 #############################################################
998
999
1000 AC_SUBST(install_sh, [$INSTALL])
1001 AC_CONFIG_FILES([Makefile])
1002
1003
1004 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
1005 AC_DEFUN([add_para],[$(for i in $@; do printf "para_$i "; done)])
1006 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) }])
1007 ############################################################# error2.h
1008 AC_MSG_NOTICE(creating error2.h)
1009 for i in $executables; do
1010 echo "$i: "
1011 eval echo \$${i}_errlist_objs
1012 done | ./error2.pl > error2.h
1013 for obj in $all_errlist_objs; do
1014 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
1015 done
1016 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
1017 [enum {$SS NUM_SS}],
1018 [list of all objects that use the paraslash error facility]
1019 )
1020
1021 ################################################################## status items
1022
1023 status_items="basename status num_played mtime bitrate frequency file_size
1024 status_flags format score techinfo afs_mode
1025 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
1026 offset seconds_total stream_start current_time audiod_uptime image_id
1027 lyrics_id duration directory lyrics_name image_name path hash channels
1028 last_played num_chunks chunk_time amplification artist title year album
1029 comment"
1030
1031 result=
1032 for i in $status_items; do
1033 result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
1034 done
1035 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
1036 [enum of all status items])
1037
1038 result=
1039 for i in $status_items; do
1040 result="$result \"$i\", "
1041 done
1042 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
1043 [char * array of all status items])
1044
1045 AC_DEFINE_UNQUOTED(SERVER_AUDIO_FORMATS, "$server_audio_formats",
1046 [formats supported by para_server and para_afh])
1047
1048 AC_SUBST(executables, add_para($executables))
1049
1050 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
1051 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
1052 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
1053 server_objs="$server_cmdline_objs $server_errlist_objs"
1054 write_objs="$write_cmdline_objs $write_errlist_objs"
1055 client_objs="$client_cmdline_objs $client_errlist_objs"
1056 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
1057 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
1058 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
1059
1060 AC_SUBST(recv_objs, add_dot_o($recv_objs))
1061 AC_SUBST(recv_ldflags, $recv_ldflags)
1062 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
1063 errors used by para_recv)
1064
1065 AC_SUBST(filter_objs, add_dot_o($filter_objs))
1066 AC_SUBST(filter_ldflags, $filter_ldflags)
1067 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
1068 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
1069
1070 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
1071 AC_SUBST(audiod_ldflags, $audiod_ldflags)
1072 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
1073 errors used by para_audiod)
1074
1075 AC_SUBST(server_objs, add_dot_o($server_objs))
1076 AC_SUBST(server_ldflags, $server_ldflags)
1077 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
1078 objlist_to_errlist($server_errlist_objs), errors used by para_server)
1079
1080 AC_SUBST(afh_objs, add_dot_o($afh_objs))
1081 AC_SUBST(afh_ldflags, $afh_ldflags)
1082 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
1083 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
1084
1085 AC_SUBST(write_objs, add_dot_o($write_objs))
1086 AC_SUBST(write_ldflags, $write_ldflags)
1087 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
1088 objlist_to_errlist($write_errlist_objs), errors used by para_write)
1089
1090 AC_SUBST(client_objs, add_dot_o($client_objs))
1091 AC_SUBST(client_ldflags, $client_ldflags)
1092 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
1093 objlist_to_errlist($client_errlist_objs), errors used by para_client)
1094
1095 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
1096 AC_SUBST(audioc_ldflags, $audioc_ldflags)
1097 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
1098 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
1099
1100 AC_SUBST(gui_objs, add_dot_o($gui_objs))
1101 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
1102 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
1103
1104 AC_SUBST(fade_objs, add_dot_o($fade_objs))
1105 AC_SUBST(fade_ldflags, $fade_ldflags)
1106 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
1107 objlist_to_errlist($fade_errlist_objs), errors used by para_fade)
1108
1109
1110 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
1111 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
1112 enum of supported filters)
1113 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
1114 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
1115 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
1116 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
1117
1118 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
1119 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
1120 enum of supported writers)
1121 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
1122 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
1123 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
1124 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
1125 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
1126 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
1127 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
1128
1129 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
1130 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
1131 enum of audio formats supported by audiod)
1132 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
1133 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
1134
1135 AC_OUTPUT
1136 AC_MSG_NOTICE([
1137 paraslash configuration:
1138 ~~~~~~~~~~~~~~~~~~~~~~~~
1139 unix socket credentials: $have_ucred
1140 readline (interactive CLIs): $have_readline
1141 audio formats supported by para_server/para_afh: $server_audio_formats
1142 id3 version2 support: $have_libid3tag
1143 filters supported by para_audiod/para_filter: $filters
1144 writers supported by para_audiod/para_write: $writers
1145 optional executables: $extras
1146 ])