From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.anongoth.pl (mail.anongoth.pl [46.248.190.61]) by sourceware.org (Postfix) with ESMTPS id BF1243858D3C; Thu, 14 Apr 2022 00:49:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BF1243858D3C Received: from anongoth.pl (unknown [192.168.1.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: pkubaj@anongoth.pl) by mail.anongoth.pl (Postfix) with ESMTPSA id 319F9196D01; Thu, 14 Apr 2022 02:49:50 +0200 (CEST) Date: Thu, 14 Apr 2022 02:49:49 +0200 From: Piotr Kubaj To: FX Cc: gcc-patches@gcc.gnu.org, Fortran List , segher@kernel.crashing.org Subject: Re: [PATCH] fortran: use fpu-glibc on powerpc*-unknown-freebsd Message-ID: References: <2E9BFB96-6979-4DB5-8029-1F89C30B242B@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7t8KWqPpqm+hC+Yh" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2022 00:49:59 -0000 --7t8KWqPpqm+hC+Yh Content-Type: multipart/mixed; boundary="kvRmNpaXxhxOK6R6" Content-Disposition: inline --kvRmNpaXxhxOK6R6 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, can you check the following patch? On 22-04-13 17:27:11, FX wrote: > Hi, >=20 > > the problem is that configure checks for feenableexcept() in libm: > > AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=3Dyes AC_DEFINE(= [HAVE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])]) > >=20 > > FreeBSD doesn't have this function in libm, it's implemented in /usr/in= clude/fenv.h. >=20 > I see. Then we probably can use AC_CHECK_FUNCS, or design a specific chec= k, so that it gives the right value on both glibc and FreeBSD targets. >=20 > Could you test something on your end? >=20 > FX --=20 --kvRmNpaXxhxOK6R6 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0001-powerpc-properly-detect-feenableexcept-on-FreeBSD.patch" Content-Transfer-Encoding: quoted-printable =46rom d5e255f09b4cfd2cb3688d0e2d5feba85d1f5dc8 Mon Sep 17 00:00:00 2001 =46rom: Piotr Kubaj Date: Thu, 14 Apr 2022 02:35:26 +0200 Subject: [PATCH] powerpc: properly detect feenableexcept on FreeBSD FreeBSD doesn't have feenableexcept in libm, but in fenv.h. Signed-off-by: Piotr Kubaj --- libgfortran/configure | 48 +++++++++++++++++++++++++++++++++++++++- libgfortran/configure.ac | 18 ++++++++++++++- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/libgfortran/configure b/libgfortran/configure index ae64dca3114..2f1011d7fdc 100755 --- a/libgfortran/configure +++ b/libgfortran/configure @@ -27338,8 +27338,52 @@ fi =20 =20 =20 +case x$target in + xpowerpc*-freebsd*) + # Check for the existence of functions. + for ac_header in fenv.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "fenv.h" "ac_cv_header_fenv_h" "$= ac_includes_default" +if test "x$ac_cv_header_fenv_h" =3D xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_FENV_H 1 +_ACEOF + ac_has_fenv_h=3Dyes +else + ac_has_fenv_h=3Dno +fi + +done + + if test x"$ac_has_fenv_h" =3D x"yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for feenableexcept= in " >&5 +$as_echo_n "checking for feenableexcept in ... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +int except, ret; + ret =3D feenableexcept(except); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + have_feenableexcept=3Dyes +$as_echo "#define HAVE_FEENABLEEXCEPT 1" >>confdefs.h + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_feenableexcep= t" >&5 +$as_echo "$have_feenableexcept" >&6; } + fi + ;; + *) # Check for GNU libc feenableexcept -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for feenableexcept in -l= m" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for feenableexcept i= n -lm" >&5 $as_echo_n "checking for feenableexcept in -lm... " >&6; } if ${ac_cv_lib_m_feenableexcept+:} false; then : $as_echo_n "(cached) " >&6 @@ -27384,6 +27428,8 @@ $as_echo "#define HAVE_FEENABLEEXCEPT 1" >>confdefs= =2Eh =20 fi =20 + ;; +esac =20 # At least for glibc, clock_gettime is in librt. But don't # pull that in if it still doesn't give us the function we want. This diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac index 97cc490cb5e..7c285aaf79c 100644 --- a/libgfortran/configure.ac +++ b/libgfortran/configure.ac @@ -602,8 +602,24 @@ fi # Check whether we have a __float128 type, depends on enable_libquadmath_s= upport LIBGFOR_CHECK_FLOAT128 =20 +case x$target in + xpowerpc*-freebsd*) + # Check for the existence of functions. + AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=3Dyes, ac_has_fenv_h=3Dno) + if test x"$ac_has_fenv_h" =3D x"yes"; then + AC_MSG_CHECKING([for feenableexcept in ]) + AC_TRY_COMPILE([#include ], + [int except, ret; + ret =3D feenableexcept(except); + ],[have_feenableexcept=3Dyes AC_DEFINE([HAVE_FEENABLE= EXCEPT],[1],[fenv.h includes feenableexcept])]) + AC_MSG_RESULT($have_feenableexcept) + fi + ;; + *) # Check for GNU libc feenableexcept -AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=3Dyes AC_DEFINE([HA= VE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])]) + AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=3Dyes AC_DEFINE= ([HAVE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])]) + ;; +esac =20 # At least for glibc, clock_gettime is in librt. But don't # pull that in if it still doesn't give us the function we want. This --=20 2.35.1 --kvRmNpaXxhxOK6R6-- --7t8KWqPpqm+hC+Yh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEycyIeNkkgohzsoorelmbhSCDnJ0FAmJXb60ACgkQelmbhSCD nJ3FRQ/+K8dlBoBlOIvGw3KMvtVxGutRkUwIUTZq+ZbOtvx0098XDBlIXLOJtZiZ iBdxExJBiEVTu+0bczfCrr4T/uwv6vhdZw82Czvo/yZ0vwAnqH0svXltqEaEwqJt njZQ+g5kpqvbA9upjhvJQZT+BGEUZPzi8MgJ9zS06TY3WtvdMXK5falVYfAt1mb+ N0wanbvUb7iC9U+KPBCJDqNQlDsJ7YgsKeT3G/4nKLK9weFfxouFHyi7j1MqHVyc fGJOR2GKv9DkwnAtDydoRszGoj/VvXevuSdOGL3VyFXbGksvF0GwDlaf3ukvP4Li YB1/c1v9Me6SpZukpTElcUzViA4t0nPqxX7kx1w1xprflqT6peeHV/BoswSD8KYd ufjpKPOhCJXGdT09kdKqlTUBnoWWgZ23GzHSzUVe9WvvLkgDT2M2H+BjFeNw9D1P Tv3UHaqrBze9huqBwKE54t4XqrIGTgu8g/mw3FZMbODuS5HZr2vBiVbMjmT+BIKO YJz2+AWxkR4F4d5/aaG62qLG4WJse4YOsRVTqIQSeYFiG+C7u8uTaFZocYQ/YSnQ MHG7LE02Q6iL11t/yHfJ8DmxC89mWvtMFuvdDCxjgBVjGFaqOwahsmc1wHergafG OgYv3t7hkWC51NL/LmBOm8ybmE8kLOTZ1OnzgUP8HgOG1cxpYrU= =STxn -----END PGP SIGNATURE----- --7t8KWqPpqm+hC+Yh--