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