summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2018-01-20 12:19:21 (GMT)
committerGitHub <noreply@github.com>2018-01-20 12:19:21 (GMT)
commitff5be6e8100276647e0077e80869fc022d1bb53f (patch)
tree70c1b01fa7040254bf81026e177a53862e7192b4 /configure.ac
parentd911e40e788fb679723d78b6ea11cabf46caed5a (diff)
downloadcpython-ff5be6e8100276647e0077e80869fc022d1bb53f.zip
cpython-ff5be6e8100276647e0077e80869fc022d1bb53f.tar.gz
cpython-ff5be6e8100276647e0077e80869fc022d1bb53f.tar.bz2
bpo-32598: Use autoconf to detect usable OpenSSL (#5242)
Add https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html to auto-detect compiler flags, linker flags and libraries to compile OpenSSL extensions. The M4 macro uses pkg-config and falls back to manual detection. Add autoconf magic to detect usable X509_VERIFY_PARAM_set1_host() and related functions. Refactor setup.py to use new config vars to compile _ssl and _hashlib modules. Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac41
1 files changed, 41 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 1894e21..39e2e8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,6 +9,8 @@ AC_PREREQ(2.65)
AC_INIT(python, PYTHON_VERSION, https://bugs.python.org/)
+AC_CONFIG_MACRO_DIR(m4)
+
AC_SUBST(BASECPPFLAGS)
if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then
# If we're building out-of-tree, we need to make sure the following
@@ -5460,6 +5462,45 @@ if test "$have_getrandom" = yes; then
[Define to 1 if the getrandom() function is available])
fi
+# Check for usable OpenSSL
+AX_CHECK_OPENSSL([have_openssl=yes],[have_openssl=no])
+
+if test "$have_openssl" = yes; then
+ AC_MSG_CHECKING([for X509_VERIFY_PARAM_set1_host in libssl])
+
+ save_LIBS="$LIBS"
+ save_LDFLAGS="$LDFLAGS"
+ save_CPPFLAGS="$CPPFLAGS"
+ LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
+ LIBS="$OPENSSL_LIBS $LIBS"
+ CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
+ [#include <openssl/x509_vfy.h>]
+ ], [
+ [X509_VERIFY_PARAM *p = X509_VERIFY_PARAM_new();]
+ [X509_VERIFY_PARAM_set1_host(p, "localhost", 0);]
+ [X509_VERIFY_PARAM_set1_ip_asc(p, "127.0.0.1");]
+ [X509_VERIFY_PARAM_set_hostflags(p, 0);]
+ ])
+ ],
+ [
+ ac_cv_has_x509_verify_param_set1_host=yes
+ ],
+ [
+ ac_cv_has_x509_verify_param_set1_host=no
+ ])
+ AC_MSG_RESULT($ac_cv_has_x509_verify_param_set1_host)
+ if test "$ac_cv_has_x509_verify_param_set1_host" = "yes"; then
+ AC_DEFINE(HAVE_X509_VERIFY_PARAM_SET1_HOST, 1,
+ [Define if libssl has X509_VERIFY_PARAM_set1_host and related function])
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+fi
+
# generate output files
AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-config.sh)
AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])