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