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