mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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>
This commit is contained in:
parent
d911e40e78
commit
ff5be6e810
9 changed files with 585 additions and 83 deletions
41
configure.ac
41
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])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue