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