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