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 malloc.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"
67 audiod_cmdline_objs="audiod.cmdline grab_client.cmdline compress_filter.cmdline
68 http_recv.cmdline dccp_recv.cmdline"
69 audiod_errlist_objs="audiod exec close_on_fork signal string daemon stat net
70 time grab_client filter_chain wav compress http_recv dccp dccp_recv recv_common fd"
73 server_cmdline_objs="server.cmdline"
74 server_errlist_objs="server mp3 afs command net string signal random_selector
75 time daemon stat crypt http_send db close_on_fork playlist_selector
76 ipc dccp dccp_send fd"
79 write_cmdline_objs="write.cmdline"
80 write_errlist_objs="write write_common file_writer time fd string"
85 ########################################################################### ssl
86 dnl @synopsis CHECK_SSL
88 dnl based on the follwing macro from the autoconf archive
90 dnl @category InstalledPackages
91 dnl @author Mark Ethan Trostler <trostler@juniper.net>
92 dnl @version 2003-01-28
93 dnl @license AllPermissive
97 for ssldir in $1 /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
98 AC_MSG_CHECKING(for openssl in $ssldir)
99 if test -f "$ssldir/include/openssl/ssl.h"; then
102 SSL_CFLAGS="-I$ssldir/include/openssl"
103 SSL_CPPFLAGS="-I$ssldir/include/openssl"
106 if test -f "$ssldir/include/ssl.h"; then
109 SSL_CFLAGS="-I$ssldir/include/";
110 SSL_CPPFLAGS="-I$ssldir/include/";
115 if test x_$found_ssl != x_yes; then
116 AC_MSG_ERROR(Cannot find ssl libraries)
118 SSL_LIBS="-lssl -lcrypto";
119 SSL_LDFLAGS="-L$ssldir/lib";
121 AC_SUBST(SSL_CPPFLAGS)
124 AC_SUBST(SSL_LDFLAGS)
127 AC_ARG_ENABLE(ssldir, [AS_HELP_STRING(--enable-ssldir=path,
128 [Search for openssl also in path.])])
129 if test "$enable_ssldir" = "yes"; then enable_ssldir=""; fi
130 CHECK_SSL($enable_ssldir)
131 server_ldflags="$srver_ldflags $SSL_LDFLAGS $SSL_LIBS"
133 ########################################################################### ucred
135 AC_MSG_CHECKING(for struct ucred)
137 #include <sys/types.h>
138 #include <sys/socket.h>
140 struct ucred sucred; sucred.pid=0;
141 ],[have_ucred=yes],[have_ucred=no])
142 AC_MSG_RESULT($have_ucred)
143 if test ${have_ucred} = yes; then
144 AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
147 ########################################################################### gtk2
149 pkg_modules="gtk+-2.0 >= 2.0.0"
150 PKG_CHECK_MODULES(GTK, [$pkg_modules], [extras="$extras para_krell.so"], [
151 AC_MSG_WARN([gtk+-2 not found, can not build para_krell])
156 ########################################################################### sdl
157 AC_CHECK_LIB([SDL_image], [SDL_Init], [extras="$extras para_sdl_gui"], [
158 AC_MSG_WARN([libSDL_image not found, cannot build para_sdl_gui])
160 AC_CHECK_HEADER(SDL/SDL.h, [],
161 [AC_MSG_WARN([SDL/SDL.h not found])])
163 ########################################################################### mysql
165 AC_ARG_ENABLE(mysql_headers, [AC_HELP_STRING(--enable-mysql-headers=dir,
166 [look for mysql.h also in dir])])
167 if test -n "$enable_mysql_headers"; then
168 mysql_cppflags="-I$enable_mysql_headers"
169 CPPFLAGS="$CPPFLAGS $mysql_cppflags"
171 AC_ARG_ENABLE(mysql_libs, [AC_HELP_STRING(--enable-mysql-libs=dir,
172 [look for libmysqlclient also in dir])])
173 if test -n "$enable_mysql_headers"; then
174 mysql_libs="-L$enable_mysql_libs"
175 LDFLAGS="$LDFLAGS $mysql_libs"
177 AC_CHECK_HEADER(mysql/mysql.h, [], [
180 AC_CHECK_LIB([mysqlclient], [mysql_init], [], [
183 if test "$have_mysql" = "yes"; then
184 server_ldflags="$server_ldflags $mysql_libs -lmysqlclient"
185 server_errlist_objs="$server_errlist_objs mysql_selector"
186 AC_SUBST(mysql_cppflags)
187 AC_DEFINE(HAVE_MYSQL, 1, [define to 1 to turn on mysql support])
189 AC_MSG_WARN([cannot build mysql-based audio file selector])
191 ########################################################################### ogg
193 AC_CHECK_LIB([ogg], [ogg_stream_init], [], [
196 AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [
199 AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [
202 if test "$have_ogg" = "yes"; then
203 AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support)
204 server_ldflags="$server_ldflags -logg -lvorbis -lvorbisfile"
205 filter_ldflags="$filter_ldflags -lvorbis -lvorbisfile"
206 audiod_ldflags="$audiod_ldflags -lvorbis -lvorbisfile"
208 filter_cmdline_objs="$filter_cmdline_objs oggdec_filter.cmdline"
209 audiod_cmdline_objs="$audiod_cmdline_objs oggdec_filter.cmdline"
211 server_errlist_objs="$server_errlist_objs ogg"
212 filter_errlist_objs="$filter_errlist_objs oggdec"
213 audiod_errlist_objs="$audiod_errlist_objs oggdec"
215 AC_MSG_WARN([no ogg vorbis support in para_server/para_filter])
217 ########################################################################### mad
219 AC_CHECK_HEADERS([mad.h], [], [
222 AC_CHECK_LIB([mad], [mad_stream_init], [], [
225 if test "$have_mad" = "yes"; then
226 AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
227 filter_errlist_objs="$filter_errlist_objs mp3dec"
228 audiod_errlist_objs="$audiod_errlist_objs mp3dec"
229 filter_ldflags="$filter_ldflags -lmad"
230 audiod_ldflags="$audiod_ldflags -lmad"
232 AC_MSG_WARN([no mp3dec support in para_audiod/para_filter])
234 ########################################################################### alsa
236 msg="=> no alsa support for para_write"
237 AC_CHECK_HEADERS([alsa/asoundlib.h], [], [
238 AC_MSG_WARN([no alsa/asoundlib $msg])
241 AC_CHECK_LIB([asound], [snd_pcm_open], [], [
242 AC_MSG_WARN([no libasound $msg])
245 if test "$have_alsa" = "yes"; then
246 write_errlist_objs="$write_errlist_objs alsa_writer"
247 write_ldflags="$write_ldflags -lasound"
248 write_writers="$write_writers alsa"
250 ########################################################################### ortp
252 AC_ARG_ENABLE(ortp, AC_HELP_STRING([--disable-ortp], [Disable ortp support]),
253 if test x$enableval = xno; then
257 if test "$have_ortp" = "yes"; then
258 AC_CHECK_HEADERS([ortp/ortp.h], [], [
261 AC_CHECK_LIB([ortp], [ortp_init], [], [
265 if test "$have_ortp" = "yes"; then
266 recv_cmdline_objs="$recv_cmdline_objs ortp_recv.cmdline"
267 recv_errlist_objs="$recv_errlist_objs ortp_recv"
269 audiod_cmdline_objs="$audiod_cmdline_objs ortp_recv.cmdline"
270 audiod_errlist_objs="$audiod_errlist_objs ortp_recv"
272 server_errlist_objs="$server_errlist_objs ortp_send"
274 recv_ldflags="$recv_ldflags -lortp"
275 server_ldflags="$server_ldflags -lortp"
276 audiod_ldflags="$audiod_ldflags -lortp"
277 AC_DEFINE(HAVE_ORTP, 1, [define to 1 to turn on ortp support])
280 AC_MSG_NOTICE([deactivating ortp support])
282 AC_SUBST(GLIB_CFLAGS)
285 ########################################################################### zmw
287 msg="can not build para_slider"
288 CPPFLAGS="$GTK_CFLAGS"
289 LDFLAGS="$LDFLAGS $GTK_LIBS"
290 AC_CHECK_HEADERS([zmw/zmw.h], [], [
291 AC_MSG_WARN([zero memory widget header files not found, $msg])
294 AC_CHECK_LIB([zmw], [zmw_init], [], [
295 AC_MSG_WARN([zero memory widget library not found, $msg])
298 extras="$extras $slide"
304 AC_SUBST(extra_binaries, [$extras])
305 AC_SUBST(extra_filter_objs, [$extra_filter_objs])
306 AC_SUBST(extra_filter_libs, [$extra_filter_libs])
307 AC_SUBST(install_sh, [$INSTALL])
308 AC_CONFIG_FILES([Makefile])
312 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
313 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) }])
315 recv_objs="$recv_cmdline_objs $recv_errlist_objs"
316 filter_objs="$filter_cmdline_objs $filter_errlist_objs"
317 audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs"
318 server_objs="$server_cmdline_objs $server_errlist_objs"
319 write_objs="$write_cmdline_objs $write_errlist_objs"
321 AC_SUBST(recv_objs, add_dot_o($recv_objs))
322 AC_SUBST(recv_ldflags, $recv_ldflags)
323 AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs),
324 errors used by para_recv)
326 AC_SUBST(filter_objs, add_dot_o($filter_objs))
327 AC_SUBST(filter_ldflags, $filter_ldflags)
328 AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS,
329 objlist_to_errlist($filter_errlist_objs), errors used by para_filter)
331 AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
332 AC_SUBST(audiod_ldflags, $audiod_ldflags)
333 AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs),
334 errors used by para_audiod)
336 AC_SUBST(server_objs, add_dot_o($server_objs))
337 AC_SUBST(server_ldflags, $server_ldflags)
338 AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
339 objlist_to_errlist($server_errlist_objs), errors used by para_server)
341 AC_SUBST(write_objs, add_dot_o($write_objs))
342 AC_SUBST(write_ldflags, $write_ldflags)
343 AC_DEFINE_UNQUOTED(INIT_WRITE_ERRLISTS,
344 objlist_to_errlist($write_errlist_objs), errors used by para_write)
346 enum="$(for i in $write_writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
347 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
348 enum of supported writers)
349 names="$(for i in $write_writers; do printf \"$i\",' ' ; done)"
350 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
351 inits="$(for i in $write_writers; do printf 'extern void '$i'_writer_init(struct writer *); '; done)"
352 AC_DEFINE_UNQUOTED(DECLARE_WRITER_INITS, $inits, init functions of the supported writers)
353 array="$(for i in $write_writers; do printf '{.init = '$i'_writer_init},'; done)"
354 AC_DEFINE_UNQUOTED(WRITER_ARRAY, $array, array of supported writers)
356 gui_cmdline_objs="gui.cmdline"
357 gui_errlist_objs="exec close_on_fork signal string stat ringbuffer fd"
358 gui_other_objs="gui gui_common gui_theme"
359 gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
360 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
361 objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
362 AC_SUBST(gui_objs, add_dot_o($gui_objs))
365 AC_MSG_NOTICE([creating Makefile.deps])
366 gcc -MM -MG $mysql_cppflags *.c > Makefile.deps
368 paraslash configuration:
369 ~~~~~~~~~~~~~~~~~~~~~~~~
370 mysql support: $have_mysql
371 ogg vorbis support: $have_ogg
372 mp3dec support (libmad): $have_mad
373 ortp support: $have_ortp
374 unix socket credentials: $have_ucred
375 supported writers for para_write: $write_writers