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