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