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