Merge branch 'maint'
[paraslash.git] / configure.ac
1 AC_PREREQ([2.61])
2
3 AC_INIT([paraslash], [m4_esyscmd_s(./GIT-VERSION-GEN)],
4         [maan@tuebingen.mpg.de], [], [http://people.tuebingen.mpg.de/maan/paraslash/])
5 AC_CONFIG_HEADERS([config.h])
6
7 AC_CONFIG_FILES([Makefile])
8 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
9 AC_DEFUN([LIB_ARG_WITH], [
10         AC_ARG_WITH($1-headers, [AS_HELP_STRING(--with-$1-headers=dir,
11                 [look for $1 headers in dir])])
12         AC_ARG_WITH($1-libs, [AS_HELP_STRING(--with-$1-libs=dir,
13                 [look for $1 libraries in dir])])
14         if test -n "$with_$1_headers"; then
15                 $1_cppflags="-I$with_$1_headers"
16                 CPPFLAGS="$CPPFLAGS $$1_cppflags"
17         fi
18         if test -n "$with_$1_libs"; then
19                 $1_ldflags="-L$with_$1_libs $2"
20         else
21                 $1_ldflags="$2"
22         fi
23         LDFLAGS="$LDFLAGS $$1_ldflags"
24 ])
25
26 AC_DEFUN([STASH_FLAGS], [
27         OLD_CPPFLAGS="$CPPFLAGS"
28         OLD_LDFLAGS="$LDFLAGS"
29         OLD_LIBS="$LIBS"
30 ])
31
32 AC_DEFUN([UNSTASH_FLAGS], [
33         CPPFLAGS="$OLD_CPPFLAGS"
34         LDFLAGS="$OLD_LDFLAGS"
35         LIBS="$OLD_LIBS"
36 ])
37 AC_DEFUN([LIB_SUBST_FLAGS], [
38         if test "$HAVE_[]m4_toupper([$1])" = 'yes'; then
39                 AC_DEFINE(HAVE_[]m4_toupper([$1]), 1,
40                         define to 1 to turn on $1 support)
41         else
42                 $1_cppflags=
43                 $1_ldflags=
44         fi
45         AC_SUBST(HAVE_[]m4_toupper([$1]))
46         AC_SUBST($1_cppflags)
47         AC_SUBST($1_ldflags)
48 ])
49
50 AC_USE_SYSTEM_EXTENSIONS
51 AC_C_BIGENDIAN()
52
53 AC_PATH_PROG([BISON], [bison])
54 AC_PATH_PROG([FLEX], [flex])
55
56 AC_PATH_PROG([M4], [m4])
57 test -z "$M4" && AC_MSG_ERROR(
58         [The m4 macro processor is required to build this package])
59
60 AC_PROG_CC
61 AC_PROG_CPP
62
63 executables="recv filter audioc write afh play"
64 ########################################################################### osl
65 STASH_FLAGS
66 LIB_ARG_WITH([osl], [-losl])
67 HAVE_OSL=yes
68 AC_CHECK_HEADER(osl.h, [], [HAVE_OSL=no])
69 AC_CHECK_LIB([osl], [osl_open_table], [], [HAVE_OSL=no])
70 LIB_SUBST_FLAGS(osl)
71 UNSTASH_FLAGS
72 ######################################################################## lopsub
73 HAVE_LOPSUB=yes
74 AC_PATH_PROG([LOPSUBGEN], [lopsubgen])
75 test -z "$LOPSUBGEN" && HAVE_LOPSUB=no
76 STASH_FLAGS
77 LIB_ARG_WITH([lopsub], [-llopsub])
78 AC_CHECK_HEADER(lopsub.h, [], [HAVE_LOPSUB=no])
79 AC_CHECK_LIB([lopsub], [lls_merge], [], [HAVE_LOPSUB=no])
80 if test $HAVE_LOPSUB = no; then AC_MSG_ERROR([
81         The lopsub library is required to build this software, but
82         the above checks indicate it is not installed on your system.
83         Run the following command to download a copy.
84                 git clone git://git.tuebingen.mpg.de/lopsub.git
85         Install the library, then run this configure script again.
86 ])
87 fi
88 LIB_SUBST_FLAGS([lopsub])
89 UNSTASH_FLAGS
90 ######################################################################## openssl
91 STASH_FLAGS
92 HAVE_OPENSSL=yes
93 LIB_ARG_WITH([openssl], [-lssl -lcrypto])
94 AC_CHECK_HEADER(openssl/ssl.h, [], [HAVE_OPENSSL=no])
95 AC_CHECK_LIB([crypto], [RAND_bytes], [], [HAVE_OPENSSL=no])
96 LIB_SUBST_FLAGS(openssl)
97 if test $HAVE_OPENSSL = yes; then
98         AC_CHECK_LIB([crypto], [RSA_set0_key],
99                 AC_DEFINE([HAVE_RSA_SET0_KEY], [1], [openssl-1.1]))
100 fi
101 UNSTASH_FLAGS
102 ######################################################################### gcrypt
103 STASH_FLAGS
104 HAVE_GCRYPT=yes
105 LIB_ARG_WITH([gcrypt], [-lgcrypt])
106 AC_CHECK_HEADER(gcrypt.h, [], [HAVE_GCRYPT=no])
107 AC_CHECK_LIB([gcrypt], [gcry_randomize], [], [HAVE_GCRYPT=no])
108 LIB_SUBST_FLAGS(gcrypt)
109 UNSTASH_FLAGS
110 ######################################################################### crypto
111 AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
112         Force using crypto library "lib". This package requires either
113         openssl or libgcrypt being installed. Possible values for "lib"
114         are thus "openssl" and "gcrypt". If this option is not given,
115         openssl is tried first. If openssl was not found, gcrypt is
116         tried next.])])
117
118 CRYPTOLIB="$enable_cryptolib"
119 case "$enable_cryptolib" in
120 "openssl")
121         test $HAVE_OPENSSL = no && AC_MSG_ERROR(openssl not found)
122         crypto_ldflags="$openssl_ldflags"
123         ;;
124 "gcrypt")
125         test $HAVE_GCRYPT = no && AC_MSG_ERROR(gcrypt not found)
126         crypto_ldflags="$gcrypt_ldflags"
127         ;;
128 "")
129         crypto_ldflags=
130         if test $HAVE_GCRYPT = yes; then
131                 CRYPTOLIB=gcrypt
132                 crypto_ldflags="$gcrypt_ldflags"
133         fi
134         if test $HAVE_OPENSSL = yes; then
135                 CRYPTOLIB=openssl
136                 crypto_ldflags="$openssl_ldflags"
137         fi
138         ;;
139 *)
140         AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib])
141         ;;
142 esac
143 AC_SUBST(crypto_ldflags)
144 ########################################################################## iconv
145 STASH_FLAGS
146 LIBS=
147 AC_SEARCH_LIBS([libiconv_open], [iconv],
148         [iconv_ldflags="$LIBS"],
149         []
150 )
151 AC_SUBST(iconv_ldflags)
152 AC_MSG_CHECKING([whether iconv needs const char ** cast])
153 AC_COMPILE_IFELSE([
154         AC_LANG_PROGRAM([
155                 #include <iconv.h>
156         ],[
157                 size_t iconv(iconv_t cd, const char **inbuf,
158                         size_t *inbytesleft, char **outbuf,
159                         size_t *outbytesleft);
160         ])
161 ],
162         [cast='(const char **)'; msg=yes],
163         [cast=; msg=no]
164 )
165 AC_DEFINE_UNQUOTED(ICONV_CAST, $cast, [cast for second arg to iconv()])
166 AC_MSG_RESULT($msg)
167 UNSTASH_FLAGS
168 ########################################################################### ucred
169 AC_CHECK_TYPE([struct ucred], [
170         AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
171 ], [], [
172         #include <sys/types.h>
173         #include <sys/socket.h>
174 ])
175 ################################################################### FNM_EXTMATCH
176 AC_MSG_CHECKING(for extended wildcard pattern matching)
177 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
178         #include <fnmatch.h>
179 ]], [[
180         unsigned n = FNM_EXTMATCH;
181 ]])], [have_fnm_extmatch=yes], [have_fnm_extmatch=no])
182 AC_MSG_RESULT($have_fnm_extmatch)
183 if test $have_fnm_extmatch = yes; then
184         AC_DEFINE(HAVE_FNM_EXTMATCH, 1, define to 1 if FNM_EXTMATCH is defined)
185 fi
186 ########################################################################### curses
187 STASH_FLAGS
188 LIB_ARG_WITH([curses], [])
189 HAVE_CURSES=yes
190 AC_CHECK_HEADER(curses.h, [], [HAVE_CURSES=no])
191 AC_SEARCH_LIBS([initscr], [ncursesw curses], [], [HAVE_CURSES=no])
192 curses_ldflags="$curses_ldflags $LIBS"
193 LIB_SUBST_FLAGS(curses)
194 UNSTASH_FLAGS
195 ########################################################################### ip_mreqn
196 AC_CHECK_TYPE([struct ip_mreqn], [
197         AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 if you have struct ip_mreqn)
198 ], [], [
199         #include <netdb.h>
200         #include <net/if.h>
201 ])
202 ########################################################################### ogg
203 STASH_FLAGS
204 LIB_ARG_WITH([ogg], [-logg])
205 HAVE_OGG=yes
206 AC_CHECK_HEADERS([ogg/ogg.h], [], [HAVE_OGG=no])
207 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [HAVE_OGG=no])
208 AC_CHECK_LIB([ogg], [ogg_stream_flush_fill], [
209         AC_DEFINE(HAVE_OGG_STREAM_FLUSH_FILL, 1, [libogg >= 1.3.0])])
210 LIB_SUBST_FLAGS(ogg)
211 UNSTASH_FLAGS
212 ######################################################################### vorbis
213 STASH_FLAGS
214 LIB_ARG_WITH([vorbis], [-lvorbis -lvorbisfile])
215 HAVE_VORBIS=yes
216 AC_CHECK_HEADERS([vorbis/codec.h], [], [HAVE_VORBIS=no])
217 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [HAVE_VORBIS=no])
218 LIB_SUBST_FLAGS(vorbis)
219 UNSTASH_FLAGS
220 ######################################################################### speex
221 STASH_FLAGS
222 LIB_ARG_WITH([speex], [-lspeex])
223 HAVE_SPEEX=yes
224 AC_CHECK_HEADERS([speex/speex.h], [], [HAVE_SPEEX=no])
225 AC_CHECK_LIB([speex], [speex_decoder_init], [], [HAVE_SPEEX=no])
226 LIB_SUBST_FLAGS(speex)
227 UNSTASH_FLAGS
228 ######################################################################### opus
229 STASH_FLAGS
230 LIB_ARG_WITH([opus], [-lopus])
231 HAVE_OPUS=yes
232 AC_CHECK_HEADERS([opus/opus.h], [], [HAVE_OPUS=no])
233 AC_CHECK_LIB([opus], [opus_multistream_decode], [], [HAVE_OPUS=no])
234 LIB_SUBST_FLAGS(opus)
235 UNSTASH_FLAGS
236 ########################################################################### flac
237 STASH_FLAGS
238 LIB_ARG_WITH([flac], [-lFLAC -lm])
239 HAVE_FLAC=yes
240 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], HAVE_FLAC=no)
241 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], HAVE_FLAC=no)
242 LIB_SUBST_FLAGS(flac)
243 UNSTASH_FLAGS
244
245 # some helper functions for codecs which use the ogg container format
246 AC_DEFUN([NEED_OGG_OBJECTS], [{
247         test "$HAVE_OGG" = 'yes' -a \( \
248                  "$HAVE_VORBIS" = 'yes' \
249                 -o "$HAVE_SPEEX" = 'yes' \
250                 -o "$HAVE_OPUS" = 'yes' \
251                 -o "$HAVE_FLAC" = 'yes' \
252         \)
253 }])
254 AC_DEFUN([NEED_VORBIS_OBJECTS], [{
255         test "$HAVE_OGG" = 'yes' -a "$HAVE_VORBIS" = 'yes'
256 }])
257 AC_DEFUN([NEED_SPEEX_OBJECTS], [{
258         test "$HAVE_OGG" = 'yes' -a "$HAVE_SPEEX" = 'yes'
259 }])
260 AC_DEFUN([NEED_OPUS_OBJECTS], [{
261         test "$HAVE_OGG" = 'yes' -a "$HAVE_OPUS" = 'yes'
262 }])
263 AC_DEFUN([NEED_FLAC_OBJECTS], [{
264         test "$HAVE_OGG" = 'yes' -a "$HAVE_FLAC" = 'yes'
265 }])
266 ########################################################################### faad
267 STASH_FLAGS
268 LIB_ARG_WITH([faad], [-lfaad -lmp4ff])
269 HAVE_FAAD=yes
270 AC_CHECK_HEADER(neaacdec.h, [], HAVE_FAAD=no)
271 AC_CHECK_HEADER(mp4ff.h, [], HAVE_FAAD=no)
272 AC_CHECK_LIB([faad], [NeAACDecOpen], [], HAVE_FAAD=no)
273 AC_CHECK_LIB([mp4ff], [mp4ff_meta_get_artist], [], HAVE_FAAD=no)
274 LIB_SUBST_FLAGS(faad)
275 UNSTASH_FLAGS
276 ########################################################################### mad
277 STASH_FLAGS
278 LIB_ARG_WITH([mad], [-lmad])
279 HAVE_MAD=yes
280 AC_CHECK_HEADER(mad.h, [], HAVE_MAD=no)
281 AC_CHECK_LIB([mad], [mad_stream_init], [], HAVE_MAD=no)
282 LIB_SUBST_FLAGS(mad)
283 UNSTASH_FLAGS
284 ###################################################################### libid3tag
285 STASH_FLAGS
286 LIB_ARG_WITH([id3tag], [-lid3tag -lz])
287 HAVE_ID3TAG=yes
288 AC_CHECK_HEADER(id3tag.h, [], HAVE_ID3TAG=no)
289 AC_CHECK_LIB([id3tag], [id3_file_fdopen], [], HAVE_ID3TAG=no)
290 LIB_SUBST_FLAGS(id3tag)
291 UNSTASH_FLAGS
292 ########################################################################### oss
293 STASH_FLAGS
294 LIB_ARG_WITH([oss], [])
295 AC_CHECK_HEADER(sys/soundcard.h, [HAVE_OSS=yes], [HAVE_OSS=no])
296 AC_CHECK_LIB(ossaudio, _oss_ioctl, [oss_ldflags="$oss_ldflags -lossaudio"], [])
297 LIB_SUBST_FLAGS(oss)
298 UNSTASH_FLAGS
299 ########################################################################### alsa
300 STASH_FLAGS
301 LIB_ARG_WITH([alsa], [-lasound])
302 HAVE_ALSA=yes
303 AC_CHECK_HEADER(alsa/asoundlib.h, [], HAVE_ALSA=no)
304 AC_CHECK_LIB([asound], [snd_pcm_open], [], HAVE_ALSA=no)
305 LIB_SUBST_FLAGS(alsa)
306 UNSTASH_FLAGS
307 ######################################################################### pthread
308 STASH_FLAGS
309 LIB_ARG_WITH([pthread], [-lpthread])
310 HAVE_PTHREAD=yes
311 AC_CHECK_HEADER(pthread.h, [], HAVE_PTHREAD=no)
312 AC_CHECK_LIB([pthread], [pthread_create], [], HAVE_PTHREAD=no)
313 LIB_SUBST_FLAGS(pthread)
314 UNSTASH_FLAGS
315 ########################################################################### libao
316 STASH_FLAGS
317 LIB_ARG_WITH([ao], [-lao])
318 HAVE_AO=yes
319 AC_CHECK_HEADER(ao/ao.h, [], HAVE_AO=no)
320 AC_CHECK_LIB([ao], [ao_initialize], [], HAVE_AO=no)
321 LIB_SUBST_FLAGS(ao)
322 UNSTASH_FLAGS
323 AC_DEFUN([NEED_AO_OBJECTS], [{ test $HAVE_AO = yes -a $HAVE_PTHREAD = yes; }])
324 ######################################################################## readline
325 STASH_FLAGS
326 AC_SEARCH_LIBS([tgetent], [tinfo curses terminfo termcap])
327 LIB_ARG_WITH([readline], [-lreadline $LIBS])
328 HAVE_READLINE=yes
329 AC_CHECK_HEADER([readline/readline.h], [], [HAVE_READLINE=no])
330 AC_CHECK_LIB([readline], [rl_free_keymap], [], HAVE_READLINE=no)
331 AC_CHECK_DECL(
332         [rl_free_keymap],
333         [AC_DEFINE(RL_FREE_KEYMAP_DECLARED, 1, readline >= 6.3)],
334         [],
335         [
336                 #include <stdio.h>
337                 #include <readline/readline.h>
338         ]
339 )
340 LIB_SUBST_FLAGS(readline)
341 UNSTASH_FLAGS
342 ############################################################# libsamplerate
343 STASH_FLAGS
344 LIB_ARG_WITH([samplerate], [-lsamplerate])
345 HAVE_SAMPLERATE=yes
346 AC_CHECK_HEADER(samplerate.h, [], HAVE_SAMPLERATE=no)
347 AC_CHECK_LIB([samplerate], [src_process], [], HAVE_SAMPLERATE=no)
348 LIB_SUBST_FLAGS(samplerate)
349 UNSTASH_FLAGS
350 ######################################################################### server
351 if test -n "$CRYPTOLIB" && test $HAVE_OSL = yes && test -n "$BISON" && \
352                 test -n "$FLEX"; then
353         build_server="yes"
354         executables="$executables server"
355         server_errlist_objs="
356                 server
357                 afh_common
358                 mp3_afh
359                 vss
360                 command
361                 net
362                 string
363                 signal
364                 time
365                 daemon
366                 http_send
367                 close_on_fork
368                 mm
369                 crypt_common
370                 base64
371                 ipc
372                 dccp_send
373                 fd
374                 user_list
375                 chunk_queue
376                 afs
377                 aft
378                 mood
379                 mp
380                 score
381                 attribute
382                 blob
383                 playlist
384                 sched
385                 acl
386                 send_common
387                 udp_send
388                 color
389                 fec
390                 wma_afh
391                 wma_common
392                 sideband
393                 version
394         "
395         if test "$CRYPTOLIB" = openssl; then
396                 server_errlist_objs="$server_errlist_objs crypt"
397         else
398                 server_errlist_objs="$server_errlist_objs gcrypt"
399         fi
400         NEED_OGG_OBJECTS() && server_errlist_objs="$server_errlist_objs ogg_afh_common"
401         NEED_VORBIS_OBJECTS() && server_errlist_objs="$server_errlist_objs ogg_afh"
402         NEED_SPEEX_OBJECTS() && server_errlist_objs="$server_errlist_objs spx_afh spx_common"
403         NEED_OPUS_OBJECTS() && server_errlist_objs="$server_errlist_objs opus_afh opus_common"
404         NEED_FLAC_OBJECTS && server_errlist_objs="$server_errlist_objs flac_afh"
405         if test $HAVE_FAAD = yes; then
406                 server_errlist_objs="$server_errlist_objs aac_afh"
407         fi
408         server_objs="$server_errlist_objs"
409         AC_SUBST(server_objs, add_dot_o($server_objs))
410 else
411         build_server="no"
412 fi
413 ############################################################# client
414 if test -n "$CRYPTOLIB"; then
415         build_client="yes"
416         executables="$executables client"
417         client_errlist_objs="
418                 client
419                 net
420                 string
421                 fd
422                 sched
423                 stdin
424                 stdout
425                 time
426                 sideband
427                 client_common
428                 buffer_tree
429                 crypt_common
430                 base64
431                 version
432         "
433         if test "$CRYPTOLIB" = openssl; then
434                 client_errlist_objs="$client_errlist_objs crypt"
435         else
436                 client_errlist_objs="$client_errlist_objs gcrypt"
437         fi
438         if test $HAVE_READLINE = yes; then
439                 client_errlist_objs="$client_errlist_objs interactive"
440         fi
441         client_objs="$client_errlist_objs"
442         AC_SUBST(client_objs, add_dot_o($client_errlist_objs))
443 else
444         build_client="no"
445 fi
446 ############################################################# audiod
447 if test -n "$CRYPTOLIB"; then
448         build_audiod="yes"
449         executables="$executables audiod"
450         audiod_audio_formats="wma"
451         audiod_errlist_objs="$audiod_errlist_objs
452                 audiod
453                 signal
454                 string
455                 daemon
456                 stat
457                 net
458                 crypt_common
459                 base64
460                 sideband
461                 time
462                 grab_client
463                 filter_common
464                 wav_filter
465                 compress_filter
466                 amp_filter
467                 http_recv
468                 dccp_recv
469                 recv_common
470                 fd
471                 sched
472                 write_common
473                 file_write
474                 audiod_command
475                 fecdec_filter
476                 client_common
477                 udp_recv
478                 color
479                 fec
480                 prebuffer_filter
481                 version
482                 bitstream
483                 imdct
484                 wma_common
485                 wmadec_filter
486                 buffer_tree
487                 sync_filter
488         "
489         if test "$CRYPTOLIB" = openssl; then
490                 audiod_errlist_objs="$audiod_errlist_objs crypt"
491         else
492                 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
493         fi
494         NEED_VORBIS_OBJECTS && {
495                 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
496                 audiod_audio_formats="$audiod_audio_formats ogg"
497         }
498         NEED_SPEEX_OBJECTS && {
499                 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
500                 audiod_audio_formats="$audiod_audio_formats spx"
501         }
502         NEED_OPUS_OBJECTS && {
503                 audiod_errlist_objs="$audiod_errlist_objs opusdec_filter opus_common"
504                 audiod_audio_formats="$audiod_audio_formats opus"
505         }
506         NEED_FLAC_OBJECTS && {
507                 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
508                 audiod_audio_formats="$audiod_audio_formats flac"
509         }
510         if test $HAVE_FAAD = yes; then
511                 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter"
512                 audiod_audio_formats="$audiod_audio_formats aac"
513         fi
514         if test $HAVE_MAD = yes; then
515                 audiod_audio_formats="$audiod_audio_formats mp3"
516                 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
517         fi
518         if test $HAVE_OSS = yes; then
519                 audiod_errlist_objs="$audiod_errlist_objs oss_write"
520         fi
521         if test $HAVE_ALSA = yes; then
522                 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
523         fi
524         NEED_AO_OBJECTS && {
525                 audiod_errlist_objs="$audiod_errlist_objs ao_write"
526         }
527         if test $HAVE_SAMPLERATE = yes; then
528                 audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
529         fi
530         audiod_objs="$audiod_errlist_objs"
531         AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
532
533         enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
534         AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
535                 enum of audio formats supported by audiod)
536         names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
537         AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
538 else
539         build_audiod="no"
540 fi
541 ########################################################################### mixer
542 if test $HAVE_OSS = yes -o $HAVE_ALSA = yes; then
543         build_mixer="yes"
544         executables="$executables mixer"
545         mixer_errlist_objs="mixer exec string fd version"
546         if test $HAVE_OSS = yes; then
547                 mixer_errlist_objs="$mixer_errlist_objs oss_mix"
548         fi
549         if test $HAVE_ALSA = yes; then
550                 mixer_errlist_objs="$mixer_errlist_objs alsa_mix"
551         fi
552         mixer_objs="$mixer_errlist_objs"
553         AC_SUBST(mixer_objs, add_dot_o($mixer_objs))
554 else
555         build_mixer="no"
556         AC_MSG_WARN([no mixer support])
557 fi
558 ########################################################################### gui
559 if test $HAVE_CURSES = yes; then
560         build_gui="yes"
561         executables="$executables gui"
562         gui_errlist_objs="
563                 exec
564                 signal
565                 string
566                 stat
567                 ringbuffer
568                 fd
569                 gui
570                 gui_theme
571                 time
572                 sched
573                 version
574         "
575         gui_objs="$gui_errlist_objs"
576         AC_SUBST(gui_objs, add_dot_o($gui_objs))
577 else
578         build_gui="no"
579         AC_MSG_WARN([no curses lib, cannot build para_gui])
580 fi
581 ######################################################################## filter
582 filter_errlist_objs="
583         filter_common
584         wav_filter
585         compress_filter
586         filter
587         string
588         stdin
589         stdout
590         sched
591         fd
592         amp_filter
593         fecdec_filter
594         fec
595         version
596         prebuffer_filter
597         time
598         bitstream
599         imdct
600         wma_common
601         wmadec_filter
602         buffer_tree
603         net
604         sync_filter
605 "
606 NEED_VORBIS_OBJECTS && filter_errlist_objs="$filter_errlist_objs oggdec_filter"
607 NEED_SPEEX_OBJECTS && filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
608 NEED_OPUS_OBJECTS && filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
609 NEED_FLAC_OBJECTS && filter_errlist_objs="$filter_errlist_objs flacdec_filter"
610 if test $HAVE_FAAD = yes; then
611         filter_errlist_objs="$filter_errlist_objs aacdec_filter"
612 fi
613 if test $HAVE_MAD = yes; then
614         filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
615 fi
616 if test $HAVE_SAMPLERATE = yes; then
617         filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
618 fi
619 filter_objs="$filter_errlist_objs"
620
621 AC_SUBST(filter_objs, add_dot_o($filter_objs))
622 ########################################################################## recv
623 recv_errlist_objs="
624         http_recv
625         recv_common
626         recv
627         time
628         string
629         net
630         dccp_recv
631         fd
632         sched
633         stdout
634         udp_recv
635         buffer_tree
636         afh_recv
637         afh_common
638         wma_afh
639         wma_common
640         mp3_afh
641         version
642 "
643 NEED_OGG_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
644 NEED_VORBIS_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh"
645 NEED_SPEEX_OBJECTS && recv_errlist_objs="$recv_errlist_objs spx_afh spx_common"
646 NEED_OPUS_OBJECTS && recv_errlist_objs="$recv_errlist_objs opus_afh opus_common"
647 NEED_FLAC_OBJECTS && recv_errlist_objs="$recv_errlist_objs flac_afh"
648
649 if test $HAVE_FAAD = yes; then
650         recv_errlist_objs="$recv_errlist_objs aac_afh"
651 fi
652 recv_objs="$recv_errlist_objs"
653 AC_SUBST(recv_objs, add_dot_o($recv_objs))
654 ########################################################################### afh
655 audio_format_handlers="mp3 wma"
656 afh_errlist_objs="
657         afh
658         string
659         fd
660         mp3_afh
661         afh_common
662         time
663         wma_afh
664         wma_common
665         version
666 "
667 NEED_OGG_OBJECTS && afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
668 NEED_VORBIS_OBJECTS && {
669         afh_errlist_objs="$afh_errlist_objs ogg_afh"
670         audio_format_handlers="$audio_format_handlers ogg"
671 }
672 NEED_SPEEX_OBJECTS && {
673         afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
674         audio_format_handlers="$audio_format_handlers spx"
675 }
676 NEED_OPUS_OBJECTS && {
677         afh_errlist_objs="$afh_errlist_objs opus_afh opus_common"
678         audio_format_handlers="$audio_format_handlers opus"
679 }
680 NEED_FLAC_OBJECTS && {
681         afh_errlist_objs="$afh_errlist_objs flac_afh"
682         audio_format_handlers="$audio_format_handlers flac"
683 }
684 if test $HAVE_FAAD = yes; then
685         afh_errlist_objs="$afh_errlist_objs aac_afh"
686         audio_format_handlers="$audio_format_handlers aac"
687 fi
688
689 afh_objs="$afh_errlist_objs"
690
691 AC_SUBST(afh_objs, add_dot_o($afh_objs))
692 ########################################################################## play
693 play_errlist_objs="
694         play
695         fd
696         sched
697         buffer_tree
698         time
699         string
700         net
701         afh_recv
702         afh_common
703         wma_afh
704         wma_common
705         mp3_afh
706         recv_common
707         udp_recv
708         http_recv
709         dccp_recv
710         filter_common
711         fec
712         bitstream
713         imdct
714         wav_filter
715         compress_filter
716         amp_filter
717         prebuffer_filter
718         fecdec_filter
719         wmadec_filter
720         write_common
721         file_write
722         version
723         sync_filter
724 "
725 NEED_OGG_OBJECTS && play_errlist_objs="$play_errlist_objs ogg_afh_common"
726 NEED_VORBIS_OBJECTS && {
727         play_errlist_objs="$play_errlist_objs oggdec_filter ogg_afh"
728 }
729 NEED_SPEEX_OBJECTS && {
730         play_errlist_objs="$play_errlist_objs spxdec_filter spx_afh spx_common"
731 }
732 NEED_OPUS_OBJECTS &&
733         play_errlist_objs="$play_errlist_objs
734                 opusdec_filter
735                 opus_afh
736                 opus_common
737         "
738 NEED_FLAC_OBJECTS && {
739         play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
740 }
741 if test $HAVE_FAAD = yes; then
742         play_errlist_objs="$play_errlist_objs aac_afh aacdec_filter"
743 fi
744 if test $HAVE_MAD = yes; then
745         play_errlist_objs="$play_errlist_objs mp3dec_filter"
746 fi
747 if test $HAVE_OSS = yes; then
748         play_errlist_objs="$play_errlist_objs oss_write"
749 fi
750 if test $HAVE_ALSA = yes; then
751         play_errlist_objs="$play_errlist_objs alsa_write"
752 fi
753 NEED_AO_OBJECTS && {
754         play_errlist_objs="$play_errlist_objs ao_write"
755 }
756 if test $HAVE_READLINE = yes; then
757         play_errlist_objs="$play_errlist_objs interactive"
758 fi
759 if test $HAVE_SAMPLERATE = yes; then
760         play_errlist_objs="$play_errlist_objs resample_filter check_wav"
761 fi
762
763 play_objs="$play_errlist_objs"
764 AC_SUBST(play_objs, add_dot_o($play_objs))
765 ######################################################################### write
766 write_errlist_objs="
767         write
768         write_common
769         file_write
770         time
771         fd
772         string
773         sched
774         stdin
775         buffer_tree
776         check_wav
777         version
778 "
779
780 NEED_AO_OBJECTS && {
781         write_errlist_objs="$write_errlist_objs ao_write"
782 }
783 if test $HAVE_OSS = yes; then
784         write_errlist_objs="$write_errlist_objs oss_write"
785 fi
786 if test $HAVE_ALSA = yes; then
787         write_errlist_objs="$write_errlist_objs alsa_write"
788 fi
789 write_objs="$write_errlist_objs"
790 AC_SUBST(write_objs, add_dot_o($write_objs))
791 ######################################################################## audioc
792 audioc_errlist_objs="
793         audioc
794         string
795         net
796         fd
797         version
798 "
799 if test $HAVE_READLINE = yes; then
800         audioc_errlist_objs="$audioc_errlist_objs
801                 buffer_tree
802                 interactive
803                 sched
804                 time
805         "
806 fi
807 audioc_objs="$audioc_errlist_objs"
808 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
809
810 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
811         [formats supported by para_server and para_afh])
812 AC_SUBST(executables)
813
814 AC_OUTPUT
815 AC_MSG_NOTICE([
816 paraslash configuration:
817 ~~~~~~~~~~~~~~~~~~~~~~~~
818 crypto lib: ${CRYPTOLIB:-[none]}
819 unix socket credentials: $have_ucred
820 readline (interactive CLIs): $HAVE_READLINE
821 id3 version 2 support: $HAVE_ID3TAG
822 faad: $HAVE_FAAD
823 audio format handlers: $audio_format_handlers
824
825 para_server: $build_server
826 para_gui: $build_gui
827 para_mixer: $build_mixer
828 para_client: $build_client
829 para_audiod: $build_audiod
830 ])