]> git.tuebingen.mpg.de Git - paraslash.git/blob - configure.ac
Remove gengetopt and help2man checks from configure.ac.
[paraslash.git] / configure.ac
1 AC_PREREQ([2.61])
2
3 AC_INIT([paraslash], [m4_esyscmd_s(./GIT-VERSION-GEN)],
4         [maan@tuebingen.mpg.de], [], [http://people.tuebingen.mpg.de/maan/paraslash/])
5 AC_CONFIG_HEADERS([config.h])
6
7 AC_CONFIG_FILES([Makefile])
8 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
9 AC_DEFUN([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 ########################################################################### fade
584 if test $HAVE_OSS = yes -o $HAVE_ALSA = yes; then
585         build_fade="yes"
586         executables="$executables fade"
587         fade_errlist_objs="fade exec string fd version"
588         if test $HAVE_OSS = yes; then
589                 fade_errlist_objs="$fade_errlist_objs oss_mix"
590                 mixers="${mixers}oss "
591                 default_mixer="OSS_MIX"
592         fi
593         if test $HAVE_ALSA = yes; then
594                 fade_errlist_objs="$fade_errlist_objs alsa_mix"
595                 mixers="${mixers}alsa "
596                 default_mixer="ALSA_MIX"
597         fi
598         fade_objs="$fade_errlist_objs"
599         AC_SUBST(fade_objs, add_dot_o($fade_objs))
600         enum="$(
601                 for i in $mixers; do
602                         printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
603                 done
604         )"
605         AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
606                 enum of supported mixers)
607         AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
608                 use this mixer if none was specified)
609         names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
610         AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
611         inits="$(
612                 for i in $mixers; do
613                         printf 'extern void '$i'_mix_init(struct mixer *); '
614                 done
615         )"
616         AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
617                 init functions of the supported mixers)
618         array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
619         AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
620 else
621         build_fade="no"
622         AC_MSG_WARN([no mixer support])
623 fi
624 ########################################################################### gui
625 if test $HAVE_CURSES = yes; then
626         build_gui="yes"
627         executables="$executables gui"
628         gui_errlist_objs="
629                 exec
630                 signal
631                 string
632                 stat
633                 ringbuffer
634                 fd
635                 gui
636                 gui_theme
637                 time
638                 sched
639                 version
640         "
641         gui_objs="$gui_errlist_objs"
642         AC_SUBST(gui_objs, add_dot_o($gui_objs))
643 else
644         build_gui="no"
645         AC_MSG_WARN([no curses lib, cannot build para_gui])
646 fi
647 ######################################################################## filter
648 filter_errlist_objs="
649         filter_common
650         wav_filter
651         compress_filter
652         filter
653         string
654         stdin
655         stdout
656         sched
657         fd
658         amp_filter
659         fecdec_filter
660         fec
661         version
662         prebuffer_filter
663         time
664         bitstream
665         imdct
666         wma_common
667         wmadec_filter
668         buffer_tree
669         net
670         sync_filter
671 "
672 NEED_VORBIS_OBJECTS && filter_errlist_objs="$filter_errlist_objs oggdec_filter"
673 NEED_SPEEX_OBJECTS && filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
674 NEED_OPUS_OBJECTS && filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
675 NEED_FLAC_OBJECTS && filter_errlist_objs="$filter_errlist_objs flacdec_filter"
676 if test $HAVE_FAAD = yes; then
677         filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
678 fi
679 if test $HAVE_MAD = yes; then
680         filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
681 fi
682 if test $HAVE_SAMPLERATE = yes; then
683         filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
684 fi
685 filter_objs="$filter_errlist_objs"
686
687 AC_SUBST(filter_objs, add_dot_o($filter_objs))
688 ########################################################################## recv
689 recv_errlist_objs="
690         http_recv
691         recv_common
692         recv
693         time
694         string
695         net
696         dccp_recv
697         fd
698         sched
699         stdout
700         udp_recv
701         buffer_tree
702         afh_recv
703         afh_common
704         wma_afh
705         wma_common
706         mp3_afh
707         version
708 "
709 NEED_OGG_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
710 NEED_VORBIS_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh"
711 NEED_SPEEX_OBJECTS && recv_errlist_objs="$recv_errlist_objs spx_afh spx_common"
712 NEED_OPUS_OBJECTS && recv_errlist_objs="$recv_errlist_objs opus_afh opus_common"
713 NEED_FLAC_OBJECTS && recv_errlist_objs="$recv_errlist_objs flac_afh"
714
715 if test $HAVE_FAAD = yes -a $HAVE_MP4V2 = yes; then
716         recv_errlist_objs="$recv_errlist_objs aac_afh aac_common"
717 fi
718 recv_objs="$recv_errlist_objs"
719 AC_SUBST(recv_objs, add_dot_o($recv_objs))
720 ########################################################################### afh
721 audio_format_handlers="mp3 wma"
722 afh_errlist_objs="
723         afh
724         string
725         fd
726         mp3_afh
727         afh_common
728         time
729         wma_afh
730         wma_common
731         version
732 "
733 NEED_OGG_OBJECTS && afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
734 NEED_VORBIS_OBJECTS && {
735         afh_errlist_objs="$afh_errlist_objs ogg_afh"
736         audio_format_handlers="$audio_format_handlers ogg"
737 }
738 NEED_SPEEX_OBJECTS && {
739         afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
740         audio_format_handlers="$audio_format_handlers spx"
741 }
742 NEED_OPUS_OBJECTS && {
743         afh_errlist_objs="$afh_errlist_objs opus_afh opus_common"
744         audio_format_handlers="$audio_format_handlers opus"
745 }
746 NEED_FLAC_OBJECTS && {
747         afh_errlist_objs="$afh_errlist_objs flac_afh"
748         audio_format_handlers="$audio_format_handlers flac"
749 }
750 if test $HAVE_FAAD = yes -a $HAVE_MP4V2 = yes; then
751         afh_errlist_objs="$afh_errlist_objs aac_afh aac_common"
752         audio_format_handlers="$audio_format_handlers aac"
753 fi
754
755 afh_objs="$afh_errlist_objs"
756
757 AC_SUBST(afh_objs, add_dot_o($afh_objs))
758 ########################################################################## play
759 play_errlist_objs="
760         play
761         fd
762         sched
763         buffer_tree
764         time
765         string
766         net
767         afh_recv
768         afh_common
769         wma_afh
770         wma_common
771         mp3_afh
772         recv_common
773         udp_recv
774         http_recv
775         dccp_recv
776         filter_common
777         fec
778         bitstream
779         imdct
780         wav_filter
781         compress_filter
782         amp_filter
783         prebuffer_filter
784         fecdec_filter
785         wmadec_filter
786         write_common
787         file_write
788         version
789         sync_filter
790 "
791 if test "$have_core_audio" = "yes"; then
792         play_errlist_objs="$play_errlist_objs osx_write ipc"
793 fi
794 NEED_OGG_OBJECTS && play_errlist_objs="$play_errlist_objs ogg_afh_common"
795 NEED_VORBIS_OBJECTS && {
796         play_errlist_objs="$play_errlist_objs oggdec_filter ogg_afh"
797 }
798 NEED_SPEEX_OBJECTS && {
799         play_errlist_objs="$play_errlist_objs spxdec_filter spx_afh spx_common"
800 }
801 NEED_OPUS_OBJECTS &&
802         play_errlist_objs="$play_errlist_objs
803                 opusdec_filter
804                 opus_afh
805                 opus_common
806         "
807 NEED_FLAC_OBJECTS && {
808         play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
809 }
810 if test $HAVE_FAAD = yes; then
811         play_errlist_objs="$play_errlist_objs aacdec_filter"
812 fi
813 if test $HAVE_MP4V2 = yes; then
814         play_errlist_objs="$play_errlist_objs aac_afh"
815 fi
816 if test $HAVE_MP4V2 = yes || test $HAVE_FAAD = yes; then
817         play_errlist_objs="$play_errlist_objs aac_common"
818 fi
819 if test $HAVE_MAD = yes; then
820         play_errlist_objs="$play_errlist_objs mp3dec_filter"
821 fi
822 if test $HAVE_OSS = yes; then
823         play_errlist_objs="$play_errlist_objs oss_write"
824 fi
825 if test $HAVE_ALSA = yes; then
826         play_errlist_objs="$play_errlist_objs alsa_write"
827 fi
828 NEED_AO_OBJECTS && {
829         play_errlist_objs="$play_errlist_objs ao_write"
830 }
831 if test $HAVE_READLINE = yes; then
832         play_errlist_objs="$play_errlist_objs interactive"
833 fi
834 if test $HAVE_SAMPLERATE = yes; then
835         play_errlist_objs="$play_errlist_objs resample_filter check_wav"
836 fi
837
838 play_objs="$play_errlist_objs"
839 AC_SUBST(play_objs, add_dot_o($play_objs))
840 ######################################################################### write
841 write_errlist_objs="
842         write
843         write_common
844         file_write
845         time
846         fd
847         string
848         sched
849         stdin
850         buffer_tree
851         check_wav
852         version
853 "
854
855 if test "$have_core_audio" = "yes"; then
856         write_errlist_objs="$write_errlist_objs osx_write ipc"
857 fi
858 NEED_AO_OBJECTS && {
859         write_errlist_objs="$write_errlist_objs ao_write"
860 }
861 if test $HAVE_OSS = yes; then
862         write_errlist_objs="$write_errlist_objs oss_write"
863 fi
864 if test $HAVE_ALSA = yes; then
865         write_errlist_objs="$write_errlist_objs alsa_write"
866 fi
867 write_objs="$write_errlist_objs"
868 AC_SUBST(write_objs, add_dot_o($write_objs))
869 ######################################################################## audioc
870 audioc_errlist_objs="
871         audioc
872         string
873         net
874         fd
875         version
876 "
877 if test $HAVE_READLINE = yes; then
878         audioc_errlist_objs="$audioc_errlist_objs
879                 buffer_tree
880                 interactive
881                 sched
882                 time
883         "
884 fi
885 audioc_objs="$audioc_errlist_objs"
886 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
887 ################################################################## status items
888
889 status_items="basename status num_played mtime bitrate frequency file_size
890 status_flags format score techinfo afs_mode
891 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
892 offset seconds_total stream_start current_time audiod_uptime image_id
893 lyrics_id duration directory lyrics_name image_name path hash channels
894 last_played num_chunks chunk_time amplification artist title year album
895 comment"
896
897 result=
898 for i in $status_items; do
899         result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
900 done
901 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
902         [enum of all status items])
903
904 result=
905 for i in $status_items; do
906         result="$result \"$i\", "
907 done
908 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
909         [char * array of all status items])
910
911 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
912         [formats supported by para_server and para_afh])
913
914 AC_SUBST(executables)
915
916 AC_OUTPUT
917 AC_MSG_NOTICE([
918 paraslash configuration:
919 ~~~~~~~~~~~~~~~~~~~~~~~~
920 crypto lib: ${CRYPTOLIB:-[none]}
921 unix socket credentials: $have_ucred
922 readline (interactive CLIs): $HAVE_READLINE
923 id3 version 2 support: $HAVE_ID3TAG
924 faad: $HAVE_FAAD
925 mp4v2: $HAVE_MP4V2
926 audio format handlers: $audio_format_handlers
927
928 para_server: $build_server
929 para_gui: $build_gui
930 para_fade: $build_fade
931 para_client: $build_client
932 para_audiod: $build_audiod
933 ])