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