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