]> diplodocus.org Git - nmh/commitdiff
Merge branch 'master' of git.sv.gnu.org:/srv/git/nmh
authorRalph Corderoy <ralph@inputplus.co.uk>
Mon, 24 Oct 2016 22:49:11 +0000 (23:49 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Mon, 24 Oct 2016 22:49:11 +0000 (23:49 +0100)
configure.ac
docs/contrib/build_nmh

index 7abb916..02a3924 100644 (file)
@@ -35,16 +35,13 @@ AS_IF([test x"$with_cyrus_sasl" != x -a x"$with_cyrus_sasl" != x"no"],[
            AC_MSG_WARN([Please pass the appropriate arguments to CPPFLAGS/LDFLAGS])])
       sasl_support=yes], [sasl_support=no])
 
+dnl Do you want client-side support for encryption with TLS?
+AC_ARG_WITH([tls], AS_HELP_STRING([--with-tls], [Enable TLS support]))
+
 dnl Do you want client-side support for using OAuth2 for SMTP authentication?
 AC_ARG_WITH([oauth], AS_HELP_STRING([--with-oauth],
   [Enable OAuth2 support in SMTP auth]))
 
-dnl Do you want client-side support for encryption with TLS?
-AC_ARG_WITH([tls], AS_HELP_STRING([--with-tls], [Enable TLS support]))
-AS_IF([test x"$with_tls" != x"no"],[
-      AC_DEFINE([TLS_SUPPORT], [1], [Support TLS for session encryption.])dnl
-      tls_support=yes],[tls_support=no])
-
 dnl Set the backup prefix
 AC_ARG_WITH([hash-backup],
   AS_HELP_STRING([--with-hash-backup],[use # as the backup prefix (default: ,)]))
@@ -468,18 +465,34 @@ dnl -----------------
 dnl CHECK FOR OPENSSL
 dnl -----------------
 
-AS_IF([test x"$tls_support" = x"yes"],[
-  dnl OpenBSD 5 needs the other-libraries (fourth argument) to the
+AS_IF([test x"$with_tls" != x"no"],[
+  dnl OpenBSD 5 needs the other-libraries (fifth argument) to the
   dnl AC_CHECK_LIB for SSL_new, because it doesn't
   dnl automatically append -lcrypto when linking with -lssl.
-  AC_CHECK_HEADER([openssl/ssl.h], , [AC_MSG_ERROR([openssl/ssl.h not found])])
-  AC_CHECK_LIB([crypto], [BIO_write], [TLSLIB="-lcrypto"],
-    [AC_MSG_ERROR([OpenSSL crypto library not found])])
-  AC_CHECK_LIB([ssl], [SSL_new], [TLSLIB="-lssl $TLSLIB"],
-    [AC_MSG_ERROR([OpenSSL library not found])],[$TLSLIB])],
-  [TLSLIB=])
+  AC_CHECK_HEADER([openssl/ssl.h], HAVE_SSL_H=1)
+  AC_CHECK_LIB([crypto], [BIO_write], [TLSLIB="-lcrypto"])
+  AC_CHECK_LIB([ssl], [SSL_new], [TLSLIB="-lssl $TLSLIB"], [TLSLIB=],
+               [$TLSLIB])])
 AC_SUBST([TLSLIB])
 
+dnl -----------------
+dnl Enable TLS?
+dnl -----------------
+dnl By default (with_tls=''), enable TLS if header and libs were found.
+dnl If TLS requested (--with-tls with_tls=yes), error if header/lib not found.
+dnl If TLS disabled (--without-tls with_tls=no), don't enable it.
+tls_support=no
+TLS_SUPPORT=0
+AC_SUBST([TLS_SUPPORT])
+AS_IF([test "x$with_tls" = xyes && test "x$HAVE_SSL_H" = x],
+      [AC_MSG_ERROR([TLS requested but openssl/ssl.h not found])],
+      [test "x$with_tls" = xyes && test "x$TLSLIB" = x],
+      [AC_MSG_ERROR([TLS requested but crypto or ssl library not found])],
+      [test "x$with_tls" != xno && test "x$HAVE_SSL_H" = x1 && test "x$TLSLIB" != x],
+      [AC_DEFINE([TLS_SUPPORT], [1], [Support TLS for session encryption.])
+       TLS_SUPPORT=1
+       tls_support=yes])
+
 dnl -----------------
 dnl CHECK FOR CURL
 dnl -----------------
index 90e733a..6c90d66 100755 (executable)
@@ -190,7 +190,6 @@ config_mts=smtp
 config_smtpservers=localhost
 config_sasl=n
 config_tls=n
-config_oauth=n
 config_debug=n
 
 
@@ -233,13 +232,9 @@ if install-mh -check >/dev/null 2>&1; then
       case `$mhbin/mhparam tls` in
         *tls*) config_tls=y ;;
       esac
-
-      case `$mhbin/mhparam oauth` in
-        *oauth*) config_oauth=y ;;
-      esac
     else
       tput smso
-      echo "$0: SASL, TLS, and OAuth2 detection not supported with current nmh"
+      echo "$0: SASL and TLS detection not supported with current nmh"
       [ $yes -eq 1 ]  &&  echo "will not configure them in"
       tput rmso
     fi
@@ -277,10 +272,6 @@ if [ $yes -eq 0 ]; then
   read response
   [ "$response" = y  -o  "$response" = Y ]  &&  config_tls=y
 
-  printf 'OAuth2 support [%s]: ' $config_oauth >&3
-  read response
-  [ "$response" = y  -o  "$response" = Y ]  &&  config_oauth=y
-
   #### Don't confirm debug here:  obey the -d option to this script.
 fi
 
@@ -295,7 +286,6 @@ config_opts="--prefix=$config_prefix"
   smtpservers="--with-smtpservers=$config_smtpservers"
 [ "$config_sasl" = y ]  &&  config_opts="$config_opts --with-cyrus-sasl"
 [ "$config_tls" = y ]  &&  config_opts="$config_opts --with-tls"
-[ "$config_oauth" = y ]  &&  config_opts="$config_opts --with-oauth"
 [ $config_debug = y ]  &&  config_opts="$config_opts --enable-assert"
 
 #### dotlocking, the usual default, requires chgrp and chmod of inc.