audiod: Fix time diff log message.
[paraslash.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.60)
5
6
7 AC_INIT(paraslash, [git], maan@systemlinux.org)
8 AC_CONFIG_HEADER([config.h])
9
10 AC_PATH_PROG(UNAMEPATH, uname, no)
11 if test "$UNAMEPATH" = "no"; then
12 AC_MSG_ERROR(unable to determine system type)
13 fi
14 AC_MSG_CHECKING(os type)
15 OSTYPE="`$UNAMEPATH -s`"
16 AC_MSG_RESULT("$OSTYPE")
17
18 if test "$OSTYPE" = "SunOS"; then
19 # needed on SunOS for socket magic
20 arch_cppflags="-D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
21 AC_SUBST(arch_cppflags)
22 fi
23
24 AC_C_BIGENDIAN()
25
26 AC_PROG_CC
27 AC_PROG_CPP
28 AC_PROG_INSTALL
29 AC_REPLACE_FNMATCH
30
31 AC_HEADER_DIRENT
32 AC_HEADER_STDC
33 AC_HEADER_SYS_WAIT
34 AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h \
35 stdlib.h string.h sys/socket.h sys/time.h sys/timeb.h sys/un.h \
36 sys/ipc.h unistd.h utime.h stddef.h],
37 [], [AC_MSG_ERROR([$ac_header not found])])
38
39
40 # Checks for typedefs, structures, and compiler characteristics.
41 AC_C_CONST
42 AC_C_INLINE
43 AC_TYPE_OFF_T
44 AC_TYPE_PID_T
45 AC_TYPE_SIZE_T
46 AC_HEADER_TIME
47 AC_STRUCT_TM
48 AC_TYPE_INT16_T
49 AC_TYPE_INT32_T
50 AC_TYPE_INT64_T
51 AC_TYPE_MODE_T
52 AC_TYPE_SSIZE_T
53 AC_TYPE_UID_T
54 AC_TYPE_UINT8_T
55 AC_TYPE_UINT16_T
56 AC_TYPE_UINT32_T
57 AC_TYPE_UINT64_T
58
59 # Checks for library functions.
60 AC_FUNC_FORK
61 AC_PROG_GCC_TRADITIONAL
62 AC_FUNC_MALLOC
63 AC_FUNC_MEMCMP
64 AC_FUNC_MKTIME
65 AC_FUNC_MMAP
66 AC_FUNC_REALLOC
67 AC_FUNC_SELECT_ARGTYPES
68 AC_TYPE_SIGNAL
69 AC_FUNC_STAT
70 AC_FUNC_STRFTIME
71 AC_FUNC_VPRINTF
72 AC_FUNC_CLOSEDIR_VOID
73 AC_FUNC_LSTAT
74
75 AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
76 regcomp select strchr strdup strerror strstr strtol uname \
77 fchdir gettimeofday localtime_r munmap strcasecmp strcspn \
78 strncasecmp strrchr strspn alarm mkdir rmdir], [],
79 [AC_MSG_ERROR([function not found, cannot live without it])])
80
81 cmdline_dir="cmdline"
82 AC_SUBST(cmdline_dir)
83 AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${i}.cmdline "; done)])
84
85
86 all_errlist_objs="server mp3_afh afh_common vss command net string signal time
87 daemon stat crypt http_send close_on_fork ipc acl afh fade amp_filter
88 dccp_send fd user_list chunk_queue afs aft mood score attribute blob ringbuffer
89 playlist sha1 sched audiod grab_client filter_common wav_filter compress_filter
90 http_recv dccp_recv recv_common write_common file_write audiod_command
91 client_common recv stdout filter stdin audioc write client exec send_common ggo
92 udp_recv udp_send color fec fecdec_filter prebuffer_filter mm
93 server_command_list afs_command_list audiod_command_list bitstream imdct wma_afh
94 wma_common wmadec_filter buffer_tree
95 "
96
97 executables="server recv filter audioc write client afh audiod"
98
99 recv_cmdline_objs="add_cmdline(recv http_recv dccp_recv udp_recv)"
100
101 recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
102 fd sched stdout ggo udp_recv fec buffer_tree"
103 recv_ldflags=""
104
105 filter_cmdline_objs="add_cmdline(filter compress_filter amp_filter prebuffer_filter)"
106 filter_errlist_objs="filter_common wav_filter compress_filter filter string
107 stdin stdout sched fd amp_filter ggo fecdec_filter fec
108 prebuffer_filter time bitstream imdct wma_common wmadec_filter buffer_tree"
109 filter_ldflags="-lm"
110 filters=" compress wav amp fecdec wmadec prebuffer"
111
112 audioc_cmdline_objs="add_cmdline(audioc)"
113 audioc_errlist_objs="audioc string net fd"
114 audioc_ldflags=""
115
116 audiod_cmdline_objs="add_cmdline(audiod compress_filter http_recv dccp_recv file_write client amp_filter udp_recv prebuffer_filter)"
117 audiod_errlist_objs="audiod signal string daemon stat net
118 time grab_client filter_common wav_filter compress_filter amp_filter http_recv dccp_recv
119 recv_common fd sched write_common file_write audiod_command crypt fecdec_filter
120 client_common ggo udp_recv color fec prebuffer_filter sha1 audiod_command_list
121 bitstream imdct wma_common wmadec_filter buffer_tree"
122 audiod_ldflags="-lm"
123 audiod_audio_formats="wma"
124
125 afh_cmdline_objs="add_cmdline(afh)"
126 afh_errlist_objs="afh string fd mp3_afh afh_common time wma_afh wma_common"
127 afh_ldflags=""
128
129 server_cmdline_objs="add_cmdline(server)"
130 server_errlist_objs="server afh_common mp3_afh vss command net string signal
131 time daemon crypt http_send close_on_fork mm
132 ipc dccp_send fd user_list chunk_queue afs aft mood score attribute
133 blob playlist sha1 sched acl send_common udp_send color fec
134 server_command_list afs_command_list wma_afh wma_common"
135 server_ldflags="-losl"
136 server_audio_formats=" mp3 wma"
137
138 write_cmdline_objs="add_cmdline(write file_write)"
139 write_errlist_objs="write write_common file_write time fd string sched stdin
140 buffer_tree ggo"
141 write_ldflags=""
142 writers=" file"
143 default_writer="FILE_WRITE"
144
145 client_cmdline_objs="add_cmdline(client)"
146 client_errlist_objs="client net string crypt fd sched stdin stdout time
147 client_common sha1 buffer_tree"
148 client_ldflags=""
149
150 gui_cmdline_objs="add_cmdline(gui)"
151 gui_errlist_objs="exec signal string stat ringbuffer fd"
152 gui_other_objs="gui gui_theme"
153 gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
154
155 fade_cmdline_objs="add_cmdline(fade)"
156 fade_errlist_objs="fade exec string fd"
157
158
159 ########################################################################### osl
160 have_osl=yes
161 OLD_CPPFLAGS="$CPPFLAGS"
162 OLD_LD_FLAGS="$LDFLAGS"
163 OLD_LIBS="$LIBS"
164 AC_ARG_WITH(osl_headers, [AC_HELP_STRING(--with-osl-headers=dir,
165 [look for osl.h also in dir])])
166 if test -n "$with_osl_headers"; then
167 osl_cppflags="-I$with_osl_headers"
168 CPPFLAGS="$CPPFLAGS $osl_cppflags"
169 fi
170 AC_ARG_WITH(osl_libs, [AC_HELP_STRING(--with-osl-libs=dir,
171 [look for libosl also in dir])])
172 if test -n "$with_osl_libs"; then
173 osl_libs="-L$with_osl_libs"
174 LDFLAGS="$LDFLAGS $osl_libs"
175 fi
176
177 AC_CHECK_HEADER(osl.h, [], have_osl=no)
178 AC_CHECK_LIB([osl], [osl_open_table], [], have_osl=no)
179 if test "$have_osl" = "no"; then
180 AC_MSG_ERROR([libosl not found, download it at
181 http://systemlinux.org/~maan/osl
182 or execute
183 git clone git://git.tuebingen.mpg.de/osl
184 ])
185 fi
186 AC_SUBST(osl_cppflags)
187 server_ldflags="$server_ldflags -L$with_osl_libs"
188 CPPFLAGS="$OLD_CPPFLAGS"
189 LDFLAGS="$OLD_LDFLAGS"
190 LIBS="$OLD_LIBS"
191 ########################################################################### ssl
192 dnl @synopsis CHECK_SSL
193 dnl
194 dnl based on the follwing macro from the autoconf archive
195 dnl
196 dnl @category InstalledPackages
197 dnl @author Mark Ethan Trostler <trostler@juniper.net>
198 dnl @version 2003-01-28
199 dnl @license AllPermissive
200
201 AC_DEFUN([CHECK_SSL],
202 [
203 for ssldir in $1 /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
204 AC_MSG_CHECKING(for openssl in $ssldir)
205 if test -f "$ssldir/include/openssl/ssl.h"; then
206 found_ssl="yes"
207 AC_MSG_RESULT(yes)
208 SSL_CFLAGS="-I$ssldir/include"
209 SSL_CPPFLAGS="-I$ssldir/include"
210 break
211 fi
212 AC_MSG_RESULT(no)
213 done
214 if test x_$found_ssl != x_yes; then
215 AC_MSG_ERROR(Cannot find ssl libraries)
216 else
217 SSL_LIBS="-lssl -lcrypto";
218 SSL_LDFLAGS="-L$ssldir/lib";
219 fi
220 AC_SUBST(SSL_CPPFLAGS)
221 ])dnl
222
223 AC_ARG_ENABLE(ssldir, [AS_HELP_STRING(--enable-ssldir=path,
224 [Search for openssl also in path.])])
225 if test "$enable_ssldir" = "yes"; then enable_ssldir=""; fi
226 CHECK_SSL($enable_ssldir)
227 server_ldflags="$server_ldflags $SSL_LDFLAGS $SSL_LIBS"
228 client_ldflags="$client_ldflags $SSL_LDFLAGS $SSL_LIBS"
229 audiod_ldflags="$audiod_ldflags $SSL_LDFLAGS $SSL_LIBS"
230
231 ########################################################################### libsocket
232 AC_CHECK_LIB([c], [socket],
233 [socket_lib=],
234 [socket_lib="-lsocket"]
235 )
236 server_ldflags="$server_ldflags $socket_lib"
237 client_ldflags="$client_ldflags $socket_lib"
238 audioc_ldflags="$audioc_ldflags $socket_lib"
239 audiod_ldflags="$audiod_ldflags $socket_lib"
240 recv_ldflags="$recv_ldflags $socket_lib"
241 AC_SEARCH_LIBS([connect],[socket],[],[
242 AC_MSG_ERROR([Fatal: Did not find connect().])
243 ],[])
244 ########################################################################### libnsl
245 AC_CHECK_LIB([c], [gethostbyname],
246 [nsl_lib=],
247 [nsl_lib="-lnsl"]
248 )
249 server_ldflags="$server_ldflags $nsl_lib"
250 client_ldflags="$client_ldflags $nsl_lib"
251 audioc_ldflags="$audioc_ldflags $nsl_lib"
252 recv_ldflags="$recv_ldflags $nsl_lib"
253 AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
254 AC_MSG_ERROR([Fatal: Did not find inet_ntoa().])
255 ],[])
256 ########################################################################### ucred
257 AC_MSG_CHECKING(for struct ucred)
258 AC_TRY_LINK([
259 #define _GNU_SOURCE
260 #include <sys/types.h>
261 #include <sys/socket.h>
262 ],[
263 struct ucred sucred; sucred.pid=0;
264 ],[have_ucred=yes],[have_ucred=no])
265 AC_MSG_RESULT($have_ucred)
266 if test ${have_ucred} = yes; then
267 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
268 fi
269
270 ########################################################################### curses
271 have_ncurses="yes"
272 OLD_CPPFLAGS="$CPPFLAGS"
273 OLD_LD_FLAGS="$LDFLAGS"
274 OLD_LIBS="$LIBS"
275 AC_ARG_WITH(ncurses_headers, [AC_HELP_STRING(--with-ncurses-headers=dir,
276 [look for ncurses.h also in dir])])
277 if test -n "$with_ncurses_headers"; then
278 ncurses_cppflags="-I$with_ncurses_headers"
279 CPPFLAGS="$CPPFLAGS $ncurses_cppflags"
280 fi
281 AC_ARG_WITH(ncurses_libs, [AC_HELP_STRING(--with-ncurses-libs=dir,
282 [look for libncurses also in dir])])
283 if test -n "$with_ncurses_libs"; then
284 ncurses_libs="-L$with_ncurses_libs"
285 LDFLAGS="$LDFLAGS $ncurses_libs"
286 fi
287 AC_CHECK_HEADER(curses.h, [], [
288 have_ncurses="no"
289 ])
290 AC_CHECK_LIB([ncurses], [initscr], [], [
291 have_ncurses="no"
292 ])
293 if test "$have_ncurses" = "yes"; then
294 AC_SUBST(ncurses_cppflags)
295 AC_DEFINE(HAVE_NCURSES, 1, [define to 1 to turn on ncurses support])
296 extras="$extras gui"
297 executables="$executables gui"
298 else
299 AC_MSG_WARN([cannot build para_gui])
300 fi
301 CPPFLAGS="$OLD_CPPFLAGS"
302 LDFLAGS="$OLD_LDFLAGS"
303 LIBS="$OLD_LIBS"
304
305 ########################################################################### ip_mreqn
306 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
307 AC_TRY_LINK([
308 #include <netdb.h>
309 #include <net/if.h>
310 ],[
311 struct ip_mreqn mn;
312 mn.imr_ifindex = 0;
313 ],[have_ip_mreqn=yes],[have_ip_mreqn=no])
314 AC_MSG_RESULT($have_ip_mreqn)
315 if test ${have_ip_mreqn} = yes; then
316 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
317 fi
318 ########################################################################### osx
319
320 AC_MSG_CHECKING(for CoreAudio (MacOs))
321 AC_TRY_LINK([
322 #include <CoreAudio/CoreAudio.h>
323 ],[
324 AudioDeviceID id;
325 ],[have_core_audio=yes],[have_core_audio=no])
326 AC_MSG_RESULT($have_core_audio)
327 if test ${have_core_audio} = yes; then
328 f1="-framework CoreAudio"
329 f2="-framework AudioToolbox"
330 f3="-framework AudioUnit"
331 f4="-framework CoreServices"
332 f="$f1 $f2 $f3 $f4"
333
334 all_errlist_objs="$all_errlist_objs osx_write"
335 audiod_errlist_objs="$audiod_errlist_objs osx_write"
336 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
337 audiod_ldflags="$audiod_ldflags $f"
338
339 write_errlist_objs="$write_errlist_objs osx_write"
340 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
341 write_ldflags="$write_ldflags $f"
342 writers="$writers osx"
343 default_writer="OSX_WRITE"
344 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
345 fi
346 ########################################################################### ogg
347 have_ogg="yes"
348 OLD_CPPFLAGS="$CPPFLAGS"
349 OLD_LD_FLAGS="$LDFLAGS"
350 OLD_LIBS="$LIBS"
351 AC_ARG_WITH(oggvorbis_headers, [AC_HELP_STRING(--with-oggvorbis-headers=dir,
352 [look for vorbis/codec.h also in dir])])
353 if test -n "$with_oggvorbis_headers"; then
354 oggvorbis_cppflags="-I$with_oggvorbis_headers"
355 CPPFLAGS="$CPPFLAGS $oggvorbis_cppflags"
356 fi
357 AC_ARG_WITH(oggvorbis_libs, [AC_HELP_STRING(--with-oggvorbis-libs=dir,
358 [look for oggvorbis libs also in dir])])
359 if test -n "$with_oggvorbis_libs"; then
360 oggvorbis_libs="-L$with_oggvorbis_libs"
361 LDFLAGS="$LDFLAGS $oggvorbis_libs"
362 fi
363
364 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
365 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_ogg="no" ])
366 AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [ have_ogg="no" ])
367 if test "$have_ogg" = "yes"; then
368 all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh"
369 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support)
370 filters="$filters oggdec"
371 if test "$OSTYPE" = "Darwin"; then
372 oggvorbis_libs="-Wl,-bind_at_load $oggvorbis_libs"
373 fi
374 server_ldflags="$server_ldflags $oggvorbis_libs -logg -lvorbis -lvorbisfile"
375 filter_ldflags="$filter_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
376 audiod_ldflags="$audiod_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
377 afh_ldflags="$afh_ldflags $oggvorbis_libs -logg -lvorbis -lvorbisfile"
378
379 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(oggdec_filter)"
380 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oggdec_filter)"
381
382 server_errlist_objs="$server_errlist_objs ogg_afh"
383 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
384 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
385 afh_errlist_objs="$afh_errlist_objs ogg_afh"
386
387 audiod_audio_formats="$audiod_audio_formats ogg"
388 server_audio_formats="$server_audio_formats ogg"
389 AC_SUBST(oggvorbis_cppflags)
390 else
391 AC_MSG_WARN([no ogg vorbis support in para_server/para_filter])
392 fi
393 CPPFLAGS="$OLD_CPPFLAGS"
394 LDFLAGS="$OLD_LDFLAGS"
395 LIBS="$OLD_LIBS"
396 ########################################################################### faad
397 have_faad=yes
398 OLD_CPPFLAGS="$CPPFLAGS"
399 OLD_LD_FLAGS="$LDFLAGS"
400 OLD_LIBS="$LIBS"
401 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
402 [look for neaacdec.h also in dir])])
403 if test -n "$with_faad_headers"; then
404 faad_cppflags="-I$with_faad_headers"
405 CPPFLAGS="$CPPFLAGS $faad_cppflags"
406 fi
407 AC_ARG_WITH(faad_libs, [AC_HELP_STRING(--with-faad-libs=dir,
408 [look for libfaad also in dir])])
409 if test -n "$with_faad_libs"; then
410 faad_libs="-L$with_faad_libs"
411 LDFLAGS="$LDFLAGS $faad_libs"
412 fi
413 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
414 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
415 if test "$have_faad" = "yes"; then
416 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
417 all_errlist_objs="$all_errlist_objs aac_common aacdec_filter aac_afh"
418 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
419 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
420 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
421 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
422 server_ldflags="$server_ldflags $faad_libs -lfaad"
423 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
424 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
425 afh_ldflags="$afh_ldflags $faad_libs -lfaad"
426 audiod_audio_formats="$audiod_audio_formats aac"
427 server_audio_formats="$server_audio_formats aac"
428 filters="$filters aacdec"
429 AC_SUBST(faad_cppflags)
430 else
431 AC_MSG_WARN([no aac support in para_audiod/para_filter])
432 fi
433 CPPFLAGS="$OLD_CPPFLAGS"
434 LDFLAGS="$OLD_LDFLAGS"
435 LIBS="$OLD_LIBS"
436 ########################################################################### mad
437 have_mad="yes"
438 OLD_CPPFLAGS="$CPPFLAGS"
439 OLD_LD_FLAGS="$LDFLAGS"
440 OLD_LIBS="$LIBS"
441
442 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
443 [look for mad.h also in dir])])
444 if test -n "$with_mad_headers"; then
445 mad_cppflags="-I$with_mad_headers"
446 CPPFLAGS="$CPPFLAGS $mad_cppflags"
447 fi
448 AC_ARG_WITH(mad_libs, [AC_HELP_STRING(--with-mad-libs=dir,
449 [look for libmad also in dir])])
450 if test -n "$with_mad_libs"; then
451 mad_libs="-L$with_mad_libs"
452 LDFLAGS="$LDFLAGS $mad_libs"
453 fi
454 AC_CHECK_HEADERS([mad.h], [], [
455 have_mad="no"
456 ])
457 AC_CHECK_LIB([mad], [mad_stream_init], [], [
458 have_mad="no"
459 ])
460 if test "$have_mad" = "yes"; then
461 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
462 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
463 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
464 all_errlist_objs="$all_errlist_objs mp3dec_filter"
465 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
466 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
467 filter_ldflags="$filter_ldflags $mad_libs -lmad"
468 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
469 audiod_audio_formats="$audiod_audio_formats mp3"
470 filters="$filters mp3dec"
471 AC_SUBST(mad_cppflags)
472 else
473 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
474 fi
475 CPPFLAGS="$OLD_CPPFLAGS"
476 LDFLAGS="$OLD_LDFLAGS"
477 LIBS="$OLD_LIBS"
478 ###################################################################### libid3tag
479 AC_MSG_CHECKING(for libid3tag)
480 AC_TRY_LINK([
481 #include <id3tag.h>
482 ],[
483 struct id3_tag t = {.flags = 0};
484 ],[have_libid3tag=yes],[have_libid3tag=no])
485 AC_MSG_RESULT($have_libid3tag)
486 if test ${have_libid3tag} = yes; then
487 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
488 server_ldflags="$server_ldflags -lid3tag"
489 afh_ldflags="$afh_ldflags -lid3tag"
490 else
491 AC_MSG_WARN([no support for id3v2 tags])
492 fi
493 ########################################################################### oss
494 OLD_CPPFLAGS="$CPPFLAGS"
495 OLD_LD_FLAGS="$LDFLAGS"
496 OLD_LIBS="$LIBS"
497
498 have_oss="yes"
499 msg="=> will not build para_fade/oss writer"
500
501 AC_CHECK_HEADER(sys/soundcard.h, [
502 extras="$extras fade"
503 executables="$executables fade"
504 all_errlist_objs="$all_errlist_objs oss_write"
505 audiod_errlist_objs="$audiod_errlist_objs oss_write"
506 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
507
508 write_errlist_objs="$write_errlist_objs oss_write"
509 write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
510 writers="$writers oss"
511 default_writer="OSS_WRITE"
512 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
513 audiod_ldflags="$audiod_ldflags -lossaudio"
514 write_ldflags="$write_ldflags -lossaudio"
515 fade_ldflags="$write_ldflags -lossaudio"
516 ]
517 )
518 ],
519 [
520 have_oss="no"
521 AC_MSG_WARN([no sys/soundcard.h $msg])
522 ]
523 )
524 CPPFLAGS="$OLD_CPPFLAGS"
525 LDFLAGS="$OLD_LDFLAGS"
526 LIBS="$OLD_LIBS"
527
528 ########################################################################### alsa
529 OLD_CPPFLAGS="$CPPFLAGS"
530 OLD_LD_FLAGS="$LDFLAGS"
531 OLD_LIBS="$LIBS"
532
533 msg="=> no alsa support for para_audiod/para_write"
534 if test "$OSTYPE" != "Linux"; then
535 have_alsa="no"
536 else
537 have_alsa="yes"
538 fi
539 if test "$have_alsa" = "yes"; then
540 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
541 have_alsa="no"
542 AC_MSG_WARN([no alsa/asoundlib $msg])
543 ])
544 fi
545
546 if test "$have_alsa" = "yes"; then
547 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
548 have_alsa="no"
549 AC_MSG_WARN([no libasound $msg])
550 ])
551 fi
552
553 if test "$have_alsa" = "yes"; then
554 all_errlist_objs="$all_errlist_objs alsa_write"
555 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
556 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
557 audiod_ldflags="$audiod_ldflags -lasound"
558
559 write_errlist_objs="$write_errlist_objs alsa_write"
560 write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
561 write_ldflags="$write_ldflags -lasound"
562 writers="$writers alsa"
563 default_writer="ALSA_WRITE"
564 fi
565
566 CPPFLAGS="$OLD_CPPFLAGS"
567 LDFLAGS="$OLD_LDFLAGS"
568 LIBS="$OLD_LIBS"
569
570 AC_SUBST(install_sh, [$INSTALL])
571 AC_CONFIG_FILES([Makefile])
572
573
574 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
575 AC_DEFUN([add_para],[$(for i in $@; do printf "para_$i "; done)])
576 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) }])
577 ############################################################# error2.h
578 AC_DEFUN([define_safe_error_enums],
579 [
580 exe=""
581 for i in $executables; do
582 # eval echo checking if $1 is linked into $i
583 for j in $(eval echo \$${i}_errlist_objs); do
584 if test $j = $1; then
585 exe="$exe $i"
586 break;
587 fi
588 done
589 done
590 #echo "$1 gets linked into $exe"
591 safe_errlists=""
592 for i in $all_errlist_objs; do
593 for j in $exe; do
594 found=0
595 for k in $(eval echo \$${j}_errlist_objs); do
596 if test $k = $i; then
597 found=1
598 break;
599 fi
600 done
601 if test $found -eq 0; then
602 break;
603 fi
604 done
605 if test $found -eq 1; then
606 safe_errlists="$safe_errlists $i"
607 fi
608 done
609 #echo "safe errlists for $1: $safe_errlists"
610 ss_defs=""
611 for i in $safe_errlists; do
612 echo "SS_ENUM($(echo $i | tr 'a-z' 'A-Z'));"
613 done
614 ]
615 )
616
617
618 AC_MSG_NOTICE(creating error2.h)
619 for obj in $all_errlist_objs; do
620 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
621 echo "#ifdef MAIN_INPUT_FILE_IS_$obj"
622 define_safe_error_enums($obj)
623 echo "#endif"
624 done > error2.h
625 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
626 [enum {$SS NUM_SS}],
627 [list of all objects that use paraslash's error facility]
628 )
629
630 ################################################################## status items
631
632 status_items="basename status num_played mtime bitrate frequency file_size
633 status_flags format score techinfo afs_mode
634 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
635 offset seconds_total stream_start current_time audiod_uptime image_id
636 lyrics_id duration directory lyrics_name image_name path hash channels
637 last_played num_chunks chunk_time amplification artist title year album
638 comment"
639
640 # $1: prefix, $2: items
641 AC_DEFUN([make_enum_items], [$(
642 for i in $2; do
643 printf "$1_$(echo $i | tr 'a-z' 'A-Z'), "
644 done
645 )])
646
647 # $1: prefix, $2: items
648 AC_DEFUN([make_enum_array], [$(
649 for i in $2; do
650 printf "\"$i\", "
651 done
652 )])
653
654 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM,
655 make_enum_items(SI, $status_items),
656 [enum of all status items]
657 )
658 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY,
659 make_enum_array(SI, $status_items),
660 [char * array of all status items]
661 )
662
663
664 AC_SUBST(executables, add_para($executables))
665
666 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
667 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
668 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
669 server_objs="$server_cmdline_objs $server_errlist_objs"
670 write_objs="$write_cmdline_objs $write_errlist_objs"
671 client_objs="$client_cmdline_objs $client_errlist_objs"
672 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
673 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
674 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
675
676 AC_SUBST(recv_objs, add_dot_o($recv_objs))
677 AC_SUBST(recv_ldflags, $recv_ldflags)
678 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
679 errors used by para_recv)
680
681 AC_SUBST(filter_objs, add_dot_o($filter_objs))
682 AC_SUBST(filter_ldflags, $filter_ldflags)
683 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
684 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
685
686 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
687 AC_SUBST(audiod_ldflags, $audiod_ldflags)
688 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
689 errors used by para_audiod)
690
691 AC_SUBST(server_objs, add_dot_o($server_objs))
692 AC_SUBST(server_ldflags, $server_ldflags)
693 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
694 objlist_to_errlist($server_errlist_objs), errors used by para_server)
695
696 AC_SUBST(afh_objs, add_dot_o($afh_objs))
697 AC_SUBST(afh_ldflags, $afh_ldflags)
698 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
699 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
700
701 AC_SUBST(write_objs, add_dot_o($write_objs))
702 AC_SUBST(write_ldflags, $write_ldflags)
703 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
704 objlist_to_errlist($write_errlist_objs), errors used by para_write)
705
706 AC_SUBST(client_objs, add_dot_o($client_objs))
707 AC_SUBST(client_ldflags, $client_ldflags)
708 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
709 objlist_to_errlist($client_errlist_objs), errors used by para_client)
710
711 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
712 AC_SUBST(audioc_ldflags, $audioc_ldflags)
713 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
714 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
715
716 AC_SUBST(gui_objs, add_dot_o($gui_objs))
717 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
718 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
719
720 AC_SUBST(fade_objs, add_dot_o($fade_objs))
721 AC_SUBST(fade_ldflags, $fade_ldflags)
722 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
723 objlist_to_errlist($fade_errlist_objs), errors used by para_fade)
724
725
726 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
727 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
728 enum of supported filters)
729 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
730 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
731 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
732 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
733
734 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
735 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
736 enum of supported writers)
737 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
738 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
739 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
740 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
741 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
742 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
743 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
744
745 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
746 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
747 enum of audio formats supported by audiod)
748 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
749 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
750
751 AC_OUTPUT
752 AC_MSG_NOTICE([
753 paraslash configuration:
754 ~~~~~~~~~~~~~~~~~~~~~~~~
755 unix socket credentials: $have_ucred
756 audio formats supported by para_server/para_afh: $server_audio_formats
757 id3 version2 support: $have_libid3tag
758 filters supported by para_audiod/para_filter: $filters
759 writers supported by para_audiod/para_write: $writers
760 optional executables: $extras
761 ])