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