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