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