mirror of
https://github.com/znc/znc.git
synced 2026-07-05 17:31:06 +02:00
d7c51ed141
We are back to the behaviour of some old version of the Makefile If you want to compile ZNC only once, just use make. If you want the Makefile do to dependency tracking and that fancy stuff, run make depend which creates the .depend and modules/.depend dirs. From then on some dependency files get written when you compile something. (The way we did it before now was bad, because all the .cpp files depended on the .depend dir which got its mtime updated regulary) git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@922 726aef4b-f618-498e-8847-2d620e286838
231 lines
4.8 KiB
Plaintext
231 lines
4.8 KiB
Plaintext
dnl Keep the version number in sync with main.h!
|
|
AC_INIT([znc], [0.053])
|
|
SAVED_CXXFLAGS=$CXXFLAGS
|
|
AC_PROG_CXX
|
|
AC_CANONICAL_HOST
|
|
|
|
CXXFLAGS="$SAVED_CXXFLAGS -D_GNU_SOURCE -D_FORTIFY_SOURCE=2"
|
|
INCLUDES=""
|
|
LIBS=""
|
|
|
|
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],)
|
|
AC_ARG_ENABLE( [sasl],
|
|
AC_HELP_STRING([--enable-sasl], [enable sasl]),
|
|
[if test "$enableval" = "yes" ; then SASL=1; fi],)
|
|
|
|
if test "$DEBUG" != "no"; then
|
|
appendCXX -ggdb -D_DEBUG
|
|
else
|
|
appendCXX -O2 -fomit-frame-pointer
|
|
fi
|
|
|
|
if test "$IPV6" != "no"; then
|
|
appendCXX -DHAVE_IPV6
|
|
fi
|
|
|
|
if test "x$GXX" = "xyes"; then
|
|
appendCXX -Wall -W -Wno-unused -Woverloaded-virtual
|
|
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="${libdir}/znc"] )
|
|
|
|
AC_ARG_WITH( [module-data-prefix],
|
|
AC_HELP_STRING([--with-module-data-prefix=/path/to/moduledir], []),
|
|
[DATADIR=$withval],
|
|
[DATADIR="${datadir}/znc"] )
|
|
|
|
|
|
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}\\\""
|
|
appendCXX "-D_DATADIR_=\\\"${DATADIR}\\\""
|
|
|
|
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
|
|
|
|
if test -n "$SASL"; then
|
|
AC_CHECK_LIB( sasl2, sasl_server_init,,
|
|
AC_ERROR([Could not find libsasl2.]))
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
VERSION=AC_PACKAGE_VERSION
|
|
#
|
|
# Auto detect modules
|
|
|
|
AC_SUBST([CXXFLAGS])
|
|
AC_SUBST([MODFLAGS])
|
|
AC_SUBST([LDFLAGS])
|
|
AC_SUBST([INCLUDES])
|
|
AC_SUBST([LIBS])
|
|
AC_SUBST([MODULES])
|
|
AC_SUBST([MODTARGET])
|
|
AC_SUBST([VERSION])
|
|
AC_SUBST([NOSSL])
|
|
AC_SUBST([PERL])
|
|
AC_SUBST([SASL])
|
|
AC_SUBST([MODDIR])
|
|
AC_SUBST([DATADIR])
|
|
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
|
|
if test x"$SASL" = "x" ; then
|
|
echo "sasl: no"
|
|
else
|
|
echo "sasl: yes"
|
|
fi
|
|
|