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