| dnl Process this file with autoconf to produce a configure script. |
| AC_INIT(flood.c) |
| |
| dnl Override the default prefix with /pkg/flood-0.1 |
| AC_PREFIX_DEFAULT(/pkg/flood-0.1) |
| |
| 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 -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 patch specified')) |
| AC_TRY_COMPILE([#include <openssl/opensslv.h>], |
| [#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 |
| AC_CHECK_LIB(ssl, BIO_next, LIBS="$LIBS -lssl") |
| 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 "/usr/lib/ssl/certs"; then |
| CAPATH="/usr/lib/ssl/certs" |
| else |
| AC_MSG_ERROR('option --with-capath must be specified') |
| fi |
| fi |
| ]) |
| fi |
| |
| dnl Need for now. Remove later. |
| AC_ARG_WITH(httpd, |
| [ --with-httpd=PATH Prefix to httpd-2.0 (default /home/jerenkrantz/cvs-apache/httpd-2.0)], |
| [if test "$withval" = "yes"; then AC_MSG_ERROR('option --with-httpd requires a path'); else HTTPD_SOURCE="$withval"; fi], |
| [HTTPD_SOURCE="/home/jerenkrantz/cvs-apache/httpd-2.0"]) |
| |
| AC_ARG_WITH(apr, |
| [ --with-apr=PATH Prefix to apr (default ${HTTPD_SOURCE}/srclib/apr)], |
| [if test "$withval" = "yes"; then AC_MSG_ERROR('option --with-apr requires a path'); else APR_SOURCE="$withval"; fi], |
| [APR_SOURCE="$HTTPD_SOURCE/srclib/apr"]) |
| |
| AC_ARG_WITH(apr, |
| [ --with-apr-util=PATH Prefix to apr-util (default ${HTTPD_SOURCE}/srclib/apr-util)], |
| [if test "$withval" = "yes"; then AC_MSG_ERROR('option --with-apr-util requires a path'); else APU_SOURCE="$withval"; fi], |
| [APU_SOURCE="$HTTPD_SOURCE/srclib/apr-util"]) |
| |
| . $APR_SOURCE/APRVARS |
| . $APU_SOURCE/export_vars.sh |
| |
| 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 $hasrand48 = "1"; then |
| prngrand48="1" |
| AC_MSG_RESULT([rand48]) |
| else if $hasrand = "1"; then |
| prngrand="1" |
| AC_MSG_RESULT([rand]) |
| fi |
| fi |
| fi |
| |
| EXTRA_CFLAGS="$CFLAGS $EXTRA_CFLAGS" |
| EXTRA_CPPFLAGS="$CPPFLAGS $EXTRA_CPPFLAGS" |
| EXTRA_LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" |
| EXTRA_LIBS="$LIBS $EXTRA_LIBS $APRUTIL_EXPORT_LIBS" |
| |
| AC_SUBST(OPENSSL_PREFIX) |
| AC_SUBST(RANDFILE) |
| AC_SUBST(CAPATH) |
| AC_SUBST(HTTPD_SOURCE) |
| AC_SUBST(APR_SOURCE) |
| AC_SUBST(APU_SOURCE) |
| AC_SUBST(EXTRA_CFLAGS) |
| AC_SUBST(EXTRA_CPPFLAGS) |
| AC_SUBST(EXTRA_LDFLAGS) |
| AC_SUBST(EXTRA_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) |
| |
| dnl Makefile outputs |
| dnl Note: There can only be one AC_OUTPUT command. |
| AC_OUTPUT(Makefile config.h) |