dnl Keep the version number in sync with main.h! AC_INIT([znc], [0.051]) AC_PROG_CXX AC_CANONICAL_HOST CXXFLAGS="-D_GNU_SOURCE" INCLUDES="" LIBS="" DEPEND="" appendLib () { if test "$LIBS" != ""; then LIBS="$LIBS $*" else LIBS=$* fi } appendInc () { if test "$INCLUDES" != ""; then INCLUDES="$INCLUDES $*" else INCLUDES=$* fi } appendCXX () { if test "$CXXFLAGS" != ""; then CXXFLAGS="$CXXFLAGS $*" else CXXFLAGS=$* fi } appendLD () { if test "$LDFLAGS" != ""; then LDFLAGS="$LDFLAGS $*" else LDFLAGS=$* fi } case "${host_os}" in freebsd*) appendInc -I/usr/local/include appendLib -L/usr/local/lib -lcompat appendCXX -D__GNU_LIBRARY__ ;; solaris*) appendLib -lsocket -lnsl ISSUN=1 ;; cygwin) ISCYGWIN=1 ;; esac # cygwin # warning: -fPIC ignored for target (all code is position independent) if test -z "$ISCYGWIN" ; then appendCXX -fPIC fi AC_ARG_WITH( [openssl], AC_HELP_STRING([--with-openssl=/path/to/openssl], []), [OPENSSL=$withval],) AC_ARG_ENABLE( [debug], AC_HELP_STRING([--enable-debug], [enable debuging]), [DEBUG="$enableval"], [DEBUG="no"]) AC_ARG_ENABLE( [ipv6], AC_HELP_STRING([--enable-ipv6], [enable ipv6 support]), [IPV6="$enableval"], [IPV6="no"]) AC_ARG_ENABLE( [modules], AC_HELP_STRING([--disable-modules], [disable modules]), [MODULES="$enableval"], [MODULES="yes"]) AC_ARG_ENABLE( [openssl], AC_HELP_STRING([--disable-openssl], [disable openssl]), [if test "$enableval" = "no" ; then NOSSL=1; fi],) AC_ARG_ENABLE( [perl], AC_HELP_STRING([--disable-perl], [disable perl]), [if test "$enableval" = "no" ; then NOPERL=1; fi],) if test "$DEBUG" != "no"; then appendCXX -Wall -ggdb -D_DEBUG else appendCXX -Wall -O2 -fomit-frame-pointer fi if test "$IPV6" != "no"; then appendCXX -DHAVE_IPV6 fi if test "x$GXX" = "xyes"; then appendCXX -Woverloaded-virtual # enable g++ dependency tracking DEPEND=".depend" fi AC_CHECK_LIB( gnugetopt, getopt_long,) AC_CHECK_FUNCS( stat lstat chmod open, , AC_ERROR([Missing Required libc feature])) if test "$MODULES" = "yes"; then AC_CHECK_FUNC( dlopen,NOCHECK_DL=1,) fi if test -z "$NOSSL"; then if test -n "$OPENSSL"; then appendLib -L${OPENSSL}/lib appendInc -I${OPENSSL}/include fi AC_CHECK_LIB( crypto, BIO_new,,AC_ERROR([Could not find libcrypto. Try --disable-openssl]), ) AC_CHECK_LIB( ssl, SSL_shutdown,,AC_ERROR([Could not find libssl. Try --disable-openssl]), ) if test -z "$NOSSL"; then appendCXX -DHAVE_LIBSSL fi fi if test -z "$prefix" || test $prefix = "NONE"; then prefix="/usr/local" fi AC_ARG_WITH( [module-prefix], AC_HELP_STRING([--with-module-prefix=/path/to/moduledir], []), [MODDIR=$withval], [MODDIR="${prefix}/libexec"] ) if test "$MODULES" = "yes"; then if test -z "$NOCHECK_DL"; then AC_CHECK_LIB( dl, dlopen,, AC_ERROR([Could not find dlopen. Try --disable-modules])) NOCHECK_DL=1 fi if test "$MODULES" = "yes"; then appendCXX -D_MODULES if test -n "$ISSUN"; then MODFLAGS="$CXXFLAGS" else MODFLAGS="$CXXFLAGS" appendLD -Wl,--export-dynamic fi MODFLAGS="$MODFLAGS -I`pwd`" MODTARGET="modules" if test -z "$NOCHECK_DL"; then appendLib -ldl fi if test -n "$ISSUN"; then MODFLAGS="$MODFLAGS -mimpure-text" fi appendCXX "-D_MODDIR_=\\\"${MODDIR}/znc\\\"" if test -z "$NOPERL"; then echo -n "checking for perl... " PERL=`which perl` if test -n "$PERL"; then echo "$PERL" AC_CHECK_LIB(perl, perl_alloc,unset NOPERL, AC_ERROR([Could not find libperl. Try --disable-perl]), [`$PERL -MExtUtils::Embed -e ccopts -e ldopts`]) else echo "no" unset PERL AC_ERROR([Could not find perl binary. Try --disable-perl]) fi fi fi fi VERSION=AC_PACKAGE_VERSION # # Auto detect modules AC_SUBST([CXXFLAGS]) AC_SUBST([MODFLAGS]) AC_SUBST([LDFLAGS]) AC_SUBST([INCLUDES]) AC_SUBST([DEPEND]) AC_SUBST([LIBS]) AC_SUBST([MODULES]) AC_SUBST([MODTARGET]) AC_SUBST([VERSION]) AC_SUBST([NOSSL]) AC_SUBST([PERL]) AC_SUBST([MODDIR]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([znc-config]) if test "$MODULES" = "yes"; then AC_CONFIG_FILES([modules/Makefile]) fi AC_OUTPUT echo echo znc $VERSION configured echo echo "debug: $DEBUG" echo "ipv6: $IPV6" if test x"$NOSSL" = "x1" ; then echo "openssl: no" else echo "openssl: yes" fi echo modules: $MODULES if test x"$PERL" = "x" ; then echo "perl: no" else echo "perl: yes" fi