build: ldflags conversion: libgcrypt.
[paraslash.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ([2.61])
5
6 AC_INIT([paraslash],[git],[maan@systemlinux.org])
7 AC_CONFIG_HEADER([config.h])
8
9 AC_CONFIG_FILES([Makefile])
10 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
11 AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; done)])
12 AC_DEFUN([objlist_to_errlist],[$(for i in $@; do printf "DEFINE_ERRLIST($(echo $i| tr 'a-z' 'A-Z'));"; done) [const char **para_errlist[[]]] = {$(for i in $@; do printf "PARA_ERRLIST($(echo $i | tr 'a-z' 'A-Z')), "; done) }])
13 AC_PATH_PROG(UNAMEPATH, uname, no)
14 if test "$UNAMEPATH" = "no"; then
15 AC_MSG_ERROR(unable to determine system type)
16 fi
17 AC_MSG_CHECKING(os type)
18 OSTYPE="`$UNAMEPATH -s`"
19 AC_MSG_RESULT("$OSTYPE")
20
21 if test "$OSTYPE" = "SunOS"; then
22 # needed on SunOS for socket magic
23 arch_cppflags="-D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
24 AC_SUBST(arch_cppflags)
25 fi
26
27 AC_C_BIGENDIAN()
28
29 AC_PATH_PROG([gengetopt], [gengetopt])
30 test -z "$gengetopt" && AC_MSG_ERROR(
31 [gengetopt is required to build this package])
32
33 AC_PATH_PROG([help2man], [help2man])
34 test -z "$help2man" && AC_MSG_ERROR(
35 [help2man is required to build this package])
36
37 AC_PATH_PROG([install], [install])
38 test -z "$install" && AC_MSG_ERROR(
39 [The install program is required to build this package])
40
41 AC_PROG_CC
42 AC_PROG_CPP
43
44 AC_HEADER_DIRENT
45 AC_HEADER_STDC
46 AC_HEADER_SYS_WAIT
47 AC_HEADER_STDBOOL
48 AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h \
49 stdlib.h string.h sys/socket.h sys/time.h sys/timeb.h sys/un.h \
50 sys/ipc.h unistd.h utime.h stddef.h],
51 [], [AC_MSG_ERROR([$ac_header not found])])
52
53 # Checks for typedefs, structures, and compiler characteristics.
54 AC_C_CONST
55 AC_C_INLINE
56 AC_TYPE_OFF_T
57 AC_TYPE_PID_T
58 AC_TYPE_SIZE_T
59 AC_HEADER_TIME
60 AC_STRUCT_TM
61 AC_TYPE_INT8_T
62 AC_TYPE_INT16_T
63 AC_TYPE_INT32_T
64 AC_TYPE_INT64_T
65 AC_TYPE_MODE_T
66 AC_TYPE_SSIZE_T
67 AC_TYPE_UID_T
68 AC_TYPE_UINT8_T
69 AC_TYPE_UINT16_T
70 AC_TYPE_UINT32_T
71 AC_TYPE_UINT64_T
72
73 # Checks for library functions.
74 AC_FUNC_FORK
75 AC_PROG_GCC_TRADITIONAL
76 AC_FUNC_MEMCMP
77 AC_FUNC_MKTIME
78 AC_FUNC_MMAP
79 AC_FUNC_SELECT_ARGTYPES
80 AC_FUNC_STAT
81 AC_FUNC_STRFTIME
82 AC_FUNC_VPRINTF
83 AC_FUNC_CLOSEDIR_VOID
84 AC_FUNC_LSTAT
85
86 AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
87 regcomp select strchr strdup strerror strstr strtol uname \
88 fchdir gettimeofday localtime_r munmap strcasecmp strcspn \
89 strncasecmp strrchr strspn alarm mkdir inet_ntoa socket], [],
90 [AC_MSG_ERROR([function not found, cannot live without it])])
91
92 executables="recv filter audioc write afh play"
93 audio_format_handlers="mp3 wma"
94
95 recv_cmdline_objs="
96 recv
97 http_recv
98 dccp_recv
99 udp_recv
100 afh_recv
101 "
102
103 recv_errlist_objs="
104 http_recv
105 recv_common
106 recv
107 time
108 string
109 net
110 dccp_recv
111 fd
112 sched
113 stdout
114 ggo
115 udp_recv
116 buffer_tree
117 afh_recv
118 afh_common
119 wma_afh
120 wma_common
121 mp3_afh
122 version
123 "
124
125 recv_ldflags=""
126
127 filter_cmdline_objs="
128 filter
129 compress_filter
130 amp_filter
131 prebuffer_filter
132 "
133 filter_errlist_objs="
134 filter_common
135 wav_filter
136 compress_filter
137 filter
138 string
139 stdin
140 stdout
141 sched
142 fd
143 amp_filter
144 ggo
145 fecdec_filter
146 fec
147 version
148 prebuffer_filter
149 time
150 bitstream
151 imdct
152 wma_common
153 wmadec_filter
154 buffer_tree
155 "
156 filter_ldflags="-lm"
157 filters="
158 compress
159 wav
160 amp
161 fecdec
162 wmadec
163 prebuffer
164 "
165
166 audioc_cmdline_objs="audioc"
167 audioc_errlist_objs="
168 audioc
169 string
170 net
171 fd
172 version
173 ggo
174 "
175 audioc_ldflags=""
176
177 afh_cmdline_objs="afh"
178 afh_errlist_objs="
179 afh
180 string
181 fd
182 mp3_afh
183 afh_common
184 time
185 wma_afh
186 wma_common
187 version
188 ggo
189 "
190 afh_ldflags=""
191
192 write_cmdline_objs="
193 write
194 file_write
195 "
196 write_errlist_objs="
197 write
198 write_common
199 file_write
200 time
201 fd
202 string
203 sched
204 stdin
205 buffer_tree
206 ggo
207 check_wav
208 version
209 "
210 write_ldflags=""
211 writers="file"
212 default_writer="FILE_WRITE"
213
214 play_errlist_objs="
215 play
216 fd
217 sched
218 ggo
219 buffer_tree
220 time
221 string
222 net
223 afh_recv
224 afh_common
225 wma_afh
226 wma_common
227 mp3_afh
228 recv_common
229 udp_recv
230 http_recv
231 dccp_recv
232 filter_common
233 fec
234 bitstream
235 imdct
236 wav_filter
237 compress_filter
238 amp_filter
239 prebuffer_filter
240 fecdec_filter
241 wmadec_filter
242 write_common
243 file_write
244 version
245 "
246 play_cmdline_objs="
247 http_recv
248 dccp_recv
249 udp_recv
250 afh_recv
251 compress_filter
252 amp_filter
253 prebuffer_filter
254 file_write
255 play
256 "
257 play_ldflags="-lm"
258 ################################################################## clock_gettime
259 clock_gettime_lib=
260 AC_CHECK_LIB([c], [clock_gettime], [clock_gettime_lib=c], [
261 AC_CHECK_LIB([rt], [clock_gettime], [clock_gettime_lib=rt], [], [])
262 ])
263 if test -n "$clock_gettime_lib"; then
264 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [
265 define to 1 if clock_gettime() is supported])
266 fi
267 if test "$clock_gettime_lib" = "rt"; then
268 AC_SUBST(clock_gettime_ldflags, -lrt)
269 fi
270 ########################################################################### osl
271 have_osl=yes
272 OLD_CPPFLAGS="$CPPFLAGS"
273 OLD_LDFLAGS="$LDFLAGS"
274 OLD_LIBS="$LIBS"
275 AC_ARG_WITH(osl_headers, [AS_HELP_STRING(--with-osl-headers=dir,
276 [look for osl.h also in dir])])
277 if test -n "$with_osl_headers"; then
278 osl_cppflags="-I$with_osl_headers"
279 CPPFLAGS="$CPPFLAGS $osl_cppflags"
280 fi
281 AC_ARG_WITH(osl_libs, [AS_HELP_STRING(--with-osl-libs=dir,
282 [look for libosl also in dir])])
283 if test -n "$with_osl_libs"; then
284 osl_libs="-L$with_osl_libs"
285 LDFLAGS="$LDFLAGS $osl_libs"
286 fi
287
288 AC_CHECK_HEADER(osl.h, [], have_osl=no)
289 AC_CHECK_LIB([osl], [osl_open_table], [], have_osl=no)
290 if test "$have_osl" = "yes"; then
291 AC_SUBST(osl_cppflags)
292 osl_ldflags="$osl_libs -losl"
293 AC_SUBST(osl_ldflags)
294 else
295 AC_MSG_WARN([libosl not found, can not build para_server.
296 Download libosl at
297 http://systemlinux.org/~maan/osl
298 or execute
299 git clone git://git.tuebingen.mpg.de/osl
300 ])
301 fi
302 CPPFLAGS="$OLD_CPPFLAGS"
303 LDFLAGS="$OLD_LDFLAGS"
304 LIBS="$OLD_LIBS"
305 ########################################################################### crypto
306 AC_ARG_ENABLE(cryptolib, [AS_HELP_STRING(--enable-cryptolib=lib, [
307 Force using crypto library "lib". This package requires either
308 openssl or libgcrypt being installed. Possible values for "lib"
309 are thus "openssl" and "gcrypt". If this option is not given,
310 openssl is tried first. If openssl was not found, gcrypt is
311 tried next.])])
312
313 case "$enable_cryptolib" in
314 "openssl") check_openssl="yes"; check_gcrypt="no";;
315 "gcrypt") check_openssl="no"; check_gcrypt="yes";;
316 "") check_openssl="yes"; check_gcrypt="yes";;
317 *) AC_MSG_ERROR([invalid value "$enable_cryptolib" for --enable-cryptolib]);;
318 esac
319 ###################################################################### openssl
320 if test "$check_openssl" = "yes"; then
321 OLD_CPPFLAGS="$CPPFLAGS"
322 OLD_LDFLAGS="$LDFLAGS"
323 OLD_LIBS="$LIBS"
324 have_openssl="yes"
325 AC_ARG_WITH(openssl_headers, [AS_HELP_STRING(--with-openssl-headers=dir,
326 [look for openssl headers also in dir])])
327 if test -n "$with_openssl_headers"; then
328 openssl_cppflags="-I$with_openssl_headers"
329 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
330 fi
331 AC_ARG_WITH(openssl_libs, [AS_HELP_STRING(--with-openssl-libs=dir,
332 [look for openssl libraries also in dir])])
333 if test -n "$with_openssl_libs"; then
334 openssl_libs="-L$with_openssl_libs"
335 LDFLAGS="$LDFLAGS $openssl_libs"
336 fi
337 AC_CHECK_HEADER(openssl/ssl.h, [], [have_openssl="no"])
338 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
339 if test "$have_openssl" = "no" -a -z "$with_openssl_headers$with_openssl_libs"; then
340 # try harder: openssl is sometimes installed in /usr/local/ssl
341 openssl_cppflags="-I/usr/local/ssl/include"
342 CPPFLAGS="$CPPFLAGS $openssl_cppflags"
343 openssl_libs="-L/usr/local/ssl/lib"
344 LDFLAGS="$LDFLAGS $openssl_libs"
345 # clear cache
346 unset ac_cv_header_openssl_ssl_h 2> /dev/null
347 unset ac_cv_lib_crypto_RAND_bytes 2> /dev/null
348 AC_CHECK_HEADER(openssl/ssl.h, [have_openssl="yes"], [])
349 if test "$have_openssl" = "yes"; then
350 AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"])
351 fi
352 fi
353 if test "$have_openssl" = "yes"; then
354 AC_DEFINE(HAVE_OPENSSL, 1, [define to 1 to turn on openssl support])
355 AC_SUBST(openssl_cppflags)
356 openssl_ldflags="$openssl_libs -lssl -lcrypto"
357 AC_SUBST(openssl_ldflags)
358
359 server_errlist_objs="$server_errlist_objs crypt"
360 client_errlist_objs="$client_errlist_objs crypt"
361 audiod_errlist_objs="$audiod_errlist_objs crypt"
362
363 check_gcrypt="no"
364 else
365 AC_MSG_WARN([openssl libraries not found])
366 fi
367 CPPFLAGS="$OLD_CPPFLAGS"
368 LDFLAGS="$OLD_LDFLAGS"
369 LIBS="$OLD_LIBS"
370 else
371 have_openssl="no"
372 fi
373 ########################################################################### gcrypt
374 if test "$check_gcrypt" = "yes"; then
375 OLD_CPPFLAGS="$CPPFLAGS"
376 OLD_LDFLAGS="$LDFLAGS"
377 OLD_LIBS="$LIBS"
378 have_gcrypt="yes"
379 AC_ARG_WITH(gcrypt_headers, [AS_HELP_STRING(--with-gcrypt-headers=dir,
380 [look for gcrypt headers also in dir])])
381 if test -n "$with_gcrypt_headers"; then
382 gcrypt_cppflags="-I$with_gcrypt_headers"
383 CPPFLAGS="$CPPFLAGS $gcrypt_cppflags"
384 fi
385 AC_ARG_WITH(gcrypt_libs, [AS_HELP_STRING(--with-gcrypt-libs=dir,
386 [look for libgcrypt also in dir])])
387 if test -n "$with_gcrypt_libs"; then
388 gcrypt_libs="-L$with_gcrypt_libs"
389 LDFLAGS="$LDFLAGS $gcrypt_libs"
390 fi
391 AC_CHECK_HEADER(gcrypt.h, [], [have_gcrypt="no"])
392 AC_CHECK_LIB([gcrypt], [gcry_randomize], [], [have_gcrypt="no"])
393 if test "$have_gcrypt" = "yes"; then
394 AC_DEFINE(HAVE_GCRYPT, 1, [define to 1 to turn on gcrypt support])
395 AC_SUBST(gcrypt_cppflags)
396 gcrypt_ldflags="$gcrypt_libs -lgcrypt"
397 AC_SUBST(gcrypt_ldflags)
398
399 server_errlist_objs="$server_errlist_objs gcrypt"
400 client_errlist_objs="$client_errlist_objs gcrypt"
401 audiod_errlist_objs="$audiod_errlist_objs gcrypt"
402 else
403 AC_MSG_WARN([gcrypt library not found])
404 fi
405 CPPFLAGS="$OLD_CPPFLAGS"
406 LDFLAGS="$OLD_LDFLAGS"
407 LIBS="$OLD_LIBS"
408 else
409 have_gcrypt="no"
410 fi
411 ########################################################################### libsocket
412 AC_CHECK_LIB([c], [socket],
413 [socket_lib=],
414 [socket_lib="-lsocket"]
415 )
416 server_ldflags="$server_ldflags $socket_lib"
417 client_ldflags="$client_ldflags $socket_lib"
418 audioc_ldflags="$audioc_ldflags $socket_lib"
419 audiod_ldflags="$audiod_ldflags $socket_lib"
420 recv_ldflags="$recv_ldflags $socket_lib"
421 AC_SEARCH_LIBS([connect],[socket],[],[
422 AC_MSG_ERROR([Fatal: Did not find connect().])
423 ],[])
424 ########################################################################### libnsl
425 AC_CHECK_LIB([c], [gethostbyname],
426 [nsl_lib=],
427 [nsl_lib="-lnsl"]
428 )
429 server_ldflags="$server_ldflags $nsl_lib"
430 client_ldflags="$client_ldflags $nsl_lib"
431 audioc_ldflags="$audioc_ldflags $nsl_lib"
432 recv_ldflags="$recv_ldflags $nsl_lib"
433 AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
434 AC_MSG_ERROR([Fatal: Did not find inet_ntoa().])
435 ],[])
436 ########################################################################### ucred
437 AC_MSG_CHECKING(for struct ucred)
438 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
439 #define _GNU_SOURCE
440 #include <sys/types.h>
441 #include <sys/socket.h>
442 ]], [[
443 struct ucred sucred; sucred.pid=0;
444 ]])],[have_ucred=yes],[have_ucred=no])
445 AC_MSG_RESULT($have_ucred)
446 if test ${have_ucred} = yes; then
447 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
448 fi
449 ########################################################################### gengetopt
450 echo 'option "z" z "" flag off' | $gengetopt --file-name conftest-ggo &&
451 AC_CHECK_DECL(
452 [gengetopt_args_info_description],
453 [ggo_descriptions_declared=yes],
454 [ggo_descriptions_declared=no],
455 [#include "conftest-ggo.h"]
456 )
457 AC_SUBST(ggo_descriptions_declared)
458 ########################################################################### curses
459 have_curses="yes"
460 OLD_CPPFLAGS="$CPPFLAGS"
461 OLD_LDFLAGS="$LDFLAGS"
462 OLD_LIBS="$LIBS"
463 AC_ARG_WITH(curses_headers, [AS_HELP_STRING(--with-curses-headers=dir,
464 [look for curses.h also in dir])])
465 if test -n "$with_curses_headers"; then
466 curses_cppflags="-I$with_curses_headers"
467 CPPFLAGS="$CPPFLAGS $curses_cppflags"
468 fi
469 AC_ARG_WITH(curses_libs, [AS_HELP_STRING(--with-curses-libs=dir,
470 [look for libcurses also in dir])])
471 if test -n "$with_curses_libs"; then
472 curses_libs="-L$with_curses_libs"
473 LDFLAGS="$LDFLAGS $curses_libs"
474 fi
475 AC_CHECK_HEADER(curses.h, [], [
476 have_curses="no"
477 ])
478 curses_ldflags="$curses_libs"
479 AC_CHECK_LIB([ncursesw], [initscr],
480 [curses_ldflags="$curses_libs -lncursesw"], [
481 AC_CHECK_LIB([curses], [initscr],
482 [curses_ldflags="$curses_libs -lcurses"],
483 [have_curses="no"]
484 )
485 ]
486 )
487 AC_SUBST(curses_cppflags)
488 AC_SUBST(curses_ldflags)
489 CPPFLAGS="$OLD_CPPFLAGS"
490 LDFLAGS="$OLD_LDFLAGS"
491 LIBS="$OLD_LIBS"
492 ########################################################################### ip_mreqn
493 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
494 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
495 #include <netdb.h>
496 #include <net/if.h>
497 ]], [[
498 struct ip_mreqn mn;
499 mn.imr_ifindex = 0;
500 ]])],[have_ip_mreqn=yes],[have_ip_mreqn=no])
501 AC_MSG_RESULT($have_ip_mreqn)
502 if test ${have_ip_mreqn} = yes; then
503 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
504 fi
505 ########################################################################### osx
506
507 AC_MSG_CHECKING(for CoreAudio (MacOs))
508 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
509 #include <CoreAudio/CoreAudio.h>
510 ]], [[
511 AudioDeviceID id;
512 ]])],[have_core_audio=yes],[have_core_audio=no])
513 AC_MSG_RESULT($have_core_audio)
514 if test ${have_core_audio} = yes; then
515 f1="-framework CoreAudio"
516 f2="-framework AudioToolbox"
517 f3="-framework AudioUnit"
518 f4="-framework CoreServices"
519 f="$f1 $f2 $f3 $f4"
520
521 audiod_errlist_objs="$audiod_errlist_objs osx_write ipc"
522 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
523 audiod_ldflags="$audiod_ldflags $f"
524
525 play_errlist_objs="$play_errlist_objs osx_write ipc"
526 play_cmdline_objs="$play_cmdline_objs osx_write.cmdline"
527 play_ldflags="$play_ldflags $f"
528
529 write_errlist_objs="$write_errlist_objs osx_write ipc"
530 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
531 write_ldflags="$write_ldflags $f"
532 writers="$writers osx"
533 default_writer="OSX_WRITE"
534 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
535 fi
536 ####################################################### ogg/vorbis/speex/opus
537 have_ogg="yes"
538 OLD_CPPFLAGS="$CPPFLAGS"
539 OLD_LDFLAGS="$LDFLAGS"
540 OLD_LIBS="$LIBS"
541 AC_ARG_WITH(ogg_headers, [AS_HELP_STRING(--with-ogg-headers=dir,
542 [look for ogg headers also in dir])])
543 AC_ARG_WITH(ogg_libs, [AS_HELP_STRING(--with-ogg-libs=dir,
544 [look for ogg libs also in dir])])
545 AC_ARG_WITH(vorbis_headers, [AS_HELP_STRING(--with-vorbis-headers=dir,
546 [look for vorbis headers also in dir])])
547 AC_ARG_WITH(vorbis_libs, [AS_HELP_STRING(--with-vorbis-libs=dir,
548 [look for vorbis libs also in dir])])
549 AC_ARG_WITH(speex_headers, [AS_HELP_STRING(--with-speex-headers=dir,
550 [look for speex headers also in dir])])
551 AC_ARG_WITH(speex_libs, [AS_HELP_STRING(--with-speex-libs=dir,
552 [look for speex libs also in dir])])
553 AC_ARG_WITH(opus_headers, [AS_HELP_STRING(--with-opus-headers=dir,
554 [look for opus headers also in dir])])
555 AC_ARG_WITH(opus_libs, [AS_HELP_STRING(--with-opus-libs=dir,
556 [look for opus libs also in dir])])
557
558 if test -n "$with_ogg_headers"; then
559 ogg_cppflags="-I$with_ogg_headers"
560 CPPFLAGS="$CPPFLAGS $ogg_cppflags"
561 fi
562 if test -n "$with_ogg_libs"; then
563 ogg_libs="-L$with_ogg_libs"
564 LDFLAGS="$LDFLAGS $ogg_libs"
565 fi
566 AC_CHECK_HEADERS([ogg/ogg.h], [], [ have_ogg="no"; ])
567 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
568
569 have_vorbis="yes"
570 have_speex="yes"
571 have_opus="yes"
572 if test "$have_ogg" = "yes"; then
573 # vorbis
574 if test -n "$with_vorbis_headers"; then
575 vorbis_cppflags="-I$with_vorbis_headers"
576 CPPFLAGS="$CPPFLAGS $vorbis_cppflags"
577 fi
578 if test -n "$with_vorbis_libs"; then
579 vorbis_libs="-L$with_vorbis_libs"
580 LDFLAGS="$LDFLAGS $vorbis_libs"
581 fi
582 AC_CHECK_HEADERS([vorbis/codec.h], [], [ have_vorbis="no" ])
583 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_vorbis="no" ])
584
585 # speex
586 if test -n "$with_speex_headers"; then
587 speex_cppflags="-I$with_speex_headers"
588 CPPFLAGS="$CPPFLAGS $speex_cppflags"
589 fi
590 if test -n "$with_speex_libs"; then
591 speex_libs="-L$with_speex_libs"
592 LDFLAGS="$LDFLAGS $speex_libs"
593 fi
594 AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ])
595 AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ])
596
597 # opus
598 if test -n "$with_opus_headers"; then
599 opus_cppflags="-I$with_opus_headers"
600 CPPFLAGS="$CPPFLAGS $opus_cppflags"
601 fi
602 if test -n "$with_opus_libs"; then
603 opus_libs="-L$with_opus_libs"
604 LDFLAGS="$LDFLAGS $opus_libs"
605 fi
606 AC_CHECK_LIB([opus], [opus_multistream_decode], [], [ have_opus="no" ])
607 AC_CHECK_HEADERS([opus/opus.h], [], [ have_opus="no" ])
608 else
609 AC_MSG_WARN([vorbis/speex/opus depend on libogg, which was not detected])
610 have_vorbis="no"
611 have_speex="no"
612 have_opus="no"
613 fi
614
615 msg="support in para_server/para_filter/para_afh"
616 if test "$have_vorbis" = "yes" || \
617 test "$have_speex" = "yes" || \
618 test "$have_opus" = "yes"; then
619 AC_SUBST(ogg_cppflags)
620 ogg_ldflags="$ogg_libs -logg"
621 if test "$OSTYPE" = "Darwin"; then
622 ogg_ldflags="-Wl,-bind_at_load $ogg_ldflags"
623 fi
624 AC_SUBST(ogg_ldflags)
625 afh_errlist_objs="$afh_errlist_objs ogg_afh_common"
626 recv_errlist_objs="$recv_errlist_objs ogg_afh_common"
627 server_errlist_objs="$server_errlist_objs ogg_afh_common"
628 play_errlist_objs="$play_errlist_objs ogg_afh_common"
629 fi
630 if test "$have_vorbis" = "yes"; then
631 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support)
632 filters="$filters oggdec"
633 vorbis_ldflags="$vorbis_libs -lvorbis -lvorbisfile"
634 AC_SUBST(vorbis_ldflags)
635
636 server_errlist_objs="$server_errlist_objs ogg_afh"
637 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
638 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
639 play_errlist_objs="$play_errlist_objs oggdec_filter ogg_afh"
640 afh_errlist_objs="$afh_errlist_objs ogg_afh"
641 recv_errlist_objs="$recv_errlist_objs ogg_afh"
642
643 audiod_audio_formats="$audiod_audio_formats ogg"
644 audio_format_handlers="$audio_format_handlers ogg"
645 fi
646 if test "$have_speex" = "yes"; then
647 AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support)
648 AC_SUBST(speex_cppflags)
649 speex_ldflags="$speex_libs -lspeex"
650 AC_SUBST(speex_ldflags)
651
652 filters="$filters spxdec"
653
654 server_errlist_objs="$server_errlist_objs spx_afh spx_common"
655 filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common"
656 audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common"
657 play_errlist_objs="$play_errlist_objs spxdec_filter spx_afh spx_common"
658 afh_errlist_objs="$afh_errlist_objs spx_afh spx_common"
659 recv_errlist_objs="$recv_errlist_objs spx_afh spx_common"
660
661 audiod_audio_formats="$audiod_audio_formats spx"
662 audio_format_handlers="$audio_format_handlers spx"
663 else
664 AC_MSG_WARN([no ogg/speex $msg])
665 fi
666 if test "$have_opus" = "yes"; then
667 AC_DEFINE(HAVE_OPUS, 1, define to 1 to turn on ogg/opus support)
668 AC_SUBST(opus_cppflags)
669 opus_ldflags="$opus_libs -lopus"
670 AC_SUBST(opus_ldflags)
671
672 filters="$filters opusdec"
673
674 server_errlist_objs="$server_errlist_objs opus_afh opus_common"
675 filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
676 audiod_errlist_objs="$audiod_errlist_objs opusdec_filter opus_common"
677 afh_errlist_objs="$afh_errlist_objs opus_afh opus_common"
678 play_errlist_objs="$play_errlist_objs opusdec_filter opus_afh opus_common"
679 recv_errlist_objs="$recv_errlist_objs opus_afh opus_common"
680
681 audiod_audio_formats="$audiod_audio_formats opus"
682 audio_format_handlers="$audio_format_handlers opus"
683 else
684 AC_MSG_WARN([no ogg/opus $msg])
685 fi
686 CPPFLAGS="$OLD_CPPFLAGS"
687 LDFLAGS="$OLD_LDFLAGS"
688 LIBS="$OLD_LIBS"
689 ########################################################################### faad
690 have_faad=yes
691 OLD_CPPFLAGS="$CPPFLAGS"
692 OLD_LDFLAGS="$LDFLAGS"
693 OLD_LIBS="$LIBS"
694 AC_ARG_WITH(faad_headers, [AS_HELP_STRING(--with-faad-headers=dir,
695 [look for neaacdec.h also in dir])])
696 if test -n "$with_faad_headers"; then
697 faad_cppflags="-I$with_faad_headers"
698 CPPFLAGS="$CPPFLAGS $faad_cppflags"
699 fi
700 AC_ARG_WITH(faad_libs, [AS_HELP_STRING(--with-faad-libs=dir,
701 [look for libfaad also in dir])])
702 if test -n "$with_faad_libs"; then
703 faad_libs="-L$with_faad_libs"
704 LDFLAGS="$LDFLAGS $faad_libs"
705 fi
706 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
707 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
708 if test "$have_faad" = "yes"; then
709 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
710 AC_SUBST(faad_cppflags)
711 faad_ldflags="$faad_libs -lfaad"
712 AC_SUBST(faad_ldflags)
713
714 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
715 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
716 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
717 play_errlist_objs="$play_errlist_objs aacdec_filter aac_afh aac_common"
718 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
719 recv_errlist_objs="$recv_errlist_objs aac_afh aac_common"
720
721 audiod_audio_formats="$audiod_audio_formats aac"
722 audio_format_handlers="$audio_format_handlers aac"
723 filters="$filters aacdec"
724 else
725 AC_MSG_WARN([no aac support in para_audiod/para_filter])
726 fi
727 CPPFLAGS="$OLD_CPPFLAGS"
728 LDFLAGS="$OLD_LDFLAGS"
729 LIBS="$OLD_LIBS"
730 ########################################################################### mad
731 have_mad="yes"
732 OLD_CPPFLAGS="$CPPFLAGS"
733 OLD_LDFLAGS="$LDFLAGS"
734 OLD_LIBS="$LIBS"
735
736 AC_ARG_WITH(mad_headers, [AS_HELP_STRING(--with-mad-headers=dir,
737 [look for mad.h also in dir])])
738 if test -n "$with_mad_headers"; then
739 mad_cppflags="-I$with_mad_headers"
740 CPPFLAGS="$CPPFLAGS $mad_cppflags"
741 fi
742 AC_ARG_WITH(mad_libs, [AS_HELP_STRING(--with-mad-libs=dir,
743 [look for libmad also in dir])])
744 if test -n "$with_mad_libs"; then
745 mad_libs="-L$with_mad_libs"
746 LDFLAGS="$LDFLAGS $mad_libs"
747 fi
748 AC_CHECK_HEADERS([mad.h], [], [
749 have_mad="no"
750 ])
751 AC_CHECK_LIB([mad], [mad_stream_init], [], [
752 have_mad="no"
753 ])
754 if test "$have_mad" = "yes"; then
755 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
756 AC_SUBST(mad_cppflags)
757 mad_ldflags="$mad_libs -lmad"
758 AC_SUBST(mad_ldflags)
759 filter_cmdline_objs="$filter_cmdline_objs mp3dec_filter"
760 audiod_cmdline_objs="$audiod_cmdline_objs mp3dec_filter"
761 play_cmdline_objs="$play_cmdline_objs mp3dec_filter"
762 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
763 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
764 play_errlist_objs="$play_errlist_objs mp3dec_filter"
765 audiod_audio_formats="$audiod_audio_formats mp3"
766 filters="$filters mp3dec"
767 else
768 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
769 fi
770 CPPFLAGS="$OLD_CPPFLAGS"
771 LDFLAGS="$OLD_LDFLAGS"
772 LIBS="$OLD_LIBS"
773 ###################################################################### libid3tag
774 OLD_CPPFLAGS="$CPPFLAGS"
775 OLD_LDFLAGS="$LDFLAGS"
776 OLD_LIBS="$LIBS"
777
778 have_libid3tag="yes"
779 AC_ARG_WITH(id3tag_headers, [AS_HELP_STRING(--with-id3tag-headers=dir,
780 [look for id3tag header files also in dir])])
781 if test -n "$with_id3tag_headers"; then
782 id3tag_cppflags="-I$with_id3tag_headers"
783 CPPFLAGS="$CPPFLAGS $id3tag_cppflags"
784 fi
785 AC_ARG_WITH(id3tag_libs, [AS_HELP_STRING(--with-id3tag-libs=dir,
786 [look for id3tag libs also in dir])])
787 if test -n "$with_id3tag_libs"; then
788 id3tag_libs="-L$with_id3tag_libs"
789 LDFLAGS="$LDFLAGS $id3tag_libs"
790 fi
791
792 AC_MSG_CHECKING(for libid3tag)
793 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
794 #include <id3tag.h>
795 ]], [[
796 struct id3_tag t = {.flags = 0};
797 ]])],[],[have_libid3tag=no])
798 AC_MSG_RESULT($have_libid3tag)
799
800 if test ${have_libid3tag} = yes; then
801 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
802 AC_SUBST(id3tag_cppflags)
803 AC_SUBST(id3tag_ldflags, "$id3tag_libs -lid3tag -lz")
804 fi
805 CPPFLAGS="$OLD_CPPFLAGS"
806 LDFLAGS="$OLD_LDFLAGS"
807 LIBS="$OLD_LIBS"
808 ########################################################################### flac
809 OLD_CPPFLAGS="$CPPFLAGS"
810 OLD_LDFLAGS="$LDFLAGS"
811 OLD_LIBS="$LIBS"
812
813 have_flac="yes"
814 AC_ARG_WITH(flac_headers, [AS_HELP_STRING(--with-flac-headers=dir,
815 [look for flac headers also in dir])])
816 if test -n "$with_flac_headers"; then
817 flac_cppflags="-I$with_flac_headers"
818 CPPFLAGS="$CPPFLAGS $flac_cppflags"
819 fi
820 AC_ARG_WITH(flac_libs, [AS_HELP_STRING(--with-flac-libs=dir,
821 [look for flac libs also in dir])])
822 if test -n "$with_flac_libs"; then
823 flac_libs="-L$with_flac_libs"
824 LDFLAGS="$LDFLAGS $flac_libs"
825 fi
826 AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no)
827 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], have_flac=no, -logg -lm)
828 if test "$have_flac" = "yes"; then
829 AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter)
830 AC_SUBST(flac_cppflags)
831 flac_ldflags="$flac_libs -lFLAC"
832 AC_SUBST(flac_ldflags)
833
834 filter_errlist_objs="$filter_errlist_objs flacdec_filter"
835 audiod_errlist_objs="$audiod_errlist_objs flacdec_filter"
836 play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
837 afh_errlist_objs="$afh_errlist_objs flac_afh"
838 server_errlist_objs="$server_errlist_objs flac_afh"
839 recv_errlist_objs="$recv_errlist_objs flac_afh"
840 filters="$filters flacdec"
841 audio_format_handlers="$audio_format_handlers flac"
842 audiod_audio_formats="$audiod_audio_formats flac"
843 else
844 AC_MSG_WARN([no flac support in para_audiod/para_filter/para_afh/para_server])
845 fi
846 CPPFLAGS="$OLD_CPPFLAGS"
847 LDFLAGS="$OLD_LDFLAGS"
848 LIBS="$OLD_LIBS"
849 ########################################################################### oss
850 OLD_CPPFLAGS="$CPPFLAGS"
851 OLD_LDFLAGS="$LDFLAGS"
852 OLD_LIBS="$LIBS"
853
854 have_oss="yes"
855 msg="=> will not build oss writer"
856
857 AC_CHECK_HEADER(sys/soundcard.h, [
858 audiod_errlist_objs="$audiod_errlist_objs oss_write"
859 play_errlist_objs="$play_errlist_objs oss_write"
860 audiod_cmdline_objs="$audiod_cmdline_objs oss_write"
861 play_cmdline_objs="$play_cmdline_objs oss_write"
862
863 write_errlist_objs="$write_errlist_objs oss_write"
864 write_cmdline_objs="$write_cmdline_objs oss_write"
865 fade_errlist_objs="$fade_errlist_objs oss_mix"
866
867 writers="$writers oss"
868 default_writer="OSS_WRITE"
869 mixers="${mixers}oss "
870 default_mixer="OSS_MIX"
871
872 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
873 oss_ldflags="-lossaudio"
874 AC_SUBST(oss_ldflags)
875 ]
876 )
877 ],
878 [
879 have_oss="no"
880 AC_MSG_WARN([no sys/soundcard.h $msg])
881 ]
882 )
883 CPPFLAGS="$OLD_CPPFLAGS"
884 LDFLAGS="$OLD_LDFLAGS"
885 LIBS="$OLD_LIBS"
886
887 ########################################################################### alsa
888 OLD_CPPFLAGS="$CPPFLAGS"
889 OLD_LDFLAGS="$LDFLAGS"
890 OLD_LIBS="$LIBS"
891
892 msg="=> no alsa support for para_audiod/para_write"
893 if test "$OSTYPE" != "Linux"; then
894 have_alsa="no"
895 else
896 have_alsa="yes"
897 fi
898 if test "$have_alsa" = "yes"; then
899 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
900 have_alsa="no"
901 AC_MSG_WARN([no alsa/asoundlib $msg])
902 ])
903 fi
904
905 if test "$have_alsa" = "yes"; then
906 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
907 have_alsa="no"
908 AC_MSG_WARN([no libasound $msg])
909 ])
910 fi
911
912 if test "$have_alsa" = "yes"; then
913 alsa_ldflags="-lasound"
914 AC_SUBST(alsa_ldflags)
915 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
916 audiod_cmdline_objs="$audiod_cmdline_objs alsa_write"
917 play_errlist_objs="$play_errlist_objs alsa_write"
918 play_cmdline_objs="$play_cmdline_objs alsa_write"
919
920 write_errlist_objs="$write_errlist_objs alsa_write"
921 write_cmdline_objs="$write_cmdline_objs alsa_write"
922 fade_errlist_objs="$fade_errlist_objs alsa_mix"
923
924 writers="$writers alsa"
925 default_writer="ALSA_WRITE"
926 mixers="${mixers}alsa "
927 default_mixer="ALSA_MIX"
928 fi
929
930 CPPFLAGS="$OLD_CPPFLAGS"
931 LDFLAGS="$OLD_LDFLAGS"
932 LIBS="$OLD_LIBS"
933 ########################################################################### libao
934 OLD_CPPFLAGS="$CPPFLAGS"
935 OLD_LDFLAGS="$LDFLAGS"
936 OLD_LIBS="$LIBS"
937
938 have_ao="yes"
939 AC_ARG_WITH(ao_headers, [AS_HELP_STRING(--with-ao-headers=dir,
940 [look for ao/ao.h also in dir])])
941 if test -n "$with_ao_headers"; then
942 ao_cppflags="-I$with_ao_headers"
943 CPPFLAGS="$CPPFLAGS $ao_cppflags"
944 fi
945 AC_ARG_WITH(ao_libs, [AS_HELP_STRING(--with-ao-libs=dir,
946 [look for libao also in dir])])
947 if test -n "$with_ao_libs"; then
948 ao_libs="-L$with_ao_libs"
949 LDFLAGS="$LDFLAGS $ao_libs"
950 fi
951 msg="no libao support for para_audiod/para_write"
952 AC_CHECK_HEADERS([ao/ao.h], [
953 ], [
954 have_ao="no"
955 AC_MSG_WARN([ao.h not found, $msg])
956 ])
957 if test "$have_ao" = "yes"; then
958 AC_CHECK_LIB([ao], [ao_initialize], [], [
959 have_ao="no"
960 AC_MSG_WARN([ao lib not found or not working, $msg])
961 ])
962 fi
963 if test "$have_ao" = "yes"; then
964 AC_CHECK_HEADERS([pthread.h], [
965 ], [
966 have_ao="no"
967 AC_MSG_WARN([pthread.h not found, $msg])
968 ])
969 fi
970 if test "$have_ao" = "yes"; then
971 AC_CHECK_LIB([pthread], [pthread_create], [], [
972 have_ao="no"
973 AC_MSG_WARN([pthread lib not found or not working, $msg])
974 ])
975 fi
976 if test "$have_ao" = "yes"; then
977 AC_SUBST(ao_cppflags)
978 ao_ldflags="$ao_libs -lao -lpthread"
979 AC_SUBST(ao_ldflags)
980
981 audiod_errlist_objs="$audiod_errlist_objs ao_write"
982 audiod_cmdline_objs="$audiod_cmdline_objs ao_write"
983
984 play_errlist_objs="$play_errlist_objs ao_write"
985 play_cmdline_objs="$play_cmdline_objs ao_write"
986
987 write_errlist_objs="$write_errlist_objs ao_write"
988 write_cmdline_objs="$write_cmdline_objs ao_write"
989 writers="$writers ao"
990 fi
991
992 CPPFLAGS="$OLD_CPPFLAGS"
993 LDFLAGS="$OLD_LDFLAGS"
994 LIBS="$OLD_LIBS"
995 ############################################################# readline
996 OLD_CPPFLAGS="$CPPFLAGS"
997 OLD_LDFLAGS="$LDFLAGS"
998 OLD_LIBS="$LIBS"
999
1000 have_readline="yes"
1001 AC_ARG_WITH(readline_headers, [AS_HELP_STRING(--with-readline-headers=dir,
1002 [look for libreadline header files also in dir])])
1003 if test -n "$with_readline_headers"; then
1004 readline_cppflags="-I$with_readline_headers"
1005 CPPFLAGS="$CPPFLAGS $readline_cppflags"
1006 fi
1007
1008 AC_ARG_WITH(readline_libs, [AS_HELP_STRING(--with-readline-libs=dir,
1009 [look for readline library also in dir])])
1010 if test -n "$with_readline_libs"; then
1011 readline_libs="-L$with_readline_libs"
1012 LDFLAGS="$LDFLAGS $readline_libs"
1013 fi
1014 msg="no interactive cli support"
1015 AC_CHECK_HEADERS([readline/readline.h], [
1016 ], [
1017 have_readline="no"
1018 AC_MSG_WARN([readline/readline.h not found, $msg])
1019 ])
1020
1021 if test "$have_curses" != "yes"; then
1022 have_readline="no"
1023 AC_MSG_WARN([interactive cli support depends on curses,])
1024 AC_MSG_WARN([but no curses lib was detected, $msg])
1025 fi
1026
1027 if test "$have_readline" = "yes"; then
1028 readline_ldflags="$readline_libs -lreadline"
1029 AC_SEARCH_LIBS([rl_free_keymap], [readline], [], [have_readline="no"])
1030 if test "$have_readline" = "no"; then # try with -lcurses
1031 # clear cache
1032 AC_MSG_NOTICE([trying again with -lcurses])
1033 unset ac_cv_search_rl_free_keymap 2> /dev/null
1034 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
1035 have_readline=yes
1036 readline_ldflags="$readline_ldflags -lcurses"
1037 ], [], [-lcurses])
1038 fi
1039 if test "$have_readline" = "no"; then # try with -ltermcap
1040 # clear cache
1041 AC_MSG_NOTICE([trying again with -ltermcap])
1042 unset ac_cv_search_rl_free_keymap 2> /dev/null
1043 AC_SEARCH_LIBS([rl_free_keymap], [readline], [
1044 have_readline=yes
1045 readline_ldflags="$readline_ldflags -ltermcap"
1046 ], [], [-ltermcap])
1047 fi
1048 fi
1049
1050 if test "$have_readline" = "yes"; then
1051 AC_SUBST(readline_cppflags)
1052 AC_SUBST(readline_ldflags)
1053 client_errlist_objs="$client_errlist_objs interactive"
1054 audioc_errlist_objs="$audioc_errlist_objs buffer_tree interactive sched time"
1055 play_errlist_objs="$play_errlist_objs interactive"
1056 AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
1057 else
1058 AC_MSG_WARN([libreadline not found or unusable])
1059 fi
1060 CPPFLAGS="$OLD_CPPFLAGS"
1061 LDFLAGS="$OLD_LDFLAGS"
1062 LIBS="$OLD_LIBS"
1063 ############################################################# libsamplerate
1064 OLD_CPPFLAGS="$CPPFLAGS"
1065 OLD_LDFLAGS="$LDFLAGS"
1066 OLD_LIBS="$LIBS"
1067
1068 have_samplerate="yes"
1069 AC_ARG_WITH(samplerate_headers, [AS_HELP_STRING(--with-samplerate-headers=dir,
1070 [look for samplerate headers also in dir])])
1071 if test -n "$with_samplerate_headers"; then
1072 samplerate_cppflags="-I$with_samplerate_headers"
1073 CPPFLAGS="$CPPFLAGS $samplerate_cppflags"
1074 fi
1075 AC_ARG_WITH(samplerate_libs, [AS_HELP_STRING(--with-samplerate-libs=dir,
1076 [look for samplerate libs also in dir])])
1077 if test -n "$with_samplerate_libs"; then
1078 samplerate_libs="-L$with_samplerate_libs"
1079 LDFLAGS="$LDFLAGS $samplerate_libs"
1080 fi
1081
1082 AC_CHECK_HEADER(samplerate.h, [], have_samplerate=no)
1083 AC_CHECK_LIB([samplerate], [src_process], [], have_samplerate=no, [])
1084
1085 if test "$have_samplerate" = "yes"; then
1086 AC_SUBST(samplerate_cppflags)
1087 samplerate_ldflags="$samplerate_libs -lsamplerate"
1088 AC_SUBST(samplerate_ldflags)
1089
1090 filter_errlist_objs="$filter_errlist_objs resample_filter check_wav"
1091 filter_cmdline_objs="$filter_cmdline_objs resample_filter"
1092 audiod_errlist_objs="$audiod_errlist_objs resample_filter check_wav"
1093 audiod_cmdline_objs="$audiod_cmdline_objs resample_filter"
1094 play_errlist_objs="$play_errlist_objs resample_filter check_wav"
1095 play_cmdline_objs="$play_cmdline_objs resample_filter"
1096 filters="$filters resample"
1097 else
1098 AC_MSG_WARN([no resample support in para_audiod/para_filter])
1099 fi
1100 CPPFLAGS="$OLD_CPPFLAGS"
1101 LDFLAGS="$OLD_LDFLAGS"
1102 LIBS="$OLD_LIBS"
1103 ######################################################################### server
1104 if test \( "$have_openssl" = "yes" -o "$have_gcrypt" = "yes" \) \
1105 -a "$have_osl" = "yes" ; then
1106
1107 build_server="yes"
1108 executables="$executables server"
1109 server_cmdline_objs="server"
1110 server_errlist_objs="$server_errlist_objs
1111 server
1112 afh_common
1113 mp3_afh
1114 vss
1115 command
1116 net
1117 string
1118 signal
1119 time
1120 daemon
1121 http_send
1122 close_on_fork
1123 mm
1124 crypt_common
1125 ipc
1126 dccp_send
1127 fd
1128 user_list
1129 chunk_queue
1130 afs
1131 aft
1132 mood
1133 score
1134 attribute
1135 blob
1136 playlist
1137 sched
1138 acl
1139 send_common
1140 udp_send
1141 color
1142 fec
1143 wma_afh
1144 wma_common
1145 sideband
1146 version
1147 ggo
1148 "
1149 else
1150 build_server="no"
1151 fi
1152 ############################################################# client
1153 if test "$have_openssl" = "yes" -o "$have_gcrypt" = "yes"; then
1154 build_client="yes"
1155 executables="$executables client"
1156 client_cmdline_objs="client"
1157 client_errlist_objs="$client_errlist_objs
1158 client
1159 net
1160 string
1161 fd
1162 sched
1163 stdin
1164 stdout
1165 time
1166 sideband
1167 client_common
1168 buffer_tree
1169 crypt_common
1170 version
1171 ggo
1172 "
1173 else
1174 build_client="no"
1175 fi
1176 ############################################################# audiod
1177 if test "$have_openssl" = "yes" -o "$have_gcrypt" = "yes"; then
1178 build_audiod="yes"
1179 executables="$executables audiod"
1180 audiod_cmdline_objs="$audiod_cmdline_objs
1181 audiod
1182 compress_filter
1183 http_recv
1184 dccp_recv
1185 file_write
1186 client
1187 amp_filter
1188 udp_recv
1189 prebuffer_filter
1190 "
1191 audiod_errlist_objs="$audiod_errlist_objs
1192 audiod
1193 signal
1194 string
1195 daemon
1196 stat
1197 net
1198 crypt_common
1199 sideband
1200 time
1201 grab_client
1202 filter_common
1203 wav_filter
1204 compress_filter
1205 amp_filter
1206 http_recv
1207 dccp_recv
1208 recv_common
1209 fd
1210 sched
1211 write_common
1212 file_write
1213 audiod_command
1214 fecdec_filter
1215 client_common
1216 ggo
1217 udp_recv
1218 color
1219 fec
1220 prebuffer_filter
1221 version
1222 bitstream
1223 imdct
1224 wma_common
1225 wmadec_filter
1226 buffer_tree
1227 "
1228 audiod_ldflags="$audiod_ldflags -lm"
1229 audiod_audio_formats="$audiod_audio_formats wma"
1230 else
1231 build_audiod="no"
1232 fi
1233 ########################################################################### fade
1234 if test -n "$mixers"; then
1235 build_fade="yes"
1236 executables="$executables fade"
1237 fade_errlist_objs="$fade_errlist_objs fade exec string fd version ggo"
1238 fade_cmdline_objs="fade"
1239 fade_objs="add_cmdline($fade_cmdline_objs) $fade_errlist_objs"
1240 AC_SUBST(fade_objs, add_dot_o($fade_objs))
1241 AC_SUBST(fade_ldflags, $fade_ldflags)
1242 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
1243 objlist_to_errlist($fade_errlist_objs),
1244 errors used by para_fade)
1245 enum="$(
1246 for i in $mixers; do
1247 printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
1248 done
1249 )"
1250 AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
1251 enum of supported mixers)
1252 AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
1253 use this mixer if none was specified)
1254 names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
1255 AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
1256 inits="$(
1257 for i in $mixers; do
1258 printf 'extern void '$i'_mix_init(struct mixer *); '
1259 done
1260 )"
1261 AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
1262 init functions of the supported mixers)
1263 array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
1264 AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
1265 mixer_summary="supported mixers:: $mixers, default: $default_mixer"
1266 else
1267 build_fade="no"
1268 AC_MSG_WARN([no mixer support])
1269 mixer_summary="para_fade: no"
1270 fi
1271 ########################################################################### gui
1272 if test "$have_curses" = "yes"; then
1273 build_gui="yes"
1274 executables="$executables gui"
1275 gui_cmdline_objs="gui"
1276 gui_errlist_objs="
1277 exec
1278 signal
1279 string
1280 stat
1281 ringbuffer
1282 fd
1283 gui
1284 gui_theme
1285 time
1286 version
1287 ggo
1288 "
1289 gui_objs="add_cmdline($gui_cmdline_objs) $gui_errlist_objs"
1290 else
1291 build_gui="no"
1292 AC_MSG_WARN([no curses lib, cannot build para_gui])
1293 fi
1294 ############################################################# error2.h
1295 # these are always built
1296 all_errlist_objs="
1297 $recv_errlist_objs
1298 $filter_errlist_objs
1299 $audioc_errlist_objs
1300 $write_errlist_objs
1301 $afh_errlist_objs
1302 $play_errlist_objs
1303 "
1304
1305 # optional executables
1306 if test "$build_server" = "yes"; then
1307 all_errlist_objs="$all_errlist_objs $server_errlist_objs"
1308 fi
1309 if test "$build_gui" = "yes"; then
1310 all_errlist_objs="$all_errlist_objs $gui_errlist_objs"
1311 fi
1312 if test "$build_fade" = "yes"; then
1313 all_errlist_objs="$all_errlist_objs $fade_errlist_objs"
1314 fi
1315 if test "$build_client" = "yes"; then
1316 all_errlist_objs="$all_errlist_objs $client_errlist_objs"
1317 fi
1318 if test "$build_audiod" = "yes"; then
1319 all_errlist_objs="$all_errlist_objs $audiod_errlist_objs"
1320 fi
1321
1322 all_errlist_objs="$(echo $all_errlist_objs | tr ' ' '\n' | sort | uniq)"
1323
1324 object_executable_matrix=
1325 for i in $executables; do
1326 eval objs=\$${i}_errlist_objs
1327 object_executable_matrix="$object_executable_matrix $i: $objs"
1328 done
1329 # use echo to replace newlines by space
1330 AC_SUBST(object_executable_matrix, $(echo $object_executable_matrix))
1331
1332 for obj in $all_errlist_objs; do
1333 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
1334 done
1335 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
1336 [enum {$SS NUM_SS}],
1337 [list of all objects that use the paraslash error facility]
1338 )
1339 ################################################################## status items
1340
1341 status_items="basename status num_played mtime bitrate frequency file_size
1342 status_flags format score techinfo afs_mode
1343 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
1344 offset seconds_total stream_start current_time audiod_uptime image_id
1345 lyrics_id duration directory lyrics_name image_name path hash channels
1346 last_played num_chunks chunk_time amplification artist title year album
1347 comment"
1348
1349 result=
1350 for i in $status_items; do
1351 result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
1352 done
1353 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
1354 [enum of all status items])
1355
1356 result=
1357 for i in $status_items; do
1358 result="$result \"$i\", "
1359 done
1360 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
1361 [char * array of all status items])
1362
1363 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
1364 [formats supported by para_server and para_afh])
1365
1366 AC_SUBST(executables)
1367
1368 recv_objs="add_cmdline($recv_cmdline_objs) $recv_errlist_objs"
1369 filter_objs="add_cmdline($filter_cmdline_objs) $filter_errlist_objs"
1370 audiod_objs="add_cmdline($audiod_cmdline_objs) $audiod_errlist_objs"
1371 server_objs="add_cmdline($server_cmdline_objs) $server_errlist_objs"
1372 write_objs="add_cmdline($write_cmdline_objs) $write_errlist_objs"
1373 client_objs="add_cmdline($client_cmdline_objs) $client_errlist_objs"
1374 audioc_objs="add_cmdline($audioc_cmdline_objs) $audioc_errlist_objs"
1375 afh_objs="add_cmdline($afh_cmdline_objs) $afh_errlist_objs"
1376 play_objs="add_cmdline($play_cmdline_objs) $play_errlist_objs"
1377 gui_objs="add_cmdline($gui_cmdline_objs) $gui_errlist_objs"
1378
1379 AC_SUBST(recv_objs, add_dot_o($recv_objs))
1380 AC_SUBST(recv_ldflags, $recv_ldflags)
1381 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
1382 errors used by para_recv)
1383
1384 AC_SUBST(filter_objs, add_dot_o($filter_objs))
1385 AC_SUBST(filter_ldflags, $filter_ldflags)
1386 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
1387 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
1388
1389 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
1390 AC_SUBST(audiod_ldflags, $audiod_ldflags)
1391 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
1392 errors used by para_audiod)
1393
1394 AC_SUBST(server_objs, add_dot_o($server_objs))
1395 AC_SUBST(server_ldflags, $server_ldflags)
1396 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
1397 objlist_to_errlist($server_errlist_objs), errors used by para_server)
1398
1399 AC_SUBST(afh_objs, add_dot_o($afh_objs))
1400 AC_SUBST(afh_ldflags, $afh_ldflags)
1401 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
1402 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
1403
1404 AC_SUBST(write_objs, add_dot_o($write_objs))
1405 AC_SUBST(write_ldflags, $write_ldflags)
1406 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
1407 objlist_to_errlist($write_errlist_objs), errors used by para_write)
1408
1409 AC_SUBST(client_objs, add_dot_o($client_objs))
1410 AC_SUBST(client_ldflags, $client_ldflags)
1411 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
1412 objlist_to_errlist($client_errlist_objs), errors used by para_client)
1413
1414 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
1415 AC_SUBST(audioc_ldflags, $audioc_ldflags)
1416 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
1417 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
1418
1419 AC_SUBST(gui_objs, add_dot_o($gui_objs))
1420 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
1421 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
1422
1423 AC_SUBST(play_objs, add_dot_o($play_objs))
1424 AC_SUBST(play_ldflags, $play_ldflags)
1425 AC_DEFINE_UNQUOTED(INIT_PLAY_ERRLISTS,
1426 objlist_to_errlist($play_errlist_objs), errors used by para_play)
1427
1428 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
1429 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
1430 enum of supported filters)
1431 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
1432 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
1433 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
1434 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
1435
1436 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
1437 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
1438 enum of supported writers)
1439 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
1440 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
1441 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
1442 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
1443 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
1444 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
1445 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
1446
1447 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
1448 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
1449 enum of audio formats supported by audiod)
1450 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
1451 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
1452
1453 AC_OUTPUT
1454 AC_MSG_NOTICE([
1455 paraslash configuration:
1456 ~~~~~~~~~~~~~~~~~~~~~~~~
1457 unix socket credentials: $have_ucred
1458 readline (interactive CLIs): $have_readline
1459 audio formats handlers: $audio_format_handlers
1460 id3 version2 support: $have_libid3tag
1461 filters: $(echo $filters)
1462 writers: $writers
1463
1464 $mixer_summary
1465 para_server: $build_server
1466 para_gui: $build_gui
1467 para_fade: $build_fade
1468 para_client: $build_client
1469 para_audiod: $build_audiod
1470 ])