From 7bd82f6d0bcc415efe6705bbb813ecbb40104017 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Tue, 15 May 2018 22:02:16 -0700 Subject: [PATCH 1/3] bpo-33473: assume that "long double" and "ssize_t" exists Instead of using custom code to detect the type, use+AC_TYPE_LONG_DOUBLE and rely on it existing. --- Include/pyport.h | 6 ------ configure.ac | 14 ++------------ 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/Include/pyport.h b/Include/pyport.h index c1f4c7fbb52c993..ad6160becbec7d8 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -80,13 +80,7 @@ typedef intptr_t Py_intptr_t; * sizeof(size_t). C99 doesn't define such a thing directly (size_t is an * unsigned integral type). See PEP 353 for details. */ -#ifdef HAVE_SSIZE_T typedef ssize_t Py_ssize_t; -#elif SIZEOF_VOID_P == SIZEOF_SIZE_T -typedef Py_intptr_t Py_ssize_t; -#else -# error "Python needs a typedef for Py_ssize_t in pyport.h." -#endif /* Py_hash_t is the same size as a pointer. */ #define SIZEOF_PY_HASH_T SIZEOF_SIZE_T diff --git a/configure.ac b/configure.ac index 883c90505219928..9c2a091013e8b49 100644 --- a/configure.ac +++ b/configure.ac @@ -2178,9 +2178,9 @@ AC_TYPE_PID_T AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void]) AC_TYPE_SIZE_T AC_TYPE_UID_T +AC_TYPE_SSIZE_T +AC_TYPE_LONG_DOUBLE -AC_CHECK_TYPE(ssize_t, - AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,) AC_CHECK_TYPE(__uint128_t, AC_DEFINE(HAVE_GCC_UINT128_T, 1, [Define if your compiler provides __uint128_t]),,) @@ -2198,16 +2198,6 @@ AC_CHECK_SIZEOF(size_t, 4) AC_CHECK_SIZEOF(pid_t, 4) AC_CHECK_SIZEOF(uintptr_t) -AC_MSG_CHECKING(for long double support) -have_long_double=no -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[ - AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.]) - have_long_double=yes -],[]) -AC_MSG_RESULT($have_long_double) -if test "$have_long_double" = yes ; then -AC_CHECK_SIZEOF(long double, 16) -fi AC_CHECK_SIZEOF(_Bool, 1) From f27a3580011e6ffb79928abd82f4348378e14faf Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Wed, 16 May 2018 03:58:42 +0000 Subject: [PATCH 2/3] Regen --- configure | 124 ++++++++++++++++++++------------------------------ pyconfig.h.in | 11 ++--- 2 files changed, 53 insertions(+), 82 deletions(-) diff --git a/configure b/configure index b098bac6472a25e..90ab0c4544a6280 100755 --- a/configure +++ b/configure @@ -779,7 +779,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -887,7 +886,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1140,15 +1138,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1286,7 +1275,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1439,7 +1428,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -8221,13 +8209,59 @@ $as_echo "#define gid_t int" >>confdefs.h fi - ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : -$as_echo "#define HAVE_SSIZE_T 1" >>confdefs.h +else + +cat >>confdefs.h <<_ACEOF +#define ssize_t int +_ACEOF + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double" >&5 +$as_echo_n "checking for long double... " >&6; } +if ${ac_cv_type_long_double+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$GCC" = yes; then + ac_cv_type_long_double=yes + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* The Stardent Vistra knows sizeof (long double), but does + not support it. */ + long double foo = 0.0L; +int +main () +{ +static int test_array [1 - 2 * !(/* On Ultrix 4.3 cc, long double is 4 and double is 8. */ + sizeof (double) <= sizeof (long double))]; +test_array [0] = 0; +return test_array [0]; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_type_long_double=yes +else + ac_cv_type_long_double=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_double" >&5 +$as_echo "$ac_cv_type_long_double" >&6; } + if test $ac_cv_type_long_double = yes; then + +$as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h + + fi + ac_fn_c_check_type "$LINENO" "__uint128_t" "ac_cv_type___uint128_t" "$ac_includes_default" if test "x$ac_cv_type___uint128_t" = xyes; then : @@ -8603,66 +8637,6 @@ _ACEOF -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double support" >&5 -$as_echo_n "checking for long double support... " >&6; } -have_long_double=no -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -long double x; x = (long double)0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - -$as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h - - have_long_double=yes - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_long_double" >&5 -$as_echo "$have_long_double" >&6; } -if test "$have_long_double" = yes ; then -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 -$as_echo_n "checking size of long double... " >&6; } -if ${ac_cv_sizeof_long_double+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_long_double" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (long double) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_long_double=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_double" >&5 -$as_echo "$ac_cv_sizeof_long_double" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double -_ACEOF - - -fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects diff --git a/pyconfig.h.in b/pyconfig.h.in index 848872a7dca3d90..b2bd02b2d8bb019 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -617,7 +617,7 @@ /* Define to 1 if you have the `log2' function. */ #undef HAVE_LOG2 -/* Define this if you have the type long double. */ +/* Define to 1 if the system has the type `long double'. */ #undef HAVE_LONG_DOUBLE /* Define to 1 if you have the `lstat' function. */ @@ -941,9 +941,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SPAWN_H -/* Define if your compiler provides ssize_t */ -#undef HAVE_SSIZE_T - /* Define to 1 if you have the `statvfs' function. */ #undef HAVE_STATVFS @@ -1361,9 +1358,6 @@ /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG -/* The size of `long double', as computed by sizeof. */ -#undef SIZEOF_LONG_DOUBLE - /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG @@ -1573,6 +1567,9 @@ /* Define to `int' if does not define. */ #undef socklen_t +/* Define to `int' if does not define. */ +#undef ssize_t + /* Define to `int' if doesn't define. */ #undef uid_t From 8371aa788684c3e52c62bb779449777686e540f0 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Wed, 16 May 2018 04:51:47 +0000 Subject: [PATCH 3/3] add news --- Misc/NEWS.d/next/Build/2018-05-16-03-59-15.bpo-33473.Bh6blu.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2018-05-16-03-59-15.bpo-33473.Bh6blu.rst diff --git a/Misc/NEWS.d/next/Build/2018-05-16-03-59-15.bpo-33473.Bh6blu.rst b/Misc/NEWS.d/next/Build/2018-05-16-03-59-15.bpo-33473.Bh6blu.rst new file mode 100644 index 000000000000000..37b3ec9aa2dad2c --- /dev/null +++ b/Misc/NEWS.d/next/Build/2018-05-16-03-59-15.bpo-33473.Bh6blu.rst @@ -0,0 +1,2 @@ +python will now build on systems that don't properly define ssize_t or long +double.