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