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