configure: Don't mention the list of supported senders/receivers.
[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 AC_SUBST(SSL_CFLAGS)
222 AC_SUBST(SSL_LIBS)
223 AC_SUBST(SSL_LDFLAGS)
224 ])dnl
225
226 AC_ARG_ENABLE(ssldir, [AS_HELP_STRING(--enable-ssldir=path,
227 [Search for openssl also in path.])])
228 if test "$enable_ssldir" = "yes"; then enable_ssldir=""; fi
229 CHECK_SSL($enable_ssldir)
230 server_ldflags="$server_ldflags $SSL_LDFLAGS $SSL_LIBS"
231 client_ldflags="$client_ldflags $SSL_LDFLAGS $SSL_LIBS"
232 audiod_ldflags="$audiod_ldflags $SSL_LDFLAGS $SSL_LIBS"
233
234 ########################################################################### libsocket
235 AC_CHECK_LIB([c], [socket],
236 [socket_lib=],
237 [socket_lib="-lsocket"]
238 )
239 server_ldflags="$server_ldflags $socket_lib"
240 client_ldflags="$client_ldflags $socket_lib"
241 audioc_ldflags="$audioc_ldflags $socket_lib"
242 audiod_ldflags="$audiod_ldflags $socket_lib"
243 recv_ldflags="$recv_ldflags $socket_lib"
244 AC_SEARCH_LIBS([connect],[socket],[],[
245 AC_MSG_ERROR([Fatal: Did not find connect().])
246 ],[])
247 ########################################################################### libnsl
248 AC_CHECK_LIB([c], [gethostbyname],
249 [nsl_lib=],
250 [nsl_lib="-lnsl"]
251 )
252 server_ldflags="$server_ldflags $nsl_lib"
253 client_ldflags="$client_ldflags $nsl_lib"
254 audioc_ldflags="$audioc_ldflags $nsl_lib"
255 recv_ldflags="$recv_ldflags $nsl_lib"
256 AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
257 AC_MSG_ERROR([Fatal: Did not find inet_ntoa().])
258 ],[])
259 ########################################################################### ucred
260 AC_MSG_CHECKING(for struct ucred)
261 AC_TRY_LINK([
262 #define _GNU_SOURCE
263 #include <sys/types.h>
264 #include <sys/socket.h>
265 ],[
266 struct ucred sucred; sucred.pid=0;
267 ],[have_ucred=yes],[have_ucred=no])
268 AC_MSG_RESULT($have_ucred)
269 if test ${have_ucred} = yes; then
270 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
271 fi
272
273 ########################################################################### curses
274 have_ncurses="yes"
275 OLD_CPPFLAGS="$CPPFLAGS"
276 OLD_LD_FLAGS="$LDFLAGS"
277 OLD_LIBS="$LIBS"
278 AC_ARG_WITH(ncurses_headers, [AC_HELP_STRING(--with-ncurses-headers=dir,
279 [look for ncurses.h also in dir])])
280 if test -n "$with_ncurses_headers"; then
281 ncurses_cppflags="-I$with_ncurses_headers"
282 CPPFLAGS="$CPPFLAGS $ncurses_cppflags"
283 fi
284 AC_ARG_WITH(ncurses_libs, [AC_HELP_STRING(--with-ncurses-libs=dir,
285 [look for libncurses also in dir])])
286 if test -n "$with_ncurses_libs"; then
287 ncurses_libs="-L$with_ncurses_libs"
288 LDFLAGS="$LDFLAGS $ncurses_libs"
289 fi
290 AC_CHECK_HEADER(curses.h, [], [
291 have_ncurses="no"
292 ])
293 AC_CHECK_LIB([ncurses], [initscr], [], [
294 have_ncurses="no"
295 ])
296 if test "$have_ncurses" = "yes"; then
297 AC_SUBST(ncurses_cppflags)
298 AC_SUBST(ncurses_libs)
299 AC_DEFINE(HAVE_NCURSES, 1, [define to 1 to turn on ncurses support])
300 extras="$extras gui"
301 executables="$executables gui"
302 else
303 AC_MSG_WARN([cannot build para_gui])
304 fi
305 CPPFLAGS="$OLD_CPPFLAGS"
306 LDFLAGS="$OLD_LDFLAGS"
307 LIBS="$OLD_LIBS"
308
309 ########################################################################### ip_mreqn
310 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
311 AC_TRY_LINK([
312 #include <netdb.h>
313 #include <net/if.h>
314 ],[
315 struct ip_mreqn mn;
316 mn.imr_ifindex = 0;
317 ],[have_ip_mreqn=yes],[have_ip_mreqn=no])
318 AC_MSG_RESULT($have_ip_mreqn)
319 if test ${have_ip_mreqn} = yes; then
320 AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
321 fi
322 ########################################################################### osx
323
324 AC_MSG_CHECKING(for CoreAudio (MacOs))
325 AC_TRY_LINK([
326 #include <CoreAudio/CoreAudio.h>
327 ],[
328 AudioDeviceID id;
329 ],[have_core_audio=yes],[have_core_audio=no])
330 AC_MSG_RESULT($have_core_audio)
331 if test ${have_core_audio} = yes; then
332 f1="-framework CoreAudio"
333 f2="-framework AudioToolbox"
334 f3="-framework AudioUnit"
335 f4="-framework CoreServices"
336 f="$f1 $f2 $f3 $f4"
337
338 all_errlist_objs="$all_errlist_objs osx_write"
339 audiod_errlist_objs="$audiod_errlist_objs osx_write"
340 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
341 audiod_ldflags="$audiod_ldflags $f"
342
343 write_errlist_objs="$write_errlist_objs osx_write"
344 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
345 write_ldflags="$write_ldflags $f"
346 writers="$writers osx"
347 default_writer="OSX_WRITE"
348 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
349 fi
350 ########################################################################### ogg
351 have_ogg="yes"
352 OLD_CPPFLAGS="$CPPFLAGS"
353 OLD_LD_FLAGS="$LDFLAGS"
354 OLD_LIBS="$LIBS"
355 AC_ARG_WITH(oggvorbis_headers, [AC_HELP_STRING(--with-oggvorbis-headers=dir,
356 [look for vorbis/codec.h also in dir])])
357 if test -n "$with_oggvorbis_headers"; then
358 oggvorbis_cppflags="-I$with_oggvorbis_headers"
359 CPPFLAGS="$CPPFLAGS $oggvorbis_cppflags"
360 fi
361 AC_ARG_WITH(oggvorbis_libs, [AC_HELP_STRING(--with-oggvorbis-libs=dir,
362 [look for oggvorbis libs also in dir])])
363 if test -n "$with_oggvorbis_libs"; then
364 oggvorbis_libs="-L$with_oggvorbis_libs"
365 LDFLAGS="$LDFLAGS $oggvorbis_libs"
366 fi
367
368 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
369 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_ogg="no" ])
370 AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [ have_ogg="no" ])
371 if test "$have_ogg" = "yes"; then
372 all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh"
373 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support)
374 filters="$filters oggdec"
375 if test "$OSTYPE" = "Darwin"; then
376 oggvorbis_libs="-Wl,-bind_at_load $oggvorbis_libs"
377 fi
378 server_ldflags="$server_ldflags $oggvorbis_libs -logg -lvorbis -lvorbisfile"
379 filter_ldflags="$filter_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
380 audiod_ldflags="$audiod_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
381 afh_ldflags="$afh_ldflags $oggvorbis_libs -logg -lvorbis -lvorbisfile"
382
383 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(oggdec_filter)"
384 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oggdec_filter)"
385
386 server_errlist_objs="$server_errlist_objs ogg_afh"
387 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
388 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
389 afh_errlist_objs="$afh_errlist_objs ogg_afh"
390
391 audiod_audio_formats="$audiod_audio_formats ogg"
392 server_audio_formats="$server_audio_formats ogg"
393 AC_SUBST(oggvorbis_cppflags)
394 AC_SUBST(oggvorbis_libs)
395 else
396 AC_MSG_WARN([no ogg vorbis support in para_server/para_filter])
397 fi
398 CPPFLAGS="$OLD_CPPFLAGS"
399 LDFLAGS="$OLD_LDFLAGS"
400 LIBS="$OLD_LIBS"
401 ########################################################################### faad
402 have_faad=yes
403 OLD_CPPFLAGS="$CPPFLAGS"
404 OLD_LD_FLAGS="$LDFLAGS"
405 OLD_LIBS="$LIBS"
406 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
407 [look for neaacdec.h also in dir])])
408 if test -n "$with_faad_headers"; then
409 faad_cppflags="-I$with_faad_headers"
410 CPPFLAGS="$CPPFLAGS $faad_cppflags"
411 fi
412 AC_ARG_WITH(faad_libs, [AC_HELP_STRING(--with-faad-libs=dir,
413 [look for libfaad also in dir])])
414 if test -n "$with_faad_libs"; then
415 faad_libs="-L$with_faad_libs"
416 LDFLAGS="$LDFLAGS $faad_libs"
417 fi
418 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
419 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
420 if test "$have_faad" = "yes"; then
421 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
422 all_errlist_objs="$all_errlist_objs aac_common aacdec_filter aac_afh"
423 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
424 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
425 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
426 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
427 server_ldflags="$server_ldflags $faad_libs -lfaad"
428 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
429 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
430 afh_ldflags="$afh_ldflags $faad_libs -lfaad"
431 audiod_audio_formats="$audiod_audio_formats aac"
432 server_audio_formats="$server_audio_formats aac"
433 filters="$filters aacdec"
434 AC_SUBST(faad_cppflags)
435 AC_SUBST(faad_libs)
436 else
437 AC_MSG_WARN([no aac support in para_audiod/para_filter])
438 fi
439 CPPFLAGS="$OLD_CPPFLAGS"
440 LDFLAGS="$OLD_LDFLAGS"
441 LIBS="$OLD_LIBS"
442 ########################################################################### mad
443 have_mad="yes"
444 OLD_CPPFLAGS="$CPPFLAGS"
445 OLD_LD_FLAGS="$LDFLAGS"
446 OLD_LIBS="$LIBS"
447
448 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
449 [look for mad.h also in dir])])
450 if test -n "$with_mad_headers"; then
451 mad_cppflags="-I$with_mad_headers"
452 CPPFLAGS="$CPPFLAGS $mad_cppflags"
453 fi
454 AC_ARG_WITH(mad_libs, [AC_HELP_STRING(--with-mad-libs=dir,
455 [look for libmad also in dir])])
456 if test -n "$with_mad_libs"; then
457 mad_libs="-L$with_mad_libs"
458 LDFLAGS="$LDFLAGS $mad_libs"
459 fi
460 AC_CHECK_HEADERS([mad.h], [], [
461 have_mad="no"
462 ])
463 AC_CHECK_LIB([mad], [mad_stream_init], [], [
464 have_mad="no"
465 ])
466 if test "$have_mad" = "yes"; then
467 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
468 filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
469 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
470 all_errlist_objs="$all_errlist_objs mp3dec_filter"
471 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
472 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
473 filter_ldflags="$filter_ldflags $mad_libs -lmad"
474 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
475 audiod_audio_formats="$audiod_audio_formats mp3"
476 filters="$filters mp3dec"
477 AC_SUBST(mad_cppflags)
478 AC_SUBST(mad_libs)
479 else
480 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
481 fi
482 CPPFLAGS="$OLD_CPPFLAGS"
483 LDFLAGS="$OLD_LDFLAGS"
484 LIBS="$OLD_LIBS"
485 ###################################################################### libid3tag
486 AC_MSG_CHECKING(for libid3tag)
487 AC_TRY_LINK([
488 #include <id3tag.h>
489 ],[
490 struct id3_tag t = {.flags = 0};
491 ],[have_libid3tag=yes],[have_libid3tag=no])
492 AC_MSG_RESULT($have_libid3tag)
493 if test ${have_libid3tag} = yes; then
494 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
495 server_ldflags="$server_ldflags -lid3tag"
496 afh_ldflags="$afh_ldflags -lid3tag"
497 else
498 AC_MSG_WARN([no support for id3v2 tags])
499 fi
500 ########################################################################### oss
501 OLD_CPPFLAGS="$CPPFLAGS"
502 OLD_LD_FLAGS="$LDFLAGS"
503 OLD_LIBS="$LIBS"
504
505 have_oss="yes"
506 msg="=> will not build para_fade/oss writer"
507
508 AC_CHECK_HEADER(sys/soundcard.h, [
509 extras="$extras fade"
510 executables="$executables fade"
511 all_errlist_objs="$all_errlist_objs oss_write"
512 audiod_errlist_objs="$audiod_errlist_objs oss_write"
513 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
514
515 write_errlist_objs="$write_errlist_objs oss_write"
516 write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
517 writers="$writers oss"
518 default_writer="OSS_WRITE"
519 AC_CHECK_LIB(ossaudio, _oss_ioctl, [
520 audiod_ldflags="$audiod_ldflags -lossaudio"
521 write_ldflags="$write_ldflags -lossaudio"
522 fade_ldflags="$write_ldflags -lossaudio"
523 ]
524 )
525 ],
526 [
527 have_oss="no"
528 AC_MSG_WARN([no sys/soundcard.h $msg])
529 ]
530 )
531 CPPFLAGS="$OLD_CPPFLAGS"
532 LDFLAGS="$OLD_LDFLAGS"
533 LIBS="$OLD_LIBS"
534
535 ########################################################################### alsa
536 OLD_CPPFLAGS="$CPPFLAGS"
537 OLD_LD_FLAGS="$LDFLAGS"
538 OLD_LIBS="$LIBS"
539
540 msg="=> no alsa support for para_audiod/para_write"
541 if test "$OSTYPE" != "Linux"; then
542 have_alsa="no"
543 else
544 have_alsa="yes"
545 fi
546 if test "$have_alsa" = "yes"; then
547 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
548 have_alsa="no"
549 AC_MSG_WARN([no alsa/asoundlib $msg])
550 ])
551 fi
552
553 if test "$have_alsa" = "yes"; then
554 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
555 have_alsa="no"
556 AC_MSG_WARN([no libasound $msg])
557 ])
558 fi
559
560 if test "$have_alsa" = "yes"; then
561 all_errlist_objs="$all_errlist_objs alsa_write"
562 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
563 audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
564 audiod_ldflags="$audiod_ldflags -lasound"
565
566 write_errlist_objs="$write_errlist_objs alsa_write"
567 write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
568 write_ldflags="$write_ldflags -lasound"
569 writers="$writers alsa"
570 default_writer="ALSA_WRITE"
571 fi
572
573 CPPFLAGS="$OLD_CPPFLAGS"
574 LDFLAGS="$OLD_LDFLAGS"
575 LIBS="$OLD_LIBS"
576
577 AC_SUBST(install_sh, [$INSTALL])
578 AC_CONFIG_FILES([Makefile])
579
580
581 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
582 AC_DEFUN([add_para],[$(for i in $@; do printf "para_$i "; done)])
583 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) }])
584 ############################################################# error2.h
585 AC_DEFUN([define_safe_error_enums],
586 [
587 exe=""
588 for i in $executables; do
589 # eval echo checking if $1 is linked into $i
590 for j in $(eval echo \$${i}_errlist_objs); do
591 if test $j = $1; then
592 exe="$exe $i"
593 break;
594 fi
595 done
596 done
597 #echo "$1 gets linked into $exe"
598 safe_errlists=""
599 for i in $all_errlist_objs; do
600 for j in $exe; do
601 found=0
602 for k in $(eval echo \$${j}_errlist_objs); do
603 if test $k = $i; then
604 found=1
605 break;
606 fi
607 done
608 if test $found -eq 0; then
609 break;
610 fi
611 done
612 if test $found -eq 1; then
613 safe_errlists="$safe_errlists $i"
614 fi
615 done
616 #echo "safe errlists for $1: $safe_errlists"
617 ss_defs=""
618 for i in $safe_errlists; do
619 echo "SS_ENUM($(echo $i | tr 'a-z' 'A-Z'));"
620 done
621 ]
622 )
623
624
625 AC_MSG_NOTICE(creating error2.h)
626 for obj in $all_errlist_objs; do
627 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
628 echo "#ifdef MAIN_INPUT_FILE_IS_$obj"
629 define_safe_error_enums($obj)
630 echo "#endif"
631 done > error2.h
632 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
633 [enum {$SS NUM_SS}],
634 [list of all objects that use paraslash's error facility]
635 )
636
637 ################################################################## status items
638
639 status_items="basename status num_played mtime bitrate frequency file_size
640 status_flags format score techinfo afs_mode
641 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
642 offset seconds_total stream_start current_time audiod_uptime image_id
643 lyrics_id duration directory lyrics_name image_name path hash channels
644 last_played num_chunks chunk_time amplification artist title year album
645 comment"
646
647 # $1: prefix, $2: items
648 AC_DEFUN([make_enum_items], [$(
649 for i in $2; do
650 printf "$1_$(echo $i | tr 'a-z' 'A-Z'), "
651 done
652 )])
653
654 # $1: prefix, $2: items
655 AC_DEFUN([make_enum_array], [$(
656 for i in $2; do
657 printf "\"$i\", "
658 done
659 )])
660
661 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM,
662 make_enum_items(SI, $status_items),
663 [enum of all status items]
664 )
665 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY,
666 make_enum_array(SI, $status_items),
667 [char * array of all status items]
668 )
669
670
671 AC_SUBST(executables, add_para($executables))
672
673 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
674 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
675 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
676 server_objs="$server_cmdline_objs $server_errlist_objs"
677 write_objs="$write_cmdline_objs $write_errlist_objs"
678 client_objs="$client_cmdline_objs $client_errlist_objs"
679 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
680 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
681 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
682
683 AC_SUBST(recv_objs, add_dot_o($recv_objs))
684 AC_SUBST(recv_ldflags, $recv_ldflags)
685 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
686 errors used by para_recv)
687
688 AC_SUBST(filter_objs, add_dot_o($filter_objs))
689 AC_SUBST(filter_ldflags, $filter_ldflags)
690 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
691 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
692
693 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
694 AC_SUBST(audiod_ldflags, $audiod_ldflags)
695 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
696 errors used by para_audiod)
697
698 AC_SUBST(server_objs, add_dot_o($server_objs))
699 AC_SUBST(server_ldflags, $server_ldflags)
700 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
701 objlist_to_errlist($server_errlist_objs), errors used by para_server)
702
703 AC_SUBST(afh_objs, add_dot_o($afh_objs))
704 AC_SUBST(afh_ldflags, $afh_ldflags)
705 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
706 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
707
708 AC_SUBST(write_objs, add_dot_o($write_objs))
709 AC_SUBST(write_ldflags, $write_ldflags)
710 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
711 objlist_to_errlist($write_errlist_objs), errors used by para_write)
712
713 AC_SUBST(client_objs, add_dot_o($client_objs))
714 AC_SUBST(client_ldflags, $client_ldflags)
715 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
716 objlist_to_errlist($client_errlist_objs), errors used by para_client)
717
718 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
719 AC_SUBST(audioc_ldflags, $audioc_ldflags)
720 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
721 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
722
723 AC_SUBST(gui_objs, add_dot_o($gui_objs))
724 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
725 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
726
727 AC_SUBST(fade_objs, add_dot_o($fade_objs))
728 AC_SUBST(fade_ldflags, $fade_ldflags)
729 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
730 objlist_to_errlist($fade_errlist_objs), errors used by para_fade)
731
732
733 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
734 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
735 enum of supported filters)
736 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
737 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
738 array="$(for i in $filters; do printf '{.name = "'$i'", .init = '$i'_filter_init},'; done)"
739 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
740
741 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
742 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
743 enum of supported writers)
744 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
745 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
746 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
747 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
748 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
749 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
750 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
751
752 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
753 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
754 enum of audio formats supported by audiod)
755 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
756 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
757
758 AC_OUTPUT
759 AC_MSG_NOTICE([
760 paraslash configuration:
761 ~~~~~~~~~~~~~~~~~~~~~~~~
762 unix socket credentials: $have_ucred
763 audio formats supported by para_server/para_afh: $server_audio_formats
764 id3 version2 support: $have_libid3tag
765 filters supported by para_audiod/para_filter: $filters
766 writers supported by para_audiod/para_write: $writers
767 optional executables: $extras
768 ])