2 # Process this file with autoconf to produce a configure script.
7 AC_INIT(paraslash, [git], maan@systemlinux.org)
8 AC_CONFIG_HEADER([config.h])
10 ########################################################################### generic
18 AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h stdlib.h \
19 string.h sys/socket.h sys/time.h sys/timeb.h sys/un.h sys/ipc.h unistd.h utime.h], \
20 [], [AC_MSG_ERROR([$ac_header not found])])
22 AC_CHECK_HEADER(linux/soundcard.h, [extras="$extras para_fade"],
23 [AC_MSG_WARN([linux/soundcard.h not found, \
24 cannot build para_fade])])
26 # Checks for typedefs, structures, and compiler characteristics.
34 # Checks for library functions.
36 AC_PROG_GCC_TRADITIONAL
42 AC_FUNC_SELECT_ARGTYPES
47 AC_CHECK_FUNCS([atexit dup2 gethostbyname inet_ntoa memchr memmove memset \
48 regcomp select socket strchr strdup strerror strstr strtol uname], [],
49 [AC_MSG_ERROR([function not found, cannot live without it])])
50 ########################################################################### curses
51 AC_CHECK_LIB([ncurses], [initscr], [],
52 [AC_MSG_ERROR([libncurses not found])])
54 AC_CHECK_LIB([menu], [new_menu], [extras="$extras para_dbadm"],
55 [AC_MSG_WARN([libmenu not found, cannot build para_dbadm])])
58 recv_cmdline_objs="recv.cmdline http_recv.cmdline dccp_recv.cmdline"
59 recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
63 filter_cmdline_objs="filter.cmdline compress_filter.cmdline"
64 filter_errlist_objs="filter_chain wav compress filter string stdin stdout sched fd"
67 audioc_cmdline_objs="audioc.cmdline"
68 audioc_errlist_objs="audioc string net fd"
70 audiod_cmdline_objs="audiod.cmdline grab_client.cmdline compress_filter.cmdline
71 http_recv.cmdline dccp_recv.cmdline file_write.cmdline client.cmdline"
72 audiod_errlist_objs="audiod signal string daemon stat net
73 time grab_client filter_chain wav compress http_recv dccp dccp_recv
74 recv_common fd sched write_common file_write audiod_command crypt
78 server_cmdline_objs="server.cmdline"
79 server_errlist_objs="server mp3_afh afs command net string signal random_selector
80 time daemon stat crypt http_send db close_on_fork playlist_selector
81 ipc dccp dccp_send fd"
84 write_cmdline_objs="write.cmdline file_write.cmdline"
85 write_errlist_objs="write write_common file_write time fd string sched stdin"
89 client_cmdline_objs="client.cmdline"
90 client_errlist_objs="client net string crypt fd sched stdin stdout client_common"
93 ########################################################################### ssl
94 dnl @synopsis CHECK_SSL
96 dnl based on the follwing macro from the autoconf archive
98 dnl @category InstalledPackages
99 dnl @author Mark Ethan Trostler <trostler@juniper.net>
100 dnl @version 2003-01-28
101 dnl @license AllPermissive
103 AC_DEFUN([CHECK_SSL],
105 for ssldir in $1 /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
106 AC_MSG_CHECKING(for openssl in $ssldir)
107 if test -f "$ssldir/include/openssl/ssl.h"; then
110 SSL_CFLAGS="-I$ssldir/include/openssl"
111 SSL_CPPFLAGS="-I$ssldir/include/openssl"
114 if test -f "$ssldir/include/ssl.h"; then
117 SSL_CFLAGS="-I$ssldir/include/";
118 SSL_CPPFLAGS="-I$ssldir/include/";
123 if test x_$found_ssl != x_yes; then
124 AC_MSG_ERROR(Cannot find ssl libraries)
126 SSL_LIBS="-lssl -lcrypto";
127 SSL_LDFLAGS="-L$ssldir/lib";
129 AC_SUBST(SSL_CPPFLAGS)
132 AC_SUBST(SSL_LDFLAGS)
135 AC_ARG_ENABLE(ssldir, [AS_HELP_STRING(--enable-ssldir=path,
136 [Search for openssl also in path.])])
137 if test "$enable_ssldir" = "yes"; then enable_ssldir=""; fi
138 CHECK_SSL($enable_ssldir)
139 server_ldflags="$srver_ldflags $SSL_LDFLAGS $SSL_LIBS"
140 client_ldflags="$client_ldflags $SSL_LDFLAGS $SSL_LIBS"
141 audiod_ldflags="$audiod_ldflags $SSL_LDFLAGS $SSL_LIBS"
143 ########################################################################### ucred
145 AC_MSG_CHECKING(for struct ucred)
147 #include <sys/types.h>
148 #include <sys/socket.h>
150 struct ucred sucred; sucred.pid=0;
151 ],[have_ucred=yes],[have_ucred=no])
152 AC_MSG_RESULT($have_ucred)
153 if test ${have_ucred} = yes; then
154 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
157 ########################################################################### osx
159 AC_MSG_CHECKING(for CoreAudio (MacOs))
161 #include <CoreAudio/CoreAudio.h>
164 ],[have_core_audio=yes],[have_core_audio=no])
165 AC_MSG_RESULT($have_core_audio)
166 if test ${have_core_audio} = yes; then
167 f1="-framework CoreAudio"
168 f2="-framework AudioToolbox"
169 f3="-framework AudioUnit"
170 f4="-framework CoreServices"
172 audiod_errlist_objs="$audiod_errlist_objs osx_write"
173 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
174 audiod_ldflags="$audiod_ldflags $f"
176 write_errlist_objs="$write_errlist_objs osx_write"
177 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
178 write_ldflags="$write_ldflags $f"
179 write_writers="$write_writers osx"
180 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on MacOs)
182 ########################################################################### gtk2
184 pkg_modules="gtk+-2.0 >= 2.0.0"
185 build_para_krell="yes"
186 PKG_CHECK_MODULES(GTK, [$pkg_modules], [], [build_para_krell="no"])
187 AC_CHECK_HEADER(gkrellm2/gkrellm.h, [], [build_para_krell="no"])
188 if test build_para_krell = "yes"; then
191 extras="$extras para_krell.so"
193 AC_MSG_WARN([can not build para_krell])
196 ########################################################################### sdl
197 AC_CHECK_LIB([SDL_image], [SDL_Init], [extras="$extras para_sdl_gui"], [
198 AC_MSG_WARN([libSDL_image not found, cannot build para_sdl_gui])
200 AC_CHECK_HEADER(SDL/SDL.h, [],
201 [AC_MSG_WARN([SDL/SDL.h not found])])
203 ########################################################################### mysql
205 AC_ARG_WITH(mysql_headers, [AC_HELP_STRING(--with-mysql-headers=dir,
206 [look for mysql.h also in dir])])
207 if test -n "$with_mysql_headers"; then
208 mysql_cppflags="-I$with_mysql_headers"
209 CPPFLAGS="$CPPFLAGS $mysql_cppflags"
211 AC_ARG_WITH(mysql_libs, [AC_HELP_STRING(--with-mysql-libs=dir,
212 [look for libmysqlclient also in dir])])
213 if test -n "$with_mysql_libs"; then
214 mysql_libs="-L$with_mysql_libs"
215 LDFLAGS="$LDFLAGS $mysql_libs"
217 AC_CHECK_HEADER(mysql/mysql.h, [], [
220 AC_CHECK_LIB([mysqlclient], [mysql_init], [], [
223 if test "$have_mysql" = "yes"; then
224 server_ldflags="$server_ldflags $mysql_libs -lmysqlclient"
225 server_errlist_objs="$server_errlist_objs mysql_selector"
226 AC_SUBST(mysql_cppflags)
228 AC_DEFINE(HAVE_MYSQL, 1, [define to 1 to turn on mysql support])
230 AC_MSG_WARN([cannot build mysql-based audio file selector])
232 ########################################################################### ogg
234 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [
237 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [
240 AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [
243 if test "$have_ogg" = "yes"; then
244 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support)
245 server_ldflags="$server_ldflags -logg -lvorbis -lvorbisfile"
246 filter_ldflags="$filter_ldflags -lvorbis -lvorbisfile"
247 audiod_ldflags="$audiod_ldflags -lvorbis -lvorbisfile"
249 filter_cmdline_objs="$filter_cmdline_objs oggdec_filter.cmdline"
250 audiod_cmdline_objs="$audiod_cmdline_objs oggdec_filter.cmdline"
252 server_errlist_objs="$server_errlist_objs ogg_afh"
253 filter_errlist_objs="$filter_errlist_objs oggdec"
254 audiod_errlist_objs="$audiod_errlist_objs oggdec"
256 AC_MSG_WARN([no ogg vorbis support in para_server/para_filter])
258 ########################################################################### faad
260 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
261 [look for neaacdec.h also in dir])])
262 if test -n "$with_faad_headers"; then
263 faad_cppflags="-I$with_faad_headers"
264 CPPFLAGS="$CPPFLAGS $faad_cppflags"
266 AC_ARG_WITH(faad_libs, [AC_HELP_STRING(--with-faad-libs=dir,
267 [look for libfaad also in dir])])
268 if test -n "$with_faad_libs"; then
269 faad_libs="-L$with_faad_libs"
270 LDFLAGS="$LDFLAGS $faad_libs"
272 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
273 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
274 if test "$have_faad" = "yes"; then
275 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
276 filter_errlist_objs="$filter_errlist_objs aacdec aac_common"
277 audiod_errlist_objs="$audiod_errlist_objs aacdec aac_common"
278 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
279 server_ldflags="$server_ldflags $faad_libs -lfaad"
280 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
281 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
282 AC_SUBST(faad_cppflags)
285 AC_MSG_WARN([no aac support in para_audiod/para_filter])
287 ########################################################################### mad
289 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
290 [look for mad.h also in dir])])
291 if test -n "$with_mad_headers"; then
292 mad_cppflags="-I$with_mad_headers"
293 CPPFLAGS="$CPPFLAGS $mad_cppflags"
295 AC_ARG_WITH(mad_libs, [AC_HELP_STRING(--with-mad-libs=dir,
296 [look for libmad also in dir])])
297 if test -n "$with_mad_libs"; then
298 mad_libs="-L$with_mad_libs"
299 LDFLAGS="$LDFLAGS $mad_libs"
301 AC_CHECK_HEADERS([mad.h], [], [
304 AC_CHECK_LIB([mad], [mad_stream_init], [], [
307 if test "$have_mad" = "yes"; then
308 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
309 filter_errlist_objs="$filter_errlist_objs mp3dec"
310 audiod_errlist_objs="$audiod_errlist_objs mp3dec"
311 filter_ldflags="$filter_ldflags $mad_libs -lmad"
312 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
313 AC_SUBST(mad_cppflags)
316 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
318 ########################################################################### alsa
320 msg="=> no alsa support for para_audiod/para_write"
321 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
322 AC_MSG_WARN([no alsa/asoundlib $msg])
325 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
326 AC_MSG_WARN([no libasound $msg])
329 if test "$have_alsa" = "yes"; then
330 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
331 audiod_cmdline_objs="$audiod_cmdline_objs alsa_write.cmdline"
332 audiod_ldflags="$audiod_ldflags -lasound"
334 write_errlist_objs="$write_errlist_objs alsa_write"
335 write_cmdline_objs="$write_cmdline_objs alsa_write.cmdline"
336 write_ldflags="$write_ldflags -lasound"
337 write_writers="$write_writers alsa"
339 ########################################################################### ortp
341 AC_ARG_ENABLE(ortp, AC_HELP_STRING([--disable-ortp], [Disable ortp support]),
342 if test x$enableval = xno; then
346 if test "$have_ortp" = "yes"; then
347 AC_CHECK_HEADERS([ortp/ortp.h], [], [
350 AC_CHECK_LIB([ortp], [ortp_init], [], [
354 if test "$have_ortp" = "yes"; then
355 recv_cmdline_objs="$recv_cmdline_objs ortp_recv.cmdline"
356 recv_errlist_objs="$recv_errlist_objs ortp_recv"
358 audiod_cmdline_objs="$audiod_cmdline_objs ortp_recv.cmdline"
359 audiod_errlist_objs="$audiod_errlist_objs ortp_recv"
361 server_errlist_objs="$server_errlist_objs ortp_send"
363 recv_ldflags="$recv_ldflags -lortp"
364 server_ldflags="$server_ldflags -lortp"
365 audiod_ldflags="$audiod_ldflags -lortp"
366 AC_DEFINE(HAVE_ORTP, 1, [define to 1 to turn on ortp support])
369 AC_MSG_NOTICE([deactivating ortp support])
371 AC_SUBST(GLIB_CFLAGS)
374 ########################################################################### zmw
376 msg="can not build para_slider"
377 CPPFLAGS="$GTK_CFLAGS"
378 LDFLAGS="$LDFLAGS $GTK_LIBS"
379 AC_CHECK_HEADERS([zmw/zmw.h], [], [
380 AC_MSG_WARN([zero memory widget header files not found, $msg])
383 AC_CHECK_LIB([zmw], [zmw_init], [], [
384 AC_MSG_WARN([zero memory widget library not found, $msg])
387 extras="$extras $slide"
393 AC_SUBST(extra_binaries, [$extras])
394 AC_SUBST(extra_filter_objs, [$extra_filter_objs])
395 AC_SUBST(extra_filter_libs, [$extra_filter_libs])
396 AC_SUBST(install_sh, [$INSTALL])
397 AC_CONFIG_FILES([Makefile])
401 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
402 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) }])
404 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
405 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
406 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
407 server_objs="$server_cmdline_objs $server_errlist_objs"
408 write_objs="$write_cmdline_objs $write_errlist_objs"
409 client_objs="$client_cmdline_objs $client_errlist_objs"
410 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
412 AC_SUBST(recv_objs, add_dot_o($recv_objs))
413 AC_SUBST(recv_ldflags, $recv_ldflags)
414 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
415 errors used by para_recv)
417 AC_SUBST(filter_objs, add_dot_o($filter_objs))
418 AC_SUBST(filter_ldflags, $filter_ldflags)
419 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
420 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
422 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
423 AC_SUBST(audiod_ldflags, $audiod_ldflags)
424 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
425 errors used by para_audiod)
427 AC_SUBST(server_objs, add_dot_o($server_objs))
428 AC_SUBST(server_ldflags, $server_ldflags)
429 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
430 objlist_to_errlist($server_errlist_objs), errors used by para_server)
432 AC_SUBST(write_objs, add_dot_o($write_objs))
433 AC_SUBST(write_ldflags, $write_ldflags)
434 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
435 objlist_to_errlist($write_errlist_objs), errors used by para_write)
437 AC_SUBST(client_objs, add_dot_o($client_objs))
438 AC_SUBST(client_ldflags, $client_ldflags)
439 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
440 objlist_to_errlist($client_errlist_objs), errors used by para_client)
442 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
443 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
444 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
446 enum="$(for i in $write_writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
447 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
448 enum of supported writers)
449 names="$(for i in $write_writers; do printf \"$i\",' ' ; done)"
450 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
451 inits="$(for i in $write_writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
452 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
453 array="$(for i in $write_writers; do printf '{.init = '$i'_write_init},'; done)"
454 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
456 gui_cmdline_objs="gui.cmdline"
457 gui_errlist_objs="exec close_on_fork signal string stat ringbuffer fd"
458 gui_other_objs="gui gui_common gui_theme"
459 gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
460 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
461 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
462 AC_SUBST(gui_objs, add_dot_o($gui_objs))
465 AC_MSG_NOTICE([creating Makefile.deps])
466 gcc -MM -MG $mysql_cppflags $faad_cppflags $mad_cppflags *.c > Makefile.deps
468 paraslash configuration:
469 ~~~~~~~~~~~~~~~~~~~~~~~~
470 mysql support: $have_mysql
471 ogg vorbis support: $have_ogg
472 mp3dec support (libmad): $have_mad
473 aac support (libfaad): $have_faad
474 ortp support: $have_ortp
475 unix socket credentials: $have_ucred
476 supported writers for para_write: $write_writers