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