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