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