# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.53) AC_INIT(paraslash, [git], maan@systemlinux.org) AC_CONFIG_HEADER([config.h]) ########################################################################### generic AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h stdlib.h \ string.h sys/socket.h sys/time.h sys/timeb.h sys/un.h sys/ipc.h unistd.h utime.h malloc.h], \ [], [AC_MSG_ERROR([$ac_header not found])]) AC_CHECK_HEADER(linux/soundcard.h, [extras="$extras para_fade"], [AC_MSG_WARN([linux/soundcard.h not found, \ cannot build para_fade])]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM # Checks for library functions. AC_FUNC_FORK AC_PROG_GCC_TRADITIONAL AC_FUNC_MALLOC AC_FUNC_MEMCMP AC_FUNC_MKTIME AC_FUNC_MMAP AC_FUNC_REALLOC AC_FUNC_SELECT_ARGTYPES AC_TYPE_SIGNAL AC_FUNC_STAT AC_FUNC_STRFTIME AC_FUNC_VPRINTF AC_CHECK_FUNCS([atexit dup2 gethostbyname inet_ntoa memchr memmove memset \ regcomp select socket strchr strdup strerror strstr strtol uname], [], [AC_MSG_ERROR([function not found, cannot live without it])]) ########################################################################### curses AC_CHECK_LIB([ncurses], [initscr], [], [AC_MSG_ERROR([libncurses not found])]) AC_CHECK_LIB([readline], [readline], [], [AC_MSG_ERROR([libreadline not found])]) AC_CHECK_LIB([menu], [new_menu], [extras="$extras para_dbadm"], [AC_MSG_WARN([libmenu not found, cannot build para_dbadm])]) ########################################################################### recv_cmdline_objs="recv.cmdline http_recv.cmdline" recv_errlist_objs="http_recv recv_common recv time string net" recv_ldflags="" filter_cmdline_objs="filter.cmdline compress_filter.cmdline" filter_errlist_objs="filter_chain wav compress filter string" filter_ldflags="" audiod_cmdline_objs="audiod.cmdline grab_client.cmdline compress_filter.cmdline http_recv.cmdline" audiod_errlist_objs="audiod exec close_on_fork signal string daemon stat net time grab_client filter_chain wav compress http_recv recv_common ringbuffer" audiod_ldflags="" server_cmdline_objs="server.cmdline" server_errlist_objs="server mp3 afs command net string signal random_selector time daemon stat crypt http_send db close_on_fork playlist_selector ipc" server_ldflags="" ########################################################################### ssl dnl @synopsis CHECK_SSL dnl dnl based on the follwing macro from the autoconf archive dnl dnl @category InstalledPackages dnl @author Mark Ethan Trostler dnl @version 2003-01-28 dnl @license AllPermissive AC_DEFUN([CHECK_SSL], [ for ssldir in $1 /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do AC_MSG_CHECKING(for openssl in $ssldir) if test -f "$ssldir/include/openssl/ssl.h"; then found_ssl="yes" AC_MSG_RESULT(yes) SSL_CFLAGS="-I$ssldir/include/openssl" SSL_CPPFLAGS="-I$ssldir/include/openssl" break fi if test -f "$ssldir/include/ssl.h"; then found_ssl="yes"; AC_MSG_RESULT(yes) SSL_CFLAGS="-I$ssldir/include/"; SSL_CPPFLAGS="-I$ssldir/include/"; break fi AC_MSG_RESULT(no) done if test x_$found_ssl != x_yes; then AC_MSG_ERROR(Cannot find ssl libraries) else SSL_LIBS="-lssl -lcrypto"; SSL_LDFLAGS="-L$ssldir/lib"; fi AC_SUBST(SSL_CPPFLAGS) AC_SUBST(SSL_CFLAGS) AC_SUBST(SSL_LIBS) AC_SUBST(SSL_LDFLAGS) ])dnl AC_ARG_ENABLE(ssldir, [AS_HELP_STRING(--enable-ssldir=path, [Search for openssl also in path.])]) if test "$enable_ssldir" = "yes"; then enable_ssldir=""; fi CHECK_SSL($enable_ssldir) server_ldflags="$srver_ldflags $SSL_LDFLAGS $SSL_LIBS" ########################################################################### gtk2 pkg_modules="gtk+-2.0 >= 2.0.0" PKG_CHECK_MODULES(GTK, [$pkg_modules], [extras="$extras para_krell.so"], [ AC_MSG_WARN([gtk+-2 not found, can not build para_krell]) ]) AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) ########################################################################### sdl AC_CHECK_LIB([SDL_image], [SDL_Init], [extras="$extras para_sdl_gui"], [ AC_MSG_WARN([libSDL_image not found, cannot build para_sdl_gui]) ]) AC_CHECK_HEADER(SDL/SDL.h, [], [AC_MSG_WARN([SDL/SDL.h not found])]) ########################################################################### mysql have_mysql="yes" AC_CHECK_HEADER(mysql/mysql.h, [], [ have_mysql="no" ]) AC_CHECK_LIB([mysqlclient], [mysql_init], [], [ have_mysql="no" ]) if test "$have_mysql" = "yes"; then server_ldflags="$server_ldflags -lmysqlclient" server_errlist_objs="$server_errlist_objs mysql_selector" AC_DEFINE(HAVE_MYSQL, 1, [define to 1 to turn on mysql support]) else AC_MSG_WARN([cannot build mysql-based audio file selector]) fi ########################################################################### ogg have_ogg="yes" AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ]) AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_ogg="no" ]) AC_CHECK_HEADERS([ogg/ogg.h vorbis/codec.h], [], [ have_ogg="no" ]) if test "$have_ogg" = "yes"; then AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg vorbis support) server_ldflags="$server_ldflags -logg -lvorbis -lvorbisfile" filter_ldflags="$filter_ldflags -lvorbis -lvorbisfile" audiod_ldflags="$audiod_ldflags -lvorbis -lvorbisfile" filter_cmdline_objs="$filter_cmdline_objs oggdec_filter.cmdline" audiod_cmdline_objs="$audiod_cmdline_objs oggdec_filter.cmdline" server_errlist_objs="$server_errlist_objs ogg" filter_errlist_objs="$filter_errlist_objs oggdec" audiod_errlist_objs="$audiod_errlist_objs oggdec" else AC_MSG_WARN([no ogg vorbis support in para_server/para_filter]) fi ########################################################################### mad have_mad="yes" AC_CHECK_HEADERS([mad.h], [], [ have_mad="no" ]) AC_CHECK_LIB([mad], [mad_stream_init], [], [ have_mad="no" ]) if test "$have_mad" = "yes"; then AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter) filter_errlist_objs="$filter_errlist_objs mp3dec" audiod_errlist_objs="$audiod_errlist_objs mp3dec" filter_ldflags="$filter_ldflags -lmad" audiod_ldflags="$audiod_ldflags -lmad" else AC_MSG_WARN([no mp3dec support in para_audiod/para_filter]) fi ########################################################################### alsa play="para_play" msg="will not build para_play" AC_CHECK_HEADERS([alsa/asoundlib.h], [], [ AC_MSG_WARN([no alsa/asoundlib, $msg]) play="" ]) AC_CHECK_LIB([asound], [snd_pcm_open], [], [ AC_MSG_WARN([no libasound, $msg]) play="" ]) extras="$extras $play" ########################################################################### ortp have_ortp="yes" pkg_modules="glib-2.0 >= 2.0.4" PKG_CHECK_MODULES(GLIB, [$pkg_modules], [], [ have_ortp="no" ]) CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS" AC_CHECK_HEADERS([ortp/ortp.h], [], [ have_ortp="no" ]) AC_CHECK_LIB([ortp], [ortp_init], [], [ have_ortp="no" ]) if test "$have_ortp" = "yes"; then recv_cmdline_objs="$recv_cmdline_objs ortp_recv.cmdline" recv_errlist_objs="$recv_errlist_objs ortp_recv" audiod_cmdline_objs="$audiod_cmdline_objs ortp_recv.cmdline" audiod_errlist_objs="$audiod_errlist_objs ortp_recv" server_errlist_objs="$server_errlist_objs ortp_send" recv_ldflags="$recv_ldflags $GLIB_LIBS -lortp" server_ldflags="$server_ldflags $GLIB_LIBS -lortp" audiod_ldflags="$audiod_ldflags $GLIB_LIBS -lortp" AC_DEFINE(HAVE_ORTP, 1, [define to 1 to turn on ortp support]) else AC_MSG_WARN([deactivating ortp support]) fi AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) ########################################################################### zmw slide="para_slider" msg="can not build para_slider" CPPFLAGS="$GTK_CFLAGS" LDFLAGS="$LDFLAGS $GTK_LIBS" AC_CHECK_HEADERS([zmw/zmw.h], [], [ AC_MSG_WARN([zero memory widget header files not found, $msg]) slide="" ]) AC_CHECK_LIB([zmw], [zmw_init], [], [ AC_MSG_WARN([zero memory widget library not found, $msg]) slide="" ]) extras="$extras $slide" AC_SUBST(extra_binaries, [$extras]) AC_SUBST(extra_filter_objs, [$extra_filter_objs]) AC_SUBST(extra_filter_libs, [$extra_filter_libs]) AC_SUBST(install_sh, [$INSTALL]) AC_CONFIG_FILES([Makefile]) AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)]) 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) }]) recv_objs="$recv_cmdline_objs $recv_errlist_objs" filter_objs="$filter_cmdline_objs $filter_errlist_objs" audiod_objs="$audiod_cmdline_objs $audiod_errlist_objs" server_objs="$server_cmdline_objs $server_errlist_objs" AC_SUBST(recv_objs, add_dot_o($recv_objs)) AC_SUBST(recv_ldflags, $recv_ldflags) AC_DEFINE_UNQUOTED(INIT_RECV_ERRLISTS, objlist_to_errlist($recv_errlist_objs), errors used by para_recv) AC_SUBST(filter_objs, add_dot_o($filter_objs)) AC_SUBST(filter_ldflags, $filter_ldflags) AC_DEFINE_UNQUOTED(INIT_FILTER_ERRLISTS, objlist_to_errlist($filter_errlist_objs), errors used by para_filter) AC_SUBST(audiod_objs, add_dot_o($audiod_objs)) AC_SUBST(audiod_ldflags, $audiod_ldflags) AC_DEFINE_UNQUOTED(INIT_AUDIOD_ERRLISTS, objlist_to_errlist($audiod_errlist_objs), errors used by para_audiod) AC_SUBST(server_objs, add_dot_o($server_objs)) AC_SUBST(server_ldflags, $server_ldflags) AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS, objlist_to_errlist($server_errlist_objs), errors used by para_server) AC_OUTPUT AC_MSG_NOTICE([creating Makefile.deps]) gcc -MM -MG *.c > Makefile.deps AC_MSG_NOTICE([ paraslash configuration: ~~~~~~~~~~~~~~~~~~~~~~~~ mysql support: $have_mysql ogg vorbis support: $have_ogg mp3dec support (libmad): $have_mad ortp support: $have_ortp ])