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