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