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