2a2d7aef5d162cd2b43745d2bd66ba275257d147
[feed/packages.git] / lang / python / python3 / patches / 026-bpo-34585-run-autoconf-GH-9411.patch
1 From b3b8cb419e496629873fa7dda82a01863f58617a Mon Sep 17 00:00:00 2001
2 From: Benjamin Peterson <benjamin@python.org>
3 Date: Tue, 18 Sep 2018 23:49:05 -0700
4 Subject: [PATCH] run autoconf (GH-9411)
5
6 Follow up to 2a9c3805ddedf282881ef7811a561c70b74f80b1 (bpo-34585).
7 ---
8 aclocal.m4 | 1 +
9 configure | 146 ++++++++++++++++----------------------------------
10 pyconfig.h.in | 4 ++
11 3 files changed, 51 insertions(+), 100 deletions(-)
12
13 --- a/aclocal.m4
14 +++ b/aclocal.m4
15 @@ -288,4 +288,5 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
16 AS_VAR_IF([$1], [""], [$5], [$4])dnl
17 ])dnl PKG_CHECK_VAR
18
19 +m4_include([m4/ax_c_float_words_bigendian.m4])
20 m4_include([m4/ax_check_openssl.m4])
21 --- a/configure
22 +++ b/configure
23 @@ -14235,131 +14235,77 @@ fi
24 # * Check for various properties of floating point *
25 # **************************************************
26
27 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are little-endian IEEE 754 binary64" >&5
28 -$as_echo_n "checking whether C doubles are little-endian IEEE 754 binary64... " >&6; }
29 -if ${ac_cv_little_endian_double+:} false; then :
30 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether float word ordering is bigendian" >&5
31 +$as_echo_n "checking whether float word ordering is bigendian... " >&6; }
32 +if ${ax_cv_c_float_words_bigendian+:} false; then :
33 $as_echo_n "(cached) " >&6
34 else
35
36 -if test "$cross_compiling" = yes; then :
37 - ac_cv_little_endian_double=no
38 -else
39 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext
40 +
41 +ax_cv_c_float_words_bigendian=unknown
42 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
43 /* end confdefs.h. */
44
45 -#include <string.h>
46 -int main() {
47 - double x = 9006104071832581.0;
48 - if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
49 - return 0;
50 - else
51 - return 1;
52 -}
53
54 -_ACEOF
55 -if ac_fn_c_try_run "$LINENO"; then :
56 - ac_cv_little_endian_double=yes
57 -else
58 - ac_cv_little_endian_double=no
59 -fi
60 -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
61 - conftest.$ac_objext conftest.beam conftest.$ac_ext
62 -fi
63 +double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
64
65 -fi
66
67 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_little_endian_double" >&5
68 -$as_echo "$ac_cv_little_endian_double" >&6; }
69 -if test "$ac_cv_little_endian_double" = yes
70 -then
71 +_ACEOF
72 +if ac_fn_c_try_compile "$LINENO"; then :
73
74 -$as_echo "#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1" >>confdefs.h
75
76 +if grep noonsees conftest.$ac_objext >/dev/null ; then
77 + ax_cv_c_float_words_bigendian=yes
78 +fi
79 +if grep seesnoon conftest.$ac_objext >/dev/null ; then
80 + if test "$ax_cv_c_float_words_bigendian" = unknown; then
81 + ax_cv_c_float_words_bigendian=no
82 + else
83 + ax_cv_c_float_words_bigendian=unknown
84 + fi
85 fi
86
87 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are big-endian IEEE 754 binary64" >&5
88 -$as_echo_n "checking whether C doubles are big-endian IEEE 754 binary64... " >&6; }
89 -if ${ac_cv_big_endian_double+:} false; then :
90 - $as_echo_n "(cached) " >&6
91 -else
92 -
93 -if test "$cross_compiling" = yes; then :
94 - ac_cv_big_endian_double=no
95 -else
96 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext
97 -/* end confdefs.h. */
98 -
99 -#include <string.h>
100 -int main() {
101 - double x = 9006104071832581.0;
102 - if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
103 - return 0;
104 - else
105 - return 1;
106 -}
107
108 -_ACEOF
109 -if ac_fn_c_try_run "$LINENO"; then :
110 - ac_cv_big_endian_double=yes
111 -else
112 - ac_cv_big_endian_double=no
113 fi
114 -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
115 - conftest.$ac_objext conftest.beam conftest.$ac_ext
116 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
117 fi
118 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_c_float_words_bigendian" >&5
119 +$as_echo "$ax_cv_c_float_words_bigendian" >&6; }
120
121 -fi
122 +case $ax_cv_c_float_words_bigendian in
123 + yes)
124
125 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_big_endian_double" >&5
126 -$as_echo "$ac_cv_big_endian_double" >&6; }
127 -if test "$ac_cv_big_endian_double" = yes
128 -then
129 +$as_echo "#define FLOAT_WORDS_BIGENDIAN 1" >>confdefs.h
130 + ;;
131 + no)
132 + ;;
133 + *)
134 + as_fn_error $? "
135
136 -$as_echo "#define DOUBLE_IS_BIG_ENDIAN_IEEE754 1" >>confdefs.h
137 +Unknown float word ordering. You need to manually preset
138 +ax_cv_c_float_words_bigendian=no (or yes) according to your system.
139
140 -fi
141 + " "$LINENO" 5 ;;
142 +esac
143
144 -# Some ARM platforms use a mixed-endian representation for doubles.
145 -# While Python doesn't currently have full support for these platforms
146 -# (see e.g., issue 1762561), we can at least make sure that float <-> string
147 -# conversions work.
148 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are ARM mixed-endian IEEE 754 binary64" >&5
149 -$as_echo_n "checking whether C doubles are ARM mixed-endian IEEE 754 binary64... " >&6; }
150 -if ${ac_cv_mixed_endian_double+:} false; then :
151 - $as_echo_n "(cached) " >&6
152 -else
153
154 -if test "$cross_compiling" = yes; then :
155 - ac_cv_mixed_endian_double=no
156 -else
157 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext
158 -/* end confdefs.h. */
159 +if test "$ax_cv_c_float_words_bigendian" = "yes"
160 +then
161
162 -#include <string.h>
163 -int main() {
164 - double x = 9006104071832581.0;
165 - if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
166 - return 0;
167 - else
168 - return 1;
169 -}
170 +$as_echo "#define DOUBLE_IS_BIG_ENDIAN_IEEE754 1" >>confdefs.h
171
172 -_ACEOF
173 -if ac_fn_c_try_run "$LINENO"; then :
174 - ac_cv_mixed_endian_double=yes
175 -else
176 - ac_cv_mixed_endian_double=no
177 -fi
178 -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
179 - conftest.$ac_objext conftest.beam conftest.$ac_ext
180 -fi
181 +elif test "$ax_cv_c_float_words_bigendian" = "no"
182 +then
183
184 -fi
185 +$as_echo "#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1" >>confdefs.h
186
187 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mixed_endian_double" >&5
188 -$as_echo "$ac_cv_mixed_endian_double" >&6; }
189 -if test "$ac_cv_mixed_endian_double" = yes
190 -then
191 +else
192 + # Some ARM platforms use a mixed-endian representation for doubles.
193 + # While Python doesn't currently have full support for these platforms
194 + # (see e.g., issue 1762561), we can at least make sure that float <-> string
195 + # conversions work.
196 + # FLOAT_WORDS_BIGENDIAN doesnt actually detect this case, but if it's not big
197 + # or little, then it must be this?
198
199 $as_echo "#define DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 1" >>confdefs.h
200
201 --- a/pyconfig.h.in
202 +++ b/pyconfig.h.in
203 @@ -30,6 +30,10 @@
204 /* Define if --enable-ipv6 is specified */
205 #undef ENABLE_IPV6
206
207 +/* Define to 1 if your system stores words within floats with the most
208 + significant word first */
209 +#undef FLOAT_WORDS_BIGENDIAN
210 +
211 /* Define if flock needs to be linked with bsd library. */
212 #undef FLOCK_NEEDS_LIBBSD
213