configure.in (7590B)
1 dnl This program is free software; you can redistribute it and/or modify 2 dnl it under the terms of the GNU General Public License as published by 3 dnl the Free Software Foundation; either version 2 of the License, or 4 dnl (at your option) any later version. 5 6 dnl You should have received a copy of the GNU General Public License 7 dnl along with this program; if not, write to the Free Software 8 dnl Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, 9 dnl USA. 10 11 dnl Process this file with autoconf to produce a configure script. 12 dnl AC_PREREQ(2.57) 13 AC_INIT(bincimap, 1.2.15, andreas-binc@bincimap.org) 14 AC_CONFIG_SRCDIR(config.h.in) 15 AM_CONFIG_HEADER(config.h) 16 AM_INIT_AUTOMAKE(bincimap, 1.2.15) 17 18 dnl Checks for programs. 19 AC_PROG_CXX 20 AC_PROG_INSTALL 21 22 dnl Checks for typedefs, structures, and compiler characteristics. 23 AC_HEADER_SYS_WAIT 24 25 dnl C++ will be used for all compile tests 26 AC_LANG_CPLUSPLUS 27 28 dnl Silly autoconf 29 prefix=$(eval echo $(eval echo ${prefix})) 30 AC_MSG_CHECKING(--prefix) 31 if [[ "x$prefix" = "xNONE" ]]; then 32 AC_MSG_RESULT([/usr/local]) 33 prefix=/usr/local 34 else 35 AC_MSG_RESULT(using $prefix) 36 fi 37 AC_SUBST(prefix) 38 39 bindir=$(eval echo $(eval echo ${bindir})) 40 AC_MSG_CHECKING(--bindir) 41 if [[ "x$bindir" = "xNONE/bin" ]]; then 42 AC_MSG_RESULT([$prefix/bin]) 43 bindir="$prefix/bin" 44 else 45 AC_MSG_RESULT(using $bindir) 46 fi 47 AC_SUBST(bindir) 48 49 50 sysconfdir=$(eval echo $(eval echo ${sysconfdir})) 51 AC_MSG_CHECKING(--sysconfdir) 52 if [[ "x$sysconfdir" = "xNONE/etc" ]]; then 53 AC_MSG_RESULT([$prefix/etc]) 54 sysconfdir="$prefix/etc" 55 else 56 AC_MSG_RESULT(using $sysconfdir) 57 fi 58 AC_SUBST(sysconfdir) 59 60 localstatedir=$(eval echo $(eval echo ${localstatedir})) 61 AC_MSG_CHECKING(--localstatedir) 62 if [[ "x$localstatedir" = "xNONE/var" ]]; then 63 AC_MSG_RESULT([$prefix/var]) 64 localstatedir="$prefix/var" 65 else 66 AC_MSG_RESULT(using $localstatedir) 67 fi 68 AC_SUBST(sysconfdir) 69 70 datadir=$(eval echo $(eval echo ${datadir})) 71 AC_MSG_CHECKING(--datadir) 72 if [[ "x$datadir" = "xNONE/share" ]]; then 73 AC_MSG_RESULT([$prefix/share]) 74 datadir="$prefix/share" 75 else 76 AC_MSG_RESULT(using $datadir) 77 fi 78 AC_SUBST(datadir) 79 80 dnl --------------------------------------------------------------------------- 81 82 dnl Add /usr/kerberos/include to include path if this path 83 dnl exists. 84 AC_MSG_CHECKING(wether to include /usr/kerberos/include) 85 if [[ -e /usr/kerberos/include ]]; then 86 AC_MSG_RESULT([yes]) 87 CXXFLAGS="-I/usr/kerberos/include $CXXFLAGS" 88 else 89 AC_MSG_RESULT([not necessary]) 90 fi 91 92 CXXFLAGS="$CXXFLAGS -Wall -fno-exceptions" 93 94 dnl --------------------------------------------------------------------------- 95 96 AC_ARG_ENABLE(static, 97 AC_HELP_STRING([--enable-static], [Enable static compile]), 98 [ if [[ "x$enableval" != "xno" ]]; then STATIC="-static"; fi ], []) 99 AC_SUBST(STATIC) 100 101 AC_MSG_CHECKING(wether to compile static or shared) 102 if [[ "x$STATIC" = "x" ]]; then 103 AC_MSG_RESULT(shared) 104 else 105 AC_MSG_RESULT(static) 106 fi 107 108 dnl --------------------------------------------------------------------------- 109 110 AC_ARG_WITH(optimization, 111 AC_HELP_STRING([--with-optimization], [Compile with -O2 (default)]) 112 AC_HELP_STRING([--without-optimization], [Compile with -O0]), 113 [ if [[ "x$withval" != "xno" ]]; then WITH_OPTIMIZATION=1; fi ], 114 WITH_OPTIMIZATION=1) 115 116 AC_MSG_CHECKING(wether to compile with optimization) 117 if [[ "x$WITH_OPTIMIZATION" = "x1" ]]; then 118 AC_MSG_RESULT(yes) 119 CXXFLAGS="$CXXFLAGS -O2" 120 else 121 AC_MSG_RESULT(no) 122 CXXFLAGS="$CXXFLAGS -O0" 123 fi 124 125 dnl --------------------------------------------------------------------------- 126 dnl Checks for the dl library, which is required on some platforms for 127 dnl static compiles. 128 129 AC_CHECK_LIB(dl, dlopen, LIBDL=-ldl, LIBDL=) 130 AC_SUBST(LIBDL) 131 AC_SUBST(LIBSSL) 132 133 dnl --------------------------------------------------------------------------- 134 dnl Checks if we can compile and link against OpenSSL. Does a check 135 dnl against the headers, trying different standard paths for the installation 136 dnl of the include/openssl/... files. Then does the same with the libraries. 137 dnl 138 dnl After this is done, LIBSSL and INCLUDESSL are either empty, or they 139 dnl contain the paths of the headers and libs. 140 141 AC_ARG_WITH(openssl-lib, 142 AC_HELP_STRING([--with-openssl-lib], [Set path to OpenSSL libraries]), 143 [ if [[ "x$withval" != "xno" -a "x$withval" != "xyes" ]]; then LDFLAGS="$LDFLAGS -L$withval"; SSLLIBPATH=$withval; fi ],) 144 145 AC_ARG_WITH(openssl-include, 146 AC_HELP_STRING([--with-openssl-include], [Set path to OpenSSL headers]), 147 [ if [[ "x$withval" != "xno" -a "x$withval" != "xyes" ]]; then CXXFLAGS="$CXXFLAGS -I$withval"; SSLINCLUDEPATH=$withval; fi ],) 148 149 AC_ARG_WITH(ssl, 150 AC_HELP_STRING([--with-ssl], [Enable SSL support (default)]) 151 AC_HELP_STRING([--without-ssl], [Disable SSL support]), 152 [ if [[ "x$withval" != "xno" ]]; then WITH_SSL=1; fi ], 153 WITH_SSL=1) 154 155 if [[ "$WITH_SSL" = "1" ]]; then 156 AC_MSG_CHECKING(whether -lsocket is available) 157 export LDTMP="$LIBS" 158 export LIBS="$LIBS -lsocket" 159 AC_TRY_LINK([], [], LIBSOCKET="-lsocket"; AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) 160 export LIBS="$LDTMP" 161 162 AC_MSG_CHECKING(for OpenSSL includes) 163 export CXXTMP="$CXXFLAGS" 164 for k in . $SSLINCLUDEPATH /usr/include /usr/local/include /usr/local/ssl/include /usr/local/openssl/include /opt/ssl/include /opt/openssl/include; do 165 export CXXFLAGS="$CXXTMP -I$k" 166 AC_TRY_COMPILE([#include <openssl/ssl.h>], [SSL_write(0, 0, 0);], INCLUDESSL="-I$k"; AC_MSG_RESULT($k), []) 167 if [[ "x$INCLUDESSL" != "x" ]]; then break; fi 168 done 169 170 if [[ "x$INCLUDESSL" = "x" ]]; then 171 AC_MSG_RESULT(not found) 172 export CXXFLAGS="$CXXTMP" 173 fi 174 175 AC_MSG_CHECKING(for OpenSSL libraries) 176 export LIBTMP="$LIBS" 177 export LDTMP="$LDFLAGS" 178 for k in . $SSLLIBPATH /usr/lib /usr/local/lib /usr/local/ssl/lib /usr/local/openssl/lib /opt/ssl/lib /opt/openssl/lib; do 179 export LDFLAGS="$LDTMP -L$k" 180 export LIBS="$LIBTMP -lssl -lcrypto $LIBSOCKET $LIBDL" 181 AC_TRY_LINK([#include <openssl/ssl.h>], [SSL_write(0, 0, 0);], LIBSSL="-L$k -lssl -lcrypto $LIBSOCKET"; AC_MSG_RESULT($k), []) 182 if [[ "x$LIBSSL" != "x" ]]; then break; fi 183 done 184 export LIBS="$LIBTMP" 185 export LDFLAGS="$LDTMP" 186 187 if [[ "x$LIBSSL" = "x" ]]; then 188 AC_MSG_RESULT(not found) 189 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.]) 190 else 191 AC_DEFINE(WITH_SSL, 1, [Define to 1 if SSL support is included.]) 192 fi 193 else 194 AC_MSG_RESULT(no) 195 fi 196 AC_SUBST(LIBSSL) 197 198 dnl --------------------------------------------------------------------------- 199 200 AC_MSG_CHECKING(whether O_LARGEFILE is defined) 201 AC_TRY_COMPILE([ #include <sys/types.h> 202 #include <sys/stat.h> 203 #include <fcntl.h> 204 int i = O_LARGEFILE;], [], AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_OLARGEFILE,, [support for O_LARGEFILE]), AC_MSG_RESULT([no])) 205 206 dnl --------------------------------------------------------------------------- 207 208 AH_TOP(#ifndef config_h_included 209 #define config_h_included 210 ) 211 AH_BOTTOM(#endif 212 ) 213 214 dnl --------------------------------------------------------------------------- 215 216 AC_OUTPUT([ 217 Makefile 218 conf/Makefile 219 conf/xinetd-bincimap 220 conf/bincimap.conf 221 conf/xinetd-bincimaps 222 man/Makefile 223 doc/Makefile 224 doc/manual/Makefile 225 contrib/Makefile 226 contrib/authenticators/Makefile 227 service/log/Makefile 228 service/Makefile 229 service/run 230 service/log/run 231 service/run-ssl 232 service/log/run-ssl 233 src/Makefile 234 bincimap.spec 235 README])