configure.ac: Add some missing checks.
[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 AC_CHECK_HEADER(linux/soundcard.h, [extras="$extras para_fade"],
40 [AC_MSG_WARN([linux/soundcard.h not found, cannot build para_fade])])
41
42 # Checks for typedefs, structures, and compiler characteristics.
43 AC_C_CONST
44 AC_C_INLINE
45 AC_TYPE_OFF_T
46 AC_TYPE_PID_T
47 AC_TYPE_SIZE_T
48 AC_HEADER_TIME
49 AC_STRUCT_TM
50 AC_TYPE_INT16_T
51 AC_TYPE_INT32_T
52 AC_TYPE_INT64_T
53 AC_TYPE_MODE_T
54 AC_TYPE_SSIZE_T
55 AC_TYPE_UID_T
56 AC_TYPE_UINT8_T
57 AC_TYPE_UINT16_T
58 AC_TYPE_UINT32_T
59 AC_TYPE_UINT64_T
60
61 # Checks for library functions.
62 AC_FUNC_FORK
63 AC_PROG_GCC_TRADITIONAL
64 AC_FUNC_MALLOC
65 AC_FUNC_MEMCMP
66 AC_FUNC_MKTIME
67 AC_FUNC_MMAP
68 AC_FUNC_REALLOC
69 AC_FUNC_SELECT_ARGTYPES
70 AC_TYPE_SIGNAL
71 AC_FUNC_STAT
72 AC_FUNC_STRFTIME
73 AC_FUNC_VPRINTF
74 AC_FUNC_CLOSEDIR_VOID
75 AC_FUNC_LSTAT
76
77 AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
78 regcomp select strchr strdup strerror strstr strtol uname \
79 fchdir gettimeofday localtime_r munmap strcasecmp strcspn \
80 strncasecmp strrchr strspn alarm inet_ntoa mkdir \
81 rmdir socket], [],
82 [AC_MSG_ERROR([function not found, cannot live without it])])
83
84 all_errlist_objs="server mp3_afh afh_common vss command net string signal time
85 daemon stat crypt http_send close_on_fork ipc
86 dccp_send fd user_list chunk_queue afs osl aft mood score attribute blob ringbuffer
87 playlist sha1 rbtree sched audiod grab_client filter_chain wav compress
88 http_recv dccp_recv recv_common write_common file_write audiod_command
89 client_common recv stdout filter stdin audioc write client fsck exec"
90 all_executables="server audiod recv filter audioc write client fsck"
91
92 recv_cmdline_objs="recv.cmdline http_recv.cmdline dccp_recv.cmdline"
93 recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
94 fd sched stdout"
95 recv_ldflags=""
96
97 receivers=" http dccp"
98 senders=" http dccp"
99
100 filter_cmdline_objs="filter.cmdline compress_filter.cmdline"
101 filter_errlist_objs="filter_chain wav compress filter string stdin stdout sched fd"
102 filter_ldflags=""
103 filters=" compress wav"
104
105 audioc_cmdline_objs="audioc.cmdline"
106 audioc_errlist_objs="audioc string net fd"
107 audioc_ldflags=""
108
109 audiod_cmdline_objs="audiod.cmdline grab_client.cmdline compress_filter.cmdline
110 http_recv.cmdline dccp_recv.cmdline file_write.cmdline client.cmdline
111 audiod_command_list"
112 audiod_errlist_objs="audiod signal string daemon stat net
113 time grab_client filter_chain wav compress http_recv dccp_recv
114 recv_common fd sched write_common file_write audiod_command crypt
115 client_common"
116 audiod_ldflags=""
117 audiod_audio_formats=""
118
119 server_cmdline_objs="server.cmdline server_command_list afs_command_list"
120 server_errlist_objs="server afh_common mp3_afh vss command net string signal
121 time daemon stat crypt http_send close_on_fork
122 ipc dccp_send fd user_list chunk_queue afs osl aft mood score attribute
123 blob playlist sha1 rbtree sched"
124 server_ldflags=""
125 server_audio_formats=" mp3"
126
127 write_cmdline_objs="write.cmdline file_write.cmdline"
128 write_errlist_objs="write write_common file_write time fd string sched stdin"
129 write_ldflags=""
130 writers=" file"
131 default_writer="FILE_WRITE"
132
133 client_cmdline_objs="client.cmdline"
134 client_errlist_objs="client net string crypt fd sched stdin stdout client_common"
135 client_ldflags=""
136
137 fsck_cmdline_objs="fsck.cmdline"
138 fsck_errlist_objs="osl rbtree fsck string sha1 fd"
139
140 gui_cmdline_objs="gui.cmdline"
141 gui_errlist_objs="exec close_on_fork signal string stat ringbuffer fd"
142 gui_other_objs="gui gui_common gui_theme"
143 gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
144
145 ########################################################################### ssl
146 dnl @synopsis CHECK_SSL
147 dnl
148 dnl based on the follwing macro from the autoconf archive
149 dnl
150 dnl @category InstalledPackages
151 dnl @author Mark Ethan Trostler <trostler@juniper.net>
152 dnl @version 2003-01-28
153 dnl @license AllPermissive
154
155 AC_DEFUN([CHECK_SSL],
156 [
157 for ssldir in $1 /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
158 AC_MSG_CHECKING(for openssl in $ssldir)
159 if test -f "$ssldir/include/openssl/ssl.h"; then
160 found_ssl="yes"
161 AC_MSG_RESULT(yes)
162 SSL_CFLAGS="-I$ssldir/include"
163 SSL_CPPFLAGS="-I$ssldir/include"
164 break
165 fi
166 AC_MSG_RESULT(no)
167 done
168 if test x_$found_ssl != x_yes; then
169 AC_MSG_ERROR(Cannot find ssl libraries)
170 else
171 SSL_LIBS="-lssl -lcrypto";
172 SSL_LDFLAGS="-L$ssldir/lib";
173 fi
174 AC_SUBST(SSL_CPPFLAGS)
175 AC_SUBST(SSL_CFLAGS)
176 AC_SUBST(SSL_LIBS)
177 AC_SUBST(SSL_LDFLAGS)
178 ])dnl
179
180 AC_ARG_ENABLE(ssldir, [AS_HELP_STRING(--enable-ssldir=path,
181 [Search for openssl also in path.])])
182 if test "$enable_ssldir" = "yes"; then enable_ssldir=""; fi
183 CHECK_SSL($enable_ssldir)
184 server_ldflags="$srver_ldflags $SSL_LDFLAGS $SSL_LIBS"
185 client_ldflags="$client_ldflags $SSL_LDFLAGS $SSL_LIBS"
186 audiod_ldflags="$audiod_ldflags $SSL_LDFLAGS $SSL_LIBS"
187 fsck_ldflags="$fsck_ldflags $SSL_LDFLAGS $SSL_LIBS"
188
189 ########################################################################### libsocket
190 AC_CHECK_LIB([c], [socket],
191 [socket_lib=],
192 [socket_lib="-lsocket"]
193 )
194 server_ldflags="$server_ldflags $socket_lib"
195 client_ldflags="$client_ldflags $socket_lib"
196 audioc_ldflags="$audioc_ldflags $socket_lib"
197 recv_ldflags="$recv_ldflags $socket_lib"
198 ########################################################################### libnsl
199 AC_CHECK_LIB([c], [gethostbyname],
200 [nsl_lib=],
201 [nsl_lib="-lnsl"]
202 )
203 server_ldflags="$server_ldflags $nsl_lib"
204 client_ldflags="$client_ldflags $nsl_lib"
205 audioc_ldflags="$audioc_ldflags $nsl_lib"
206 recv_ldflags="$recv_ldflags $nsl_lib"
207 ########################################################################### ucred
208 AC_MSG_CHECKING(for struct ucred)
209 AC_TRY_LINK([
210 #include <sys/types.h>
211 #include <sys/socket.h>
212 ],[
213 struct ucred sucred; sucred.pid=0;
214 ],[have_ucred=yes],[have_ucred=no])
215 AC_MSG_RESULT($have_ucred)
216 if test ${have_ucred} = yes; then
217 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
218 fi
219
220 ########################################################################### curses
221 have_ncurses="yes"
222 OLD_CPPFLAGS="$CPPFLAGS"
223 OLD_LD_FLAGS="$LDFLAGS"
224 OLD_LIBS="$LIBS"
225 AC_ARG_WITH(ncurses_headers, [AC_HELP_STRING(--with-ncurses-headers=dir,
226 [look for ncurses.h also in dir])])
227 if test -n "$with_ncurses_headers"; then
228 ncurses_cppflags="-I$with_ncurses_headers"
229 CPPFLAGS="$CPPFLAGS $ncurses_cppflags"
230 fi
231 AC_ARG_WITH(ncurses_libs, [AC_HELP_STRING(--with-ncurses-libs=dir,
232 [look for libncurses also in dir])])
233 if test -n "$with_ncurses_libs"; then
234 ncurses_libs="-L$with_ncurses_libs"
235 LDFLAGS="$LDFLAGS $ncurses_libs"
236 fi
237 AC_CHECK_HEADER(curses.h, [], [
238 have_ncurses="no"
239 ])
240 AC_CHECK_LIB([ncurses], [initscr], [], [
241 have_ncurses="no"
242 ])
243 if test "$have_ncurses" = "yes"; then
244 AC_SUBST(ncurses_cppflags)
245 AC_SUBST(ncurses_libs)
246 AC_DEFINE(HAVE_NCURSES, 1, [define to 1 to turn on ncurses support])
247 extras="$extras para_gui"
248 all_executables="$all_executables gui"
249 else
250 AC_MSG_WARN([cannot build para_gui])
251 fi
252 CPPFLAGS="$OLD_CPPFLAGS"
253 LDFLAGS="$OLD_LDFLAGS"
254 LIBS="$OLD_LIBS"
255 ########################################################################### osx
256
257 AC_MSG_CHECKING(for CoreAudio (MacOs))
258 AC_TRY_LINK([
259 #include <CoreAudio/CoreAudio.h>
260 ],[
261 AudioDeviceID id;
262 ],[have_core_audio=yes],[have_core_audio=no])
263 AC_MSG_RESULT($have_core_audio)
264 if test ${have_core_audio} = yes; then
265 f1="-framework CoreAudio"
266 f2="-framework AudioToolbox"
267 f3="-framework AudioUnit"
268 f4="-framework CoreServices"
269 f="$f1 $f2 $f3 $f4"
270
271 all_errlist_objs="$all_errlist_objs osx_write"
272 audiod_errlist_objs="$audiod_errlist_objs osx_write"
273 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
274 audiod_ldflags="$audiod_ldflags $f"
275
276 write_errlist_objs="$write_errlist_objs osx_write"
277 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
278 write_ldflags="$write_ldflags $f"
279 writers="$writers osx"
280 default_writer="OSX_WRITE"
281 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
282 fi
283 ########################################################################### ogg
284 have_ogg="yes"
285 OLD_CPPFLAGS="$CPPFLAGS"
286 OLD_LD_FLAGS="$LDFLAGS"
287 OLD_LIBS="$LIBS"
288 AC_ARG_WITH(oggvorbis_headers, [AC_HELP_STRING(--with-oggvorbis-headers=dir,
289 [look for vorbis/codec.h also in dir])])
290 if test -n "$with_oggvorbis_headers"; then
291 oggvorbis_cppflags="-I$with_oggvorbis_headers"
292 CPPFLAGS="$CPPFLAGS $oggvorbis_cppflags"
293 fi
294 AC_ARG_WITH(oggvorbis_libs, [AC_HELP_STRING(--with-oggvorbis-libs=dir,
295 [look for oggvorbis libs also in dir])])
296 if test -n "$with_oggvorbis_libs"; then
297 oggvorbis_libs="-L$with_oggvorbis_libs"
298 LDFLAGS="$LDFLAGS $oggvorbis_libs"
299 fi
300
301 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
302 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_ogg="no" ])
303 AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [ have_ogg="no" ])
304 if test "$have_ogg" = "yes"; then
305 all_errlist_objs="$all_errlist_objs oggdec ogg_afh"
306 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support)
307 filters="$filters oggdec"
308 if test "$OSTYPE" = "Darwin"; then
309 oggvorbis_libs="-Wl,-bind_at_load $oggvorbis_libs"
310 fi
311 server_ldflags="$server_ldflags $oggvorbis_libs -logg -lvorbis -lvorbisfile"
312 filter_ldflags="$filter_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
313 audiod_ldflags="$audiod_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
314
315 filter_cmdline_objs="$filter_cmdline_objs oggdec_filter.cmdline"
316 audiod_cmdline_objs="$audiod_cmdline_objs oggdec_filter.cmdline"
317
318 server_errlist_objs="$server_errlist_objs ogg_afh"
319 filter_errlist_objs="$filter_errlist_objs oggdec"
320 audiod_errlist_objs="$audiod_errlist_objs oggdec"
321
322 audiod_audio_formats="ogg"
323 server_audio_formats="$server_audio_formats ogg"
324 filter_filters="$filter_filters oggdec"
325 AC_SUBST(oggvorbis_cppflags)
326 AC_SUBST(oggvorbis_libs)
327 else
328 AC_MSG_WARN([no ogg vorbis support in para_server/para_filter])
329 fi
330 CPPFLAGS="$OLD_CPPFLAGS"
331 LDFLAGS="$OLD_LDFLAGS"
332 LIBS="$OLD_LIBS"
333 ########################################################################### faad
334 have_faad=yes
335 OLD_CPPFLAGS="$CPPFLAGS"
336 OLD_LD_FLAGS="$LDFLAGS"
337 OLD_LIBS="$LIBS"
338 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
339 [look for neaacdec.h also in dir])])
340 if test -n "$with_faad_headers"; then
341 faad_cppflags="-I$with_faad_headers"
342 CPPFLAGS="$CPPFLAGS $faad_cppflags"
343 fi
344 AC_ARG_WITH(faad_libs, [AC_HELP_STRING(--with-faad-libs=dir,
345 [look for libfaad also in dir])])
346 if test -n "$with_faad_libs"; then
347 faad_libs="-L$with_faad_libs"
348 LDFLAGS="$LDFLAGS $faad_libs"
349 fi
350 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
351 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
352 if test "$have_faad" = "yes"; then
353 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
354 all_errlist_objs="$all_errlist_objs aac_common aacdec aac_afh"
355 filter_errlist_objs="$filter_errlist_objs aacdec aac_common"
356 filter_filters="$filter_filters aacdec"
357 audiod_errlist_objs="$audiod_errlist_objs aacdec aac_common"
358 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
359 server_ldflags="$server_ldflags $faad_libs -lfaad"
360 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
361 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
362 audiod_audio_formats="$audiod_audio_formats aac"
363 server_audio_formats="$server_audio_formats aac"
364 filters="$filters aacdec"
365 AC_SUBST(faad_cppflags)
366 AC_SUBST(faad_libs)
367 else
368 AC_MSG_WARN([no aac support in para_audiod/para_filter])
369 fi
370 CPPFLAGS="$OLD_CPPFLAGS"
371 LDFLAGS="$OLD_LDFLAGS"
372 LIBS="$OLD_LIBS"
373 ########################################################################### mad
374 have_mad="yes"
375 OLD_CPPFLAGS="$CPPFLAGS"
376 OLD_LD_FLAGS="$LDFLAGS"
377 OLD_LIBS="$LIBS"
378
379 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
380 [look for mad.h also in dir])])
381 if test -n "$with_mad_headers"; then
382 mad_cppflags="-I$with_mad_headers"
383 CPPFLAGS="$CPPFLAGS $mad_cppflags"
384 fi
385 AC_ARG_WITH(mad_libs, [AC_HELP_STRING(--with-mad-libs=dir,
386 [look for libmad also in dir])])
387 if test -n "$with_mad_libs"; then
388 mad_libs="-L$with_mad_libs"
389 LDFLAGS="$LDFLAGS $mad_libs"
390 fi
391 AC_CHECK_HEADERS([mad.h], [], [
392 have_mad="no"
393 ])
394 AC_CHECK_LIB([mad], [mad_stream_init], [], [
395 have_mad="no"
396 ])
397 if test "$have_mad" = "yes"; then
398 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
399 all_errlist_objs="$all_errlist_objs mp3dec"
400 filter_errlist_objs="$filter_errlist_objs mp3dec"
401 audiod_errlist_objs="$audiod_errlist_objs mp3dec"
402 filter_ldflags="$filter_ldflags $mad_libs -lmad"
403 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
404 audiod_audio_formats="$audiod_audio_formats mp3"
405 filters="$filters mp3dec"
406 AC_SUBST(mad_cppflags)
407 AC_SUBST(mad_libs)
408 else
409 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
410 fi
411 if test -n "$audiod_audio_formats"; then
412 extras="$extras para_audiod"
413 else
414 AC_MSG_WARN([can not build para_audiod (no supported audio formats)])
415 fi
416 CPPFLAGS="$OLD_CPPFLAGS"
417 LDFLAGS="$OLD_LDFLAGS"
418 LIBS="$OLD_LIBS"
419 ########################################################################### alsa
420 have_alsa="yes"
421 OLD_CPPFLAGS="$CPPFLAGS"
422 OLD_LD_FLAGS="$LDFLAGS"
423 OLD_LIBS="$LIBS"
424 msg="=> no alsa support for para_audiod/para_write"
425 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
426 AC_MSG_WARN([no alsa/asoundlib $msg])
427 have_alsa="no"
428 ])
429 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
430 AC_MSG_WARN([no libasound $msg])
431 have_alsa="no"
432 ])
433 if test "$have_alsa" = "yes"; then
434 all_errlist_objs="$all_errlist_objs alsa_write"
435 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
436 audiod_cmdline_objs="$audiod_cmdline_objs alsa_write.cmdline"
437 audiod_ldflags="$audiod_ldflags -lasound"
438
439 write_errlist_objs="$write_errlist_objs alsa_write"
440 write_cmdline_objs="$write_cmdline_objs alsa_write.cmdline"
441 write_ldflags="$write_ldflags -lasound"
442 writers="$writers alsa"
443 default_writer="ALSA_WRITE"
444 fi
445 CPPFLAGS="$OLD_CPPFLAGS"
446 LDFLAGS="$OLD_LDFLAGS"
447 LIBS="$OLD_LIBS"
448 ########################################################################### ortp
449 have_ortp="yes"
450 OLD_CPPFLAGS="$CPPFLAGS"
451 OLD_LD_FLAGS="$LDFLAGS"
452 OLD_LIBS="$LIBS"
453 AC_ARG_WITH(ortp_headers, [AC_HELP_STRING(--with-ortp-headers=dir,
454 [look for ortp/ortp.h also in dir])])
455 if test -n "$with_ortp_headers"; then
456 ortp_cppflags="-I$with_ortp_headers"
457 CPPFLAGS="$CPPFLAGS $ortp_cppflags"
458 fi
459 AC_ARG_WITH(ortp_libs, [AC_HELP_STRING(--with-ortp-libs=dir,
460 [look for libortp also in dir])])
461 if test -n "$with_ortp_libs"; then
462 ortp_libs="-L$with_ortp_libs"
463 LDFLAGS="$LDFLAGS $ortp_libs"
464 fi
465 AC_CHECK_HEADERS([ortp/ortp.h], [], [have_ortp="no"])
466 AC_CHECK_LIB([ortp], [ortp_init], [], [have_ortp="no"])
467 if test "$have_ortp" = "yes"; then
468 all_errlist_objs="$all_errlist_objs ortp_recv ortp_send"
469
470 recv_cmdline_objs="$recv_cmdline_objs ortp_recv.cmdline"
471 recv_errlist_objs="$recv_errlist_objs ortp_recv"
472
473 audiod_cmdline_objs="$audiod_cmdline_objs ortp_recv.cmdline"
474 audiod_errlist_objs="$audiod_errlist_objs ortp_recv"
475
476 server_errlist_objs="$server_errlist_objs ortp_send"
477
478 recv_ldflags="$recv_ldflags $ortp_libs -lortp"
479 server_ldflags="$server_ldflags $ortp_libs -lortp"
480 audiod_ldflags="$audiod_ldflags $ortp_libs -lortp"
481
482 receivers="$receivers ortp"
483 senders="$senders ortp"
484 AC_DEFINE(HAVE_ORTP, 1, [define to 1 to turn on ortp support])
485 AC_SUBST(ortp_cppflags)
486 AC_SUBST(ortp_libs)
487 else
488 AC_MSG_NOTICE([deactivating ortp sender/receiver])
489 fi
490 CPPFLAGS="$OLD_CPPFLAGS"
491 LDFLAGS="$OLD_LDFLAGS"
492 LIBS="$OLD_LIBS"
493
494
495 AC_SUBST(extra_binaries, [$extras])
496 AC_SUBST(extra_filter_objs, [$extra_filter_objs])
497 AC_SUBST(extra_filter_libs, [$extra_filter_libs])
498 AC_SUBST(install_sh, [$INSTALL])
499 AC_CONFIG_FILES([Makefile])
500
501
502 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
503 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) }])
504
505 ############################################################# error2.h
506
507 AC_DEFUN([define_safe_error_enums],
508 [
509 exe=""
510 for i in $all_executables; do
511 # eval echo checking if $1 is linked into $i
512 for j in $(eval echo \$${i}_errlist_objs); do
513 if test $j = $1; then
514 exe="$exe $i"
515 break;
516 fi
517 done
518 done
519 #echo "$1 gets linked into $exe"
520 safe_errlists=""
521 for i in $all_errlist_objs; do
522 for j in $exe; do
523 found=0
524 for k in $(eval echo \$${j}_errlist_objs); do
525 if test $k = $i; then
526 found=1
527 break;
528 fi
529 done
530 if test $found -eq 0; then
531 break;
532 fi
533 done
534 if test $found -eq 1; then
535 safe_errlists="$safe_errlists $i"
536 fi
537 done
538 #echo "safe errlists for $1: $safe_errlists"
539 ss_defs=""
540 for i in $safe_errlists; do
541 echo "SS_ENUM($(echo $i | tr 'a-z' 'A-Z'));"
542 done
543 ]
544 )
545
546
547 AC_MSG_NOTICE(creating error2.h)
548 for obj in $all_errlist_objs; do
549 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
550 echo "#ifdef MAIN_INPUT_FILE_IS_$obj"
551 define_safe_error_enums($obj)
552 echo "#endif"
553 done > error2.h
554 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
555 [enum {$SS NUM_SS}],
556 [list of all objects that use paraslash's error facility]
557 )
558
559 ################################################################## status items
560
561 status_items="basename status num_played mtime bitrate frequency file_size
562 status_flags format score audio_file_info taginfo1 taginfo2 afs_mode
563 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
564 offset seconds_total stream_start current_time audiod_uptime image_id
565 lyrics_id duration directory lyrics_name image_name path hash channels
566 last_played num_chunks chunk_time"
567
568 # $1: prefix, $2: items
569 AC_DEFUN([make_enum_items], [$(
570 for i in $2; do
571 printf "$1_$(echo $i | tr 'a-z' 'A-Z'), "
572 done
573 )])
574
575 # $1: prefix, $2: items
576 AC_DEFUN([make_enum_array], [$(
577 for i in $2; do
578 printf "\"$i\", "
579 done
580 )])
581
582 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM,
583 make_enum_items(SI, $status_items),
584 [enum of all status items]
585 )
586 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY,
587 make_enum_array(SI, $status_items),
588 [char * array of all status items]
589 )
590
591
592 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
593 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
594 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
595 server_objs="$server_cmdline_objs $server_errlist_objs"
596 write_objs="$write_cmdline_objs $write_errlist_objs"
597 client_objs="$client_cmdline_objs $client_errlist_objs"
598 fsck_objs="$fsck_cmdline_objs $fsck_errlist_objs"
599 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
600
601 AC_SUBST(recv_objs, add_dot_o($recv_objs))
602 AC_SUBST(recv_ldflags, $recv_ldflags)
603 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
604 errors used by para_recv)
605
606 AC_SUBST(filter_objs, add_dot_o($filter_objs))
607 AC_SUBST(filter_ldflags, $filter_ldflags)
608 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
609 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
610
611 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
612 AC_SUBST(audiod_ldflags, $audiod_ldflags)
613 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
614 errors used by para_audiod)
615
616 AC_SUBST(server_objs, add_dot_o($server_objs))
617 AC_SUBST(server_ldflags, $server_ldflags)
618 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
619 objlist_to_errlist($server_errlist_objs), errors used by para_server)
620
621 AC_SUBST(write_objs, add_dot_o($write_objs))
622 AC_SUBST(write_ldflags, $write_ldflags)
623 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
624 objlist_to_errlist($write_errlist_objs), errors used by para_write)
625
626 AC_SUBST(client_objs, add_dot_o($client_objs))
627 AC_SUBST(client_ldflags, $client_ldflags)
628 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
629 objlist_to_errlist($client_errlist_objs), errors used by para_client)
630
631 AC_SUBST(fsck_objs, add_dot_o($fsck_objs))
632 AC_SUBST(fsck_ldflags, $fsck_ldflags)
633 AC_DEFINE_UNQUOTED(INIT_FSCK_ERRLISTS,
634 objlist_to_errlist($fsck_errlist_objs), errors used by para_fsck)
635
636 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
637 AC_SUBST(audioc_ldflags, $audioc_ldflags)
638 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
639 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
640
641 AC_SUBST(gui_objs, add_dot_o($gui_objs))
642 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
643 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
644
645 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
646 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
647 enum of supported writers)
648 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
649 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
650 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
651 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
652 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
653 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
654 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
655 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
656 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
657 enum of audio formats supported by audiod)
658 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
659 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
660
661 AC_OUTPUT
662 AC_MSG_NOTICE([creating Makefile.deps])
663 gcc -MM -MG $faad_cppflags $mad_cppflags $ortp_cppflags $oggvorbis_cppflags *.c > Makefile.deps
664 AC_MSG_NOTICE([
665 paraslash configuration:
666 ~~~~~~~~~~~~~~~~~~~~~~~~
667 unix socket credentials: $have_ucred
668 audio formats supported by para_server: $server_audio_formats
669 senders supported by para_server/para_send: $senders
670 receivers supported by para_audiod/para_recv: $receivers
671 filters supported by para_audiod/para_filter: $filters
672 writers supported by para_audiod/para_write: $writers
673 optional executables: $extras
674 ])