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