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