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