Merge branch 'refs/heads/t/dynamic_chunks'
[paraslash.git] / configure.ac
1 AC_PREREQ([2.61])
2
3 AC_INIT([paraslash], [m4_esyscmd_s(./GIT-VERSION-GEN)],
4 [maan@tuebingen.mpg.de], [], [http://people.tuebingen.mpg.de/maan/paraslash/])
5 AC_CONFIG_HEADERS([config.h])
6
7 AC_CONFIG_FILES([Makefile])
8 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
9 AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; done)])
10 AC_DEFUN([LIB_ARG_WITH], [
11 AC_ARG_WITH($1-headers, [AS_HELP_STRING(--with-$1-headers=dir,
12 [look for $1 headers in dir])])
13 AC_ARG_WITH($1-libs, [AS_HELP_STRING(--with-$1-libs=dir,
14 [look for $1 libraries in dir])])
15 if test -n "$with_$1_headers"; then
16 $1_cppflags="-I$with_$1_headers"
17 CPPFLAGS="$CPPFLAGS $$1_cppflags"
18 fi
19 if test -n "$with_$1_libs"; then
20 $1_ldflags="-L$with_$1_libs $2"
21 else
22 $1_ldflags="$2"
23 fi
24 LDFLAGS="$LDFLAGS $$1_ldflags"
25 ])
26
27 AC_DEFUN([STASH_FLAGS], [
28 OLD_CPPFLAGS="$CPPFLAGS"
29 OLD_LDFLAGS="$LDFLAGS"
30 OLD_LIBS="$LIBS"
31 ])
32
33 AC_DEFUN([UNSTASH_FLAGS], [
34 CPPFLAGS="$OLD_CPPFLAGS"
35 LDFLAGS="$OLD_LDFLAGS"
36 LIBS="$OLD_LIBS"
37 ])
38 AC_DEFUN([LIB_SUBST_FLAGS], [
39 if test "$HAVE_[]m4_toupper([$1])" = 'yes'; then
40 AC_DEFINE(HAVE_[]m4_toupper([$1]), 1,
41 define to 1 to turn on $1 support)
42 else
43 $1_cppflags=
44 $1_ldflags=
45 fi
46 AC_SUBST(HAVE_[]m4_toupper([$1]))
47 AC_SUBST($1_cppflags)
48 AC_SUBST($1_ldflags)
49 ])
50
51 AC_USE_SYSTEM_EXTENSIONS
52 AC_C_BIGENDIAN()
53
54 AC_PATH_PROG([GENGETOPT], [gengetopt])
55 test -z "$GENGETOPT" && AC_MSG_ERROR(
56 [gengetopt is required to build this package])
57
58 AC_PATH_PROG([M4], [m4])
59 test -z "$M4" && AC_MSG_ERROR(
60 [The m4 macro processor is required to build this package])
61
62 AC_PATH_PROG([HELP2MAN], [help2man])
63 test -z "$HELP2MAN" && AC_MSG_ERROR(
64 [help2man is required to build this package])
65
66 AC_PROG_CC
67 AC_PROG_CPP
68
69 executables="recv filter audioc write afh play"
70 ########################################################################### osl
71 STASH_FLAGS
72 LIB_ARG_WITH([osl], [-losl])
73 HAVE_OSL=yes
74 AC_CHECK_HEADER(osl.h, [], [HAVE_OSL=no])
75 AC_CHECK_LIB([osl], [osl_open_table], [], [HAVE_OSL=no])
76 LIB_SUBST_FLAGS(osl)
77 UNSTASH_FLAGS
78 ######################################################################## openssl
79 STASH_FLAGS
80 HAVE_OPENSSL=yes
81 LIB_ARG_WITH([openssl], [-lssl -lcrypto])
82 AC_CHECK_HEADER(openssl/ssl.h, [], [HAVE_OPENSSL=no])
83 AC_CHECK_LIB([crypto], [RAND_bytes], [], [HAVE_OPENSSL=no])
84 LIB_SUBST_FLAGS(openssl)
85 if test $HAVE_OPENSSL = yes; then
86 AC_CHECK_LIB([crypto], [RSA_set0_key],
87 AC_DEFINE([HAVE_RSA_SET0_KEY], [1], [openssl-1.1]))
88 fi
89 UNSTASH_FLAGS
90 ######################################################################### gcrypt
91 STASH_FLAGS
92 HAVE_GCRYPT=yes
93 LIB_ARG_WITH([gcrypt], [-lgcrypt])
94 AC_CHECK_HEADER(gcrypt.h, [], [HAVE_GCRYPT=no])
95 AC_CHECK_LIB([gcrypt], [gcry_randomize], [], [HAVE_GCRYPT=no])
96 LIB_SUBST_FLAGS(gcrypt)
97 UNSTASH_FLAGS
98 ######################################################################### crypto
99 AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
100 Force using crypto library "lib". This package requires either
101 openssl or libgcrypt being installed. Possible values for "lib"
102 are thus "openssl" and "gcrypt". If this option is not given,
103 openssl is tried first. If openssl was not found, gcrypt is
104 tried next.])])
105
106 CRYPTOLIB="$enable_cryptolib"
107 case "$enable_cryptolib" in
108 "openssl")
109 test $HAVE_OPENSSL = no && AC_MSG_ERROR(openssl not found)
110 crypto_ldflags="$openssl_ldflags"
111 ;;
112 "gcrypt")
113 test $HAVE_GCRYPT = no && AC_MSG_ERROR(gcrypt not found)
114 crypto_ldflags="$gcrypt_ldflags"
115 ;;
116 "")
117 crypto_ldflags=
118 if test $HAVE_GCRYPT = yes; then
119 CRYPTOLIB=gcrypt
120 crypto_ldflags="$gcrypt_ldflags"
121 fi
122 if test $HAVE_OPENSSL = yes; then
123 CRYPTOLIB=openssl
124 crypto_ldflags="$openssl_ldflags"
125 fi
126 ;;
127 *)
128 AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib])
129 ;;
130 esac
131 AC_SUBST(crypto_ldflags)
132 ########################################################################## iconv
133 STASH_FLAGS
134 LIBS=
135 AC_SEARCH_LIBS([libiconv_open], [iconv],
136 [iconv_ldflags="$LIBS"],
137 []
138 )
139 AC_SUBST(iconv_ldflags)
140 AC_MSG_CHECKING([whether iconv needs const char ** cast])
141 AC_COMPILE_IFELSE([
142 AC_LANG_PROGRAM([
143 #include <iconv.h>
144 ],[
145 size_t iconv(iconv_t cd, const char **inbuf,
146 size_t *inbytesleft, char **outbuf,
147 size_t *outbytesleft);
148 ])
149 ],
150 [cast='(const char **)'; msg=yes],
151 [cast=; msg=no]
152 )
153 AC_DEFINE_UNQUOTED(ICONV_CAST, $cast, [cast for second arg to iconv()])
154 AC_MSG_RESULT($msg)
155 UNSTASH_FLAGS
156 ########################################################################### ucred
157 AC_MSG_CHECKING(for struct ucred)
158 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
159 #include <sys/types.h>
160 #include <sys/socket.h>
161 ]], [[
162 struct ucred sucred; sucred.pid=0;
163 ]])],[have_ucred=yes],[have_ucred=no])
164 AC_MSG_RESULT($have_ucred)
165 if test ${have_ucred} = yes; then
166 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
167 fi
168 ########################################################################### gengetopt
169 echo 'option "z" z "" flag off' | $GENGETOPT --file-name conftest-ggo &&
170 AC_CHECK_DECL(
171 [gengetopt_args_info_description],
172 [ggo_descriptions_declared=yes],
173 [ggo_descriptions_declared=no],
174 [#include "conftest-ggo.h"]
175 )
176 AC_SUBST(ggo_descriptions_declared)
177 ########################################################################### curses
178 STASH_FLAGS
179 LIB_ARG_WITH([curses], [])
180 HAVE_CURSES=yes
181 AC_CHECK_HEADER(curses.h, [], [HAVE_CURSES=no])
182 AC_SEARCH_LIBS([initscr], [ncursesw curses], [], [HAVE_CURSES=no])
183 curses_ldflags="$curses_ldflags $LIBS"
184 LIB_SUBST_FLAGS(curses)
185 UNSTASH_FLAGS
186 ########################################################################### ip_mreqn
187 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
188 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
189 #include <netdb.h>
190 #include <net/if.h>
191 ]], [[
192 struct ip_mreqn mn;
193 mn.imr_ifindex = 0;
194 ]])],[have_ip_mreqn=yes],[have_ip_mreqn=no])
195 AC_MSG_RESULT($have_ip_mreqn)
196 if test ${have_ip_mreqn} = yes; then
197 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
198 fi
199 ########################################################################### ogg
200 STASH_FLAGS
201 LIB_ARG_WITH([ogg], [-logg])
202 HAVE_OGG=yes
203 AC_CHECK_HEADERS([ogg/ogg.h], [], [HAVE_OGG=no])
204 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [HAVE_OGG=no])
205 AC_CHECK_LIB([ogg], [ogg_stream_flush_fill], [
206 AC_DEFINE(HAVE_OGG_STREAM_FLUSH_FILL, 1, [libogg >= 1.3.0])])
207 LIB_SUBST_FLAGS(ogg)
208 UNSTASH_FLAGS
209 ######################################################################### vorbis
210 STASH_FLAGS
211 LIB_ARG_WITH([vorbis], [-lvorbis -lvorbisfile])
212 HAVE_VORBIS=yes
213 AC_CHECK_HEADERS([vorbis/codec.h], [], [HAVE_VORBIS=no])
214 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [HAVE_VORBIS=no])
215 LIB_SUBST_FLAGS(vorbis)
216 UNSTASH_FLAGS
217 ######################################################################### speex
218 STASH_FLAGS
219 LIB_ARG_WITH([speex], [-lspeex])
220 HAVE_SPEEX=yes
221 AC_CHECK_HEADERS([speex/speex.h], [], [HAVE_SPEEX=no])
222 AC_CHECK_LIB([speex], [speex_decoder_init], [], [HAVE_SPEEX=no])
223 LIB_SUBST_FLAGS(speex)
224 UNSTASH_FLAGS
225 ######################################################################### opus
226 STASH_FLAGS
227 LIB_ARG_WITH([opus], [-lopus])
228 HAVE_OPUS=yes
229 AC_CHECK_HEADERS([opus/opus.h], [], [HAVE_OPUS=no])
230 AC_CHECK_LIB([opus], [opus_multistream_decode], [], [HAVE_OPUS=no])
231 LIB_SUBST_FLAGS(opus)
232 UNSTASH_FLAGS
233 ########################################################################### flac
234 STASH_FLAGS
235 LIB_ARG_WITH([flac], [-lFLAC -lm])
236 HAVE_FLAC=yes
237 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], HAVE_FLAC=no)
238 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], HAVE_FLAC=no)
239 LIB_SUBST_FLAGS(flac)
240 UNSTASH_FLAGS
241
242 # some helper functions for codecs which use the ogg container format
243 AC_DEFUN([NEED_OGG_OBJECTS], [{
244 test "$HAVE_OGG" = 'yes' -a \( \
245 "$HAVE_VORBIS" = 'yes' \
246 -o "$HAVE_SPEEX" = 'yes' \
247 -o "$HAVE_OPUS" = 'yes' \
248 -o "$HAVE_FLAC" = 'yes' \
249 \)
250 }])
251 AC_DEFUN([NEED_VORBIS_OBJECTS], [{
252 test "$HAVE_OGG" = 'yes' -a "$HAVE_VORBIS" = 'yes'
253 }])
254 AC_DEFUN([NEED_SPEEX_OBJECTS], [{
255 test "$HAVE_OGG" = 'yes' -a "$HAVE_SPEEX" = 'yes'
256 }])
257 AC_DEFUN([NEED_OPUS_OBJECTS], [{
258 test "$HAVE_OGG" = 'yes' -a "$HAVE_OPUS" = 'yes'
259 }])
260 AC_DEFUN([NEED_FLAC_OBJECTS], [{
261 test "$HAVE_OGG" = 'yes' -a "$HAVE_FLAC" = 'yes'
262 }])
263 ########################################################################### faad
264 STASH_FLAGS
265 LIB_ARG_WITH([faad], [-lfaad -lmp4ff])
266 HAVE_FAAD=yes
267 AC_CHECK_HEADER(neaacdec.h, [], HAVE_FAAD=no)
268 AC_CHECK_HEADER(mp4ff.h, [], HAVE_FAAD=no)
269 AC_CHECK_LIB([faad], [NeAACDecOpen], [], HAVE_FAAD=no)
270 AC_CHECK_LIB([mp4ff], [mp4ff_meta_get_artist], [], HAVE_FAAD=no)
271 LIB_SUBST_FLAGS(faad)
272 UNSTASH_FLAGS
273 ########################################################################### mad
274 STASH_FLAGS
275 LIB_ARG_WITH([mad], [-lmad])
276 HAVE_MAD=yes
277 AC_CHECK_HEADER(mad.h, [], HAVE_MAD=no)
278 AC_CHECK_LIB([mad], [mad_stream_init], [], HAVE_MAD=no)
279 LIB_SUBST_FLAGS(mad)
280 UNSTASH_FLAGS
281 ###################################################################### libid3tag
282 STASH_FLAGS
283 LIB_ARG_WITH([id3tag], [-lid3tag -lz])
284 HAVE_ID3TAG=yes
285 AC_CHECK_HEADER(id3tag.h, [], HAVE_ID3TAG=no)
286 AC_CHECK_LIB([id3tag], [id3_file_fdopen], [], HAVE_ID3TAG=no)
287 LIB_SUBST_FLAGS(id3tag)
288 UNSTASH_FLAGS
289 ########################################################################### oss
290 STASH_FLAGS
291 LIB_ARG_WITH([oss], [])
292 AC_CHECK_HEADER(sys/soundcard.h, [HAVE_OSS=yes], [HAVE_OSS=no])
293 AC_CHECK_LIB(ossaudio, _oss_ioctl, [oss_ldflags="$oss_ldflags -lossaudio"], [])
294 LIB_SUBST_FLAGS(oss)
295 UNSTASH_FLAGS
296 ########################################################################### alsa
297 STASH_FLAGS
298 LIB_ARG_WITH([alsa], [-lasound])
299 HAVE_ALSA=yes
300 AC_CHECK_HEADER(alsa/asoundlib.h, [], HAVE_ALSA=no)
301 AC_CHECK_LIB([asound], [snd_pcm_open], [], HAVE_ALSA=no)
302 LIB_SUBST_FLAGS(alsa)
303 UNSTASH_FLAGS
304 ######################################################################### pthread
305 STASH_FLAGS
306 LIB_ARG_WITH([pthread], [-lpthread])
307 HAVE_PTHREAD=yes
308 AC_CHECK_HEADER(pthread.h, [], HAVE_PTHREAD=no)
309 AC_CHECK_LIB([pthread], [pthread_create], [], HAVE_PTHREAD=no)
310 LIB_SUBST_FLAGS(pthread)
311 UNSTASH_FLAGS
312 ########################################################################### libao
313 STASH_FLAGS
314 LIB_ARG_WITH([ao], [-lao])
315 HAVE_AO=yes
316 AC_CHECK_HEADER(ao/ao.h, [], HAVE_AO=no)
317 AC_CHECK_LIB([ao], [ao_initialize], [], HAVE_AO=no)
318 LIB_SUBST_FLAGS(ao)
319 UNSTASH_FLAGS
320 AC_DEFUN([NEED_AO_OBJECTS], [{ test $HAVE_AO = yes -a $HAVE_PTHREAD = yes; }])
321 ######################################################################## readline
322 STASH_FLAGS
323 AC_SEARCH_LIBS([tgetent], [tinfo curses terminfo termcap])
324 LIB_ARG_WITH([readline], [-lreadline $LIBS])
325 HAVE_READLINE=yes
326 AC_CHECK_HEADER([readline/readline.h], [], [HAVE_READLINE=no])
327 AC_CHECK_LIB([readline], [rl_free_keymap], [], HAVE_READLINE=no)
328 AC_CHECK_DECL(
329 [rl_free_keymap],
330 [AC_DEFINE(RL_FREE_KEYMAP_DECLARED, 1, readline >= 6.3)],
331 [],
332 [
333 #include <stdio.h>
334 #include <readline/readline.h>
335 ]
336 )
337 LIB_SUBST_FLAGS(readline)
338 UNSTASH_FLAGS
339 ############################################################# libsamplerate
340 STASH_FLAGS
341 LIB_ARG_WITH([samplerate], [-lsamplerate])
342 HAVE_SAMPLERATE=yes
343 AC_CHECK_HEADER(samplerate.h, [], HAVE_SAMPLERATE=no)
344 AC_CHECK_LIB([samplerate], [src_process], [], HAVE_SAMPLERATE=no)
345 LIB_SUBST_FLAGS(samplerate)
346 UNSTASH_FLAGS
347 ######################################################################### server
348 if test -n "$CRYPTOLIB" && test $HAVE_OSL = yes; then
349 build_server="yes"
350 executables="$executables server"
351 server_cmdline_objs="server"
352 server_errlist_objs="
353 server
354 afh_common
355 mp3_afh
356 vss
357 command
358 net
359 string
360 signal
361 time
362 daemon
363 http_send
364 close_on_fork
365 mm
366 crypt_common
367 base64
368 ipc
369 dccp_send
370 fd
371 user_list
372 chunk_queue
373 afs
374 aft
375 mood
376 score
377 attribute
378 blob
379 playlist
380 sched
381 acl
382 send_common
383 udp_send
384 color
385 fec
386 wma_afh
387 wma_common
388 sideband
389 version
390 ggo
391 "
392 if test "$CRYPTOLIB" = openssl; then
393 server_errlist_objs="$server_errlist_objs crypt"
394 else
395 server_errlist_objs="$server_errlist_objs gcrypt"
396 fi
397 NEED_OGG_OBJECTS() && server_errlist_objs="$server_errlist_objs ogg_afh_common"
398 NEED_VORBIS_OBJECTS() && server_errlist_objs="$server_errlist_objs ogg_afh"
399 NEED_SPEEX_OBJECTS() && server_errlist_objs="$server_errlist_objs spx_afh spx_common"
400 NEED_OPUS_OBJECTS() && server_errlist_objs="$server_errlist_objs opus_afh opus_common"
401 NEED_FLAC_OBJECTS && server_errlist_objs="$server_errlist_objs flac_afh"
402 if test $HAVE_FAAD = yes; then
403 server_errlist_objs="$server_errlist_objs aac_afh"
404 fi
405 server_objs="add_cmdline($server_cmdline_objs) $server_errlist_objs"
406 AC_SUBST(server_objs, add_dot_o($server_objs))
407 else
408 build_server="no"
409 fi
410 ############################################################# client
411 if test -n "$CRYPTOLIB"; then
412 build_client="yes"
413 executables="$executables client"
414 client_cmdline_objs="client"
415 client_errlist_objs="
416 client
417 net
418 string
419 fd
420 sched
421 stdin
422 stdout
423 time
424 sideband
425 client_common
426 buffer_tree
427 crypt_common
428 base64
429 version
430 ggo
431 "
432 if test "$CRYPTOLIB" = openssl; then
433 client_errlist_objs="$client_errlist_objs crypt"
434 else
435 client_errlist_objs="$client_errlist_objs gcrypt"
436 fi
437 if test $HAVE_READLINE = yes; then
438 client_errlist_objs="$client_errlist_objs interactive"
439 fi
440 client_objs="add_cmdline($client_cmdline_objs) $client_errlist_objs"
441 AC_SUBST(client_objs, add_dot_o($client_objs))
442 else
443 build_client="no"
444 fi
445 ############################################################# audiod
446 if test -n "$CRYPTOLIB"; then
447 build_audiod="yes"
448 executables="$executables audiod"
449 audiod_audio_formats="wma"
450 audiod_cmdline_objs="$audiod_cmdline_objs
451 audiod
452 compress_filter
453 http_recv
454 dccp_recv
455 file_write
456 client
457 amp_filter
458 udp_recv
459 prebuffer_filter
460 sync_filter
461 "
462 audiod_errlist_objs="$audiod_errlist_objs
463 audiod
464 signal
465 string
466 daemon
467 stat
468 net
469 crypt_common
470 base64
471 sideband
472 time
473 grab_client
474 filter_common
475 wav_filter
476 compress_filter
477 amp_filter
478 http_recv
479 dccp_recv
480 recv_common
481 fd
482 sched
483 write_common
484 file_write
485 audiod_command
486 fecdec_filter
487 client_common
488 ggo
489 udp_recv
490 color
491 fec
492 prebuffer_filter
493 version
494 bitstream
495 imdct
496 wma_common
497 wmadec_filter
498 buffer_tree
499 sync_filter
500 "
501 if test "$CRYPTOLIB" = openssl; then
502 audiod_errlist_objs="$audiod_errlist_objs crypt"
503 else
504 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
505 fi
506 NEED_VORBIS_OBJECTS && {
507 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
508 audiod_audio_formats="$audiod_audio_formats ogg"
509 }
510 NEED_SPEEX_OBJECTS && {
511 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
512 audiod_audio_formats="$audiod_audio_formats spx"
513 }
514 NEED_OPUS_OBJECTS && {
515 audiod_errlist_objs="$audiod_errlist_objs opusdec_filter opus_common"
516 audiod_audio_formats="$audiod_audio_formats opus"
517 }
518 NEED_FLAC_OBJECTS && {
519 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
520 audiod_audio_formats="$audiod_audio_formats flac"
521 }
522 if test $HAVE_FAAD = yes; then
523 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter"
524 audiod_audio_formats="$audiod_audio_formats aac"
525 fi
526 if test $HAVE_MAD = yes; then
527 audiod_audio_formats="$audiod_audio_formats mp3"
528 audiod_cmdline_objs="$audiod_cmdline_objs mp3dec_filter"
529 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
530 fi
531 if test $HAVE_OSS = yes; then
532 audiod_errlist_objs="$audiod_errlist_objs oss_write"
533 audiod_cmdline_objs="$audiod_cmdline_objs oss_write"
534 fi
535 if test $HAVE_ALSA = yes; then
536 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
537 audiod_cmdline_objs="$audiod_cmdline_objs alsa_write"
538 fi
539 NEED_AO_OBJECTS && {
540 audiod_errlist_objs="$audiod_errlist_objs ao_write"
541 audiod_cmdline_objs="$audiod_cmdline_objs ao_write"
542 }
543 if test $HAVE_SAMPLERATE = yes; then
544 audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
545 audiod_cmdline_objs="$audiod_cmdline_objs resample_filter"
546 fi
547 audiod_objs="add_cmdline($audiod_cmdline_objs) $audiod_errlist_objs"
548 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
549
550 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
551 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
552 enum of audio formats supported by audiod)
553 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
554 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
555 else
556 build_audiod="no"
557 fi
558 ########################################################################### fade
559 if test $HAVE_OSS = yes -o $HAVE_ALSA = yes; then
560 build_fade="yes"
561 executables="$executables fade"
562 fade_cmdline_objs="fade"
563 fade_errlist_objs="fade exec string fd version ggo"
564 if test $HAVE_OSS = yes; then
565 fade_errlist_objs="$fade_errlist_objs oss_mix"
566 mixers="${mixers}oss "
567 default_mixer="OSS_MIX"
568 fi
569 if test $HAVE_ALSA = yes; then
570 fade_errlist_objs="$fade_errlist_objs alsa_mix"
571 mixers="${mixers}alsa "
572 default_mixer="ALSA_MIX"
573 fi
574 fade_objs="add_cmdline($fade_cmdline_objs) $fade_errlist_objs"
575 AC_SUBST(fade_objs, add_dot_o($fade_objs))
576 enum="$(
577 for i in $mixers; do
578 printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
579 done
580 )"
581 AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
582 enum of supported mixers)
583 AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
584 use this mixer if none was specified)
585 names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
586 AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
587 inits="$(
588 for i in $mixers; do
589 printf 'extern void '$i'_mix_init(struct mixer *); '
590 done
591 )"
592 AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
593 init functions of the supported mixers)
594 array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
595 AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
596 else
597 build_fade="no"
598 AC_MSG_WARN([no mixer support])
599 fi
600 ########################################################################### gui
601 if test $HAVE_CURSES = yes; then
602 build_gui="yes"
603 executables="$executables gui"
604 gui_cmdline_objs="gui"
605 gui_errlist_objs="
606 exec
607 signal
608 string
609 stat
610 ringbuffer
611 fd
612 gui
613 gui_theme
614 time
615 sched
616 version
617 ggo
618 "
619 gui_objs="add_cmdline($gui_cmdline_objs) $gui_errlist_objs"
620 AC_SUBST(gui_objs, add_dot_o($gui_objs))
621 else
622 build_gui="no"
623 AC_MSG_WARN([no curses lib, cannot build para_gui])
624 fi
625 ######################################################################## filter
626 filters="
627 compress
628 wav
629 amp
630 fecdec
631 wmadec
632 prebuffer
633 sync
634 "
635 filter_errlist_objs="
636 filter_common
637 wav_filter
638 compress_filter
639 filter
640 string
641 stdin
642 stdout
643 sched
644 fd
645 amp_filter
646 ggo
647 fecdec_filter
648 fec
649 version
650 prebuffer_filter
651 time
652 bitstream
653 imdct
654 wma_common
655 wmadec_filter
656 buffer_tree
657 net
658 sync_filter
659 "
660 filter_cmdline_objs="
661 filter
662 compress_filter
663 amp_filter
664 prebuffer_filter
665 sync_filter
666 "
667 NEED_VORBIS_OBJECTS && {
668 filters="$filters oggdec"
669 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
670 }
671 NEED_SPEEX_OBJECTS && {
672 filters="$filters spxdec"
673 filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
674 }
675 NEED_OPUS_OBJECTS && {
676 filters="$filters opusdec"
677 filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
678 }
679 NEED_FLAC_OBJECTS && {
680 filter_errlist_objs="$filter_errlist_objs flacdec_filter"
681 filters="$filters flacdec"
682 }
683 if test $HAVE_FAAD = yes; then
684 filter_errlist_objs="$filter_errlist_objs aacdec_filter"
685 filters="$filters aacdec"
686 fi
687 if test $HAVE_MAD = yes; then
688 filter_cmdline_objs="$filter_cmdline_objs mp3dec_filter"
689 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
690 filters="$filters mp3dec"
691 fi
692 if test $HAVE_SAMPLERATE = yes; then
693 filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
694 filter_cmdline_objs="$filter_cmdline_objs resample_filter"
695 filters="$filters resample"
696 fi
697 filters="$(echo $filters)"
698 AC_SUBST(filters)
699 filter_objs="add_cmdline($filter_cmdline_objs) $filter_errlist_objs"
700
701 AC_SUBST(filter_objs, add_dot_o($filter_objs))
702
703 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
704 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
705 enum of supported filters)
706 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
707 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
708 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
709 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
710 ########################################################################## recv
711 recv_cmdline_objs="
712 recv
713 http_recv
714 dccp_recv
715 udp_recv
716 afh_recv
717 "
718
719 recv_errlist_objs="
720 http_recv
721 recv_common
722 recv
723 time
724 string
725 net
726 dccp_recv
727 fd
728 sched
729 stdout
730 ggo
731 udp_recv
732 buffer_tree
733 afh_recv
734 afh_common
735 wma_afh
736 wma_common
737 mp3_afh
738 version
739 "
740 NEED_OGG_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
741 NEED_VORBIS_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh"
742 NEED_SPEEX_OBJECTS && recv_errlist_objs="$recv_errlist_objs spx_afh spx_common"
743 NEED_OPUS_OBJECTS && recv_errlist_objs="$recv_errlist_objs opus_afh opus_common"
744 NEED_FLAC_OBJECTS && recv_errlist_objs="$recv_errlist_objs flac_afh"
745
746 if test $HAVE_FAAD = yes; then
747 recv_errlist_objs="$recv_errlist_objs aac_afh"
748 fi
749 recv_objs="add_cmdline($recv_cmdline_objs) $recv_errlist_objs"
750 AC_SUBST(receivers, "http dccp udp afh")
751 AC_SUBST(recv_objs, add_dot_o($recv_objs))
752 ########################################################################### afh
753 audio_format_handlers="mp3 wma"
754 afh_cmdline_objs="afh"
755 afh_errlist_objs="
756 afh
757 string
758 fd
759 mp3_afh
760 afh_common
761 time
762 wma_afh
763 wma_common
764 version
765 ggo
766 "
767 NEED_OGG_OBJECTS && afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
768 NEED_VORBIS_OBJECTS && {
769 afh_errlist_objs="$afh_errlist_objs ogg_afh"
770 audio_format_handlers="$audio_format_handlers ogg"
771 }
772 NEED_SPEEX_OBJECTS && {
773 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
774 audio_format_handlers="$audio_format_handlers spx"
775 }
776 NEED_OPUS_OBJECTS && {
777 afh_errlist_objs="$afh_errlist_objs opus_afh opus_common"
778 audio_format_handlers="$audio_format_handlers opus"
779 }
780 NEED_FLAC_OBJECTS && {
781 afh_errlist_objs="$afh_errlist_objs flac_afh"
782 audio_format_handlers="$audio_format_handlers flac"
783 }
784 if test $HAVE_FAAD = yes; then
785 afh_errlist_objs="$afh_errlist_objs aac_afh"
786 audio_format_handlers="$audio_format_handlers aac"
787 fi
788
789 afh_objs="add_cmdline($afh_cmdline_objs) $afh_errlist_objs"
790
791 AC_SUBST(afh_objs, add_dot_o($afh_objs))
792 ########################################################################## play
793 play_errlist_objs="
794 play
795 fd
796 sched
797 ggo
798 buffer_tree
799 time
800 string
801 net
802 afh_recv
803 afh_common
804 wma_afh
805 wma_common
806 mp3_afh
807 recv_common
808 udp_recv
809 http_recv
810 dccp_recv
811 filter_common
812 fec
813 bitstream
814 imdct
815 wav_filter
816 compress_filter
817 amp_filter
818 prebuffer_filter
819 fecdec_filter
820 wmadec_filter
821 write_common
822 file_write
823 version
824 sync_filter
825 "
826 play_cmdline_objs="
827 http_recv
828 dccp_recv
829 udp_recv
830 afh_recv
831 compress_filter
832 amp_filter
833 prebuffer_filter
834 file_write
835 play
836 sync_filter
837 "
838 NEED_OGG_OBJECTS && play_errlist_objs="$play_errlist_objs ogg_afh_common"
839 NEED_VORBIS_OBJECTS && {
840 play_errlist_objs="$play_errlist_objs oggdec_filter ogg_afh"
841 }
842 NEED_SPEEX_OBJECTS && {
843 play_errlist_objs="$play_errlist_objs spxdec_filter spx_afh spx_common"
844 }
845 NEED_OPUS_OBJECTS &&
846 play_errlist_objs="$play_errlist_objs
847 opusdec_filter
848 opus_afh
849 opus_common
850 "
851 NEED_FLAC_OBJECTS && {
852 play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
853 }
854 if test $HAVE_FAAD = yes; then
855 play_errlist_objs="$play_errlist_objs aac_afh aacdec_filter"
856 fi
857 if test $HAVE_MAD = yes; then
858 play_cmdline_objs="$play_cmdline_objs mp3dec_filter"
859 play_errlist_objs="$play_errlist_objs mp3dec_filter"
860 fi
861 if test $HAVE_OSS = yes; then
862 play_errlist_objs="$play_errlist_objs oss_write"
863 play_cmdline_objs="$play_cmdline_objs oss_write"
864 fi
865 if test $HAVE_ALSA = yes; then
866 play_errlist_objs="$play_errlist_objs alsa_write"
867 play_cmdline_objs="$play_cmdline_objs alsa_write"
868 fi
869 NEED_AO_OBJECTS && {
870 play_errlist_objs="$play_errlist_objs ao_write"
871 play_cmdline_objs="$play_cmdline_objs ao_write"
872 }
873 if test $HAVE_READLINE = yes; then
874 play_errlist_objs="$play_errlist_objs interactive"
875 fi
876 if test $HAVE_SAMPLERATE = yes; then
877 play_errlist_objs="$play_errlist_objs resample_filter check_wav"
878 play_cmdline_objs="$play_cmdline_objs resample_filter"
879 fi
880
881 play_objs="add_cmdline($play_cmdline_objs) $play_errlist_objs"
882 AC_SUBST(play_objs, add_dot_o($play_objs))
883 ######################################################################### write
884 write_cmdline_objs="
885 write
886 file_write
887 "
888 write_errlist_objs="
889 write
890 write_common
891 file_write
892 time
893 fd
894 string
895 sched
896 stdin
897 buffer_tree
898 ggo
899 check_wav
900 version
901 "
902 writers="file"
903 default_writer="FILE_WRITE"
904
905 NEED_AO_OBJECTS && {
906 write_errlist_objs="$write_errlist_objs ao_write"
907 write_cmdline_objs="$write_cmdline_objs ao_write"
908 writers="$writers ao"
909 default_writer="AO_WRITE"
910 }
911 if test $HAVE_OSS = yes; then
912 write_errlist_objs="$write_errlist_objs oss_write"
913 write_cmdline_objs="$write_cmdline_objs oss_write"
914 writers="$writers oss"
915 default_writer="OSS_WRITE"
916 fi
917 if test $HAVE_ALSA = yes; then
918 write_errlist_objs="$write_errlist_objs alsa_write"
919 write_cmdline_objs="$write_cmdline_objs alsa_write"
920 writers="$writers alsa"
921 default_writer="ALSA_WRITE"
922 fi
923 AC_SUBST(writers)
924 write_objs="add_cmdline($write_cmdline_objs) $write_errlist_objs"
925 AC_SUBST(write_objs, add_dot_o($write_objs))
926 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
927 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
928 enum of supported writers)
929 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
930 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
931 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
932 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
933 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
934 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
935 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
936 ######################################################################## audioc
937 audioc_cmdline_objs="audioc"
938 audioc_errlist_objs="
939 audioc
940 string
941 net
942 fd
943 version
944 ggo
945 "
946 if test $HAVE_READLINE = yes; then
947 audioc_errlist_objs="$audioc_errlist_objs
948 buffer_tree
949 interactive
950 sched
951 time
952 "
953 fi
954 audioc_objs="add_cmdline($audioc_cmdline_objs) $audioc_errlist_objs"
955 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
956 ################################################################## status items
957
958 status_items="basename status num_played mtime bitrate frequency file_size
959 status_flags format score techinfo afs_mode
960 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
961 offset seconds_total stream_start current_time audiod_uptime image_id
962 lyrics_id duration directory lyrics_name image_name path hash channels
963 last_played num_chunks chunk_time amplification artist title year album
964 comment max_chunk_size"
965
966 result=
967 for i in $status_items; do
968 result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
969 done
970 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
971 [enum of all status items])
972
973 result=
974 for i in $status_items; do
975 result="$result \"$i\", "
976 done
977 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
978 [char * array of all status items])
979
980 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
981 [formats supported by para_server and para_afh])
982
983 AC_SUBST(executables)
984
985 AC_OUTPUT
986 AC_MSG_NOTICE([
987 paraslash configuration:
988 ~~~~~~~~~~~~~~~~~~~~~~~~
989 crypto lib: ${CRYPTOLIB:-[none]}
990 unix socket credentials: $have_ucred
991 readline (interactive CLIs): $HAVE_READLINE
992 id3 version 2 support: $HAVE_ID3TAG
993 faad: $HAVE_FAAD
994
995 audio format handlers: $audio_format_handlers
996 filters: $(echo $filters)
997 writers: $writers
998
999 para_server: $build_server
1000 para_gui: $build_gui
1001 para_fade: $build_fade
1002 para_client: $build_client
1003 para_audiod: $build_audiod
1004 ])