From 3055c947f98a078bd10d6a8cc352048a1b771d60 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Tue, 15 May 2018 22:58:09 -0700 Subject: closes bpo-33512: use standard for detecting long double (GH-6847) --- .../Build/2018-05-15-02-07-49.bpo-33512.X4Fy1Q.rst | 1 + configure | 57 ++++++++++++---------- configure.ac | 10 +--- pyconfig.h.in | 2 +- 4 files changed, 33 insertions(+), 37 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2018-05-15-02-07-49.bpo-33512.X4Fy1Q.rst diff --git a/Misc/NEWS.d/next/Build/2018-05-15-02-07-49.bpo-33512.X4Fy1Q.rst b/Misc/NEWS.d/next/Build/2018-05-15-02-07-49.bpo-33512.X4Fy1Q.rst new file mode 100644 index 0000000..6b74551 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2018-05-15-02-07-49.bpo-33512.X4Fy1Q.rst @@ -0,0 +1 @@ +configure's check for "long double" has been simplified diff --git a/configure b/configure index b098bac..669060b 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] @@ -8603,32 +8591,48 @@ _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. */ + { $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 () { -long double x; x = (long double)0; +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 - have_long_double=yes + fi -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]];'. @@ -8662,7 +8666,6 @@ cat >>confdefs.h <<_ACEOF _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/configure.ac b/configure.ac index 883c905..679fac3 100644 --- a/configure.ac +++ b/configure.ac @@ -2198,16 +2198,8 @@ 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_TYPE_LONG_DOUBLE AC_CHECK_SIZEOF(long double, 16) -fi AC_CHECK_SIZEOF(_Bool, 1) diff --git a/pyconfig.h.in b/pyconfig.h.in index 848872a..2af4117 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. */ -- cgit v0.12