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, cannot build para_fade])])
25 # Checks for typedefs, structures, and compiler characteristics.
33 # Checks for library functions.
35 AC_PROG_GCC_TRADITIONAL
41 AC_FUNC_SELECT_ARGTYPES
46 AC_CHECK_FUNCS([atexit dup2 gethostbyname inet_ntoa memchr memmove memset \
47 regcomp select socket strchr strdup strerror strstr strtol uname], [],
48 [AC_MSG_ERROR([function not found, cannot live without it])])
49 ########################################################################### curses
50 AC_CHECK_LIB([ncurses], [initscr], [],
51 [AC_MSG_ERROR([libncurses not found])])
53 AC_CHECK_LIB([menu], [new_menu], [extras="$extras para_dbadm"],
54 [AC_MSG_WARN([libmenu not found, cannot build para_dbadm])])
57 recv_cmdline_objs="recv.cmdline http_recv.cmdline dccp_recv.cmdline"
58 recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
62 receivers=" http dccp"
64 selectors=" random playlist"
66 filter_cmdline_objs="filter.cmdline compress_filter.cmdline"
67 filter_errlist_objs="filter_chain wav compress filter string stdin stdout sched fd"
69 filters=" compress wav"
71 audioc_cmdline_objs="audioc.cmdline"
72 audioc_errlist_objs="audioc string net fd"
74 audiod_cmdline_objs="audiod.cmdline grab_client.cmdline compress_filter.cmdline
75 http_recv.cmdline dccp_recv.cmdline file_write.cmdline client.cmdline"
76 audiod_errlist_objs="audiod signal string daemon stat net
77 time grab_client filter_chain wav compress http_recv dccp dccp_recv
78 recv_common fd sched write_common file_write audiod_command crypt
81 audiod_audio_formats=""
83 server_cmdline_objs="server.cmdline"
84 server_errlist_objs="server mp3_afh afs command net string signal random_selector
85 time daemon stat crypt http_send db close_on_fork playlist_selector
86 ipc dccp dccp_send fd"
88 server_audio_formats=" mp3"
90 write_cmdline_objs="write.cmdline file_write.cmdline"
91 write_errlist_objs="write write_common file_write time fd string sched stdin"
95 client_cmdline_objs="client.cmdline"
96 client_errlist_objs="client net string crypt fd sched stdin stdout client_common"
99 ########################################################################### ssl
100 dnl @synopsis CHECK_SSL
102 dnl based on the follwing macro from the autoconf archive
104 dnl @category InstalledPackages
105 dnl @author Mark Ethan Trostler <trostler@juniper.net>
106 dnl @version 2003-01-28
107 dnl @license AllPermissive
109 AC_DEFUN([CHECK_SSL],
111 for ssldir in $1 /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
112 AC_MSG_CHECKING(for openssl in $ssldir)
113 if test -f "$ssldir/include/openssl/ssl.h"; then
116 SSL_CFLAGS="-I$ssldir/include/openssl"
117 SSL_CPPFLAGS="-I$ssldir/include/openssl"
120 if test -f "$ssldir/include/ssl.h"; then
123 SSL_CFLAGS="-I$ssldir/include/";
124 SSL_CPPFLAGS="-I$ssldir/include/";
129 if test x_$found_ssl != x_yes; then
130 AC_MSG_ERROR(Cannot find ssl libraries)
132 SSL_LIBS="-lssl -lcrypto";
133 SSL_LDFLAGS="-L$ssldir/lib";
135 AC_SUBST(SSL_CPPFLAGS)
138 AC_SUBST(SSL_LDFLAGS)
141 AC_ARG_ENABLE(ssldir, [AS_HELP_STRING(--enable-ssldir=path,
142 [Search for openssl also in path.])])
143 if test "$enable_ssldir" = "yes"; then enable_ssldir=""; fi
144 CHECK_SSL($enable_ssldir)
145 server_ldflags="$srver_ldflags $SSL_LDFLAGS $SSL_LIBS"
146 client_ldflags="$client_ldflags $SSL_LDFLAGS $SSL_LIBS"
147 audiod_ldflags="$audiod_ldflags $SSL_LDFLAGS $SSL_LIBS"
149 ########################################################################### ucred
151 AC_MSG_CHECKING(for struct ucred)
153 #include <sys/types.h>
154 #include <sys/socket.h>
156 struct ucred sucred; sucred.pid=0;
157 ],[have_ucred=yes],[have_ucred=no])
158 AC_MSG_RESULT($have_ucred)
159 if test ${have_ucred} = yes; then
160 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
163 ########################################################################### osx
165 AC_MSG_CHECKING(for CoreAudio (MacOs))
167 #include <CoreAudio/CoreAudio.h>
170 ],[have_core_audio=yes],[have_core_audio=no])
171 AC_MSG_RESULT($have_core_audio)
172 if test ${have_core_audio} = yes; then
173 f1="-framework CoreAudio"
174 f2="-framework AudioToolbox"
175 f3="-framework AudioUnit"
176 f4="-framework CoreServices"
178 audiod_errlist_objs="$audiod_errlist_objs osx_write"
179 audiod_cmdline_objs="$audiod_cmdline_objs osx_write.cmdline"
180 audiod_ldflags="$audiod_ldflags $f"
182 write_errlist_objs="$write_errlist_objs osx_write"
183 write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
184 write_ldflags="$write_ldflags $f"
185 writers="$writers osx"
186 AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
188 ########################################################################### gtk2
190 pkg_modules="gtk+-2.0 >= 2.0.0"
191 build_para_krell="yes"
192 PKG_CHECK_MODULES(GTK, [$pkg_modules], [], [build_para_krell="no"])
193 AC_CHECK_HEADER(gkrellm2/gkrellm.h, [], [build_para_krell="no"])
194 if test build_para_krell = "yes"; then
197 extras="$extras para_krell.so"
199 AC_MSG_WARN([can not build para_krell])
202 ########################################################################### sdl
204 AC_CHECK_LIB([SDL_image], [SDL_Init], [extras="$extras para_sdl_gui"], [
205 AC_MSG_WARN([libSDL_image not found, cannot build para_sdl_gui])
207 AC_CHECK_HEADER(SDL/SDL.h, [],
208 [AC_MSG_WARN([SDL/SDL.h not found])])
210 ########################################################################### mysql
212 AC_ARG_WITH(mysql_headers, [AC_HELP_STRING(--with-mysql-headers=dir,
213 [look for mysql.h also in dir])])
214 if test -n "$with_mysql_headers"; then
215 mysql_cppflags="-I$with_mysql_headers"
216 CPPFLAGS="$CPPFLAGS $mysql_cppflags"
218 AC_ARG_WITH(mysql_libs, [AC_HELP_STRING(--with-mysql-libs=dir,
219 [look for libmysqlclient also in dir])])
220 if test -n "$with_mysql_libs"; then
221 mysql_libs="-L$with_mysql_libs"
222 LDFLAGS="$LDFLAGS $mysql_libs"
224 AC_CHECK_HEADER(mysql/mysql.h, [], [
227 AC_CHECK_LIB([mysqlclient], [mysql_init], [], [
230 if test "$have_mysql" = "yes"; then
231 selectors="$selectors mysql"
232 server_ldflags="$server_ldflags $mysql_libs -lmysqlclient"
233 server_errlist_objs="$server_errlist_objs mysql_selector"
234 AC_SUBST(mysql_cppflags)
236 AC_DEFINE(HAVE_MYSQL, 1, [define to 1 to turn on mysql support])
238 AC_MSG_WARN([cannot build mysql-based audio file selector])
240 ########################################################################### ogg
242 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [
245 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [
248 AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [
251 if test "$have_ogg" = "yes"; then
252 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support)
253 filters="$filters oggdec"
254 server_ldflags="$server_ldflags -logg -lvorbis -lvorbisfile"
255 filter_ldflags="$filter_ldflags -lvorbis -lvorbisfile"
256 audiod_ldflags="$audiod_ldflags -lvorbis -lvorbisfile"
258 filter_cmdline_objs="$filter_cmdline_objs oggdec_filter.cmdline"
259 audiod_cmdline_objs="$audiod_cmdline_objs oggdec_filter.cmdline"
261 server_errlist_objs="$server_errlist_objs ogg_afh"
262 filter_errlist_objs="$filter_errlist_objs oggdec"
263 audiod_errlist_objs="$audiod_errlist_objs oggdec"
265 audiod_audio_formats="ogg"
266 server_audio_formats="$server_audio_formats ogg"
267 filter_filters="$filter_filters oggdec"
269 AC_MSG_WARN([no ogg vorbis support in para_server/para_filter])
271 ########################################################################### faad
273 AC_ARG_WITH(faad_headers, [AC_HELP_STRING(--with-faad-headers=dir,
274 [look for neaacdec.h also in dir])])
275 if test -n "$with_faad_headers"; then
276 faad_cppflags="-I$with_faad_headers"
277 CPPFLAGS="$CPPFLAGS $faad_cppflags"
279 AC_ARG_WITH(faad_libs, [AC_HELP_STRING(--with-faad-libs=dir,
280 [look for libfaad also in dir])])
281 if test -n "$with_faad_libs"; then
282 faad_libs="-L$with_faad_libs"
283 LDFLAGS="$LDFLAGS $faad_libs"
285 AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
286 AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
287 if test "$have_faad" = "yes"; then
288 AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
289 filter_errlist_objs="$filter_errlist_objs aacdec aac_common"
290 filter_filters="$filter_filters aacdec"
291 audiod_errlist_objs="$audiod_errlist_objs aacdec aac_common"
292 server_errlist_objs="$server_errlist_objs aac_afh aac_common"
293 server_ldflags="$server_ldflags $faad_libs -lfaad"
294 filter_ldflags="$filter_ldflags $faad_libs -lfaad"
295 audiod_ldflags="$audiod_ldflags $faad_libs -lfaad"
296 audiod_audio_formats="$audiod_audio_formats aac"
297 server_audio_formats="$server_audio_formats aac"
298 filters="$filters aacdec"
299 AC_SUBST(faad_cppflags)
302 AC_MSG_WARN([no aac support in para_audiod/para_filter])
304 ########################################################################### mad
306 AC_ARG_WITH(mad_headers, [AC_HELP_STRING(--with-mad-headers=dir,
307 [look for mad.h also in dir])])
308 if test -n "$with_mad_headers"; then
309 mad_cppflags="-I$with_mad_headers"
310 CPPFLAGS="$CPPFLAGS $mad_cppflags"
312 AC_ARG_WITH(mad_libs, [AC_HELP_STRING(--with-mad-libs=dir,
313 [look for libmad also in dir])])
314 if test -n "$with_mad_libs"; then
315 mad_libs="-L$with_mad_libs"
316 LDFLAGS="$LDFLAGS $mad_libs"
318 AC_CHECK_HEADERS([mad.h], [], [
321 AC_CHECK_LIB([mad], [mad_stream_init], [], [
324 if test "$have_mad" = "yes"; then
325 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
326 filter_errlist_objs="$filter_errlist_objs mp3dec"
327 audiod_errlist_objs="$audiod_errlist_objs mp3dec"
328 filter_ldflags="$filter_ldflags $mad_libs -lmad"
329 audiod_ldflags="$audiod_ldflags $mad_libs -lmad"
330 audiod_audio_formats="$audiod_audio_formats mp3"
331 filters="$filters mp3dec"
332 AC_SUBST(mad_cppflags)
335 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
337 if test -n "$audiod_audio_formats"; then
338 extras="$extras para_audiod"
340 AC_MSG_WARN([can not build para_audiod (no supported audio formats)])
342 ########################################################################### alsa
344 msg="=> no alsa support for para_audiod/para_write"
345 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
346 AC_MSG_WARN([no alsa/asoundlib $msg])
349 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
350 AC_MSG_WARN([no libasound $msg])
353 if test "$have_alsa" = "yes"; then
354 audiod_errlist_objs="$audiod_errlist_objs alsa_write"
355 audiod_cmdline_objs="$audiod_cmdline_objs alsa_write.cmdline"
356 audiod_ldflags="$audiod_ldflags -lasound"
358 write_errlist_objs="$write_errlist_objs alsa_write"
359 write_cmdline_objs="$write_cmdline_objs alsa_write.cmdline"
360 write_ldflags="$write_ldflags -lasound"
361 writers="$writers alsa"
363 ########################################################################### ortp
365 AC_ARG_ENABLE(ortp, AC_HELP_STRING([--disable-ortp], [Disable ortp support]),
366 if test x$enableval = xno; then
370 if test "$have_ortp" = "yes"; then
371 AC_CHECK_HEADERS([ortp/ortp.h], [], [
374 AC_CHECK_LIB([ortp], [ortp_init], [], [
378 if test "$have_ortp" = "yes"; then
379 recv_cmdline_objs="$recv_cmdline_objs ortp_recv.cmdline"
380 recv_errlist_objs="$recv_errlist_objs ortp_recv"
382 audiod_cmdline_objs="$audiod_cmdline_objs ortp_recv.cmdline"
383 audiod_errlist_objs="$audiod_errlist_objs ortp_recv"
385 server_errlist_objs="$server_errlist_objs ortp_send"
387 recv_ldflags="$recv_ldflags -lortp"
388 server_ldflags="$server_ldflags -lortp"
389 audiod_ldflags="$audiod_ldflags -lortp"
391 receivers="$receivers ortp"
392 senders="$senders ortp"
393 AC_DEFINE(HAVE_ORTP, 1, [define to 1 to turn on ortp support])
396 AC_MSG_NOTICE([deactivating ortp support])
398 AC_SUBST(GLIB_CFLAGS)
401 ########################################################################### zmw
403 msg="can not build para_slider"
404 CPPFLAGS="$GTK_CFLAGS"
405 LDFLAGS="$LDFLAGS $GTK_LIBS"
406 AC_CHECK_HEADERS([zmw/zmw.h], [], [
407 AC_MSG_WARN([zero memory widget header files not found, $msg])
410 AC_CHECK_LIB([zmw], [zmw_init], [], [
411 AC_MSG_WARN([zero memory widget library not found, $msg])
414 extras="$extras $slide"
420 AC_SUBST(extra_binaries, [$extras])
421 AC_SUBST(extra_filter_objs, [$extra_filter_objs])
422 AC_SUBST(extra_filter_libs, [$extra_filter_libs])
423 AC_SUBST(install_sh, [$INSTALL])
424 AC_CONFIG_FILES([Makefile])
428 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
429 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) }])
431 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
432 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
433 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
434 server_objs="$server_cmdline_objs $server_errlist_objs"
435 write_objs="$write_cmdline_objs $write_errlist_objs"
436 client_objs="$client_cmdline_objs $client_errlist_objs"
437 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
439 AC_SUBST(recv_objs, add_dot_o($recv_objs))
440 AC_SUBST(recv_ldflags, $recv_ldflags)
441 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
442 errors used by para_recv)
444 AC_SUBST(filter_objs, add_dot_o($filter_objs))
445 AC_SUBST(filter_ldflags, $filter_ldflags)
446 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
447 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
449 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
450 AC_SUBST(audiod_ldflags, $audiod_ldflags)
451 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
452 errors used by para_audiod)
454 AC_SUBST(server_objs, add_dot_o($server_objs))
455 AC_SUBST(server_ldflags, $server_ldflags)
456 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
457 objlist_to_errlist($server_errlist_objs), errors used by para_server)
459 AC_SUBST(write_objs, add_dot_o($write_objs))
460 AC_SUBST(write_ldflags, $write_ldflags)
461 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
462 objlist_to_errlist($write_errlist_objs), errors used by para_write)
464 AC_SUBST(client_objs, add_dot_o($client_objs))
465 AC_SUBST(client_ldflags, $client_ldflags)
466 AC_DEFINE_UNQUOTED(INIT_CLIENT_ERRLISTS,
467 objlist_to_errlist($client_errlist_objs), errors used by para_client)
469 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
470 AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
471 objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)
473 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
474 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
475 enum of supported writers)
476 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
477 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
478 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
479 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
480 array="$(for i in $writers; do printf '{.init = '$i'_write_init},'; done)"
481 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
483 gui_cmdline_objs="gui.cmdline"
484 gui_errlist_objs="exec close_on_fork signal string stat ringbuffer fd"
485 gui_other_objs="gui gui_common gui_theme"
486 gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
487 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
488 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
489 AC_SUBST(gui_objs, add_dot_o($gui_objs))
492 AC_MSG_NOTICE([creating Makefile.deps])
493 gcc -MM -MG $mysql_cppflags $faad_cppflags $mad_cppflags *.c > Makefile.deps
495 paraslash configuration:
496 ~~~~~~~~~~~~~~~~~~~~~~~~
497 unix socket credentials: $have_ucred
498 audio file selectors supported by para_server: $selectors
499 audio formats supported by para_server: $server_audio_formats
500 senders supported by para_server/para_send: $senders
501 receivers supported by para_audiod/para_recv: $receivers
502 filters supported by para_audiod/para_filter: $filters
503 writers supported by para_audiod/para_write: $writers