From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1521) id F1E003858C60; Fri, 21 Jan 2022 12:08:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F1E003858C60 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Frysinger To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] newlib: switch to autoconf long double macro X-Act-Checkin: newlib-cygwin X-Git-Author: Mike Frysinger X-Git-Refname: refs/heads/master X-Git-Oldrev: 0a67325726577e189c65e7c190f3f9e0874143a6 X-Git-Newrev: 55e09d5e8c1e9cd7d54952af706341ae45a67e3a Message-Id: <20220121120859.F1E003858C60@sourceware.org> Date: Fri, 21 Jan 2022 12:08:59 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Jan 2022 12:09:00 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D55e09d5e8c1= e9cd7d54952af706341ae45a67e3a commit 55e09d5e8c1e9cd7d54952af706341ae45a67e3a Author: Mike Frysinger Date: Thu Jan 20 22:47:47 2022 -0500 newlib: switch to autoconf long double macro =20 Now that we require a recent version of autoconf, we can rely on this macro working. This change was already made to libm, but these other dirs were missed as I didn't notice it being duplicated in 3 places. Diff: --- newlib/configure | 68 +++++++++++++++++++++++++++-----------------= ---- newlib/configure.ac | 35 +++---------------------- newlib/libc/configure | 58 ++++++++++++++++++++++++++--------------- newlib/libc/configure.ac | 21 ++------------- newlib/newlib.hin | 3 +++ 5 files changed, 84 insertions(+), 101 deletions(-) diff --git a/newlib/configure b/newlib/configure index 879392da8..2d015dbb6 100755 --- a/newlib/configure +++ b/newlib/configure @@ -13315,46 +13315,54 @@ $as_echo "#define _HAVE_CC_INHIBIT_LOOP_TO_LIBCAL= L 1" >>confdefs.h fi =20 =20 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether long double type= exists" >&5 -$as_echo_n "checking whether long double type exists... " >&6; } -if ${acnewlib_cv_type_long_double+:} false; then : + + { $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 - cat > conftest.c < -#if defined(LDBL_MANT_DIG) - #define _HAVE_LONG_DOUBLE - #else - #error "LDBL !=3D DBL" -#endif -long double test() { -long double ld =3D 0.0L; -return ld; + if test "$GCC" =3D yes; then + ac_cv_type_long_double=3Dyes + 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 =3D 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) <=3D sizeof (long double))]; +test_array [0] =3D 0; +return test_array [0]; + + ; + return 0; } -EOF -if { ac_try=3D'${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c - 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=3D$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? =3D $ac_status" >&5 - test $ac_status =3D 0; }; } -then - acnewlib_cv_type_long_double=3Dyes; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_type_long_double=3Dyes else - acnewlib_cv_type_long_double=3Dno; + ac_cv_type_long_double=3Dno fi -rm -f conftest* +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acnewlib_cv_type_long_do= uble" >&5 -$as_echo "$acnewlib_cv_type_long_double" >&6; } -if test $acnewlib_cv_type_long_double =3D yes; then +{ $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 =3D yes; then + +$as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h + + fi + +if test $ac_cv_type_long_double =3D yes; then =20 $as_echo "#define _HAVE_LONG_DOUBLE 1" >>confdefs.h =20 fi - if test x"$acnewlib_cv_type_long_double" =3D x"yes"; then + if test x"$ac_cv_type_long_double" =3D x"yes"; then HAVE_LONG_DOUBLE_TRUE=3D HAVE_LONG_DOUBLE_FALSE=3D'#' else diff --git a/newlib/configure.ac b/newlib/configure.ac index b4d11f5e3..c54d2047a 100644 --- a/newlib/configure.ac +++ b/newlib/configure.ac @@ -687,39 +687,12 @@ if test $libc_cv_cc_loop_to_function =3D yes; then fi AC_SUBST(libc_cv_cc_loop_to_function) =20 -dnl Autoconf 2.59 doesn't support the AC_TYPE_LONG_DOUBLE macro. Instead o= f: -dnl AC_TYPE_LONG_DOUBLE -dnl AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" =3D= x"yes") -dnl we specify our own long double test. -dnl Additionally, ac_cv_objext is broken so that AC_COMPILE_IFELSE cannot = be -dnl used, so use AC_TRY_COMMAND instead. -AC_CACHE_CHECK(whether long double type exists, - acnewlib_cv_type_long_double, [dnl -cat > conftest.c < -#if defined(LDBL_MANT_DIG) - #define _HAVE_LONG_DOUBLE - #else - #error "LDBL !=3D DBL" -#endif -long double test() { -long double ld =3D 0.0L; -return ld; -} -EOF -if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c - 1>&AS_MESSAGE_LOG_FD]) -then - acnewlib_cv_type_long_double=3Dyes; -else - acnewlib_cv_type_long_double=3Dno; -fi -rm -f conftest*]) -if test $acnewlib_cv_type_long_double =3D yes; then +AC_TYPE_LONG_DOUBLE +dnl Export the setting for our installed headers to check. +if test $ac_cv_type_long_double =3D yes; then AC_DEFINE(_HAVE_LONG_DOUBLE, 1, [Define if the platform supports long do= uble type.]) fi -AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$acnewlib_cv_type_long_double" =3D= x"yes") +AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" =3D x"yes= ") =20 AC_CACHE_CHECK(whether long double equals double, newlib_cv_ldbl_eq_dbl, [dnl diff --git a/newlib/libc/configure b/newlib/libc/configure index 38eaf7a65..1afafab77 100755 --- a/newlib/libc/configure +++ b/newlib/libc/configure @@ -12229,33 +12229,49 @@ fi =20 =20 =20 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking long double sup= port" >&5 -$as_echo_n "checking Checking long double support... " >&6; } -if ${acnewlib_cv_type_long_double+:} false; then : + + { $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 - cat > conftest.c <conftest.$ac_ext +/* end confdefs.h. */ +/* The Stardent Vistra knows sizeof (long double), but does + not support it. */ + long double foo =3D 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) <=3D sizeof (long double))]; +test_array [0] =3D 0; +return test_array [0]; + + ; + return 0; } -EOF -if { ac_try=3D'${CC} $CFLAGS $CPPFLAGS -c conftest.c 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=3D$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? =3D $ac_status" >&5 - test $ac_status =3D 0; }; } -then - acnewlib_cv_type_long_double=3Dyes +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_type_long_double=3Dyes else - acnewlib_cv_type_long_double=3Dno + ac_cv_type_long_double=3Dno fi -rm -f conftest* +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acnewlib_cv_type_long_do= uble" >&5 -$as_echo "$acnewlib_cv_type_long_double" >&6; } - if test x"$acnewlib_cv_type_long_double" =3D x"yes"; then +{ $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 =3D yes; then + +$as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h + + fi + + if test x"$ac_cv_type_long_double" =3D x"yes"; then HAVE_LONG_DOUBLE_TRUE=3D HAVE_LONG_DOUBLE_FALSE=3D'#' else diff --git a/newlib/libc/configure.ac b/newlib/libc/configure.ac index 29a839623..c23282d08 100644 --- a/newlib/libc/configure.ac +++ b/newlib/libc/configure.ac @@ -184,25 +184,8 @@ fi AC_SUBST(LIBC_SYS_LIB) AC_SUBST(sys_dir) =20 -dnl Autoconf 2.59 doesn't support the AC_TYPE_LONG_DOUBLE macro. Instead o= f: -dnl AC_TYPE_LONG_DOUBLE -dnl AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" =3D= x"yes") -dnl we specify our own long double test. -AC_CACHE_CHECK([Checking long double support], [acnewlib_cv_type_long_doub= le],[dnl -cat > conftest.c <&AS_MESSAGE_LOG= _FD]) -then - acnewlib_cv_type_long_double=3Dyes -else - acnewlib_cv_type_long_double=3Dno -fi -rm -f conftest*]) -AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$acnewlib_cv_type_long_double" =3D= x"yes") +AC_TYPE_LONG_DOUBLE +AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" =3D x"yes= ") =20 dnl iconv library will be compiled if --enable-newlib-iconv option is enab= led AM_CONDITIONAL(ENABLE_NEWLIB_ICONV, test x${newlib_iconv} !=3D x) diff --git a/newlib/newlib.hin b/newlib/newlib.hin index 69a7cb7a7..feeb409bb 100644 --- a/newlib/newlib.hin +++ b/newlib/newlib.hin @@ -14,6 +14,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H =20 +/* Define to 1 if the system has the type `long double'. */ +#undef HAVE_LONG_DOUBLE + /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H