dnl Process this file with autoconf to produce a configure script. AC_INIT(flood.c) dnl Location for config.guess, config.sub, install.sh, etc. AC_CONFIG_AUX_DIR(build) dnl Override the default prefix with /usr/local/flood AC_PREFIX_DEFAULT(/usr/local/flood) dnl m4 Macros from APR sinclude(build/apr_common.m4) dnl m4 Macros for finding APR and APR-util sinclude(build/find_apr.m4) sinclude(build/find_apu.m4) dnl We need to know our top directory. abs_builddir=`pwd` dnl Initially, we need no subdirs FLOOD_SUBDIRS="" dnl Generate ./config.nice for reproducing runs of configure APR_CONFIG_NICE(config.nice) dnl Checks for programs. AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_CANONICAL_SYSTEM AC_ARG_WITH(openssl, [ --with-openssl=PATH Path to OpenSSL (eg. /usr/local/ssl)], [if test "$withval" = "yes"; then AC_MSG_ERROR('option --with-openssl requires a path') else fl_openssl_prefix=$withval if test "x$fl_openssl_prefix" != "x" -a ! -d "$fl_openssl_prefix"; then AC_MSG_ERROR('open --with-openssl requires a path to a directory') fi dnl XXX: We could probably do some better checking here, like looking dnl for headers and libraries with an explicit path. dnl Prefix these to the list, so they override env var settings CPPFLAGS="-I${fl_openssl_prefix}/include $CPPFLAGS" dnl We may need to also include $fl_openssl_prefix/openssl LDFLAGS="-L${fl_openssl_prefix}/lib $LDFLAGS" LIBTOOL_LDFLAGS="-R${fl_openssl_prefix}/lib" fi]) dnl If the OS provides random support, use it. Otherwise, we'll be dnl cheesy. if test -c "/dev/random"; then flood_has_devrand=1 else if test -c "/dev/urandom"; then flood_has_devrand=1 else flood_has_devrand=0 fi fi dnl SSL is disabled by default dnl "Export and import restrictions in some countries require that it be dnl disabled by default." See: <20011116151249.B1943@waka.ebuilt.net> AC_ARG_ENABLE(ssl, [ --enable-ssl Enable SSL support (disabled by default)], [enable_ssl=$enableval], [enable_ssl=no]) flood_has_openssl=0 if test "$enable_ssl" = "yes"; then AC_CHECK_HEADERS(openssl/ssl.h openssl/opensslv.h,, AC_MSG_ERROR('OpenSSL Headers not found at path specified')) AC_TRY_COMPILE([#include ], [#if (OPENSSL_VERSION_NUMBER < 0x0090600fL) #error You need OpenSSL version 0.9.6 or greater. #endif],, AC_MSG_ERROR('OpenSSL version 0.9.6 or greater required.')) AC_CHECK_LIB(crypto, SHA1, LIBS="$LIBS -lcrypto") dnl BIO_next only appears in newer versions of OpenSSL dnl Since libssl relies on libcrypto, it *must* appear before -lcrypto. AC_CHECK_LIB(ssl, BIO_next, LIBS="-lssl $LIBS") flood_has_openssl=1 dnl Extra OpenSSL specific options AC_ARG_WITH(capath, [ --with-capath=PATH Path to a directory with c_rehash'd CA files used by OpenSSL (default $OPENSSL_PREFIX/certs)], [if test "$withval" = "yes"; then AC_MSG_ERROR('option --with-capath requires a path'); else CAPATH="$withval"; fi], [if test -d "$fl_openssl_prefix/certs"; then CAPATH="$fl_openssl_prefix/certs" else if test -d "$fl_openssl_prefix/ssl/certs"; then CAPATH="$fl_openssl_prefix/ssl/certs" else if test -d "/usr/lib/ssl/certs"; then CAPATH="/usr/lib/ssl/certs" else if test -d "/usr/share/ssl/certs"; then CAPATH="/usr/share/ssl/certs" else AC_MSG_ERROR('option --with-capath must be specified') fi fi fi fi ]) fi APR_FIND_APR(./apr,,1,[1 0]) if test "$apr_found" = "no"; then AC_MSG_ERROR([APR not found. Please read the documentation.]) fi if test "$apr_found" = "reconfig"; then APR_SUBDIR_CONFIG(apr, "$apache_apr_flags --prefix=$prefix") FLOOD_SUBDIRS="$FLOOD_SUBDIRS apr" fi CC="`$apr_config --cc`" CFLAGS="$CFLAGS `$apr_config --cflags`" CPPFLAGS="$CPPFLAGS `$apr_config --cppflags --includes`" LDFLAGS="$LDFLAGS `$apr_config --ldflags`" LIBTOOL="`$apr_config --apr-libtool`" LIBTOOL_LIBS="$LIBTOOL_LIBS `$apr_config --link-libtool --libs`" APR_CONFIG="$apr_config" APR_FIND_APU(./apr-util,,1,[1 0]) if test "$apu_found" = "no"; then AC_MSG_ERROR([APR-util not found. Please read the documentation.]) fi if test "$apu_found" = "reconfig"; then dnl If we are configuring apr-util as source, APR must be source dnl configured. APR_SUBDIR_CONFIG(apr-util, "$apache_apr_flags --with-apr=../apr --prefix=$prefix") FLOOD_SUBDIRS="$FLOOD_SUBDIRS apr-util" fi CPPFLAGS="$CPPFLAGS `$apu_config --includes`" LIBTOOL_LDFLAGS="$LIBTOOL_LDFLAGS `$apu_config --ldflags`" dnl Since libaprutil relies on libapr, it *must* appear before -lapr. LIBTOOL_LIBS="`$apu_config --link-libtool --libs` $LIBTOOL_LIBS" APU_CONFIG="$apu_config" AC_CHECK_FUNC(strtoll, hasstrtoll="1", hasstrtoll="0") AC_CHECK_FUNC(strtoq, hasstrtoq="1", hasstrtoq="0") AC_CHECK_FUNC(rand, hasrand="1", hasrand="0") AC_CHECK_FUNC(lrand48, hasrand48="1", hasrand48="0") AC_CHECK_FUNC(random, hasrandom="1", hasrandom="0") AC_MSG_CHECKING([random number generator to use]) prngrand="0" prngrand48="0" prngrandom="0" if test "$hasrandom" = "1"; then prngrandom="1" AC_MSG_RESULT([random]) else if test "$hasrand48" = "1"; then prngrand48="1" AC_MSG_RESULT([rand48]) else if test "$hasrand" = "1"; then prngrand="1" AC_MSG_RESULT([rand]) else AC_ERROR([No suitable PRNG detected]) fi fi fi AC_SUBST(OPENSSL_PREFIX) AC_SUBST(RANDFILE) AC_SUBST(CAPATH) AC_SUBST(FLOOD_SUBDIRS) AC_SUBST(LIBTOOL) AC_SUBST(LIBTOOL_LDFLAGS) AC_SUBST(LIBTOOL_LIBS) AC_SUBST(prngrand) AC_SUBST(prngrand48) AC_SUBST(prngrandom) AC_SUBST(hasstrtoll) AC_SUBST(hasstrtoq) AC_SUBST(flood_has_openssl) AC_SUBST(flood_has_devrand) AC_SUBST(abs_builddir) AC_SUBST(APR_CONFIG) AC_SUBST(APU_CONFIG) dnl Required for source compatibility with build/rules.mk of httpd-2.0 LTFLAGS="--silent" LTCFLAGS="" SHLTCFLAGS="" AC_SUBST(LTFLAGS) AC_SUBST(LTCFLAGS) AC_SUBST(SHLTCFLAGS) dnl Makefile outputs dnl Note: There can only be one AC_OUTPUT command. AC_OUTPUT(Makefile config.h build/rules.mk build/config_vars.mk)