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