Skip to content

Commit 064bc07

Browse files
authored
[3.9] bpo-43617: Check autoconf-archive package in configure.ac (GH-25016) (GH-25034)
Signed-off-by: Christian Heimes <[email protected]>. (cherry picked from commit 5d6e8c1) Co-authored-by: Christian Heimes <[email protected]>
1 parent 7990072 commit 064bc07

7 files changed

+229
-219
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Improve configure.ac: Check for presence of autoconf-archive package and
2+
remove our copies of M4 macros.

aclocal.m4

+209-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,215 @@
1212
# PARTICULAR PURPOSE.
1313

1414
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15+
# ===============================================================================
16+
# https://www.gnu.org/software/autoconf-archive/ax_c_float_words_bigendian.html
17+
# ===============================================================================
18+
#
19+
# SYNOPSIS
20+
#
21+
# AX_C_FLOAT_WORDS_BIGENDIAN([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
22+
#
23+
# DESCRIPTION
24+
#
25+
# Checks the ordering of words within a multi-word float. This check is
26+
# necessary because on some systems (e.g. certain ARM systems), the float
27+
# word ordering can be different from the byte ordering. In a multi-word
28+
# float context, "big-endian" implies that the word containing the sign
29+
# bit is found in the memory location with the lowest address. This
30+
# implementation was inspired by the AC_C_BIGENDIAN macro in autoconf.
31+
#
32+
# The endianness is detected by first compiling C code that contains a
33+
# special double float value, then grepping the resulting object file for
34+
# certain strings of ASCII values. The double is specially crafted to have
35+
# a binary representation that corresponds with a simple string. In this
36+
# implementation, the string "noonsees" was selected because the
37+
# individual word values ("noon" and "sees") are palindromes, thus making
38+
# this test byte-order agnostic. If grep finds the string "noonsees" in
39+
# the object file, the target platform stores float words in big-endian
40+
# order. If grep finds "seesnoon", float words are in little-endian order.
41+
# If neither value is found, the user is instructed to specify the
42+
# ordering.
43+
#
44+
# LICENSE
45+
#
46+
# Copyright (c) 2008 Daniel Amelang <[email protected]>
47+
#
48+
# Copying and distribution of this file, with or without modification, are
49+
# permitted in any medium without royalty provided the copyright notice
50+
# and this notice are preserved. This file is offered as-is, without any
51+
# warranty.
52+
53+
#serial 11
54+
55+
AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN],
56+
[AC_CACHE_CHECK(whether float word ordering is bigendian,
57+
ax_cv_c_float_words_bigendian, [
58+
59+
ax_cv_c_float_words_bigendian=unknown
60+
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
61+
62+
double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
63+
64+
]])], [
65+
66+
if grep noonsees conftest.$ac_objext >/dev/null ; then
67+
ax_cv_c_float_words_bigendian=yes
68+
fi
69+
if grep seesnoon conftest.$ac_objext >/dev/null ; then
70+
if test "$ax_cv_c_float_words_bigendian" = unknown; then
71+
ax_cv_c_float_words_bigendian=no
72+
else
73+
ax_cv_c_float_words_bigendian=unknown
74+
fi
75+
fi
76+
77+
])])
78+
79+
case $ax_cv_c_float_words_bigendian in
80+
yes)
81+
m4_default([$1],
82+
[AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1,
83+
[Define to 1 if your system stores words within floats
84+
with the most significant word first])]) ;;
85+
no)
86+
$2 ;;
87+
*)
88+
m4_default([$3],
89+
[AC_MSG_ERROR([
90+
91+
Unknown float word ordering. You need to manually preset
92+
ax_cv_c_float_words_bigendian=no (or yes) according to your system.
93+
94+
])]) ;;
95+
esac
96+
97+
])# AX_C_FLOAT_WORDS_BIGENDIAN
98+
99+
# ===========================================================================
100+
# https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
101+
# ===========================================================================
102+
#
103+
# SYNOPSIS
104+
#
105+
# AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
106+
#
107+
# DESCRIPTION
108+
#
109+
# Look for OpenSSL in a number of default spots, or in a user-selected
110+
# spot (via --with-openssl). Sets
111+
#
112+
# OPENSSL_INCLUDES to the include directives required
113+
# OPENSSL_LIBS to the -l directives required
114+
# OPENSSL_LDFLAGS to the -L or -R flags required
115+
#
116+
# and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
117+
#
118+
# This macro sets OPENSSL_INCLUDES such that source files should use the
119+
# openssl/ directory in include directives:
120+
#
121+
# #include <openssl/hmac.h>
122+
#
123+
# LICENSE
124+
#
125+
# Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
126+
# Copyright (c) 2009,2010 Dustin J. Mitchell <[email protected]>
127+
#
128+
# Copying and distribution of this file, with or without modification, are
129+
# permitted in any medium without royalty provided the copyright notice
130+
# and this notice are preserved. This file is offered as-is, without any
131+
# warranty.
132+
133+
#serial 10
134+
135+
AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
136+
AC_DEFUN([AX_CHECK_OPENSSL], [
137+
found=false
138+
AC_ARG_WITH([openssl],
139+
[AS_HELP_STRING([--with-openssl=DIR],
140+
[root of the OpenSSL directory])],
141+
[
142+
case "$withval" in
143+
"" | y | ye | yes | n | no)
144+
AC_MSG_ERROR([Invalid --with-openssl value])
145+
;;
146+
*) ssldirs="$withval"
147+
;;
148+
esac
149+
], [
150+
# if pkg-config is installed and openssl has installed a .pc file,
151+
# then use that information and don't search ssldirs
152+
AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
153+
if test x"$PKG_CONFIG" != x""; then
154+
OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
155+
if test $? = 0; then
156+
OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
157+
OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
158+
found=true
159+
fi
160+
fi
161+
162+
# no such luck; use some default ssldirs
163+
if ! $found; then
164+
ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
165+
fi
166+
]
167+
)
168+
169+
170+
# note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
171+
# an 'openssl' subdirectory
172+
173+
if ! $found; then
174+
OPENSSL_INCLUDES=
175+
for ssldir in $ssldirs; do
176+
AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
177+
if test -f "$ssldir/include/openssl/ssl.h"; then
178+
OPENSSL_INCLUDES="-I$ssldir/include"
179+
OPENSSL_LDFLAGS="-L$ssldir/lib"
180+
OPENSSL_LIBS="-lssl -lcrypto"
181+
found=true
182+
AC_MSG_RESULT([yes])
183+
break
184+
else
185+
AC_MSG_RESULT([no])
186+
fi
187+
done
188+
189+
# if the file wasn't found, well, go ahead and try the link anyway -- maybe
190+
# it will just work!
191+
fi
192+
193+
# try the preprocessor and linker with our new flags,
194+
# being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
195+
196+
AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
197+
echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
198+
"OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
199+
200+
save_LIBS="$LIBS"
201+
save_LDFLAGS="$LDFLAGS"
202+
save_CPPFLAGS="$CPPFLAGS"
203+
LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
204+
LIBS="$OPENSSL_LIBS $LIBS"
205+
CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
206+
AC_LINK_IFELSE(
207+
[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
208+
[
209+
AC_MSG_RESULT([yes])
210+
$1
211+
], [
212+
AC_MSG_RESULT([no])
213+
$2
214+
])
215+
CPPFLAGS="$save_CPPFLAGS"
216+
LDFLAGS="$save_LDFLAGS"
217+
LIBS="$save_LIBS"
218+
219+
AC_SUBST([OPENSSL_INCLUDES])
220+
AC_SUBST([OPENSSL_LIBS])
221+
AC_SUBST([OPENSSL_LDFLAGS])
222+
])
223+
15224
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
16225
# serial 11 (pkg-config-0.29.1)
17226

@@ -356,5 +565,3 @@ AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
356565
[AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
357566
])dnl PKG_HAVE_DEFINE_WITH_MODULES
358567

359-
m4_include([m4/ax_c_float_words_bigendian.m4])
360-
m4_include([m4/ax_check_openssl.m4])

configure

+4-3
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,7 @@ Optional Packages:
15771577
--with-ensurepip[=install|upgrade|no]
15781578
"install" or "upgrade" using bundled pip (default is
15791579
upgrade)
1580-
--with-openssl=DIR override root of the OpenSSL directory to DIR
1580+
--with-openssl=DIR root of the OpenSSL directory
15811581
--with-ssl-default-suites=[python|openssl|STRING]
15821582
override default cipher suites string, python: use
15831583
Python's preferred selection (default), openssl:
@@ -14495,10 +14495,10 @@ _ACEOF
1449514495
if ac_fn_c_try_compile "$LINENO"; then :
1449614496

1449714497

14498-
if $GREP noonsees conftest.$ac_objext >/dev/null ; then
14498+
if grep noonsees conftest.$ac_objext >/dev/null ; then
1449914499
ax_cv_c_float_words_bigendian=yes
1450014500
fi
14501-
if $GREP seesnoon conftest.$ac_objext >/dev/null ; then
14501+
if grep seesnoon conftest.$ac_objext >/dev/null ; then
1450214502
if test "$ax_cv_c_float_words_bigendian" = unknown; then
1450314503
ax_cv_c_float_words_bigendian=no
1450414504
else
@@ -15382,6 +15382,7 @@ _ACEOF
1538215382

1538315383
fi
1538415384

15385+
1538515386
EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX}
1538615387

1538715388
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LDVERSION" >&5

configure.ac

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
dnl ***********************************************
2-
dnl * Please run autoreconf to test your changes! *
3-
dnl ***********************************************
1+
dnl ***************************************************
2+
dnl * Please run autoreconf -if to test your changes! *
3+
dnl ***************************************************
4+
dnl
5+
dnl Python's configure script requires autoconf 2.69 and autoconf-archive.
6+
dnl
47

58
# Set VERSION so we only need to edit in one place (i.e., here)
69
m4_define(PYTHON_VERSION, 3.9)
@@ -9,7 +12,11 @@ AC_PREREQ([2.69])
912

1013
AC_INIT([python],[PYTHON_VERSION],[https://bugs.python.org/])
1114

12-
AC_CONFIG_MACRO_DIR(m4)
15+
m4_ifdef(
16+
[AX_C_FLOAT_WORDS_BIGENDIAN],
17+
[],
18+
[AC_MSG_ERROR([Please install autoconf-archive package and re-run autoreconf])]
19+
)
1320

1421
AC_SUBST(BASECPPFLAGS)
1522
if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then

m4/ax_c_float_words_bigendian.m4

-83
This file was deleted.

0 commit comments

Comments
 (0)