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