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