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