AC_INIT(src/ices.c) AM_CONFIG_HEADER(config.h) ICES_MAJOR=0 ICES_MINOR=2 ICES_MICRO=3 dnl Check to see if ICES_SPECIAL is overridden on commandline if test -z "$ICES_SPECIAL" -a -d ${srcdir}/CVS then ICES_SPECIAL="cvs" fi if test -n "$ICES_MICRO" -a "$ICES_MICRO" != "0" then ICES_VERSION_SMALL=$ICES_MAJOR.$ICES_MINOR.$ICES_MICRO else ICES_VERSION_SMALL=$ICES_MAJOR.$ICES_MINOR fi if test -z "$ICES_SPECIAL" then ICES_VERSION=$ICES_VERSION_SMALL else ICES_VERSION=$ICES_VERSION_SMALL-$ICES_SPECIAL fi VERSION="$ICES_VERSION" AC_MSG_RESULT([Building ices $VERSION...]) AM_INIT_AUTOMAKE(ices, $VERSION) dnl reasonable guesses for where stuff is installed if test "$prefix" = "NONE" then prefix="/usr/local/icecast" fi AC_ARG_WITH(docdir, [ --with-docdir=DIR ices documentation in DIR [PREFIX/doc/ices]], [ices_cv_docdir="$with_docdir"], [ices_cv_docdir='${prefix}/doc/ices']) docdir="$ices_cv_docdir" AC_SUBST(docdir) AC_ARG_WITH(moddir, [ --with-moddir=DIR ices playlist modules in DIR [SYSCONFDIR/modules]], [ices_cv_moddir="$with_moddir"], [ices_cv_moddir='${sysconfdir}/modules']) moddir="$ices_cv_moddir" AC_SUBST(moddir) dnl -- Finally, actual autoconf stuff -- AM_MAINTAINER_MODE AM_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) AC_ARG_PROGRAM AC_PROG_RANLIB dnl Checks for programs. AC_PROG_CC if test "$GCC" = yes then CFLAGS="$CFLAGS -Wall" fi AC_CHECK_PROG(UNAME,uname,uname) AC_CHECK_PROG(GMAKE,gmake,gmake) AC_PROG_INSTALL AC_PROG_MAKE_SET dnl -- System check -- AC_CANONICAL_HOST AC_AIX AC_ISC_POSIX AC_MINIX IRIX=no case $target in *solaris*) if test "$CC" = cc then CFLAGS="$CFLAGS -mt" fi ;; *sunos*) if test "$CC" = cc then CFLAGS="$CFLAGS -mt" fi ;; *hpux*) CFLAGS="$CFLAGS -D_HPUX_SOURCE -DHPUX" if test "$CC" = cc then CFLAGS="$CFLAGS -Aa" fi ;; *irix*) IRIX=yes ;; esac dnl -- Compiler feature check -- AC_C_CONST dnl -- System library check -- if test "$IRIX" = "yes" then AC_MSG_WARN(Skipping library tests because they confuse Irix) else AC_SEARCH_LIBS(gethostbyname, dns nsl resolv) fi dnl -- System header check -- AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([errno.h fcntl.h signal.h sys/signal.h sys/socket.h \ sys/stat.h sys/time.h sys/types.h unistd.h]) AC_HEADER_TIME AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SIGNAL dnl -- System function check -- AC_FUNC_STRFTIME AC_CHECK_FUNCS([vsnprintf setsid inet_addr inet_aton setlinebuf]) dnl -- Required extra libraries -- AC_ARG_WITH(libshout, [ --with-libshout[=DIR] use installed libshout [in DIR]]) have_libshout="no" if test "$with_libshout" != "no" then if test -n "$with_libshout" -a "$with_libshout" != "yes" then CPPFLAGS="$CPPFLAGS -I$with_libshout/include" LDFLAGS="$LDFLAGS -L$with_libshout/lib" fi AC_CHECK_HEADER(shout/shout.h, [ AC_DEFINE(HAVE_SHOUT_SHOUT_H, 1, [Define if you have ]) have_libshout="maybe" ]) if test "$have_libshout" != "no" then dnl shout_strerror was introduced later so it serves as a version check. AC_CHECK_LIB(shout, shout_strerror, [ have_libshout="yes" LIBS="$LIBS -lshout" ]) fi if test "$have_libshout" != "yes" then if test -n "$with_libshout" then AC_MSG_ERROR([Could not find a usable installed libshout]) else AC_MSG_RESULT([Installed libshout not found, using builtin]) fi fi fi if test "$have_libshout" != "yes" then libshout="libshout" fi AC_CONFIG_SUBDIRS($libshout) AM_CONDITIONAL(NEED_SHOUT, test "$have_libshout" != "yes") dnl -- Optional features -- AC_ARG_WITH(lame, [ --with-lame[=DIR] enable support for reencoding with lame [in DIR]]) AC_ARG_WITH(lame-includes, [ --with-lame-includes=DIR directory to find lame.h]) AC_ARG_WITH(lame-libraries, [ --with-lame-libraries=DIR directory to find lame library]) if test "$with_lame_includes" then if test -f "$with_lame_includes/lame.h" then CPPFLAGS="$CPPFLAGS -I$with_lame_includes" else AC_MSG_ERROR("lame.h is not where you told me it should be. No that is just plain rude.") fi fi if test "$with_lame_libraries" then LDFLAGS="$LDFLAGS -L$with_lame_libraries" fi have_LAME="no" if test "$with_lame" != "no" then AC_CACHE_SAVE if test -n "$with_lame" -a "$with_lame" != "yes" then CPPFLAGS="$CPPFLAGS -I$with_lame/include" LDFLAGS="$LDFLAGS -L$with_lame/lib" fi AC_CHECK_HEADER(lame/lame.h, [ have_LAME="maybe", AC_DEFINE(HAVE_LAME_LAME_H, 1, [Use instead of ]) ], AC_CHECK_HEADER(lame.h, [ have_LAME="maybe"])) if test "$have_LAME" != "no" then dnl lame_init_old only exists in the NEW API - we don't actually use it. AC_CHECK_LIB(mp3lame, lame_init_old, [ have_LAME="yes" LIBS="$LIBS -lmp3lame" ICES_OBJECTS="$ICES_OBJECTS reencode.o" LIBM="-lm" AC_DEFINE(HAVE_LIBLAME, 1, [Define if you have the LAME MP3 library]) ], [have_LAME="no"], -lm) fi dnl lame_encode_flush_nogap was added at the same time that lame was made dnl to handle calls to lame_encode_buffer following a flush, so we use dnl this as a flag to see whether we have to reset the LAME engine between dnl songs. if test "$have_LAME" = "yes" then AC_CHECK_LIB(mp3lame, lame_encode_flush_nogap, [ AC_DEFINE(HAVE_LAME_NOGAP, 1, [Define if libmp3lame has lame_encode_flush_nogap])],, -lm) fi fi if test "$with_lame" != "no" -a "$have_LAME" != "yes" then if test -n "$with_lame" then AC_MSG_ERROR([Could not find a valid LAME library installation]) else AC_MSG_RESULT([Could not find a valid LAME library, reencoding disabled]) fi fi AC_ARG_WITH(vorbis, [ --with-vorbis[=DIR] support for vorbis using libvorbisfile [in DIR]]) if test "$have_LAME" != "yes" then if test -n "$with_vorbis" -a "$with_vorbis" != "no" then AC_MSG_ERROR([Vorbis cannot be enabled without LAME]) elif test "$with_vorbis" != "no" then AC_MSG_RESULT([Vorbis is disabled because LAME is not enabled]) with_vorbis="no" fi fi have_vorbis="no" if test "$with_vorbis" != "no" then AC_CACHE_SAVE if test -n "$with_vorbis" -a "$with_vorbis" != "yes" then CPPFLAGS="$CPPFLAGS -I$with_vorbis/include" LDFLAGS="$LDFLAGS -L$with_vorbis/lib" fi AC_CHECK_HEADER(vorbis/vorbisfile.h, have_vorbis="maybe") if test "$have_vorbis" != "no" then AC_CHECK_LIB(vorbisfile, ov_open, [ ICES_OBJECTS="$ICES_OBJECTS in_vorbis.o" LIBS="$LIBS -lvorbisfile -lvorbis -logg" AC_DEFINE(HAVE_LIBVORBISFILE, 1, [Define if you have libvorbisfile]) have_vorbis="yes" ],[have_vorbis="no"],-lvorbis -logg) fi fi if test "$with_vorbis" != "no" -a "$have_vorbis" != "yes" then if test -n "$with_vorbis" then AC_MSG_ERROR([Could not find libvorbisfile]) else AC_MSG_RESULT([Could not find libvorbisfile, vorbis support disabled]) fi fi AC_ARG_WITH(perl, [ --with-perl[=DIR] enable perl interpreter [found in DIR]]) have_perl="no" PERL=perl if test "$with_perl" != "no" then AC_CACHE_SAVE if test -n "$with_perl" -a "$with_perl" != "yes" then PERL="$with_perl/bin/perl" if ! test -x "$PERL" then AC_MSG_ERROR([Perl not found in the specified location]) fi fi PERLCFLAGS=`$PERL -MExtUtils::Embed -e ccopts` PERLLIBS=`$PERL -MExtUtils::Embed -e ldopts` saved_CPPFLAGS="$CPPFLAGS" saved_LIBS="$LIBS" CPPFLAGS="$CPPFLAGS $PERLCFLAGS" LIBS="$LIBS $PERLLIBS" AC_CHECK_FUNCS(perl_construct) if test "$ac_cv_func_perl_construct" != "no" then have_perl="yes" PLAYLIST_OBJECTS="$PLAYLIST_OBJECTS pm_perl.o" AC_DEFINE(HAVE_LIBPERL, 1, [Define if you have perl libraries]) else CPPFLAGS="$saved_CPPFLAGS" LIBS="$saved_LIBS" fi fi if test "$with_perl" != "no" -a "$have_perl" != "yes" then if test -n "$with_perl" then AC_MSG_ERROR([Could not find perl libraries]) else AC_MSG_RESULT([Could not find perl libraries, perl scripting disabled]) fi fi AC_ARG_WITH(python, [ --with-python[=DIR] enable python interpreter [in DIR]]) use_python=$withval AC_ARG_WITH(python-includes, [ --with-python-includes=DIR python include files are in DIR]) AC_ARG_WITH(python-libraries, [ --with-python-libraries=DIR python libraries are in DIR]) if test -n "$with_python_includes" then CPPFLAGS="$CPPFLAGS -I$with_python_includes" fi if test -n "$with_python_libraries" then LDFLAGS="$LDFLAGS -L$with_python_libraries" fi have_python="no" if test "$with_python" != "no" then AC_CACHE_SAVE if test -n "$with_python" -a "$with_python" != "yes" then CPPFLAGS="$CPPFLAGS -I$with_python/include" LDFLAGS="$LDFLAGS -L$with_python/lib" fi AC_CHECK_HEADER(Python.h, [ have_python="maybe", AC_DEFINE(HAVE_PYTHON_H, 1, [Define if you have Python.h])]) if test "$have_python" != "no" then for lib in python python2.2 python2.1 python2.0 python1.6 python1.5 do if test "$have_python" != "yes" then AC_CHECK_LIB($lib, Py_Initialize, [ LIBS="$LIBS -l$lib" PLAYLIST_OBJECTS="$PLAYLIST_OBJECTS pm_python.o" have_python="yes" LIBM="-lm" LIBDL="-ldl" AC_DEFINE(HAVE_LIBPYTHON, 1, [Define if you have the python library])],[have_python="no"],-lm -ldl) fi done fi fi if test "$with_python" != "no" -a "$have_python" != "yes" then if test -n "$with_python" then AC_MSG_ERROR([Could not find the python library]) else AC_MSG_RESULT([Could not find the python library, python scripting disabled]) fi fi AC_ARG_WITH(xml-config, [ --with-xml-config=PATH Use xml-config in PATH to find libxml ]) have_xml="no" if test "$with_xml_config" != "no" then if test -n "$with_xml_config" -a "$with_xml_config" != "yes" then XMLCONFIG="$with_xml_config" if ! test -x "$XMLCONFIG" then AC_MSG_ERROR([$with_xmlconfig is not a program]) fi else AC_CHECK_PROGS(XMLCONFIG, [xml2-config xml-config]) fi if test -n "$XMLCONFIG" then AC_DEFINE(HAVE_LIBXML, 1, [Define if you have the GNOME XML library]) LIBS="$LIBS `$XMLCONFIG --libs`" CPPFLAGS="$CPPFLAGS `$XMLCONFIG --cflags`" ICES_OBJECTS="$ICES_OBJECTS ices_config.o" have_xml="yes" else AC_MSG_RESULT([Compiling without libxml support - no configfiles]) fi fi dnl -- and finish up -- LIBS="$LIBS $LIBM $LIBDL" AC_SUBST(ICES_OBJECTS) AC_SUBST(PLAYLIST_OBJECTS) AC_OUTPUT([Makefile src/Makefile src/playlist/Makefile conf/Makefile conf/ices.conf.dist doc/Makefile doc/ices.1]) AC_MSG_RESULT([Compiling with CPPFLAGS=$CPPFLAGS]) AC_MSG_RESULT([Linking with LDFLAGS=$LDFLAGS $LIBS]) AC_MSG_RESULT([Features:]) if test "$have_libshout" != "yes" then AC_MSG_RESULT([ libshout: builtin]) else AC_MSG_RESULT([ libshout: system]) fi AC_MSG_RESULT([ LAME : $have_LAME]) AC_MSG_RESULT([ Vorbis : $have_vorbis]) AC_MSG_RESULT([ Perl : $have_perl]) AC_MSG_RESULT([ Python : $have_python]) AC_MSG_RESULT([ XML : $have_xml]) if test "$GMAKE" then AC_MSG_RESULT([Configuration complete. Now run 'gmake'.]) AC_MSG_RESULT([You can then run 'gmake install' to install ices]) else AC_MSG_RESULT([Configuration complete. Now run 'make'.]) AC_MSG_RESULT([You can then run 'make install' to install ices]) fi