respond-agent/configure.ac

138 lines
3.7 KiB
Plaintext

dnl $Id: configure.ac 21635 2006-01-11 21:52:17Z leeh $
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
AC_COPYRIGHT([$Id: configure.ac 21635 2006-01-11 21:52:17Z leeh $])
AC_INIT([ratbox-respond],[stable])
AC_CONFIG_HEADER(setup.h)
AC_PREFIX_DEFAULT(.)
AC_GNU_SOURCE
AC_PROG_CC
AC_PROG_INSTALL
AC_PATH_PROG(RM, rm)
AC_PATH_PROG(CP, cp)
AC_PATH_PROG(MV, mv)
AC_PATH_PROG(TOUCH, touch)
AC_LANG(C)
AC_HEADER_STDC
CPPFLAGS="-I /usr/include"
LIBS="-L /usr/lib"
dnl OpenSSL support
AC_MSG_CHECKING(for OpenSSL)
AC_ARG_ENABLE(openssl,
[AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).])],
[cf_enable_openssl=$enableval],
[cf_enable_openssl="auto"])
if test "$cf_enable_openssl" != "no" ; then
cf_openssl_basedir=""
if test "$cf_enable_openssl" != "auto" &&
test "$cf_enable_openssl" != "yes" ; then
dnl Support for --enable-openssl=/some/place
cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`"
else
dnl Do the auto-probe here. Check some common directory paths.
for dirs in /usr/local/ssl /usr/pkg /usr/local \
/usr/local/openssl ; do
if test -f "${dirs}/include/openssl/opensslv.h" ; then
cf_openssl_basedir="${dirs}"
break
fi
done
unset dirs
fi
dnl Now check cf_openssl_found to see if we found anything.
if test ! -z "$cf_openssl_basedir"; then
if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then
SSL_INCLUDES="-I${cf_openssl_basedir}/include"
SSL_LIBS="-L${cf_openssl_basedir}/lib"
else
dnl OpenSSL wasn't found in the directory specified. Naughty
dnl administrator...
cf_openssl_basedir=""
fi
else
dnl Check for stock FreeBSD 4.x and 5.x systems, since their files
dnl are in /usr/include and /usr/lib. In this case, we don't want to
dnl change INCLUDES or LIBS, but still want to enable OpenSSL.
dnl We can't do this check above, because some people want two versions
dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl)
dnl and they want /usr/local/ssl to have preference.
if test -f "/usr/include/openssl/opensslv.h" ; then
cf_openssl_basedir="/usr"
fi
fi
dnl If we have a basedir defined, then everything is okay. Otherwise,
dnl we have a problem.
if test ! -z "$cf_openssl_basedir"; then
AC_MSG_RESULT($cf_openssl_basedir)
cf_enable_openssl="yes"
else
AC_MSG_RESULT([not found. Specify a correct path?])
cf_enable_openssl="no"
fi
unset cf_openssl_basedir
else
dnl If --disable-openssl was specified
AC_MSG_RESULT(disabled)
AC_MSG_ERROR([Need openssl to compile ratbox-respond])
fi
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
save_LIBS="$LIBS"
LIBS="$LIBS $SSL_LIBS"
if test "$cf_enable_openssl" != no; then
dnl Check OpenSSL version (must be 0.9.6 or above!)
AC_MSG_CHECKING(for OpenSSL 0.9.6 or above)
AC_RUN_IFELSE(
AC_LANG_PROGRAM(
[#include <openssl/opensslv.h>
#include <stdlib.h>],
[[if (OPENSSL_VERSION_NUMBER >= 0x00906000)
exit(0); else exit(1);]]),
cf_openssl_version_ok=yes,
cf_openssl_version_ok=no,
cf_openssl_version_ok=no)
if test "$cf_openssl_version_ok" = yes; then
AC_MSG_RESULT(found)
dnl Do all the HAVE_LIBCRYPTO magic -- and check for ciphers
CPPFLAGS="$CPPFLAGS $SSL_LIBS"
AC_CHECK_LIB(crypto, RSA_free)
SSL_LIBS="$SSL_LIBS -lcrypto"
SSL_SRCS_ENABLE='$(SSL_SRCS)'
else
AC_MSG_RESULT(no - OpenSSL support disabled)
AC_MSG_ERROR([Need openssl to compile ratbox-respond])
fi
else
AC_MSG_ERROR([Need openssl development files to compile ratbox-respond])
fi
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"
dnl End OpenSSL detection
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LIBS)
AC_SUBST(SSL_SRCS_ENABLE)
AC_SUBST(SSL_INCLUDES)
AC_SUBST(SSL_LIBS)
AC_CONFIG_FILES(Makefile)
AC_OUTPUT