dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, dnl USA. dnl Process this file with autoconf to produce a configure script. dnl AC_PREREQ(2.57) AC_INIT(bincimap, 1.2.13final, andreas-binc@bincimap.org) AC_CONFIG_SRCDIR(config.h.in) AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE(bincimap, 1.2.13final) dnl Checks for programs. AC_PROG_CXX AC_PROG_INSTALL dnl Checks for typedefs, structures, and compiler characteristics. AC_HEADER_SYS_WAIT dnl C++ will be used for all compile tests AC_LANG_CPLUSPLUS dnl Silly autoconf prefix=$(eval echo $(eval echo ${prefix})) AC_MSG_CHECKING(--prefix) if [[ "x$prefix" = "xNONE" ]]; then AC_MSG_RESULT([/usr/local]) prefix=/usr/local else AC_MSG_RESULT(using $prefix) fi AC_SUBST(prefix) bindir=$(eval echo $(eval echo ${bindir})) AC_MSG_CHECKING(--bindir) if [[ "x$bindir" = "xNONE/bin" ]]; then AC_MSG_RESULT([$prefix/bin]) bindir="$prefix/bin" else AC_MSG_RESULT(using $bindir) fi AC_SUBST(bindir) sysconfdir=$(eval echo $(eval echo ${sysconfdir})) AC_MSG_CHECKING(--sysconfdir) if [[ "x$sysconfdir" = "xNONE/etc" ]]; then AC_MSG_RESULT([$prefix/etc]) sysconfdir="$prefix/etc" else AC_MSG_RESULT(using $sysconfdir) fi AC_SUBST(sysconfdir) localstatedir=$(eval echo $(eval echo ${localstatedir})) AC_MSG_CHECKING(--localstatedir) if [[ "x$localstatedir" = "xNONE/var" ]]; then AC_MSG_RESULT([$prefix/var]) localstatedir="$prefix/var" else AC_MSG_RESULT(using $localstatedir) fi AC_SUBST(sysconfdir) datadir=$(eval echo $(eval echo ${datadir})) AC_MSG_CHECKING(--datadir) if [[ "x$datadir" = "xNONE/share" ]]; then AC_MSG_RESULT([$prefix/share]) datadir="$prefix/share" else AC_MSG_RESULT(using $datadir) fi AC_SUBST(datadir) dnl --------------------------------------------------------------------------- dnl Add /usr/kerberos/include to include path if this path dnl exists. AC_MSG_CHECKING(wether to include /usr/kerberos/include) if [[ -e /usr/kerberos/include ]]; then AC_MSG_RESULT([yes]) CXXFLAGS="-I/usr/kerberos/include $CXXFLAGS" else AC_MSG_RESULT([not necessary]) fi CXXFLAGS="$CXXFLAGS -Wall -fno-exceptions" dnl --------------------------------------------------------------------------- AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [Enable static compile]), [ if [[ "x$enableval" != "xno" ]]; then STATIC="-static"; fi ], []) AC_SUBST(STATIC) AC_MSG_CHECKING(wether to compile static or shared) if [[ "x$STATIC" = "x" ]]; then AC_MSG_RESULT(shared) else AC_MSG_RESULT(static) fi dnl --------------------------------------------------------------------------- AC_ARG_WITH(optimization, AC_HELP_STRING([--with-optimization], [Compile with -O2 (default)]) AC_HELP_STRING([--without-optimization], [Compile with -O0]), [ if [[ "x$withval" != "xno" ]]; then WITH_OPTIMIZATION=1; fi ], WITH_OPTIMIZATION=1) AC_MSG_CHECKING(wether to compile with optimization) if [[ "x$WITH_OPTIMIZATION" = "x1" ]]; then AC_MSG_RESULT(yes) CXXFLAGS="$CXXFLAGS -O2" else AC_MSG_RESULT(no) CXXFLAGS="$CXXFLAGS -O0" fi dnl --------------------------------------------------------------------------- dnl Checks for the dl library, which is required on some platforms for dnl static compiles. AC_CHECK_LIB(dl, dlopen, LIBDL=-ldl, LIBDL=) AC_SUBST(LIBDL) AC_SUBST(LIBSSL) dnl --------------------------------------------------------------------------- dnl Checks if we can compile and link against OpenSSL. Does a check dnl against the headers, trying different standard paths for the installation dnl of the include/openssl/... files. Then does the same with the libraries. dnl dnl After this is done, LIBSSL and INCLUDESSL are either empty, or they dnl contain the paths of the headers and libs. AC_ARG_WITH(openssl-lib, AC_HELP_STRING([--with-openssl-lib], [Set path to OpenSSL libraries]), [ if [[ "x$withval" != "xno" -a "x$withval" != "xyes" ]]; then LDFLAGS="$LDFLAGS -L$withval"; SSLLIBPATH=$withval; fi ],) AC_ARG_WITH(openssl-include, AC_HELP_STRING([--with-openssl-include], [Set path to OpenSSL headers]), [ if [[ "x$withval" != "xno" -a "x$withval" != "xyes" ]]; then CXXFLAGS="$CXXFLAGS -I$withval"; SSLINCLUDEPATH=$withval; fi ],) AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl], [Enable SSL support (default)]) AC_HELP_STRING([--without-ssl], [Disable SSL support]), [ if [[ "x$withval" != "xno" ]]; then WITH_SSL=1; fi ], WITH_SSL=1) if [[ "$WITH_SSL" = "1" ]]; then AC_MSG_CHECKING(whether -lsocket is available) export LDTMP="$LIBS" export LIBS="$LIBS -lsocket" AC_TRY_LINK([], [], LIBSOCKET="-lsocket"; AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) export LIBS="$LDTMP" AC_MSG_CHECKING(for OpenSSL includes) export CXXTMP="$CXXFLAGS" for k in . $SSLINCLUDEPATH /usr/include /usr/local/include /usr/local/ssl/include /usr/local/openssl/include /opt/ssl/include /opt/openssl/include; do export CXXFLAGS="$CXXTMP -I$k" AC_TRY_COMPILE([#include ], [SSL_write(0, 0, 0);], INCLUDESSL="-I$k"; AC_MSG_RESULT($k), []) if [[ "x$INCLUDESSL" != "x" ]]; then break; fi done if [[ "x$INCLUDESSL" = "x" ]]; then AC_MSG_RESULT(not found) export CXXFLAGS="$CXXTMP" fi AC_MSG_CHECKING(for OpenSSL libraries) export LIBTMP="$LIBS" export LDTMP="$LDFLAGS" for k in . $SSLLIBPATH /usr/lib /usr/local/lib /usr/local/ssl/lib /usr/local/openssl/lib /opt/ssl/lib /opt/openssl/lib; do export LDFLAGS="$LDTMP -L$k" export LIBS="$LIBTMP -lssl -lcrypto $LIBSOCKET $LIBDL" AC_TRY_LINK([#include ], [SSL_write(0, 0, 0);], LIBSSL="-L$k -lssl -lcrypto $LIBSOCKET"; AC_MSG_RESULT($k), []) if [[ "x$LIBSSL" != "x" ]]; then break; fi done export LIBS="$LIBTMP" export LDFLAGS="$LDTMP" if [[ "x$LIBSSL" = "x" ]]; then AC_MSG_RESULT(not found) AC_MSG_WARN([Unable to find the ssl library which is part of OpenSSL. You want want to look up the FAQ to learn more about this requirement and how to deal with it. For now, SSL is disabled.]) else AC_DEFINE(WITH_SSL, 1, [Define to 1 if SSL support is included.]) fi else AC_MSG_RESULT(no) fi AC_SUBST(LIBSSL) dnl --------------------------------------------------------------------------- AC_MSG_CHECKING(whether O_LARGEFILE is defined) AC_TRY_COMPILE([ #include #include #include int i = O_LARGEFILE;], [], AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_OLARGEFILE,, [support for O_LARGEFILE]), AC_MSG_RESULT([no])) dnl --------------------------------------------------------------------------- AH_TOP(#ifndef config_h_included #define config_h_included ) AH_BOTTOM(#endif ) dnl --------------------------------------------------------------------------- AC_OUTPUT([ Makefile conf/Makefile conf/xinetd-bincimap conf/bincimap.conf conf/xinetd-bincimaps man/Makefile doc/Makefile doc/manual/Makefile contrib/Makefile contrib/authenticators/Makefile service/log/Makefile service/Makefile service/run service/log/run service/run-ssl service/log/run-ssl src/Makefile bincimap.spec README])