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