63cbdc973f7e17d809351c534cf0b9a562766092
[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_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 amp_filter"
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 amp_filter.cmdline"
98 filter_errlist_objs="filter_chain wav compress filter string stdin stdout sched fd amp_filter"
99 filter_ldflags=""
100 filters=" compress wav amp"
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 amp_filter.cmdline"
109 audiod_errlist_objs="audiod signal string daemon stat net
110 time grab_client filter_chain wav compress amp_filter 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 ###################################################################### libid3tag
438 AC_MSG_CHECKING(for libid3tag)
439 AC_TRY_LINK([
440 #include <id3tag.h>
441 ],[
442 struct id3_tag t = {.flags = 0};
443 ],[have_libid3tag=yes],[have_libid3tag=no])
444 AC_MSG_RESULT($have_libid3tag)
445 if test ${have_libid3tag} = yes; then
446 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
447 server_ldflags="$server_ldflags -lid3tag"
448 afh_ldflags="$afh_ldflags -lid3tag"
449 else
450 AC_MSG_WARN([no support for id3v2 tags])
451 fi
452 ########################################################################### alsa
453 have_alsa="yes"
454 OLD_CPPFLAGS="$CPPFLAGS"
455 OLD_LD_FLAGS="$LDFLAGS"
456 OLD_LIBS="$LIBS"
457 if test "$OSTYPE" != "Linux"; then
458 have_alsa="no"
459 fi
460 msg="=> will not build para_fade"
461 if test "$have_alsa" = "yes"; then
462 AC_CHECK_HEADER(linux/soundcard.h, [
463 extras="$extras para_fade"
464 all_executables="$all_executables fade"
465 ],
466 [
467 have_alsa="no"
468 AC_MSG_WARN([no linux/soundcard.h $msg])
469 ]
470 )
471 fi
472 msg="=> no alsa support for para_audiod/para_write"
473 if test "$have_alsa" = "yes"; then
474 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
475 have_alsa="no"
476 AC_MSG_WARN([no alsa/asoundlib $msg])
477 ])
478 fi
479
480 if test "$have_alsa" = "yes"; then
481 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
482 have_alsa="no"
483 AC_MSG_WARN([no libasound $msg])
484 ])
485 fi
486
487 if test "$have_alsa" = "yes"; then
488 all_errlist_objs="$all_errlist_objs alsa_write"
489 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
490 audiod_cmdline_objs="$audiod_cmdline_objs alsa_write.cmdline"
491 audiod_ldflags="$audiod_ldflags -lasound"
492
493 write_errlist_objs="$write_errlist_objs alsa_write"
494 write_cmdline_objs="$write_cmdline_objs alsa_write.cmdline"
495 write_ldflags="$write_ldflags -lasound"
496 writers="$writers alsa"
497 default_writer="ALSA_WRITE"
498 fi
499 CPPFLAGS="$OLD_CPPFLAGS"
500 LDFLAGS="$OLD_LDFLAGS"
501 LIBS="$OLD_LIBS"
502 ########################################################################### ortp
503 have_ortp="yes"
504 OLD_CPPFLAGS="$CPPFLAGS"
505 OLD_LD_FLAGS="$LDFLAGS"
506 OLD_LIBS="$LIBS"
507 AC_ARG_WITH(ortp_headers, [AC_HELP_STRING(--with-ortp-headers=dir,
508 [look for ortp/ortp.h also in dir])])
509 if test -n "$with_ortp_headers"; then
510 ortp_cppflags="-I$with_ortp_headers"
511 CPPFLAGS="$CPPFLAGS $ortp_cppflags"
512 fi
513 AC_ARG_WITH(ortp_libs, [AC_HELP_STRING(--with-ortp-libs=dir,
514 [look for libortp also in dir])])
515 if test -n "$with_ortp_libs"; then
516 ortp_libs="-L$with_ortp_libs"
517 LDFLAGS="$LDFLAGS $ortp_libs"
518 fi
519 AC_CHECK_HEADERS([ortp/ortp.h], [], [have_ortp="no"])
520 AC_CHECK_LIB([ortp], [ortp_init], [], [have_ortp="no"])
521 if test "$have_ortp" = "yes"; then
522 all_errlist_objs="$all_errlist_objs ortp_recv ortp_send"
523
524 recv_cmdline_objs="$recv_cmdline_objs ortp_recv.cmdline"
525 recv_errlist_objs="$recv_errlist_objs ortp_recv"
526
527 audiod_cmdline_objs="$audiod_cmdline_objs ortp_recv.cmdline"
528 audiod_errlist_objs="$audiod_errlist_objs ortp_recv"
529
530 server_errlist_objs="$server_errlist_objs ortp_send"
531
532 recv_ldflags="$recv_ldflags $ortp_libs -lortp"
533 server_ldflags="$server_ldflags $ortp_libs -lortp"
534 audiod_ldflags="$audiod_ldflags $ortp_libs -lortp"
535
536 receivers="$receivers ortp"
537 senders="$senders ortp"
538 AC_DEFINE(HAVE_ORTP, 1, [define to 1 to turn on ortp support])
539 AC_SUBST(ortp_cppflags)
540 AC_SUBST(ortp_libs)
541 else
542 AC_MSG_NOTICE([deactivating ortp sender/receiver])
543 fi
544 CPPFLAGS="$OLD_CPPFLAGS"
545 LDFLAGS="$OLD_LDFLAGS"
546 LIBS="$OLD_LIBS"
547
548
549 AC_SUBST(extra_binaries, [$extras])
550 AC_SUBST(extra_filter_objs, [$extra_filter_objs])
551 AC_SUBST(extra_filter_libs, [$extra_filter_libs])
552 AC_SUBST(install_sh, [$INSTALL])
553 AC_CONFIG_FILES([Makefile])
554
555
556 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
557 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) }])
558
559 ############################################################# error2.h
560 AC_DEFUN([define_safe_error_enums],
561 [
562 exe=""
563 for i in $all_executables; do
564 # eval echo checking if $1 is linked into $i
565 for j in $(eval echo \$${i}_errlist_objs); do
566 if test $j = $1; then
567 exe="$exe $i"
568 break;
569 fi
570 done
571 done
572 #echo "$1 gets linked into $exe"
573 safe_errlists=""
574 for i in $all_errlist_objs; do
575 for j in $exe; do
576 found=0
577 for k in $(eval echo \$${j}_errlist_objs); do
578 if test $k = $i; then
579 found=1
580 break;
581 fi
582 done
583 if test $found -eq 0; then
584 break;
585 fi
586 done
587 if test $found -eq 1; then
588 safe_errlists="$safe_errlists $i"
589 fi
590 done
591 #echo "safe errlists for $1: $safe_errlists"
592 ss_defs=""
593 for i in $safe_errlists; do
594 echo "SS_ENUM($(echo $i | tr 'a-z' 'A-Z'));"
595 done
596 ]
597 )
598
599
600 AC_MSG_NOTICE(creating error2.h)
601 for obj in $all_errlist_objs; do
602 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
603 echo "#ifdef MAIN_INPUT_FILE_IS_$obj"
604 define_safe_error_enums($obj)
605 echo "#endif"
606 done > error2.h
607 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
608 [enum {$SS NUM_SS}],
609 [list of all objects that use paraslash's error facility]
610 )
611
612 ################################################################## status items
613
614 status_items="basename status num_played mtime bitrate frequency file_size
615 status_flags format score audio_file_info taginfo1 taginfo2 afs_mode
616 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
617 offset seconds_total stream_start current_time audiod_uptime image_id
618 lyrics_id duration directory lyrics_name image_name path hash channels
619 last_played num_chunks chunk_time amplification"
620
621 # $1: prefix, $2: items
622 AC_DEFUN([make_enum_items], [$(
623 for i in $2; do
624 printf "$1_$(echo $i | tr 'a-z' 'A-Z'), "
625 done
626 )])
627
628 # $1: prefix, $2: items
629 AC_DEFUN([make_enum_array], [$(
630 for i in $2; do
631 printf "\"$i\", "
632 done
633 )])
634
635 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM,
636 make_enum_items(SI, $status_items),
637 [enum of all status items]
638 )
639 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY,
640 make_enum_array(SI, $status_items),
641 [char * array of all status items]
642 )
643
644
645 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
646 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
647 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
648 server_objs="$server_cmdline_objs $server_errlist_objs"
649 write_objs="$write_cmdline_objs $write_errlist_objs"
650 client_objs="$client_cmdline_objs $client_errlist_objs"
651 fsck_objs="$fsck_cmdline_objs $fsck_errlist_objs"
652 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
653 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
654 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
655
656 AC_SUBST(recv_objs, add_dot_o($recv_objs))
657 AC_SUBST(recv_ldflags, $recv_ldflags)
658 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
659 errors used by para_recv)
660
661 AC_SUBST(filter_objs, add_dot_o($filter_objs))
662 AC_SUBST(filter_ldflags, $filter_ldflags)
663 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
664 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
665
666 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
667 AC_SUBST(audiod_ldflags, $audiod_ldflags)
668 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
669 errors used by para_audiod)
670
671 AC_SUBST(server_objs, add_dot_o($server_objs))
672 AC_SUBST(server_ldflags, $server_ldflags)
673 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
674 objlist_to_errlist($server_errlist_objs), errors used by para_server)
675
676 AC_SUBST(afh_objs, add_dot_o($afh_objs))
677 AC_SUBST(afh_ldflags, $afh_ldflags)
678 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
679 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
680
681 AC_SUBST(write_objs, add_dot_o($write_objs))
682 AC_SUBST(write_ldflags, $write_ldflags)
683 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
684 objlist_to_errlist($write_errlist_objs), errors used by para_write)
685
686 AC_SUBST(client_objs, add_dot_o($client_objs))
687 AC_SUBST(client_ldflags, $client_ldflags)
688 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
689 objlist_to_errlist($client_errlist_objs), errors used by para_client)
690
691 AC_SUBST(fsck_objs, add_dot_o($fsck_objs))
692 AC_SUBST(fsck_ldflags, $fsck_ldflags)
693 AC_DEFINE_UNQUOTED(INIT_FSCK_ERRLISTS,
694 objlist_to_errlist($fsck_errlist_objs), errors used by para_fsck)
695
696 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
697 AC_SUBST(audioc_ldflags, $audioc_ldflags)
698 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
699 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
700
701 AC_SUBST(gui_objs, add_dot_o($gui_objs))
702 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
703 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
704
705 AC_SUBST(fade_objs, add_dot_o($fade_objs))
706 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
707 objlist_to_errlist($fade_errlist_objs), errors used by para_fade)
708
709 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
710 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
711 enum of supported writers)
712 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
713 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
714 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
715 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
716 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
717 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
718 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
719 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
720 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
721 enum of audio formats supported by audiod)
722 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
723 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
724
725 AC_OUTPUT
726 AC_MSG_NOTICE([creating Makefile.deps])
727 gcc -MM -MG $faad_cppflags $mad_cppflags $ortp_cppflags $oggvorbis_cppflags *.c > Makefile.deps
728 AC_MSG_NOTICE([
729 paraslash configuration:
730 ~~~~~~~~~~~~~~~~~~~~~~~~
731 unix socket credentials: $have_ucred
732 audio formats supported by para_server/para_afh: $server_audio_formats
733 id3 version2 support: $have_libid3tag
734 senders supported by para_server: $senders
735 receivers supported by para_audiod/para_recv: $receivers
736 filters supported by para_audiod/para_filter: $filters
737 writers supported by para_audiod/para_write: $writers
738 optional executables: $extras
739 ])