]> git.tuebingen.mpg.de Git - paraslash.git/blob - configure.ac
9f63bc1043c66e2b1046d2c606bf95736f475e51
[paraslash.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ([2.61])
5
6 AC_INIT([paraslash],[git],[maan@systemlinux.org])
7 AC_CONFIG_HEADER([config.h])
8
9 AC_CONFIG_FILES([Makefile])
10 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
11 AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; done)])
12 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) }])
13 AC_PATH_PROG(UNAMEPATH, uname, no)
14 if test "$UNAMEPATH" = "no"; then
15         AC_MSG_ERROR(unable to determine system type)
16 fi
17 AC_MSG_CHECKING(os type)
18 OSTYPE="`$UNAMEPATH -s`"
19 AC_MSG_RESULT("$OSTYPE")
20
21 if test "$OSTYPE" = "SunOS"; then
22         # needed on SunOS for socket magic
23         arch_cppflags="-D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
24         AC_SUBST(arch_cppflags)
25 fi
26
27 AC_C_BIGENDIAN()
28
29 AC_PATH_PROG([gengetopt], [gengetopt])
30 test -z "$gengetopt" && AC_MSG_ERROR(
31         [gengetopt is required to build this package])
32
33 AC_PATH_PROG([help2man], [help2man])
34 test -z "$help2man" && AC_MSG_ERROR(
35         [help2man is required to build this package])
36
37 AC_PATH_PROG([install], [install])
38 test -z "$install" && AC_MSG_ERROR(
39         [The install program is required to build this package])
40
41 AC_PROG_CC
42 AC_PROG_CPP
43
44 AC_HEADER_DIRENT
45 AC_HEADER_STDC
46 AC_HEADER_SYS_WAIT
47 AC_HEADER_STDBOOL
48 AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h \
49         stdlib.h string.h sys/socket.h sys/time.h sys/timeb.h sys/un.h \
50         sys/ipc.h unistd.h utime.h stddef.h],
51         [], [AC_MSG_ERROR([$ac_header not found])])
52
53 # Checks for typedefs, structures, and compiler characteristics.
54 AC_C_CONST
55 AC_C_INLINE
56 AC_TYPE_OFF_T
57 AC_TYPE_PID_T
58 AC_TYPE_SIZE_T
59 AC_HEADER_TIME
60 AC_STRUCT_TM
61 AC_TYPE_INT8_T
62 AC_TYPE_INT16_T
63 AC_TYPE_INT32_T
64 AC_TYPE_INT64_T
65 AC_TYPE_MODE_T
66 AC_TYPE_SSIZE_T
67 AC_TYPE_UID_T
68 AC_TYPE_UINT8_T
69 AC_TYPE_UINT16_T
70 AC_TYPE_UINT32_T
71 AC_TYPE_UINT64_T
72
73 # Checks for library functions.
74 AC_FUNC_FORK
75 AC_PROG_GCC_TRADITIONAL
76 AC_FUNC_MEMCMP
77 AC_FUNC_MKTIME
78 AC_FUNC_MMAP
79 AC_FUNC_SELECT_ARGTYPES
80 AC_FUNC_STAT
81 AC_FUNC_STRFTIME
82 AC_FUNC_VPRINTF
83 AC_FUNC_CLOSEDIR_VOID
84 AC_FUNC_LSTAT
85
86 AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
87         regcomp select strchr strdup strerror strstr strtol uname \
88         fchdir gettimeofday localtime_r munmap strcasecmp strcspn \
89         strncasecmp strrchr strspn alarm mkdir inet_ntoa socket], [],
90         [AC_MSG_ERROR([function not found, cannot live without it])])
91
92 executables="recv filter audioc write afh play"
93 audio_format_handlers="mp3 wma"
94
95 recv_cmdline_objs="
96         recv
97         http_recv
98         dccp_recv
99         udp_recv
100         afh_recv
101 "
102
103 recv_errlist_objs="
104         http_recv
105         recv_common
106         recv
107         time
108         string
109         net
110         dccp_recv
111         fd
112         sched
113         stdout
114         ggo
115         udp_recv
116         buffer_tree
117         afh_recv
118         afh_common
119         wma_afh
120         wma_common
121         mp3_afh
122         version
123 "
124
125 recv_ldflags=""
126
127 audioc_cmdline_objs="audioc"
128 audioc_errlist_objs="
129         audioc
130         string
131         net
132         fd
133         version
134         ggo
135 "
136 audioc_ldflags=""
137
138 afh_cmdline_objs="afh"
139 afh_errlist_objs="
140         afh
141         string
142         fd
143         mp3_afh
144         afh_common
145         time
146         wma_afh
147         wma_common
148         version
149         ggo
150 "
151 afh_ldflags=""
152
153 write_cmdline_objs="
154         write
155         file_write
156 "
157 write_errlist_objs="
158         write
159         write_common
160         file_write
161         time
162         fd
163         string
164         sched
165         stdin
166         buffer_tree
167         ggo
168         check_wav
169         version
170 "
171 write_ldflags=""
172 writers="file"
173 default_writer="FILE_WRITE"
174
175 play_errlist_objs="
176         play
177         fd
178         sched
179         ggo
180         buffer_tree
181         time
182         string
183         net
184         afh_recv
185         afh_common
186         wma_afh
187         wma_common
188         mp3_afh
189         recv_common
190         udp_recv
191         http_recv
192         dccp_recv
193         filter_common
194         fec
195         bitstream
196         imdct
197         wav_filter
198         compress_filter
199         amp_filter
200         prebuffer_filter
201         fecdec_filter
202         wmadec_filter
203         write_common
204         file_write
205         version
206 "
207 play_cmdline_objs="
208         http_recv
209         dccp_recv
210         udp_recv
211         afh_recv
212         compress_filter
213         amp_filter
214         prebuffer_filter
215         file_write
216         play
217 "
218 play_ldflags="-lm"
219 ################################################################## clock_gettime
220 clock_gettime_lib=
221 AC_CHECK_LIB([c], [clock_gettime], [clock_gettime_lib=c], [
222         AC_CHECK_LIB([rt], [clock_gettime], [clock_gettime_lib=rt], [], [])
223 ])
224 if test -n "$clock_gettime_lib"; then
225         AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [
226                 define to 1 if clock_gettime() is supported])
227 fi
228 if test "$clock_gettime_lib" = "rt"; then
229         AC_SUBST(clock_gettime_ldflags, -lrt)
230 fi
231 ########################################################################### osl
232 have_osl=yes
233 OLD_CPPFLAGS="$CPPFLAGS"
234 OLD_LDFLAGS="$LDFLAGS"
235 OLD_LIBS="$LIBS"
236 AC_ARG_WITH(osl_headers, [AS_HELP_STRING(--with-osl-headers=dir,
237         [look for osl.h also in dir])])
238 if test -n "$with_osl_headers"; then
239         osl_cppflags="-I$with_osl_headers"
240         CPPFLAGS="$CPPFLAGS $osl_cppflags"
241 fi
242 AC_ARG_WITH(osl_libs, [AS_HELP_STRING(--with-osl-libs=dir,
243         [look for libosl also in dir])])
244 if test -n "$with_osl_libs"; then
245         osl_libs="-L$with_osl_libs"
246         LDFLAGS="$LDFLAGS $osl_libs"
247 fi
248
249 AC_CHECK_HEADER(osl.h, [], have_osl=no)
250 AC_CHECK_LIB([osl], [osl_open_table], [], have_osl=no)
251 if test "$have_osl" = "yes"; then
252         AC_SUBST(osl_cppflags)
253         osl_ldflags="$osl_libs -losl"
254         AC_SUBST(osl_ldflags)
255 else
256         AC_MSG_WARN([libosl not found, can not build para_server.
257 Download libosl at
258         http://systemlinux.org/~maan/osl
259 or execute
260         git clone git://git.tuebingen.mpg.de/osl
261         ])
262 fi
263 CPPFLAGS="$OLD_CPPFLAGS"
264 LDFLAGS="$OLD_LDFLAGS"
265 LIBS="$OLD_LIBS"
266 ########################################################################### crypto
267 AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
268         Force using crypto library "lib". This package requires either
269         openssl or libgcrypt being installed. Possible values for "lib"
270         are thus "openssl" and "gcrypt". If this option is not given,
271         openssl is tried first. If openssl was not found, gcrypt is
272         tried next.])])
273
274 case "$enable_cryptolib" in
275         "openssl") check_openssl="yes"; check_gcrypt="no";;
276         "gcrypt") check_openssl="no"; check_gcrypt="yes";;
277         "") check_openssl="yes"; check_gcrypt="yes";;
278         *) AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib]);;
279 esac
280 ###################################################################### openssl
281 if test "$check_openssl" = "yes"; then
282         OLD_CPPFLAGS="$CPPFLAGS"
283         OLD_LDFLAGS="$LDFLAGS"
284         OLD_LIBS="$LIBS"
285         have_openssl="yes"
286         AC_ARG_WITH(openssl_headers, [AS_HELP_STRING(--with-openssl-headers=dir,
287                 [look for openssl headers also in dir])])
288         if test -n "$with_openssl_headers"; then
289                 openssl_cppflags="-I$with_openssl_headers"
290                 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
291         fi
292         AC_ARG_WITH(openssl_libs, [AS_HELP_STRING(--with-openssl-libs=dir,
293                 [look for openssl libraries also in dir])])
294         if test -n "$with_openssl_libs"; then
295                 openssl_libs="-L$with_openssl_libs"
296                 LDFLAGS="$LDFLAGS $openssl_libs"
297         fi
298         AC_CHECK_HEADER(openssl/ssl.h, [], [have_openssl="no"])
299         AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
300         if test "$have_openssl" = "no" -a -z "$with_openssl_headers$with_openssl_libs"; then
301                 # try harder: openssl is sometimes installed in /usr/local/ssl
302                 openssl_cppflags="-I/usr/local/ssl/include"
303                 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
304                 openssl_libs="-L/usr/local/ssl/lib"
305                 LDFLAGS="$LDFLAGS $openssl_libs"
306                 # clear cache
307                 unset ac_cv_header_openssl_ssl_h 2> /dev/null
308                 unset ac_cv_lib_crypto_RAND_bytes 2> /dev/null
309                 AC_CHECK_HEADER(openssl/ssl.h, [have_openssl="yes"], [])
310                 if test "$have_openssl" = "yes"; then
311                         AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
312                 fi
313         fi
314         if test "$have_openssl" = "yes"; then
315                 AC_DEFINE(HAVE_OPENSSL, 1, [define to 1 to turn on openssl support])
316                 AC_SUBST(openssl_cppflags)
317                 openssl_ldflags="$openssl_libs -lssl -lcrypto"
318                 AC_SUBST(openssl_ldflags)
319
320                 server_errlist_objs="$server_errlist_objs crypt"
321                 client_errlist_objs="$client_errlist_objs crypt"
322                 audiod_errlist_objs="$audiod_errlist_objs crypt"
323
324                 check_gcrypt="no"
325         else
326                 AC_MSG_WARN([openssl libraries not found])
327         fi
328         CPPFLAGS="$OLD_CPPFLAGS"
329         LDFLAGS="$OLD_LDFLAGS"
330         LIBS="$OLD_LIBS"
331 else
332         have_openssl="no"
333 fi
334 ########################################################################### gcrypt
335 if test "$check_gcrypt" = "yes"; then
336         OLD_CPPFLAGS="$CPPFLAGS"
337         OLD_LDFLAGS="$LDFLAGS"
338         OLD_LIBS="$LIBS"
339         have_gcrypt="yes"
340         AC_ARG_WITH(gcrypt_headers, [AS_HELP_STRING(--with-gcrypt-headers=dir,
341                 [look for gcrypt headers also in dir])])
342         if test -n "$with_gcrypt_headers"; then
343                 gcrypt_cppflags="-I$with_gcrypt_headers"
344                 CPPFLAGS="$CPPFLAGS $gcrypt_cppflags"
345         fi
346         AC_ARG_WITH(gcrypt_libs, [AS_HELP_STRING(--with-gcrypt-libs=dir,
347                 [look for libgcrypt also in dir])])
348         if test -n "$with_gcrypt_libs"; then
349                 gcrypt_libs="-L$with_gcrypt_libs"
350                 LDFLAGS="$LDFLAGS $gcrypt_libs"
351         fi
352         AC_CHECK_HEADER(gcrypt.h, [], [have_gcrypt="no"])
353         AC_CHECK_LIB([gcrypt], [gcry_randomize], [], [have_gcrypt="no"])
354         if test "$have_gcrypt" = "yes"; then
355                 AC_DEFINE(HAVE_GCRYPT, 1, [define to 1 to turn on gcrypt support])
356                 AC_SUBST(gcrypt_cppflags)
357                 gcrypt_ldflags="$gcrypt_libs -lgcrypt"
358                 AC_SUBST(gcrypt_ldflags)
359
360                 server_errlist_objs="$server_errlist_objs gcrypt"
361                 client_errlist_objs="$client_errlist_objs gcrypt"
362                 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
363         else
364                 AC_MSG_WARN([gcrypt library not found])
365         fi
366         CPPFLAGS="$OLD_CPPFLAGS"
367         LDFLAGS="$OLD_LDFLAGS"
368         LIBS="$OLD_LIBS"
369 else
370         have_gcrypt="no"
371 fi
372 ########################################################################### libsocket
373 AC_CHECK_LIB([c], [socket],
374         [socket_ldlflags=],
375         [socket_ldflags="-lsocket"]
376 )
377 AC_SUBST(socket_ldflags)
378 ########################################################################### libnsl
379 AC_CHECK_LIB([c], [gethostbyname],
380         [nsl_ldflags=],
381         [nsl_ldflags="-lnsl"]
382 )
383 AC_SUBST(nsl_ldflags)
384 ########################################################################### ucred
385 AC_MSG_CHECKING(for struct ucred)
386 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
387         #define _GNU_SOURCE
388         #include <sys/types.h>
389         #include <sys/socket.h>
390 ]], [[
391         struct ucred sucred; sucred.pid=0;
392 ]])],[have_ucred=yes],[have_ucred=no])
393 AC_MSG_RESULT($have_ucred)
394 if test ${have_ucred} = yes; then
395         AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
396 fi
397 ########################################################################### gengetopt
398 echo 'option "z" z "" flag off' | $gengetopt --file-name conftest-ggo &&
399 AC_CHECK_DECL(
400         [gengetopt_args_info_description],
401         [ggo_descriptions_declared=yes],
402         [ggo_descriptions_declared=no],
403         [#include "conftest-ggo.h"]
404 )
405 AC_SUBST(ggo_descriptions_declared)
406 ########################################################################### curses
407 have_curses="yes"
408 OLD_CPPFLAGS="$CPPFLAGS"
409 OLD_LDFLAGS="$LDFLAGS"
410 OLD_LIBS="$LIBS"
411 AC_ARG_WITH(curses_headers, [AS_HELP_STRING(--with-curses-headers=dir,
412         [look for curses.h also in dir])])
413 if test -n "$with_curses_headers"; then
414         curses_cppflags="-I$with_curses_headers"
415         CPPFLAGS="$CPPFLAGS $curses_cppflags"
416 fi
417 AC_ARG_WITH(curses_libs, [AS_HELP_STRING(--with-curses-libs=dir,
418         [look for libcurses also in dir])])
419 if test -n "$with_curses_libs"; then
420         curses_libs="-L$with_curses_libs"
421         LDFLAGS="$LDFLAGS $curses_libs"
422 fi
423 AC_CHECK_HEADER(curses.h, [], [
424         have_curses="no"
425 ])
426 curses_ldflags="$curses_libs"
427 AC_CHECK_LIB([ncursesw], [initscr],
428         [curses_ldflags="$curses_libs -lncursesw"], [
429                 AC_CHECK_LIB([curses], [initscr],
430                         [curses_ldflags="$curses_libs -lcurses"],
431                         [have_curses="no"]
432                 )
433         ]
434 )
435 AC_SUBST(curses_cppflags)
436 AC_SUBST(curses_ldflags)
437 CPPFLAGS="$OLD_CPPFLAGS"
438 LDFLAGS="$OLD_LDFLAGS"
439 LIBS="$OLD_LIBS"
440 ########################################################################### ip_mreqn
441 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
442 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
443         #include <netdb.h>
444         #include <net/if.h>
445 ]], [[
446         struct ip_mreqn mn;
447         mn.imr_ifindex = 0;
448 ]])],[have_ip_mreqn=yes],[have_ip_mreqn=no])
449 AC_MSG_RESULT($have_ip_mreqn)
450 if test ${have_ip_mreqn} = yes; then
451         AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
452 fi
453 ########################################################################### osx
454
455 AC_MSG_CHECKING(for CoreAudio (MacOs))
456 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
457         #include <CoreAudio/CoreAudio.h>
458 ]], [[
459         AudioDeviceID id;
460 ]])],[have_core_audio=yes],[have_core_audio=no])
461 AC_MSG_RESULT($have_core_audio)
462 if test ${have_core_audio} = yes; then
463         f1="-framework CoreAudio"
464         f2="-framework AudioToolbox"
465         f3="-framework AudioUnit"
466         f4="-framework CoreServices"
467         core_audio_ldflags="$f1 $f2 $f3 $f4"
468         AC_SUBST(core_audio_ldflags)
469
470         audiod_errlist_objs="$audiod_errlist_objs osx_write ipc"
471         audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
472
473         play_errlist_objs="$play_errlist_objs osx_write ipc"
474         play_cmdline_objs="$play_cmdline_objs osx_write.cmdline"
475
476         write_errlist_objs="$write_errlist_objs osx_write ipc"
477         write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
478         writers="$writers osx"
479         default_writer="OSX_WRITE"
480         AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
481 fi
482 ####################################################### ogg/vorbis/speex/opus
483 have_ogg="yes"
484 OLD_CPPFLAGS="$CPPFLAGS"
485 OLD_LDFLAGS="$LDFLAGS"
486 OLD_LIBS="$LIBS"
487 AC_ARG_WITH(ogg_headers, [AS_HELP_STRING(--with-ogg-headers=dir,
488         [look for ogg headers also in dir])])
489 AC_ARG_WITH(ogg_libs, [AS_HELP_STRING(--with-ogg-libs=dir,
490         [look for ogg libs also in dir])])
491 AC_ARG_WITH(vorbis_headers, [AS_HELP_STRING(--with-vorbis-headers=dir,
492         [look for vorbis headers also in dir])])
493 AC_ARG_WITH(vorbis_libs, [AS_HELP_STRING(--with-vorbis-libs=dir,
494         [look for vorbis libs also in dir])])
495 AC_ARG_WITH(speex_headers, [AS_HELP_STRING(--with-speex-headers=dir,
496         [look for speex headers also in dir])])
497 AC_ARG_WITH(speex_libs, [AS_HELP_STRING(--with-speex-libs=dir,
498         [look for speex libs also in dir])])
499 AC_ARG_WITH(opus_headers, [AS_HELP_STRING(--with-opus-headers=dir,
500         [look for opus headers also in dir])])
501 AC_ARG_WITH(opus_libs, [AS_HELP_STRING(--with-opus-libs=dir,
502         [look for opus libs also in dir])])
503
504 if test -n "$with_ogg_headers"; then
505         ogg_cppflags="-I$with_ogg_headers"
506         CPPFLAGS="$CPPFLAGS $ogg_cppflags"
507 fi
508 if test -n "$with_ogg_libs"; then
509         ogg_libs="-L$with_ogg_libs"
510         LDFLAGS="$LDFLAGS $ogg_libs"
511 fi
512 AC_CHECK_HEADERS([ogg/ogg.h], [], [ have_ogg="no"; ])
513 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
514
515 have_vorbis="yes"
516 have_speex="yes"
517 have_opus="yes"
518 if test "$have_ogg" = "yes"; then
519         # vorbis
520         if test -n "$with_vorbis_headers"; then
521                 vorbis_cppflags="-I$with_vorbis_headers"
522                 CPPFLAGS="$CPPFLAGS $vorbis_cppflags"
523         fi
524         if test -n "$with_vorbis_libs"; then
525                 vorbis_libs="-L$with_vorbis_libs"
526                 LDFLAGS="$LDFLAGS $vorbis_libs"
527         fi
528         AC_CHECK_HEADERS([vorbis/codec.h], [], [ have_vorbis="no" ])
529         AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_vorbis="no" ])
530
531         # speex
532         if test -n "$with_speex_headers"; then
533                 speex_cppflags="-I$with_speex_headers"
534                 CPPFLAGS="$CPPFLAGS $speex_cppflags"
535         fi
536         if test -n "$with_speex_libs"; then
537                 speex_libs="-L$with_speex_libs"
538                 LDFLAGS="$LDFLAGS $speex_libs"
539         fi
540         AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ])
541         AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ])
542
543         # opus
544         if test -n "$with_opus_headers"; then
545                 opus_cppflags="-I$with_opus_headers"
546                 CPPFLAGS="$CPPFLAGS $opus_cppflags"
547         fi
548         if test -n "$with_opus_libs"; then
549                 opus_libs="-L$with_opus_libs"
550                 LDFLAGS="$LDFLAGS $opus_libs"
551         fi
552         AC_CHECK_LIB([opus], [opus_multistream_decode], [], [ have_opus="no" ])
553         AC_CHECK_HEADERS([opus/opus.h], [], [ have_opus="no" ])
554 else
555         AC_MSG_WARN([vorbis/speex/opus depend on libogg, which was not detected])
556         have_vorbis="no"
557         have_speex="no"
558         have_opus="no"
559 fi
560
561 msg="support in para_server/para_filter/para_afh"
562 if test "$have_vorbis" = "yes" || \
563                 test "$have_speex" = "yes" || \
564                 test "$have_opus" = "yes"; then
565         AC_SUBST(ogg_cppflags)
566         ogg_ldflags="$ogg_libs -logg"
567         if test "$OSTYPE" = "Darwin"; then
568                 ogg_ldflags="-Wl,-bind_at_load $ogg_ldflags"
569         fi
570         AC_SUBST(ogg_ldflags)
571         afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
572         recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
573         server_errlist_objs="$server_errlist_objs ogg_afh_common"
574         play_errlist_objs="$play_errlist_objs ogg_afh_common"
575 fi
576 if test "$have_vorbis" = "yes"; then
577         AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support)
578         vorbis_ldflags="$vorbis_libs -lvorbis -lvorbisfile"
579         AC_SUBST(vorbis_ldflags)
580
581         server_errlist_objs="$server_errlist_objs ogg_afh"
582         audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
583         play_errlist_objs="$play_errlist_objs oggdec_filter ogg_afh"
584         afh_errlist_objs="$afh_errlist_objs ogg_afh"
585         recv_errlist_objs="$recv_errlist_objs ogg_afh"
586
587         audiod_audio_formats="$audiod_audio_formats ogg"
588         audio_format_handlers="$audio_format_handlers ogg"
589 fi
590 if test "$have_speex" = "yes"; then
591         AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support)
592         AC_SUBST(speex_cppflags)
593         speex_ldflags="$speex_libs -lspeex"
594         AC_SUBST(speex_ldflags)
595
596
597         server_errlist_objs="$server_errlist_objs spx_afh spx_common"
598         audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
599         play_errlist_objs="$play_errlist_objs spxdec_filter spx_afh spx_common"
600         afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
601         recv_errlist_objs="$recv_errlist_objs spx_afh spx_common"
602
603         audiod_audio_formats="$audiod_audio_formats spx"
604         audio_format_handlers="$audio_format_handlers spx"
605 else
606         AC_MSG_WARN([no ogg/speex $msg])
607 fi
608 if test "$have_opus" = "yes"; then
609         AC_DEFINE(HAVE_OPUS, 1, define to 1 to turn on ogg/opus support)
610         AC_SUBST(opus_cppflags)
611         opus_ldflags="$opus_libs -lopus"
612         AC_SUBST(opus_ldflags)
613
614
615         server_errlist_objs="$server_errlist_objs opus_afh opus_common"
616         audiod_errlist_objs="$audiod_errlist_objs opusdec_filter opus_common"
617         afh_errlist_objs="$afh_errlist_objs opus_afh opus_common"
618         play_errlist_objs="$play_errlist_objs opusdec_filter opus_afh opus_common"
619         recv_errlist_objs="$recv_errlist_objs opus_afh opus_common"
620
621         audiod_audio_formats="$audiod_audio_formats opus"
622         audio_format_handlers="$audio_format_handlers opus"
623 else
624         AC_MSG_WARN([no ogg/opus $msg])
625 fi
626 CPPFLAGS="$OLD_CPPFLAGS"
627 LDFLAGS="$OLD_LDFLAGS"
628 LIBS="$OLD_LIBS"
629 ########################################################################### faad
630 have_faad=yes
631 OLD_CPPFLAGS="$CPPFLAGS"
632 OLD_LDFLAGS="$LDFLAGS"
633 OLD_LIBS="$LIBS"
634 AC_ARG_WITH(faad_headers, [AS_HELP_STRING(--with-faad-headers=dir,
635         [look for neaacdec.h also in dir])])
636 if test -n "$with_faad_headers"; then
637         faad_cppflags="-I$with_faad_headers"
638         CPPFLAGS="$CPPFLAGS $faad_cppflags"
639 fi
640 AC_ARG_WITH(faad_libs, [AS_HELP_STRING(--with-faad-libs=dir,
641         [look for libfaad also in dir])])
642 if test -n "$with_faad_libs"; then
643         faad_libs="-L$with_faad_libs"
644         LDFLAGS="$LDFLAGS $faad_libs"
645 fi
646 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
647 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
648 if test "$have_faad" = "yes"; then
649         AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
650         AC_SUBST(faad_cppflags)
651         faad_ldflags="$faad_libs -lfaad"
652         AC_SUBST(faad_ldflags)
653
654         afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
655         audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
656         play_errlist_objs="$play_errlist_objs aacdec_filter aac_afh aac_common"
657         server_errlist_objs="$server_errlist_objs aac_afh aac_common"
658         recv_errlist_objs="$recv_errlist_objs aac_afh aac_common"
659
660         audiod_audio_formats="$audiod_audio_formats aac"
661         audio_format_handlers="$audio_format_handlers aac"
662 fi
663 CPPFLAGS="$OLD_CPPFLAGS"
664 LDFLAGS="$OLD_LDFLAGS"
665 LIBS="$OLD_LIBS"
666 ########################################################################### mad
667 have_mad="yes"
668 OLD_CPPFLAGS="$CPPFLAGS"
669 OLD_LDFLAGS="$LDFLAGS"
670 OLD_LIBS="$LIBS"
671
672 AC_ARG_WITH(mad_headers, [AS_HELP_STRING(--with-mad-headers=dir,
673         [look for mad.h also in dir])])
674 if test -n "$with_mad_headers"; then
675         mad_cppflags="-I$with_mad_headers"
676         CPPFLAGS="$CPPFLAGS $mad_cppflags"
677 fi
678 AC_ARG_WITH(mad_libs, [AS_HELP_STRING(--with-mad-libs=dir,
679         [look for libmad also in dir])])
680 if test -n "$with_mad_libs"; then
681         mad_libs="-L$with_mad_libs"
682         LDFLAGS="$LDFLAGS $mad_libs"
683 fi
684 AC_CHECK_HEADERS([mad.h], [], [
685         have_mad="no"
686 ])
687 AC_CHECK_LIB([mad], [mad_stream_init], [], [
688         have_mad="no"
689 ])
690 if test "$have_mad" = "yes"; then
691         AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
692         AC_SUBST(mad_cppflags)
693         mad_ldflags="$mad_libs -lmad"
694         AC_SUBST(mad_ldflags)
695         audiod_cmdline_objs="$audiod_cmdline_objs mp3dec_filter"
696         play_cmdline_objs="$play_cmdline_objs mp3dec_filter"
697         audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
698         play_errlist_objs="$play_errlist_objs mp3dec_filter"
699         audiod_audio_formats="$audiod_audio_formats mp3"
700 else
701         AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
702 fi
703 CPPFLAGS="$OLD_CPPFLAGS"
704 LDFLAGS="$OLD_LDFLAGS"
705 LIBS="$OLD_LIBS"
706 ###################################################################### libid3tag
707 OLD_CPPFLAGS="$CPPFLAGS"
708 OLD_LDFLAGS="$LDFLAGS"
709 OLD_LIBS="$LIBS"
710
711 have_libid3tag="yes"
712 AC_ARG_WITH(id3tag_headers, [AS_HELP_STRING(--with-id3tag-headers=dir,
713         [look for id3tag header files also in dir])])
714 if test -n "$with_id3tag_headers"; then
715         id3tag_cppflags="-I$with_id3tag_headers"
716         CPPFLAGS="$CPPFLAGS $id3tag_cppflags"
717 fi
718 AC_ARG_WITH(id3tag_libs, [AS_HELP_STRING(--with-id3tag-libs=dir,
719         [look for id3tag libs also in dir])])
720 if test -n "$with_id3tag_libs"; then
721         id3tag_libs="-L$with_id3tag_libs"
722         LDFLAGS="$LDFLAGS $id3tag_libs"
723 fi
724
725 AC_MSG_CHECKING(for libid3tag)
726 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
727         #include <id3tag.h>
728 ]], [[
729         struct id3_tag t = {.flags = 0};
730 ]])],[],[have_libid3tag=no])
731 AC_MSG_RESULT($have_libid3tag)
732
733 if test ${have_libid3tag} = yes; then
734         AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
735         AC_SUBST(id3tag_cppflags)
736         AC_SUBST(id3tag_ldflags, "$id3tag_libs -lid3tag -lz")
737 fi
738 CPPFLAGS="$OLD_CPPFLAGS"
739 LDFLAGS="$OLD_LDFLAGS"
740 LIBS="$OLD_LIBS"
741 ########################################################################### flac
742 OLD_CPPFLAGS="$CPPFLAGS"
743 OLD_LDFLAGS="$LDFLAGS"
744 OLD_LIBS="$LIBS"
745
746 have_flac="yes"
747 AC_ARG_WITH(flac_headers, [AS_HELP_STRING(--with-flac-headers=dir,
748         [look for flac headers also in dir])])
749 if test -n "$with_flac_headers"; then
750         flac_cppflags="-I$with_flac_headers"
751         CPPFLAGS="$CPPFLAGS $flac_cppflags"
752 fi
753 AC_ARG_WITH(flac_libs, [AS_HELP_STRING(--with-flac-libs=dir,
754         [look for flac libs also in dir])])
755 if test -n "$with_flac_libs"; then
756         flac_libs="-L$with_flac_libs"
757         LDFLAGS="$LDFLAGS $flac_libs"
758 fi
759 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no)
760 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], have_flac=no, -logg -lm)
761 if test "$have_flac" = "yes"; then
762         AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter)
763         AC_SUBST(flac_cppflags)
764         flac_ldflags="$flac_libs -lFLAC"
765         AC_SUBST(flac_ldflags)
766
767         audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
768         play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
769         afh_errlist_objs="$afh_errlist_objs flac_afh"
770         server_errlist_objs="$server_errlist_objs flac_afh"
771         recv_errlist_objs="$recv_errlist_objs flac_afh"
772         audio_format_handlers="$audio_format_handlers flac"
773         audiod_audio_formats="$audiod_audio_formats flac"
774 else
775         AC_MSG_WARN([no flac support in para_audiod/para_filter/para_afh/para_server])
776 fi
777 CPPFLAGS="$OLD_CPPFLAGS"
778 LDFLAGS="$OLD_LDFLAGS"
779 LIBS="$OLD_LIBS"
780 ########################################################################### oss
781 OLD_CPPFLAGS="$CPPFLAGS"
782 OLD_LDFLAGS="$LDFLAGS"
783 OLD_LIBS="$LIBS"
784
785 have_oss="yes"
786 msg="=> will not build oss writer"
787
788 AC_CHECK_HEADER(sys/soundcard.h, [
789         audiod_errlist_objs="$audiod_errlist_objs oss_write"
790         play_errlist_objs="$play_errlist_objs oss_write"
791         audiod_cmdline_objs="$audiod_cmdline_objs oss_write"
792         play_cmdline_objs="$play_cmdline_objs oss_write"
793
794         write_errlist_objs="$write_errlist_objs oss_write"
795         write_cmdline_objs="$write_cmdline_objs oss_write"
796         fade_errlist_objs="$fade_errlist_objs oss_mix"
797
798         writers="$writers oss"
799         default_writer="OSS_WRITE"
800         mixers="${mixers}oss "
801         default_mixer="OSS_MIX"
802
803         AC_CHECK_LIB(ossaudio, _oss_ioctl, [
804                         oss_ldflags="-lossaudio"
805                         AC_SUBST(oss_ldflags)
806                 ]
807         )
808         ],
809         [
810                 have_oss="no"
811                 AC_MSG_WARN([no sys/soundcard.h $msg])
812         ]
813 )
814 CPPFLAGS="$OLD_CPPFLAGS"
815 LDFLAGS="$OLD_LDFLAGS"
816 LIBS="$OLD_LIBS"
817
818 ########################################################################### alsa
819 OLD_CPPFLAGS="$CPPFLAGS"
820 OLD_LDFLAGS="$LDFLAGS"
821 OLD_LIBS="$LIBS"
822
823 msg="=> no alsa support for para_audiod/para_write"
824 if test "$OSTYPE" != "Linux"; then
825         have_alsa="no"
826 else
827         have_alsa="yes"
828 fi
829 if test "$have_alsa" = "yes"; then
830         AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
831                 have_alsa="no"
832                 AC_MSG_WARN([no alsa/asoundlib $msg])
833         ])
834 fi
835
836 if test "$have_alsa" = "yes"; then
837         AC_CHECK_LIB([asound], [snd_pcm_open], [], [
838                 have_alsa="no"
839                 AC_MSG_WARN([no libasound $msg])
840         ])
841 fi
842
843 if test "$have_alsa" = "yes"; then
844         alsa_ldflags="-lasound"
845         AC_SUBST(alsa_ldflags)
846         audiod_errlist_objs="$audiod_errlist_objs alsa_write"
847         audiod_cmdline_objs="$audiod_cmdline_objs alsa_write"
848         play_errlist_objs="$play_errlist_objs alsa_write"
849         play_cmdline_objs="$play_cmdline_objs alsa_write"
850
851         write_errlist_objs="$write_errlist_objs alsa_write"
852         write_cmdline_objs="$write_cmdline_objs alsa_write"
853         fade_errlist_objs="$fade_errlist_objs alsa_mix"
854
855         writers="$writers alsa"
856         default_writer="ALSA_WRITE"
857         mixers="${mixers}alsa "
858         default_mixer="ALSA_MIX"
859 fi
860
861 CPPFLAGS="$OLD_CPPFLAGS"
862 LDFLAGS="$OLD_LDFLAGS"
863 LIBS="$OLD_LIBS"
864 ########################################################################### libao
865 OLD_CPPFLAGS="$CPPFLAGS"
866 OLD_LDFLAGS="$LDFLAGS"
867 OLD_LIBS="$LIBS"
868
869 have_ao="yes"
870 AC_ARG_WITH(ao_headers, [AS_HELP_STRING(--with-ao-headers=dir,
871         [look for ao/ao.h also in dir])])
872 if test -n "$with_ao_headers"; then
873         ao_cppflags="-I$with_ao_headers"
874         CPPFLAGS="$CPPFLAGS $ao_cppflags"
875 fi
876 AC_ARG_WITH(ao_libs, [AS_HELP_STRING(--with-ao-libs=dir,
877         [look for libao also in dir])])
878 if test -n "$with_ao_libs"; then
879         ao_libs="-L$with_ao_libs"
880         LDFLAGS="$LDFLAGS $ao_libs"
881 fi
882 msg="no libao support for para_audiod/para_write"
883 AC_CHECK_HEADERS([ao/ao.h], [
884         ], [
885         have_ao="no"
886         AC_MSG_WARN([ao.h not found, $msg])
887 ])
888 if test "$have_ao" = "yes"; then
889         AC_CHECK_LIB([ao], [ao_initialize], [], [
890                 have_ao="no"
891                 AC_MSG_WARN([ao lib not found or not working, $msg])
892         ])
893 fi
894 if test "$have_ao" = "yes"; then
895         AC_CHECK_HEADERS([pthread.h], [
896                 ], [
897                 have_ao="no"
898                 AC_MSG_WARN([pthread.h not found, $msg])
899         ])
900 fi
901 if test "$have_ao" = "yes"; then
902         AC_CHECK_LIB([pthread], [pthread_create], [], [
903                 have_ao="no"
904                 AC_MSG_WARN([pthread lib not found or not working, $msg])
905         ])
906 fi
907 if test "$have_ao" = "yes"; then
908         AC_SUBST(ao_cppflags)
909         ao_ldflags="$ao_libs -lao -lpthread"
910         AC_SUBST(ao_ldflags)
911
912         audiod_errlist_objs="$audiod_errlist_objs ao_write"
913         audiod_cmdline_objs="$audiod_cmdline_objs ao_write"
914
915         play_errlist_objs="$play_errlist_objs ao_write"
916         play_cmdline_objs="$play_cmdline_objs ao_write"
917
918         write_errlist_objs="$write_errlist_objs ao_write"
919         write_cmdline_objs="$write_cmdline_objs ao_write"
920         writers="$writers ao"
921 fi
922
923 CPPFLAGS="$OLD_CPPFLAGS"
924 LDFLAGS="$OLD_LDFLAGS"
925 LIBS="$OLD_LIBS"
926 ############################################################# readline
927 OLD_CPPFLAGS="$CPPFLAGS"
928 OLD_LDFLAGS="$LDFLAGS"
929 OLD_LIBS="$LIBS"
930
931 have_readline="yes"
932 AC_ARG_WITH(readline_headers, [AS_HELP_STRING(--with-readline-headers=dir,
933         [look for libreadline header files also in dir])])
934 if test -n "$with_readline_headers"; then
935         readline_cppflags="-I$with_readline_headers"
936         CPPFLAGS="$CPPFLAGS $readline_cppflags"
937 fi
938
939 AC_ARG_WITH(readline_libs, [AS_HELP_STRING(--with-readline-libs=dir,
940         [look for readline library also in dir])])
941 if test -n "$with_readline_libs"; then
942         readline_libs="-L$with_readline_libs"
943         LDFLAGS="$LDFLAGS $readline_libs"
944 fi
945 msg="no interactive cli support"
946 AC_CHECK_HEADERS([readline/readline.h], [
947         ], [
948         have_readline="no"
949         AC_MSG_WARN([readline/readline.h not found, $msg])
950 ])
951
952 if test "$have_curses" != "yes"; then
953         have_readline="no"
954         AC_MSG_WARN([interactive cli support depends on curses,])
955         AC_MSG_WARN([but no curses lib was detected, $msg])
956 fi
957
958 if test "$have_readline" = "yes"; then
959         readline_ldflags="$readline_libs -lreadline"
960         AC_SEARCH_LIBS([rl_free_keymap], [readline], [], [have_readline="no"])
961         if test "$have_readline" = "no"; then # try with -lcurses
962                 # clear cache
963                 AC_MSG_NOTICE([trying again with -lcurses])
964                 unset ac_cv_search_rl_free_keymap 2> /dev/null
965                 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
966                         have_readline=yes
967                         readline_ldflags="$readline_ldflags -lcurses"
968                 ], [], [-lcurses])
969         fi
970         if test "$have_readline" = "no"; then # try with -ltermcap
971                 # clear cache
972                 AC_MSG_NOTICE([trying again with -ltermcap])
973                 unset ac_cv_search_rl_free_keymap 2> /dev/null
974                 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
975                         have_readline=yes
976                         readline_ldflags="$readline_ldflags -ltermcap"
977                 ], [], [-ltermcap])
978         fi
979 fi
980
981 if test "$have_readline" = "yes"; then
982         AC_SUBST(readline_cppflags)
983         AC_SUBST(readline_ldflags)
984         client_errlist_objs="$client_errlist_objs interactive"
985         audioc_errlist_objs="$audioc_errlist_objs buffer_tree interactive sched time"
986         play_errlist_objs="$play_errlist_objs interactive"
987         AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
988 else
989         AC_MSG_WARN([libreadline not found or unusable])
990 fi
991 CPPFLAGS="$OLD_CPPFLAGS"
992 LDFLAGS="$OLD_LDFLAGS"
993 LIBS="$OLD_LIBS"
994 ############################################################# libsamplerate
995 OLD_CPPFLAGS="$CPPFLAGS"
996 OLD_LDFLAGS="$LDFLAGS"
997 OLD_LIBS="$LIBS"
998
999 have_samplerate="yes"
1000 AC_ARG_WITH(samplerate_headers, [AS_HELP_STRING(--with-samplerate-headers=dir,
1001         [look for samplerate headers also in dir])])
1002 if test -n "$with_samplerate_headers"; then
1003         samplerate_cppflags="-I$with_samplerate_headers"
1004         CPPFLAGS="$CPPFLAGS $samplerate_cppflags"
1005 fi
1006 AC_ARG_WITH(samplerate_libs, [AS_HELP_STRING(--with-samplerate-libs=dir,
1007         [look for samplerate libs also in dir])])
1008 if test -n "$with_samplerate_libs"; then
1009         samplerate_libs="-L$with_samplerate_libs"
1010         LDFLAGS="$LDFLAGS $samplerate_libs"
1011 fi
1012
1013 AC_CHECK_HEADER(samplerate.h, [], have_samplerate=no)
1014 AC_CHECK_LIB([samplerate], [src_process], [], have_samplerate=no, [])
1015
1016 if test "$have_samplerate" = "yes"; then
1017         AC_SUBST(samplerate_cppflags)
1018         samplerate_ldflags="$samplerate_libs -lsamplerate"
1019         AC_SUBST(samplerate_ldflags)
1020
1021         audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
1022         audiod_cmdline_objs="$audiod_cmdline_objs resample_filter"
1023         play_errlist_objs="$play_errlist_objs resample_filter check_wav"
1024         play_cmdline_objs="$play_cmdline_objs resample_filter"
1025 else
1026         AC_MSG_WARN([no resample support in para_audiod/para_filter])
1027 fi
1028 CPPFLAGS="$OLD_CPPFLAGS"
1029 LDFLAGS="$OLD_LDFLAGS"
1030 LIBS="$OLD_LIBS"
1031 ######################################################################### server
1032 if test \( "$have_openssl" = "yes" -o "$have_gcrypt" = "yes" \) \
1033         -a "$have_osl" = "yes" ; then
1034
1035         build_server="yes"
1036         executables="$executables server"
1037         server_cmdline_objs="server"
1038         server_errlist_objs="$server_errlist_objs
1039                 server
1040                 afh_common
1041                 mp3_afh
1042                 vss
1043                 command
1044                 net
1045                 string
1046                 signal
1047                 time
1048                 daemon
1049                 http_send
1050                 close_on_fork
1051                 mm
1052                 crypt_common
1053                 ipc
1054                 dccp_send
1055                 fd
1056                 user_list
1057                 chunk_queue
1058                 afs
1059                 aft
1060                 mood
1061                 score
1062                 attribute
1063                 blob
1064                 playlist
1065                 sched
1066                 acl
1067                 send_common
1068                 udp_send
1069                 color
1070                 fec
1071                 wma_afh
1072                 wma_common
1073                 sideband
1074                 version
1075                 ggo
1076         "
1077 else
1078         build_server="no"
1079 fi
1080 ############################################################# client
1081 if test "$have_openssl" = "yes" -o "$have_gcrypt" = "yes"; then
1082         build_client="yes"
1083         executables="$executables client"
1084         client_cmdline_objs="client"
1085         client_errlist_objs="$client_errlist_objs
1086                 client
1087                 net
1088                 string
1089                 fd
1090                 sched
1091                 stdin
1092                 stdout
1093                 time
1094                 sideband
1095                 client_common
1096                 buffer_tree
1097                 crypt_common
1098                 version
1099                 ggo
1100         "
1101 else
1102         build_client="no"
1103 fi
1104 ############################################################# audiod
1105 if test "$have_openssl" = "yes" -o "$have_gcrypt" = "yes"; then
1106         build_audiod="yes"
1107         executables="$executables audiod"
1108         audiod_cmdline_objs="$audiod_cmdline_objs
1109                 audiod
1110                 compress_filter
1111                 http_recv
1112                 dccp_recv
1113                 file_write
1114                 client
1115                 amp_filter
1116                 udp_recv
1117                 prebuffer_filter
1118         "
1119         audiod_errlist_objs="$audiod_errlist_objs
1120                 audiod
1121                 signal
1122                 string
1123                 daemon
1124                 stat
1125                 net
1126                 crypt_common
1127                 sideband
1128                 time
1129                 grab_client
1130                 filter_common
1131                 wav_filter
1132                 compress_filter
1133                 amp_filter
1134                 http_recv
1135                 dccp_recv
1136                 recv_common
1137                 fd
1138                 sched
1139                 write_common
1140                 file_write
1141                 audiod_command
1142                 fecdec_filter
1143                 client_common
1144                 ggo
1145                 udp_recv
1146                 color
1147                 fec
1148                 prebuffer_filter
1149                 version
1150                 bitstream
1151                 imdct
1152                 wma_common
1153                 wmadec_filter
1154                 buffer_tree
1155         "
1156         audiod_ldflags="$audiod_ldflags -lm"
1157         audiod_audio_formats="$audiod_audio_formats wma"
1158 else
1159         build_audiod="no"
1160 fi
1161 ########################################################################### fade
1162 if test -n "$mixers"; then
1163         build_fade="yes"
1164         executables="$executables fade"
1165         fade_errlist_objs="$fade_errlist_objs fade exec string fd version ggo"
1166         fade_cmdline_objs="fade"
1167         fade_objs="add_cmdline($fade_cmdline_objs) $fade_errlist_objs"
1168         AC_SUBST(fade_objs, add_dot_o($fade_objs))
1169         AC_SUBST(fade_ldflags, $fade_ldflags)
1170         AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
1171                 objlist_to_errlist($fade_errlist_objs),
1172                 errors used by para_fade)
1173         enum="$(
1174                 for i in $mixers; do
1175                         printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
1176                 done
1177         )"
1178         AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
1179                 enum of supported mixers)
1180         AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
1181                 use this mixer if none was specified)
1182         names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
1183         AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
1184         inits="$(
1185                 for i in $mixers; do
1186                         printf 'extern void '$i'_mix_init(struct mixer *); '
1187                 done
1188         )"
1189         AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
1190                 init functions of the supported mixers)
1191         array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
1192         AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
1193         mixer_summary="supported mixers:: $mixers, default: $default_mixer"
1194 else
1195         build_fade="no"
1196         AC_MSG_WARN([no mixer support])
1197         mixer_summary="para_fade: no"
1198 fi
1199 ########################################################################### gui
1200 if test "$have_curses" = "yes"; then
1201         build_gui="yes"
1202         executables="$executables gui"
1203         gui_cmdline_objs="gui"
1204         gui_errlist_objs="
1205                 exec
1206                 signal
1207                 string
1208                 stat
1209                 ringbuffer
1210                 fd
1211                 gui
1212                 gui_theme
1213                 time
1214                 version
1215                 ggo
1216         "
1217         gui_objs="add_cmdline($gui_cmdline_objs) $gui_errlist_objs"
1218 else
1219         build_gui="no"
1220         AC_MSG_WARN([no curses lib, cannot build para_gui])
1221 fi
1222 ######################################################################## filter
1223 filters="
1224         compress
1225         wav
1226         amp
1227         fecdec
1228         wmadec
1229         prebuffer
1230 "
1231 filter_errlist_objs="
1232         filter_common
1233         wav_filter
1234         compress_filter
1235         filter
1236         string
1237         stdin
1238         stdout
1239         sched
1240         fd
1241         amp_filter
1242         ggo
1243         fecdec_filter
1244         fec
1245         version
1246         prebuffer_filter
1247         time
1248         bitstream
1249         imdct
1250         wma_common
1251         wmadec_filter
1252         buffer_tree
1253         net
1254 "
1255 filter_cmdline_objs="
1256         filter
1257         compress_filter
1258         amp_filter
1259         prebuffer_filter
1260 "
1261
1262 if test "$have_vorbis" = "yes"; then
1263         filters="$filters oggdec"
1264         filter_errlist_objs="$filter_errlist_objs oggdec_filter"
1265 fi
1266 if test "$have_speex" = "yes"; then
1267         filters="$filters spxdec"
1268         filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
1269 fi
1270 if test "$have_opus" = "yes"; then
1271         filters="$filters opusdec"
1272         filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
1273 fi
1274 if test "$have_faad" = "yes"; then
1275         filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
1276         filters="$filters aacdec"
1277 fi
1278 if test "$have_mad" = "yes"; then
1279         filter_cmdline_objs="$filter_cmdline_objs mp3dec_filter"
1280         filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
1281         filters="$filters mp3dec"
1282 fi
1283 if test "$have_flac" = "yes"; then
1284         filter_errlist_objs="$filter_errlist_objs flacdec_filter"
1285         filters="$filters flacdec"
1286 fi
1287 if test "$have_samplerate" = "yes"; then
1288         filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
1289         filter_cmdline_objs="$filter_cmdline_objs resample_filter"
1290         filters="$filters resample"
1291 fi
1292
1293 ############################################################# error2.h
1294 # these are always built
1295 all_errlist_objs="
1296         $recv_errlist_objs
1297         $filter_errlist_objs
1298         $audioc_errlist_objs
1299         $write_errlist_objs
1300         $afh_errlist_objs
1301         $play_errlist_objs
1302 "
1303
1304 # optional executables
1305 if test "$build_server" = "yes"; then
1306         all_errlist_objs="$all_errlist_objs $server_errlist_objs"
1307 fi
1308 if test "$build_gui" = "yes"; then
1309         all_errlist_objs="$all_errlist_objs $gui_errlist_objs"
1310 fi
1311 if test "$build_fade" = "yes"; then
1312         all_errlist_objs="$all_errlist_objs $fade_errlist_objs"
1313 fi
1314 if test "$build_client" = "yes"; then
1315         all_errlist_objs="$all_errlist_objs $client_errlist_objs"
1316 fi
1317 if test "$build_audiod" = "yes"; then
1318         all_errlist_objs="$all_errlist_objs $audiod_errlist_objs"
1319 fi
1320
1321 all_errlist_objs="$(echo $all_errlist_objs | tr ' ' '\n' | sort | uniq)"
1322
1323 object_executable_matrix=
1324 for i in $executables; do
1325         eval objs=\$${i}_errlist_objs
1326         object_executable_matrix="$object_executable_matrix $i: $objs"
1327 done
1328 # use echo to replace newlines by space
1329 AC_SUBST(object_executable_matrix, $(echo $object_executable_matrix))
1330
1331 for obj in $all_errlist_objs; do
1332         SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
1333 done
1334 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
1335         [enum {$SS NUM_SS}],
1336         [list of all objects that use the paraslash error facility]
1337 )
1338 ################################################################## status items
1339
1340 status_items="basename status num_played mtime bitrate frequency file_size
1341 status_flags format score techinfo afs_mode
1342 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
1343 offset seconds_total stream_start current_time audiod_uptime image_id
1344 lyrics_id duration directory lyrics_name image_name path hash channels
1345 last_played num_chunks chunk_time amplification artist title year album
1346 comment"
1347
1348 result=
1349 for i in $status_items; do
1350         result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
1351 done
1352 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
1353         [enum of all status items])
1354
1355 result=
1356 for i in $status_items; do
1357         result="$result \"$i\", "
1358 done
1359 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
1360         [char * array of all status items])
1361
1362 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
1363         [formats supported by para_server and para_afh])
1364
1365 AC_SUBST(executables)
1366
1367 recv_objs="add_cmdline($recv_cmdline_objs) $recv_errlist_objs"
1368 filter_objs="add_cmdline($filter_cmdline_objs) $filter_errlist_objs"
1369 audiod_objs="add_cmdline($audiod_cmdline_objs) $audiod_errlist_objs"
1370 server_objs="add_cmdline($server_cmdline_objs) $server_errlist_objs"
1371 write_objs="add_cmdline($write_cmdline_objs) $write_errlist_objs"
1372 client_objs="add_cmdline($client_cmdline_objs) $client_errlist_objs"
1373 audioc_objs="add_cmdline($audioc_cmdline_objs) $audioc_errlist_objs"
1374 afh_objs="add_cmdline($afh_cmdline_objs) $afh_errlist_objs"
1375 play_objs="add_cmdline($play_cmdline_objs) $play_errlist_objs"
1376 gui_objs="add_cmdline($gui_cmdline_objs) $gui_errlist_objs"
1377
1378 AC_SUBST(recv_objs, add_dot_o($recv_objs))
1379 AC_SUBST(recv_ldflags, $recv_ldflags)
1380 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
1381         errors used by para_recv)
1382
1383 AC_SUBST(filter_objs, add_dot_o($filter_objs))
1384 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
1385         objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
1386
1387 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
1388 AC_SUBST(audiod_ldflags, $audiod_ldflags)
1389 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
1390         errors used by para_audiod)
1391
1392 AC_SUBST(server_objs, add_dot_o($server_objs))
1393 AC_SUBST(server_ldflags, $server_ldflags)
1394 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
1395         objlist_to_errlist($server_errlist_objs), errors used by para_server)
1396
1397 AC_SUBST(afh_objs, add_dot_o($afh_objs))
1398 AC_SUBST(afh_ldflags, $afh_ldflags)
1399 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
1400         objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
1401
1402 AC_SUBST(write_objs, add_dot_o($write_objs))
1403 AC_SUBST(write_ldflags, $write_ldflags)
1404 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
1405         objlist_to_errlist($write_errlist_objs), errors used by para_write)
1406
1407 AC_SUBST(client_objs, add_dot_o($client_objs))
1408 AC_SUBST(client_ldflags, $client_ldflags)
1409 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
1410         objlist_to_errlist($client_errlist_objs), errors used by para_client)
1411
1412 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
1413 AC_SUBST(audioc_ldflags, $audioc_ldflags)
1414 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
1415         objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
1416
1417 AC_SUBST(gui_objs, add_dot_o($gui_objs))
1418 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
1419         objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
1420
1421 AC_SUBST(play_objs, add_dot_o($play_objs))
1422 AC_SUBST(play_ldflags, $play_ldflags)
1423 AC_DEFINE_UNQUOTED(INIT_PLAY_ERRLISTS,
1424         objlist_to_errlist($play_errlist_objs), errors used by para_play)
1425
1426 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
1427 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
1428         enum of supported filters)
1429 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
1430 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
1431 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
1432 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
1433
1434 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
1435 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
1436         enum of supported writers)
1437 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
1438 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
1439 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
1440 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
1441 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
1442 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
1443 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
1444
1445 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
1446 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
1447         enum of audio formats supported by audiod)
1448 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
1449 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
1450
1451 AC_OUTPUT
1452 AC_MSG_NOTICE([
1453 paraslash configuration:
1454 ~~~~~~~~~~~~~~~~~~~~~~~~
1455 unix socket credentials: $have_ucred
1456 readline (interactive CLIs): $have_readline
1457 audio formats handlers: $audio_format_handlers
1458 id3 version2 support: $have_libid3tag
1459 filters: $(echo $filters)
1460 writers: $writers
1461
1462 $mixer_summary
1463 para_server: $build_server
1464 para_gui: $build_gui
1465 para_fade: $build_fade
1466 para_client: $build_client
1467 para_audiod: $build_audiod
1468 ])