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