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