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