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