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