fix compress filter for big endian machines
[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 AC_C_BIGENDIAN()
19
20 AC_PROG_CC
21 AC_PROG_CPP
22 AC_PROG_INSTALL
23
24 AC_HEADER_DIRENT
25 AC_HEADER_STDC
26 AC_HEADER_SYS_WAIT
27 AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h stdlib.h \
28 string.h sys/socket.h sys/time.h sys/timeb.h sys/un.h sys/ipc.h unistd.h utime.h], \
29 [], [AC_MSG_ERROR([$ac_header not found])])
30
31 AC_CHECK_HEADER(linux/soundcard.h, [extras="$extras para_fade"],
32 [AC_MSG_WARN([linux/soundcard.h not found, cannot build para_fade])])
33
34 # Checks for typedefs, structures, and compiler characteristics.
35 AC_C_CONST
36 AC_TYPE_OFF_T
37 AC_TYPE_PID_T
38 AC_TYPE_SIZE_T
39 AC_HEADER_TIME
40 AC_STRUCT_TM
41
42 # Checks for library functions.
43 AC_FUNC_FORK
44 AC_PROG_GCC_TRADITIONAL
45 AC_FUNC_MALLOC
46 AC_FUNC_MEMCMP
47 AC_FUNC_MKTIME
48 AC_FUNC_MMAP
49 AC_FUNC_REALLOC
50 AC_FUNC_SELECT_ARGTYPES
51 AC_TYPE_SIGNAL
52 AC_FUNC_STAT
53 AC_FUNC_STRFTIME
54 AC_FUNC_VPRINTF
55 AC_CHECK_FUNCS([atexit dup2 gethostbyname inet_ntoa memchr memmove memset \
56 regcomp select socket strchr strdup strerror strstr strtol uname], [],
57 [AC_MSG_ERROR([function not found, cannot live without it])])
58 ########################################################################### curses
59 AC_CHECK_LIB([ncurses], [initscr], [],
60 [AC_MSG_ERROR([libncurses not found])])
61
62 AC_CHECK_LIB([menu], [new_menu], [extras="$extras para_dbadm"],
63 [AC_MSG_WARN([libmenu not found, cannot build para_dbadm])])
64
65
66 recv_cmdline_objs="recv.cmdline http_recv.cmdline dccp_recv.cmdline"
67 recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
68 dccp fd sched stdout"
69 recv_ldflags=""
70
71 receivers=" http dccp"
72 senders=" http dccp"
73 selectors=" random playlist"
74
75 filter_cmdline_objs="filter.cmdline compress_filter.cmdline"
76 filter_errlist_objs="filter_chain wav compress filter string stdin stdout sched fd"
77 filter_ldflags=""
78 filters=" compress wav"
79
80 audioc_cmdline_objs="audioc.cmdline"
81 audioc_errlist_objs="audioc string net fd"
82
83 audiod_cmdline_objs="audiod.cmdline grab_client.cmdline compress_filter.cmdline
84 http_recv.cmdline dccp_recv.cmdline file_write.cmdline client.cmdline
85 audiod_command_list"
86 audiod_errlist_objs="audiod signal string daemon stat net
87 time grab_client filter_chain wav compress http_recv dccp dccp_recv
88 recv_common fd sched write_common file_write audiod_command crypt
89 client_common"
90 audiod_ldflags=""
91 audiod_audio_formats=""
92
93 server_cmdline_objs="server.cmdline server_command_list random_selector_command_list
94 playlist_selector_command_list"
95 server_errlist_objs="server mp3_afh vss command net string signal random_selector
96 time daemon stat crypt http_send afs close_on_fork playlist_selector
97 ipc dccp dccp_send fd user_list"
98 server_ldflags=""
99 server_audio_formats=" mp3"
100
101 write_cmdline_objs="write.cmdline file_write.cmdline"
102 write_errlist_objs="write write_common file_write time fd string sched stdin"
103 write_ldflags=""
104 writers=" file"
105 default_writer="FILE_WRITE"
106
107 client_cmdline_objs="client.cmdline"
108 client_errlist_objs="client net string crypt fd sched stdin stdout client_common"
109 client_ldflags=""
110
111 ########################################################################### ssl
112 dnl @synopsis CHECK_SSL
113 dnl
114 dnl based on the follwing macro from the autoconf archive
115 dnl
116 dnl @category InstalledPackages
117 dnl @author Mark Ethan Trostler <trostler@juniper.net>
118 dnl @version 2003-01-28
119 dnl @license AllPermissive
120
121 AC_DEFUN([CHECK_SSL],
122 [
123 for ssldir in $1 /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
124 AC_MSG_CHECKING(for openssl in $ssldir)
125 if test -f "$ssldir/include/openssl/ssl.h"; then
126 found_ssl="yes"
127 AC_MSG_RESULT(yes)
128 SSL_CFLAGS="-I$ssldir/include/openssl"
129 SSL_CPPFLAGS="-I$ssldir/include/openssl"
130 break
131 fi
132 if test -f "$ssldir/include/ssl.h"; then
133 found_ssl="yes";
134 AC_MSG_RESULT(yes)
135 SSL_CFLAGS="-I$ssldir/include/";
136 SSL_CPPFLAGS="-I$ssldir/include/";
137 break
138 fi
139 AC_MSG_RESULT(no)
140 done
141 if test x_$found_ssl != x_yes; then
142 AC_MSG_ERROR(Cannot find ssl libraries)
143 else
144 SSL_LIBS="-lssl -lcrypto";
145 SSL_LDFLAGS="-L$ssldir/lib";
146 fi
147 AC_SUBST(SSL_CPPFLAGS)
148 AC_SUBST(SSL_CFLAGS)
149 AC_SUBST(SSL_LIBS)
150 AC_SUBST(SSL_LDFLAGS)
151 ])dnl
152
153 AC_ARG_ENABLE(ssldir, [AS_HELP_STRING(--enable-ssldir=path,
154 [Search for openssl also in path.])])
155 if test "$enable_ssldir" = "yes"; then enable_ssldir=""; fi
156 CHECK_SSL($enable_ssldir)
157 server_ldflags="$srver_ldflags $SSL_LDFLAGS $SSL_LIBS"
158 client_ldflags="$client_ldflags $SSL_LDFLAGS $SSL_LIBS"
159 audiod_ldflags="$audiod_ldflags $SSL_LDFLAGS $SSL_LIBS"
160
161 ########################################################################### ucred
162 AC_MSG_CHECKING(for struct ucred)
163 AC_TRY_LINK([
164 #include <sys/types.h>
165 #include <sys/socket.h>
166 ],[
167 struct ucred sucred; sucred.pid=0;
168 ],[have_ucred=yes],[have_ucred=no])
169 AC_MSG_RESULT($have_ucred)
170 if test ${have_ucred} = yes; then
171 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
172 fi
173
174 ########################################################################### osx
175
176 AC_MSG_CHECKING(for CoreAudio (MacOs))
177 AC_TRY_LINK([
178 #include <CoreAudio/CoreAudio.h>
179 ],[
180 AudioDeviceID id;
181 ],[have_core_audio=yes],[have_core_audio=no])
182 AC_MSG_RESULT($have_core_audio)
183 if test ${have_core_audio} = yes; then
184 f1="-framework CoreAudio"
185 f2="-framework AudioToolbox"
186 f3="-framework AudioUnit"
187 f4="-framework CoreServices"
188 f="$f1 $f2 $f3 $f4"
189 audiod_errlist_objs="$audiod_errlist_objs osx_write"
190 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
191 audiod_ldflags="$audiod_ldflags $f"
192
193 write_errlist_objs="$write_errlist_objs osx_write"
194 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
195 write_ldflags="$write_ldflags $f"
196 writers="$writers osx"
197 default_writer="OSX_WRITE"
198 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
199 fi
200 ########################################################################### gtk2
201 build_para_krell="yes"
202 OLD_CPPFLAGS="$CPPFLAGS"
203 OLD_LD_FLAGS="$LDFLAGS"
204 OLD_LIBS="$LIBS"
205 pkg_modules="gtk+-2.0 >= 2.0.0"
206 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.0.4], [], [build_para_krell="no"])
207 PKG_CHECK_MODULES(GTK, [$pkg_modules], [], [build_para_krell="no"])
208 CPPFLAGS="$GTK_CFLAGS $GLIB_CFLAGS"
209 LDFLAGS="$LDFLAGS $GTK_LIBS"
210 AC_CHECK_HEADER(gkrellm2/gkrellm.h, [], [build_para_krell="no"])
211 if test "$build_para_krell" = "yes"; then
212 AC_SUBST(GTK_CFLAGS)
213 AC_SUBST(GTK_LIBS)
214 extras="$extras para_krell.so"
215 else
216 AC_MSG_WARN([can not build para_krell])
217 fi
218 CPPFLAGS="$OLD_CPPFLAGS"
219 LDFLAGS="$OLD_LDFLAGS"
220 LIBS="$OLD_LIBS"
221 ########################################################################### sdl
222 # FIXME
223 AC_CHECK_LIB([SDL_image], [SDL_Init], [extras="$extras para_sdl_gui"], [
224 AC_MSG_WARN([libSDL_image not found, cannot build para_sdl_gui])
225 ])
226 AC_CHECK_HEADER(SDL/SDL.h, [],
227 [AC_MSG_WARN([SDL/SDL.h not found])])
228
229 ########################################################################### mysql
230 have_mysql="yes"
231 OLD_CPPFLAGS="$CPPFLAGS"
232 OLD_LD_FLAGS="$LDFLAGS"
233 OLD_LIBS="$LIBS"
234 AC_ARG_WITH(mysql_headers, [AC_HELP_STRING(--with-mysql-headers=dir,
235 [look for mysql.h also in dir])])
236 if test -n "$with_mysql_headers"; then
237 mysql_cppflags="-I$with_mysql_headers"
238 CPPFLAGS="$CPPFLAGS $mysql_cppflags"
239 fi
240 AC_ARG_WITH(mysql_libs, [AC_HELP_STRING(--with-mysql-libs=dir,
241 [look for libmysqlclient also in dir])])
242 if test -n "$with_mysql_libs"; then
243 mysql_libs="-L$with_mysql_libs"
244 LDFLAGS="$LDFLAGS $mysql_libs"
245 fi
246 AC_CHECK_HEADER(mysql/mysql.h, [], [
247 have_mysql="no"
248 ])
249 AC_CHECK_LIB([mysqlclient], [mysql_init], [], [
250 have_mysql="no"
251 ])
252 if test "$have_mysql" = "yes"; then
253 selectors="$selectors mysql"
254 server_ldflags="$server_ldflags $mysql_libs -lmysqlclient"
255 server_errlist_objs="$server_errlist_objs mysql_selector"
256 server_cmdline_objs="$server_cmdline_objs mysql_selector_command_list"
257 AC_SUBST(mysql_cppflags)
258 AC_SUBST(mysql_libs)
259 AC_DEFINE(HAVE_MYSQL, 1, [define to 1 to turn on mysql support])
260 else
261 AC_MSG_WARN([cannot build mysql-based audio file selector])
262 fi
263 CPPFLAGS="$OLD_CPPFLAGS"
264 LDFLAGS="$OLD_LDFLAGS"
265 LIBS="$OLD_LIBS"
266 ########################################################################### ogg
267 have_ogg="yes"
268 OLD_CPPFLAGS="$CPPFLAGS"
269 OLD_LD_FLAGS="$LDFLAGS"
270 OLD_LIBS="$LIBS"
271 AC_ARG_WITH(oggvorbis_headers, [AC_HELP_STRING(--with-oggvorbis-headers=dir,
272 [look for vorbis/codec.h also in dir])])
273 if test -n "$with_oggvorbis_headers"; then
274 oggvorbis_cppflags="-I$with_oggvorbis_headers"
275 CPPFLAGS="$CPPFLAGS $oggvorbis_cppflags"
276 fi
277 AC_ARG_WITH(oggvorbis_libs, [AC_HELP_STRING(--with-oggvorbis-libs=dir,
278 [look for oggvorbis libs also in dir])])
279 if test -n "$with_oggvorbis_libs"; then
280 oggvorbis_libs="-L$with_oggvorbis_libs"
281 LDFLAGS="$LDFLAGS $oggvorbis_libs"
282 fi
283
284 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
285 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_ogg="no" ])
286 AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [ have_ogg="no" ])
287 if test "$have_ogg" = "yes"; then
288 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support)
289 filters="$filters oggdec"
290 if test "$OSTYPE" = "Darwin"; then
291 oggvorbis_libs="-Wl,-bind_at_load $oggvorbis_libs"
292 fi
293 server_ldflags="$server_ldflags $oggvorbis_libs -logg -lvorbis -lvorbisfile"
294 filter_ldflags="$filter_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
295 audiod_ldflags="$audiod_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
296
297 filter_cmdline_objs="$filter_cmdline_objs oggdec_filter.cmdline"
298 audiod_cmdline_objs="$audiod_cmdline_objs oggdec_filter.cmdline"
299
300 server_errlist_objs="$server_errlist_objs ogg_afh"
301 filter_errlist_objs="$filter_errlist_objs oggdec"
302 audiod_errlist_objs="$audiod_errlist_objs oggdec"
303
304 audiod_audio_formats="ogg"
305 server_audio_formats="$server_audio_formats ogg"
306 filter_filters="$filter_filters oggdec"
307 AC_SUBST(oggvorbis_cppflags)
308 AC_SUBST(oggvorbis_libs)
309 else
310 AC_MSG_WARN([no ogg vorbis support in para_server/para_filter])
311 fi
312 CPPFLAGS="$OLD_CPPFLAGS"
313 LDFLAGS="$OLD_LDFLAGS"
314 LIBS="$OLD_LIBS"
315 ########################################################################### faad
316 have_faad=yes
317 OLD_CPPFLAGS="$CPPFLAGS"
318 OLD_LD_FLAGS="$LDFLAGS"
319 OLD_LIBS="$LIBS"
320 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
321 [look for neaacdec.h also in dir])])
322 if test -n "$with_faad_headers"; then
323 faad_cppflags="-I$with_faad_headers"
324 CPPFLAGS="$CPPFLAGS $faad_cppflags"
325 fi
326 AC_ARG_WITH(faad_libs, [AC_HELP_STRING(--with-faad-libs=dir,
327 [look for libfaad also in dir])])
328 if test -n "$with_faad_libs"; then
329 faad_libs="-L$with_faad_libs"
330 LDFLAGS="$LDFLAGS $faad_libs"
331 fi
332 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
333 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
334 if test "$have_faad" = "yes"; then
335 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
336 filter_errlist_objs="$filter_errlist_objs aacdec aac_common"
337 filter_filters="$filter_filters aacdec"
338 audiod_errlist_objs="$audiod_errlist_objs aacdec aac_common"
339 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
340 server_ldflags="$server_ldflags $faad_libs -lfaad"
341 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
342 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
343 audiod_audio_formats="$audiod_audio_formats aac"
344 server_audio_formats="$server_audio_formats aac"
345 filters="$filters aacdec"
346 AC_SUBST(faad_cppflags)
347 AC_SUBST(faad_libs)
348 else
349 AC_MSG_WARN([no aac support in para_audiod/para_filter])
350 fi
351 CPPFLAGS="$OLD_CPPFLAGS"
352 LDFLAGS="$OLD_LDFLAGS"
353 LIBS="$OLD_LIBS"
354 ########################################################################### mad
355 have_mad="yes"
356 OLD_CPPFLAGS="$CPPFLAGS"
357 OLD_LD_FLAGS="$LDFLAGS"
358 OLD_LIBS="$LIBS"
359
360 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
361 [look for mad.h also in dir])])
362 if test -n "$with_mad_headers"; then
363 mad_cppflags="-I$with_mad_headers"
364 CPPFLAGS="$CPPFLAGS $mad_cppflags"
365 fi
366 AC_ARG_WITH(mad_libs, [AC_HELP_STRING(--with-mad-libs=dir,
367 [look for libmad also in dir])])
368 if test -n "$with_mad_libs"; then
369 mad_libs="-L$with_mad_libs"
370 LDFLAGS="$LDFLAGS $mad_libs"
371 fi
372 AC_CHECK_HEADERS([mad.h], [], [
373 have_mad="no"
374 ])
375 AC_CHECK_LIB([mad], [mad_stream_init], [], [
376 have_mad="no"
377 ])
378 if test "$have_mad" = "yes"; then
379 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
380 filter_errlist_objs="$filter_errlist_objs mp3dec"
381 audiod_errlist_objs="$audiod_errlist_objs mp3dec"
382 filter_ldflags="$filter_ldflags $mad_libs -lmad"
383 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
384 audiod_audio_formats="$audiod_audio_formats mp3"
385 filters="$filters mp3dec"
386 AC_SUBST(mad_cppflags)
387 AC_SUBST(mad_libs)
388 else
389 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
390 fi
391 if test -n "$audiod_audio_formats"; then
392 extras="$extras para_audiod"
393 else
394 AC_MSG_WARN([can not build para_audiod (no supported audio formats)])
395 fi
396 CPPFLAGS="$OLD_CPPFLAGS"
397 LDFLAGS="$OLD_LDFLAGS"
398 LIBS="$OLD_LIBS"
399 ########################################################################### alsa
400 have_alsa="yes"
401 OLD_CPPFLAGS="$CPPFLAGS"
402 OLD_LD_FLAGS="$LDFLAGS"
403 OLD_LIBS="$LIBS"
404 msg="=> no alsa support for para_audiod/para_write"
405 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
406 AC_MSG_WARN([no alsa/asoundlib $msg])
407 have_alsa="no"
408 ])
409 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
410 AC_MSG_WARN([no libasound $msg])
411 have_alsa="no"
412 ])
413 if test "$have_alsa" = "yes"; then
414 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
415 audiod_cmdline_objs="$audiod_cmdline_objs alsa_write.cmdline"
416 audiod_ldflags="$audiod_ldflags -lasound"
417
418 write_errlist_objs="$write_errlist_objs alsa_write"
419 write_cmdline_objs="$write_cmdline_objs alsa_write.cmdline"
420 write_ldflags="$write_ldflags -lasound"
421 writers="$writers alsa"
422 default_writer="ALSA_WRITE"
423 fi
424 CPPFLAGS="$OLD_CPPFLAGS"
425 LDFLAGS="$OLD_LDFLAGS"
426 LIBS="$OLD_LIBS"
427 ########################################################################### ortp
428 have_ortp="yes"
429 OLD_CPPFLAGS="$CPPFLAGS"
430 OLD_LD_FLAGS="$LDFLAGS"
431 OLD_LIBS="$LIBS"
432 AC_ARG_WITH(ortp_headers, [AC_HELP_STRING(--with-ortp-headers=dir,
433 [look for ortp/ortp.h also in dir])])
434 if test -n "$with_ortp_headers"; then
435 ortp_cppflags="-I$with_ortp_headers"
436 CPPFLAGS="$CPPFLAGS $ortp_cppflags"
437 fi
438 AC_ARG_WITH(ortp_libs, [AC_HELP_STRING(--with-ortp-libs=dir,
439 [look for libortp also in dir])])
440 if test -n "$with_ortp_libs"; then
441 ortp_libs="-L$with_ortp_libs"
442 LDFLAGS="$LDFLAGS $ortp_libs"
443 fi
444 AC_CHECK_HEADERS([ortp/ortp.h], [], [have_ortp="no"])
445 AC_CHECK_LIB([ortp], [ortp_init], [], [have_ortp="no"])
446 if test "$have_ortp" = "yes"; then
447 recv_cmdline_objs="$recv_cmdline_objs ortp_recv.cmdline"
448 recv_errlist_objs="$recv_errlist_objs ortp_recv"
449
450 audiod_cmdline_objs="$audiod_cmdline_objs ortp_recv.cmdline"
451 audiod_errlist_objs="$audiod_errlist_objs ortp_recv"
452
453 server_errlist_objs="$server_errlist_objs ortp_send"
454
455 recv_ldflags="$recv_ldflags $ortp_libs -lortp"
456 server_ldflags="$server_ldflags $ortp_libs -lortp"
457 audiod_ldflags="$audiod_ldflags $ortp_libs -lortp"
458
459 receivers="$receivers ortp"
460 senders="$senders ortp"
461 AC_DEFINE(HAVE_ORTP, 1, [define to 1 to turn on ortp support])
462 AC_SUBST(ortp_cppflags)
463 AC_SUBST(ortp_libs)
464 else
465 AC_MSG_NOTICE([deactivating ortp sender/receiver])
466 fi
467 CPPFLAGS="$OLD_CPPFLAGS"
468 LDFLAGS="$OLD_LDFLAGS"
469 LIBS="$OLD_LIBS"
470 ########################################################################### zmw
471 build_slider="yes"
472 OLD_CPPFLAGS="$CPPFLAGS"
473 OLD_LD_FLAGS="$LDFLAGS"
474 OLD_LIBS="$LIBS"
475 PKG_CHECK_MODULES(GTK, [$pkg_modules], [], [build_para_slider="no"])
476 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.0.4], [], [build_slider="no"])
477 CPPFLAGS="$GTK_CFLAGS $GLIB_CFLAGS"
478 LDFLAGS="$LDFLAGS $GTK_LIBS"
479 AC_CHECK_HEADERS([zmw/zmw.h], [], [build_slider="no"])
480 AC_CHECK_LIB([zmw], [zmw_init], [], [build_slider="no"])
481 if test "$build_slider" = "no"; then
482 AC_MSG_WARN([will not build para_slider])
483 else
484 extras="$extras para_slider"
485 fi
486 CPPFLAGS="$OLD_CPPFLAGS"
487 LDFLAGS="$OLD_LDFLAGS"
488 LIBS="$OLD_LIBS"
489
490
491
492
493
494 AC_SUBST(extra_binaries, [$extras])
495 AC_SUBST(extra_filter_objs, [$extra_filter_objs])
496 AC_SUBST(extra_filter_libs, [$extra_filter_libs])
497 AC_SUBST(install_sh, [$INSTALL])
498 AC_CONFIG_FILES([Makefile])
499
500
501
502 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
503 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) }])
504
505 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
506 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
507 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
508 server_objs="$server_cmdline_objs $server_errlist_objs"
509 write_objs="$write_cmdline_objs $write_errlist_objs"
510 client_objs="$client_cmdline_objs $client_errlist_objs"
511 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
512
513 AC_SUBST(recv_objs, add_dot_o($recv_objs))
514 AC_SUBST(recv_ldflags, $recv_ldflags)
515 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
516 errors used by para_recv)
517
518 AC_SUBST(filter_objs, add_dot_o($filter_objs))
519 AC_SUBST(filter_ldflags, $filter_ldflags)
520 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
521 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
522
523 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
524 AC_SUBST(audiod_ldflags, $audiod_ldflags)
525 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
526 errors used by para_audiod)
527
528 AC_SUBST(server_objs, add_dot_o($server_objs))
529 AC_SUBST(server_ldflags, $server_ldflags)
530 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
531 objlist_to_errlist($server_errlist_objs), errors used by para_server)
532
533 AC_SUBST(write_objs, add_dot_o($write_objs))
534 AC_SUBST(write_ldflags, $write_ldflags)
535 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
536 objlist_to_errlist($write_errlist_objs), errors used by para_write)
537
538 AC_SUBST(client_objs, add_dot_o($client_objs))
539 AC_SUBST(client_ldflags, $client_ldflags)
540 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
541 objlist_to_errlist($client_errlist_objs), errors used by para_client)
542
543 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
544 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
545 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
546
547 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
548 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
549 enum of supported writers)
550 AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
551 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
552 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
553 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
554 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
555 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
556 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
557 enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
558 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
559 enum of audio formats supported by audiod)
560 names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
561 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
562
563 gui_cmdline_objs="gui.cmdline"
564 gui_errlist_objs="exec close_on_fork signal string stat ringbuffer fd"
565 gui_other_objs="gui gui_common gui_theme"
566 gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
567 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
568 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
569 AC_SUBST(gui_objs, add_dot_o($gui_objs))
570
571 AC_OUTPUT
572 AC_MSG_NOTICE([creating Makefile.deps])
573 gcc -MM -MG $mysql_cppflags $faad_cppflags $mad_cppflags $ortp_cppflags $oggvorbis_cppflags *.c > Makefile.deps
574 AC_MSG_NOTICE([
575 paraslash configuration:
576 ~~~~~~~~~~~~~~~~~~~~~~~~
577 unix socket credentials: $have_ucred
578 audio file selectors supported by para_server: $selectors
579 audio formats supported by para_server: $server_audio_formats
580 senders supported by para_server/para_send: $senders
581 receivers supported by para_audiod/para_recv: $receivers
582 filters supported by para_audiod/para_filter: $filters
583 writers supported by para_audiod/para_write: $writers
584 optional executables: $extras
585 ])