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