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