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