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