Add some more derived files to .gitignore.
[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 ########################################################################### osx
271
272 AC_MSG_CHECKING(for CoreAudio (MacOs))
273 AC_TRY_LINK([
274 #include <CoreAudio/CoreAudio.h>
275 ],[
276 AudioDeviceID id;
277 ],[have_core_audio=yes],[have_core_audio=no])
278 AC_MSG_RESULT($have_core_audio)
279 if test ${have_core_audio} = yes; then
280 f1="-framework CoreAudio"
281 f2="-framework AudioToolbox"
282 f3="-framework AudioUnit"
283 f4="-framework CoreServices"
284 f="$f1 $f2 $f3 $f4"
285
286 all_errlist_objs="$all_errlist_objs osx_write"
287 audiod_errlist_objs="$audiod_errlist_objs osx_write"
288 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
289 audiod_ldflags="$audiod_ldflags $f"
290
291 write_errlist_objs="$write_errlist_objs osx_write"
292 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
293 write_ldflags="$write_ldflags $f"
294 writers="$writers osx"
295 default_writer="OSX_WRITE"
296 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
297 fi
298 ########################################################################### ogg
299 have_ogg="yes"
300 OLD_CPPFLAGS="$CPPFLAGS"
301 OLD_LD_FLAGS="$LDFLAGS"
302 OLD_LIBS="$LIBS"
303 AC_ARG_WITH(oggvorbis_headers, [AC_HELP_STRING(--with-oggvorbis-headers=dir,
304 [look for vorbis/codec.h also in dir])])
305 if test -n "$with_oggvorbis_headers"; then
306 oggvorbis_cppflags="-I$with_oggvorbis_headers"
307 CPPFLAGS="$CPPFLAGS $oggvorbis_cppflags"
308 fi
309 AC_ARG_WITH(oggvorbis_libs, [AC_HELP_STRING(--with-oggvorbis-libs=dir,
310 [look for oggvorbis libs also in dir])])
311 if test -n "$with_oggvorbis_libs"; then
312 oggvorbis_libs="-L$with_oggvorbis_libs"
313 LDFLAGS="$LDFLAGS $oggvorbis_libs"
314 fi
315
316 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
317 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_ogg="no" ])
318 AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [ have_ogg="no" ])
319 if test "$have_ogg" = "yes"; then
320 all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh"
321 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support)
322 filters="$filters oggdec"
323 if test "$OSTYPE" = "Darwin"; then
324 oggvorbis_libs="-Wl,-bind_at_load $oggvorbis_libs"
325 fi
326 server_ldflags="$server_ldflags $oggvorbis_libs -logg -lvorbis -lvorbisfile"
327 filter_ldflags="$filter_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
328 audiod_ldflags="$audiod_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
329 afh_ldflags="$afh_ldflags $oggvorbis_libs -logg -lvorbis -lvorbisfile"
330
331 filter_cmdline_objs="$filter_cmdline_objs oggdec_filter.cmdline"
332 audiod_cmdline_objs="$audiod_cmdline_objs oggdec_filter.cmdline"
333
334 server_errlist_objs="$server_errlist_objs ogg_afh"
335 filter_errlist_objs="$filter_errlist_objs oggdec_filter"
336 audiod_errlist_objs="$audiod_errlist_objs oggdec_filter"
337 afh_errlist_objs="$afh_errlist_objs ogg_afh"
338
339 audiod_audio_formats="ogg"
340 server_audio_formats="$server_audio_formats ogg"
341 AC_SUBST(oggvorbis_cppflags)
342 AC_SUBST(oggvorbis_libs)
343 else
344 AC_MSG_WARN([no ogg vorbis support in para_server/para_filter])
345 fi
346 CPPFLAGS="$OLD_CPPFLAGS"
347 LDFLAGS="$OLD_LDFLAGS"
348 LIBS="$OLD_LIBS"
349 ########################################################################### faad
350 have_faad=yes
351 OLD_CPPFLAGS="$CPPFLAGS"
352 OLD_LD_FLAGS="$LDFLAGS"
353 OLD_LIBS="$LIBS"
354 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
355 [look for neaacdec.h also in dir])])
356 if test -n "$with_faad_headers"; then
357 faad_cppflags="-I$with_faad_headers"
358 CPPFLAGS="$CPPFLAGS $faad_cppflags"
359 fi
360 AC_ARG_WITH(faad_libs, [AC_HELP_STRING(--with-faad-libs=dir,
361 [look for libfaad also in dir])])
362 if test -n "$with_faad_libs"; then
363 faad_libs="-L$with_faad_libs"
364 LDFLAGS="$LDFLAGS $faad_libs"
365 fi
366 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
367 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
368 if test "$have_faad" = "yes"; then
369 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
370 all_errlist_objs="$all_errlist_objs aac_common aacdec_filter aac_afh"
371 filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
372 afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
373 audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
374 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
375 server_ldflags="$server_ldflags $faad_libs -lfaad"
376 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
377 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
378 afh_ldflags="$afh_ldflags $faad_libs -lfaad"
379 audiod_audio_formats="$audiod_audio_formats aac"
380 server_audio_formats="$server_audio_formats aac"
381 filters="$filters aacdec"
382 AC_SUBST(faad_cppflags)
383 AC_SUBST(faad_libs)
384 else
385 AC_MSG_WARN([no aac support in para_audiod/para_filter])
386 fi
387 CPPFLAGS="$OLD_CPPFLAGS"
388 LDFLAGS="$OLD_LDFLAGS"
389 LIBS="$OLD_LIBS"
390 ########################################################################### mad
391 have_mad="yes"
392 OLD_CPPFLAGS="$CPPFLAGS"
393 OLD_LD_FLAGS="$LDFLAGS"
394 OLD_LIBS="$LIBS"
395
396 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
397 [look for mad.h also in dir])])
398 if test -n "$with_mad_headers"; then
399 mad_cppflags="-I$with_mad_headers"
400 CPPFLAGS="$CPPFLAGS $mad_cppflags"
401 fi
402 AC_ARG_WITH(mad_libs, [AC_HELP_STRING(--with-mad-libs=dir,
403 [look for libmad also in dir])])
404 if test -n "$with_mad_libs"; then
405 mad_libs="-L$with_mad_libs"
406 LDFLAGS="$LDFLAGS $mad_libs"
407 fi
408 AC_CHECK_HEADERS([mad.h], [], [
409 have_mad="no"
410 ])
411 AC_CHECK_LIB([mad], [mad_stream_init], [], [
412 have_mad="no"
413 ])
414 if test "$have_mad" = "yes"; then
415 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
416 filter_cmdline_objs="$filter_cmdline_objs mp3dec_filter.cmdline"
417 audiod_cmdline_objs="$audiod_cmdline_objs mp3dec_filter.cmdline"
418 all_errlist_objs="$all_errlist_objs mp3dec_filter"
419 filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
420 audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
421 filter_ldflags="$filter_ldflags $mad_libs -lmad"
422 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
423 audiod_audio_formats="$audiod_audio_formats mp3"
424 filters="$filters mp3dec"
425 AC_SUBST(mad_cppflags)
426 AC_SUBST(mad_libs)
427 else
428 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
429 fi
430 if test -n "$audiod_audio_formats"; then
431 extras="$extras para_audiod"
432 all_executables="$all_executables audiod"
433 else
434 AC_MSG_WARN([can not build para_audiod (no supported audio formats)])
435 fi
436 CPPFLAGS="$OLD_CPPFLAGS"
437 LDFLAGS="$OLD_LDFLAGS"
438 LIBS="$OLD_LIBS"
439 ###################################################################### libid3tag
440 AC_MSG_CHECKING(for libid3tag)
441 AC_TRY_LINK([
442 #include <id3tag.h>
443 ],[
444 struct id3_tag t = {.flags = 0};
445 ],[have_libid3tag=yes],[have_libid3tag=no])
446 AC_MSG_RESULT($have_libid3tag)
447 if test ${have_libid3tag} = yes; then
448 AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
449 server_ldflags="$server_ldflags -lid3tag"
450 afh_ldflags="$afh_ldflags -lid3tag"
451 else
452 AC_MSG_WARN([no support for id3v2 tags])
453 fi
454 ########################################################################### alsa
455 have_alsa="yes"
456 OLD_CPPFLAGS="$CPPFLAGS"
457 OLD_LD_FLAGS="$LDFLAGS"
458 OLD_LIBS="$LIBS"
459 if test "$OSTYPE" != "Linux"; then
460 have_alsa="no"
461 fi
462 msg="=> will not build para_fade"
463 if test "$have_alsa" = "yes"; then
464 AC_CHECK_HEADER(linux/soundcard.h, [
465 extras="$extras para_fade"
466 all_executables="$all_executables fade"
467 ],
468 [
469 have_alsa="no"
470 AC_MSG_WARN([no linux/soundcard.h $msg])
471 ]
472 )
473 fi
474 msg="=> no alsa support for para_audiod/para_write"
475 if test "$have_alsa" = "yes"; then
476 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
477 have_alsa="no"
478 AC_MSG_WARN([no alsa/asoundlib $msg])
479 ])
480 fi
481
482 if test "$have_alsa" = "yes"; then
483 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
484 have_alsa="no"
485 AC_MSG_WARN([no libasound $msg])
486 ])
487 fi
488
489 if test "$have_alsa" = "yes"; then
490 all_errlist_objs="$all_errlist_objs alsa_write"
491 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
492 audiod_cmdline_objs="$audiod_cmdline_objs alsa_write.cmdline"
493 audiod_ldflags="$audiod_ldflags -lasound"
494
495 write_errlist_objs="$write_errlist_objs alsa_write"
496 write_cmdline_objs="$write_cmdline_objs alsa_write.cmdline"
497 write_ldflags="$write_ldflags -lasound"
498 writers="$writers alsa"
499 default_writer="ALSA_WRITE"
500 fi
501 CPPFLAGS="$OLD_CPPFLAGS"
502 LDFLAGS="$OLD_LDFLAGS"
503 LIBS="$OLD_LIBS"
504
505 AC_SUBST(extra_binaries, [$extras])
506 AC_SUBST(extra_filter_objs, [$extra_filter_objs])
507 AC_SUBST(extra_filter_libs, [$extra_filter_libs])
508 AC_SUBST(install_sh, [$INSTALL])
509 AC_CONFIG_FILES([Makefile])
510
511
512 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
513 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) }])
514
515 ############################################################# error2.h
516 AC_DEFUN([define_safe_error_enums],
517 [
518 exe=""
519 for i in $all_executables; do
520 # eval echo checking if $1 is linked into $i
521 for j in $(eval echo \$${i}_errlist_objs); do
522 if test $j = $1; then
523 exe="$exe $i"
524 break;
525 fi
526 done
527 done
528 #echo "$1 gets linked into $exe"
529 safe_errlists=""
530 for i in $all_errlist_objs; do
531 for j in $exe; do
532 found=0
533 for k in $(eval echo \$${j}_errlist_objs); do
534 if test $k = $i; then
535 found=1
536 break;
537 fi
538 done
539 if test $found -eq 0; then
540 break;
541 fi
542 done
543 if test $found -eq 1; then
544 safe_errlists="$safe_errlists $i"
545 fi
546 done
547 #echo "safe errlists for $1: $safe_errlists"
548 ss_defs=""
549 for i in $safe_errlists; do
550 echo "SS_ENUM($(echo $i | tr 'a-z' 'A-Z'));"
551 done
552 ]
553 )
554
555
556 AC_MSG_NOTICE(creating error2.h)
557 for obj in $all_errlist_objs; do
558 SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
559 echo "#ifdef MAIN_INPUT_FILE_IS_$obj"
560 define_safe_error_enums($obj)
561 echo "#endif"
562 done > error2.h
563 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
564 [enum {$SS NUM_SS}],
565 [list of all objects that use paraslash's error facility]
566 )
567
568 ################################################################## status items
569
570 status_items="basename status num_played mtime bitrate frequency file_size
571 status_flags format score audio_file_info taginfo1 taginfo2 afs_mode
572 attributes_txt decoder_flags audiod_status play_time attributes_bitmap
573 offset seconds_total stream_start current_time audiod_uptime image_id
574 lyrics_id duration directory lyrics_name image_name path hash channels
575 last_played num_chunks chunk_time amplification"
576
577 # $1: prefix, $2: items
578 AC_DEFUN([make_enum_items], [$(
579 for i in $2; do
580 printf "$1_$(echo $i | tr 'a-z' 'A-Z'), "
581 done
582 )])
583
584 # $1: prefix, $2: items
585 AC_DEFUN([make_enum_array], [$(
586 for i in $2; do
587 printf "\"$i\", "
588 done
589 )])
590
591 AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM,
592 make_enum_items(SI, $status_items),
593 [enum of all status items]
594 )
595 AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY,
596 make_enum_array(SI, $status_items),
597 [char * array of all status items]
598 )
599
600
601 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
602 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
603 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
604 server_objs="$server_cmdline_objs $server_errlist_objs"
605 write_objs="$write_cmdline_objs $write_errlist_objs"
606 client_objs="$client_cmdline_objs $client_errlist_objs"
607 fsck_objs="$fsck_cmdline_objs $fsck_errlist_objs"
608 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
609 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
610 fade_objs="$fade_cmdline_objs $fade_errlist_objs"
611
612 AC_SUBST(recv_objs, add_dot_o($recv_objs))
613 AC_SUBST(recv_ldflags, $recv_ldflags)
614 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
615 errors used by para_recv)
616
617 AC_SUBST(filter_objs, add_dot_o($filter_objs))
618 AC_SUBST(filter_ldflags, $filter_ldflags)
619 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
620 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
621
622 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
623 AC_SUBST(audiod_ldflags, $audiod_ldflags)
624 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
625 errors used by para_audiod)
626
627 AC_SUBST(server_objs, add_dot_o($server_objs))
628 AC_SUBST(server_ldflags, $server_ldflags)
629 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
630 objlist_to_errlist($server_errlist_objs), errors used by para_server)
631
632 AC_SUBST(afh_objs, add_dot_o($afh_objs))
633 AC_SUBST(afh_ldflags, $afh_ldflags)
634 AC_DEFINE_UNQUOTED(INIT_AFH_ERRLISTS,
635 objlist_to_errlist($afh_errlist_objs), errors used by para_afh)
636
637 AC_SUBST(write_objs, add_dot_o($write_objs))
638 AC_SUBST(write_ldflags, $write_ldflags)
639 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
640 objlist_to_errlist($write_errlist_objs), errors used by para_write)
641
642 AC_SUBST(client_objs, add_dot_o($client_objs))
643 AC_SUBST(client_ldflags, $client_ldflags)
644 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
645 objlist_to_errlist($client_errlist_objs), errors used by para_client)
646
647 AC_SUBST(fsck_objs, add_dot_o($fsck_objs))
648 AC_SUBST(fsck_ldflags, $fsck_ldflags)
649 AC_DEFINE_UNQUOTED(INIT_FSCK_ERRLISTS,
650 objlist_to_errlist($fsck_errlist_objs), errors used by para_fsck)
651
652 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
653 AC_SUBST(audioc_ldflags, $audioc_ldflags)
654 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
655 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
656
657 AC_SUBST(gui_objs, add_dot_o($gui_objs))
658 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
659 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
660
661 AC_SUBST(fade_objs, add_dot_o($fade_objs))
662 AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
663 objlist_to_errlist($fade_errlist_objs), errors used by para_fade)
664
665
666 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
667 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
668 enum of supported filters)
669 inits="$(for i in $filters; do printf 'extern void '$i'_filter_init(struct filter *f); '; done)"
670 AC_DEFINE_UNQUOTED(DECLARE_FILTER_INITS, $inits, init functions of the supported filters)
671 array="$(for i in $filters; do printf '{.name = \"'$i'\", .init = '$i'_filter_init},'; done)"
672 AC_DEFINE_UNQUOTED(FILTER_ARRAY, $array, array of supported filters)
673
674 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
675 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
676 enum of supported writers)
677 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
678 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
679 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
680 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
681 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
682 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
683 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
684
685 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
686 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
687 enum of audio formats supported by audiod)
688 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
689 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
690
691 AC_OUTPUT
692 AC_MSG_NOTICE([creating Makefile.deps])
693 gcc -MM -MG $faad_cppflags $mad_cppflags $oggvorbis_cppflags *.c > Makefile.deps
694 AC_MSG_NOTICE([
695 paraslash configuration:
696 ~~~~~~~~~~~~~~~~~~~~~~~~
697 unix socket credentials: $have_ucred
698 audio formats supported by para_server/para_afh: $server_audio_formats
699 id3 version2 support: $have_libid3tag
700 senders supported by para_server: $senders
701 receivers supported by para_audiod/para_recv: $receivers
702 filters supported by para_audiod/para_filter: $filters
703 writers supported by para_audiod/para_write: $writers
704 optional executables: $extras
705 ])