Skip to contentSkip to conversation

configure.ac: simplify crypto library configuration

PATCH In review Steffan Karger 2 participants 2 messages Jan 10, 2016 – Jan 16, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure.ac: simplify crypto library configuration

This reworks the crypto library configuration, to make it both simpler to understand and more usable:

* Only check for OpenSSL when building against OpenSSL (and similar for PolarSSL/mbed TLS).
* Bail out early if a problem with the library is detected.
* Set CRYPTO_{LIBS,FLAGS} immediately after the crypto library checks, removing the need for an extra switch-case later on.
* We no longer support building openvpn with crypto but without ssl, so we can also simplify the logic in configure.ac accordingly.

As a 'side effect' (this actually triggered me), this fixes a bug that would cause a user-specified OPENSSL_{CRYPTO,SSL}_LIBS to be overwritten by AC_CHECK_LIB if there are openssl headers available in the PATH.

---
 Changes.rst  |   8 ++++
 INSTALL      |  12 ++---
 configure.ac | 148 ++++++++++++++++++++++++++---------------------------------
 3 files changed, 78 insertions(+), 90 deletions(-)
Changes.rst +8 -0
index f27d7f0..dd9b9b2 100644
@@ -78,3 +78,11 @@ User-visible Changes
 
 - Removed --enable-password-save from configure. This option is now
   always enabled.
+
+Maintainer-visible changes
+--------------------------
+- OpenVPN no longer supports building with crypto support, but without TLS
+  support.  As a consequence, OPENSSL_CRYPTO_{CFLAGS,LIBS} and
+  OPENSSL_SSL_{CFLAGS,LIBS} have been merged into OPENSSL_{CFLAGS,LIBS}.  This
+  is particularly relevant for maintainers who build their own OpenSSL library,
+  e.g. when cross-compiling.
INSTALL +4 -8
index 2ef7904..2401f7c 100644
@@ -210,14 +210,10 @@ ENVIRONMENT for ./configure:
   MAN2HTML    path to man2html utility
   GIT         path to git utility
   TAP_CFLAGS  C compiler flags for tap
-  OPENSSL_CRYPTO_CFLAGS
-              C compiler flags for OPENSSL_CRYPTO, overriding pkg-config
-  OPENSSL_CRYPTO_LIBS
-              linker flags for OPENSSL_CRYPTO, overriding pkg-config
-  OPENSSL_SSL_CFLAGS
-              C compiler flags for OPENSSL_SSL, overriding pkg-config
-  OPENSSL_SSL_LIBS
-              linker flags for OPENSSL_SSL, overriding pkg-config
+  OPENSSL_CFLAGS
+              C compiler flags for OpenSSL, overriding pkg-config
+  OPENSSL_LIBS
+              linker flags for OpenSSL, overriding pkg-config
   POLARSSL_CFLAGS
               C compiler flags for polarssl
   POLARSSL_LIBS
configure.ac +66 -82

191 lines not on this page · raw message

Signature · 1 line
2.5.0
#1 lore raw

ACK. I'm no autoconf expert, but it looks reasonable to me, and works on my test system... Samuli might have to check whether it affects/breaks building for windows (but his buildslave will tell us in a few minutes :) ).

It does change behaviour in some cases - my polarssl build only set POLARSSL_CFLAGS=-I..., and it still found the library - with this patch, POLARSSL_LIBS=-lpolarssl is now needed as well. But I think that was the intended usage all the time ("if you set one, you need to set both"), so I'm not complaining.

Your patch has been applied to the master branch.

commit 31b0bebef61413151af9ded55aa985798d4f7666

Author: Steffan Karger
Date:   Sun Jan 10 15:37:19 2016 +0100
     configure.ac: simplify crypto library configuration

     Signed-off-by: Steffan Karger <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/10978
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering