diff options
Diffstat (limited to 'configure.ac')
| -rw-r--r-- | configure.ac | 276 |
1 files changed, 185 insertions, 91 deletions
diff --git a/configure.ac b/configure.ac index 510ff6f2..035e730a 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl Process this file with autoconf to produce a configure script. dnl dnl XXX - if bumping version here, check fetchmail.man, too! -AC_INIT([fetchmail],[6.4.20],[fetchmail-users@lists.sourceforge.net]) +AC_INIT([fetchmail],[6.4.38],[fetchmail-users@lists.sourceforge.net]) AC_CONFIG_SRCDIR([fetchmail.h]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_LIBOBJ_DIR([.]) @@ -30,7 +30,11 @@ dnl python is optional # # recent Python 3.x versions are supported. # -AM_PATH_PYTHON(2.7,,AC_MSG_WARN([Disabling fetchmailconf: python 2.7 or greater not found])) +try27=0 +AM_PATH_PYTHON([3.7],,[try27=1]) +if test try27 != 0 ; then + AM_PATH_PYTHON([2.7],,AC_MSG_WARN([[Disabling fetchmailconf: python 2.7 or 3.7 or greater not found]]) ) +fi AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :]) AC_USE_SYSTEM_EXTENSIONS @@ -42,6 +46,12 @@ AC_PROG_CPP dnl Later checks need this. AM_PROG_AR AC_PROG_RANLIB AM_PROG_CC_C_O +PKG_PROG_PKG_CONFIG + +AC_CHECK_PROGS([RST2HTML], [rst2html5.py rst2html5], [false]) +AC_CHECK_PROGS([HTMLDOC], [htmldoc], [${srcdir}/dist-tools/htmldoc]) + +AC_LIB_RPATH AC_ISC_POSIX dnl AC_ISC_POSIX: - XXX FIXME: remove in fetchmail 6.4. @@ -168,7 +178,7 @@ dnl addition of libintl to the build, which is both undesired dnl and breaks on Solaris/Blastwave.org machines. dnl dnl AC_CHECK_LIB(intl, gettext, -dnl [LIBS="$LIBS -lintl"]) +dnl [LIBS="$LIBS -lintl"]) AC_REPLACE_FUNCS([strstr strcasecmp memmove stpcpy strlcpy strlcat]) @@ -367,6 +377,7 @@ esac AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(long long) ### use option --enable-POP2 to compile in the POP2 support AC_ARG_ENABLE(POP2, @@ -612,7 +623,7 @@ else AC_DEFINE(KERBEROS_V5) test "$dir" != "/usr" && CFLAGS="$CFLAGS -I$dir/include" LDFLAGS="$LDFLAGS -L$dir/lib" - LIBS="$LIBS $ac_krblibs $libk5crypto" + LIBS="$LIBS $ac_krblibs $libk5crypto" with_kerberos5=$dir break else @@ -717,102 +728,185 @@ if test "$KERBEROS_V4" = 1 ; then fi AM_CONDITIONAL(KERBEROS_V4_ENABLE, test "$KERBEROS_V4" = 1) -### use option --with-ssl to compile in the SSL support -AC_ARG_WITH(ssl, - [AS_HELP_STRING([--with-ssl[[={yes|no|DIR}]]],[Use OpenSSL from - DIR/include/openssl and - DIR/lib (default: yes). Yes means try to find it.])], - [with_ssl=$withval], - [with_ssl=yes]) - -if test "$with_ssl" = "yes" -then - # User didn't specify an SSL location. Let's look at some common - # directories where SSL has been found in the past and try and auto - # configure for SSL. OpenSSL determination will be made later. - # This will screw up if an OpenSSL install is located in a later - # directory than an older SSLeay install, but the user should fix that - # anyways and he can override on the configure line. - # Just testing for directories is not sufficient, /usr exists on - # all systems! - for ac_dir in \ - /usr/local/ssl \ - /usr/local \ - /usr/ssl \ - /usr \ - /local/ssl \ - /opt/ssl \ - /opt/csw \ - ; \ - do - if test -r "$ac_dir/include/openssl/ssl.h" ; then - with_ssl=$ac_dir - break; - fi - done -fi +openssldefault=yes +AC_ARG_WITH(wolfssl, + [AS_HELP_STRING([--with-wolfssl={DIR|no}], + [EXPERIMENTAL: Use wolfSSL and its OpenSSL compatibility layer])], + [with_wolfssl=$withval], [with_wolfssl=no]) +if test "$with_wolfssl" != "no" ; then + if test -x "$WOLFSSL_CONFIG" ; then + _WOLFSSLCONF="$WOLFSSL_CONFIG" + elif test yes != "$with_wolfssl" -a -x "${with_wolfssl}/bin/wolfssl-config" ; then + _WOLFSSLCONF=${with_wolfssl}/bin/wolfssl-config + else + _WOLFSSLCONF=wolfssl-config + fi + if test yes = "$with_wolfssl" && "$_WOLFSSLCONF" >/dev/null 2>&1 --version ; then + with_wolfssl="$(${_WOLFSSLCONF} --prefix)" + fi + if "$_WOLFSSLCONF" >/dev/null 2>&1 --version ; then + wolfCFLAGS="$(${_WOLFSSLCONF} --cflags)" + wolfLIBS="$(${_WOLFSSLCONF} --libs)" + elif test -d "${with_wolfssl}/include" -a -d "${with_wolfssl}/lib" ; then + wolfCFLAGS="-I${with_wolfssl}/include" + wolfLIBS="-L${with_wolfssl}/lib -lwolfssl -lpthread" + AS_MESSAGE([wolfssl-config not found nor executable, falling back to CFLAGS $wolfCFLAGS, LIBS $wolfLIBS]) + else + AC_MSG_ERROR([WolfSSL not found - please specify proper location to --with-wolfssl]) + fi + set -- $wolfLIBS + while test $# -ge 1 ; do + case $1 in -l*|lib*) : ;; + *) LDFLAGS="$LDFLAGS $1" ;; + esac + shift + done + CPPFLAGS="$CPPFLAGS $wolfCFLAGS -I${with_wolfssl}/include/wolfssl" + AC_CHECK_HEADERS([wolfssl/options.h]) + AC_LIB_LINKFLAGS([wolfssl]) + LIBS="$LIBWOLFSSL $LIBS" + openssldefault=no + AC_DEFINE(SSL_ENABLE, 1) + with_ssl=yes + if test -z "$WOLFSSL_TRUST_FILE" ; then + AC_MSG_ERROR([You must define WOLFSSL_TRUST_FILE and point it to the default CA certificate file (PEM format)]) + fi + AS_MESSAGE([Enabling wolfSSL support.]) + AC_DEFINE_UNQUOTED(WOLFSSL_TRUST_FILE, "$WOLFSSL_TRUST_FILE", + [Set to the default file of trusted certificates.]) +else + ### use option --with-ssl to compile in the SSL support + AC_ARG_WITH(ssl, + [AS_HELP_STRING([--with-ssl[[={yes|no|DIR}]]],[Use OpenSSL from + DIR/include/openssl and + DIR/lib (default: yes). Yes means try to find it.])], + [with_ssl=$withval], + [with_ssl=$openssldefault]) -if test -n "$with_ssl" -a "$with_ssl" != "no" -then - # With the autoconfigure above, the only time this is going to be - # true is going to be when we could not find the headers. If they - # are not in system standard locations, we are going to be broken. if test "$with_ssl" = "yes" then - # Let's just define the standard location for the SSLeay root - with_ssl="/usr/local/ssl" + # User didn't specify an SSL location. Let's look at some common + # directories where SSL has been found in the past and try and auto + # configure for SSL. OpenSSL determination will be made later. + # This will screw up if an OpenSSL install is located in a later + # directory than an older SSLeay install, but the user should fix that + # anyways and he can override on the configure line. + # Just testing for directories is not sufficient, /usr exists on + # all systems! + for ac_dir in \ + /usr/local/ssl \ + /usr/local \ + /usr/ssl \ + /usr \ + /local/ssl \ + /opt/ssl \ + /opt/csw \ + ; \ + do + if test -r "$ac_dir/include/openssl/ssl.h" ; then + with_ssl=$ac_dir + break; + fi + done fi - if test -r $with_ssl/include/openssl/ssl.h + + if test -n "$with_ssl" -a "$with_ssl" != "no" then - ### ssl.h found under openssl. Use openssl configuration preferentially, - AC_MSG_NOTICE(Enabling OpenSSL support in $with_ssl.) - test "$with_ssl" != "/usr" && CFLAGS="$CFLAGS -I$with_ssl/include" LDFLAGS="$LDFLAGS -L$with_ssl/lib" - ### In Red Hat 9, this file includes a reference to <krb5.h>, so we - ### force the Kerberos directory onto the include path so it will build. - CFLAGS="$CFLAGS -I/usr/kerberos/include" - ### OpenBSD comes with ssl headers - else - AC_MSG_ERROR([SSL support enabled, but OpenSSL not found]) - fi - PKG_CHECK_MODULES([SSL],[libssl libcrypto],[LIBS="$LIBS $SSL_LIBS"],[ - AS_MESSAGE([SSL-check: pkg-config check failed, using traditional probe]) - LDFLAGS="$LDFLAGS -L$with_ssl/lib" - AC_LIB_LINKFLAGS([crypto]) - AC_LIB_LINKFLAGS([ssl], [crypto]) - LIBS="$LIBS $LIBSSL $LIBCRYPTO" - dnl check if -ldl is needed - AC_MSG_CHECKING([for additional library dependencies of SSL]) + # With the autoconfigure above, the only time this is going to be + # true is going to be when we could not find the headers. If they + # are not in system standard locations, we are going to be broken. + if test "$with_ssl" = "yes" + then + # Let's just define the standard location for the SSLeay root + with_ssl="/usr/local/ssl" + fi + if test -r $with_ssl/include/openssl/ssl.h + then + ### ssl.h found under openssl. Use openssl configuration preferentially, + AC_MSG_NOTICE(Enabling OpenSSL support in $with_ssl.) + test "$with_ssl" != "/usr" && CFLAGS="$CFLAGS -I$with_ssl/include" LIBS="-L$with_ssl/lib $LIBS" + ### In Red Hat 9, this file includes a reference to <krb5.h>, so we + ### force the Kerberos directory onto the include path so it will build. + CFLAGS="$CFLAGS -I/usr/kerberos/include" + ### OpenBSD comes with ssl headers + else + case "$with_ssl" in */*) + AC_MSG_ERROR([SSL support enabled, but OpenSSL not found]) + ;; + *) + ;; + esac + fi + modules=openssl + case "$with_ssl" in */*) ;; *) modules="$with_ssl $modules" ;; esac found=0 - save_LIBS="$LIBS" - for i in "" "-ldl" ; do - LIBS="$LDFLAGS $save_LIBS $i" - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <openssl/ssl.h>],[SSL_connect((SSL *)0)])],[found=1; break]) + test -n "$PKG_CONFIG" && for i in $modules ; do + AS_MESSAGE([SSL-check: trying pkg-config for $i]) + AS_MESSAGE([NOTE: libdir=$libdir]) + PKG_CHECK_MODULES([SSL],[$i],[ + set -- $SSL_LIBS + while test $# -ge 1 ; do + case $1 in -l*|lib*) LIBS="$LIBS $1" ;; + *) LDFLAGS="$LDFLAGS $1" ;; + esac + shift + done + CPPFLAGS="$SSL_CFLAGS $CPPFLAGS" + AS_MESSAGE([From pkg-config: $SSL_LIBS]) + AC_LIB_LINKFLAGS_FROM_LIBS([SSL_LDFLAGS],[$LIBS $SSL_LIBS]) + AS_MESSAGE([derived LDFLAGS: $SSL_LDFLAGS]) + LDFLAGS="$SSL_LDFLAGS $LDFLAGS" + found=1 + break],[: ignore-error]) done - if test $found = 0 ; then - AC_MSG_RESULT([error]) - AC_MSG_ERROR([cannot link with SSL - check config.log]) + if test $found -eq 0 ; then + AS_MESSAGE([SSL-check: pkg-config check failed, using traditional probe in $with_ssl]) + LDFLAGS="$LDFLAGS -L$with_ssl/lib" + CPPFLAGS="$CPPFLAGS -I$with_ssl/include" + AC_LIB_LINKFLAGS([ssl], [crypto]) + AS_MESSAGE([From probing: Adding $LIBSSL to LIBS. LDFLAGS=$LDFLAGS]) + LIBS="$LIBS $LIBSSL" + dnl check if -ldl is needed + AC_MSG_CHECKING([for additional library dependencies of SSL (-ldl?)]) + found=0 + save_LIBS="$LIBS" + for i in "" "-ldl" ; do + LIBS="$LDFLAGS $save_LIBS $i" + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <openssl/ssl.h>],[SSL_connect((SSL *)0)])],[found=1; break]) + done + if test $found = 0 ; then + AC_MSG_RESULT([error]) + AC_MSG_ERROR([cannot link with SSL - check config.log]) + fi + LIBS="$save_LIBS $i" + if test "$i" = "" ; then i="(none)" ; fi + AC_MSG_RESULT($i) fi - LIBS="$save_LIBS $i" - if test "$i" = "" ; then i="(none)" ; fi - AC_MSG_RESULT($i) - ]) - AC_DEFINE(SSL_ENABLE, 1, [Define if you want SSL support compiled in]) - AS_MESSAGE(Enabling SSL support.) -else - AC_MSG_WARN(Disabling SSL support.) - AC_MSG_WARN(Consider re-running configure --with-ssl.) -fi - -if test "$cross_compiling" != yes -a "$with_ssl" != "no" -then - AC_LIB_LINKFLAGS([crypto]) - AC_LIB_LINKFLAGS([ssl], [crypto]) - - LIBS="$LIBS $LIBSSL $LIBCRYPTO" + AC_DEFINE(SSL_ENABLE, 1, [Define if you want SSL support compiled in]) + AS_MESSAGE([Enabling OpenSSL support.]) + else + AC_MSG_WARN(Disabling SSL support.) + AC_MSG_WARN(Consider re-running configure --with-ssl.) + fi fi -AC_MSG_NOTICE([LIBS:] "$LIBS") -case "$LIBS" in *-lssl*|*libssl*) +AS_MESSAGE([ + CC: $CC + CPPFLAGS: $CPPFLAGS + CFLAGS: $CFLAGS + LDFLAGS: $LDFLAGS + LIBS: $LIBS]) + +case "$LIBS" in *-lssl*|*libssl*|*-lwolfssl*|*libwolfssl*) + case $host_os in + openbsd*) ;; dnl OpenBSD ships LibreSSL in the base operating system + dnl so makes use of the GPL2 clause 3 exception. + *) + AC_CHECK_DECLS([LIBRESSL_VERSION_NUMBER], + AC_MSG_ERROR([fetchmail cannot legally be linked against LibreSSL for lack of GPL2 clause 2b exception. See COPYING.]),, + [#include <openssl/ssl.h>]) + ;; + esac AC_CHECK_DECLS([TLS1_3_VERSION],, AC_MSG_WARN([Your OpenSSL version is too old and does not support TLS v1.3. Upgrade.]), [#include <openssl/ssl.h>]) @@ -856,7 +950,7 @@ then ac_savedLDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $LDFLAGS" AC_CHECK_LIB(socks5, SOCKSconnect,, - AC_MSG_ERROR([could not find libsocks5 which is needed for built-in SOCKS5 support])) + AC_MSG_ERROR([could not find libsocks5 which is needed for built-in SOCKS5 support])) AC_DEFINE(HAVE_SOCKS) CFLAGS="$CFLAGS -Dconnect=SOCKSconnect -Dgetsockname=SOCKSgetsockname -Dbind=SOCKSbind -Daccept=SOCKSaccept -Dlisten=SOCKSlisten -Dselect=SOCKSselect -Drecvfrom=SOCKSrecvfrom -Dsendto=SOCKSsendto -Drecv=SOCKSrecv -Dsend=SOCKSsend -Dread=SOCKSread -Dwrite=SOCKSwrite -Drresvport=SOCKSrresvport -Dshutdown=SOCKSshutdown -Dlisten=SOCKSlisten -Dclose=SOCKSclose -Ddup=SOCKSdup -Ddup2=SOCKSdup2" AC_CHECK_FUNC(SOCKSfclose, [CFLAGS="$CFLAGS -Dfclose=SOCKSfclose"]) |
