From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 10AA73954469; Thu, 12 May 2022 20:18:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 10AA73954469 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 24CKGcjb030522; Thu, 12 May 2022 15:16:38 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 24CKGbap030521; Thu, 12 May 2022 15:16:37 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 12 May 2022 15:16:37 -0500 From: Segher Boessenkool To: pkubaj@FreeBSD.org Cc: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Subject: Re: [PATCH V2] powerpc: properly check for feenableexcept() on FreeBSD Message-ID: <20220512201637.GR25951@gate.crashing.org> References: <20220503102111.10406-1-pkubaj@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220503102111.10406-1-pkubaj@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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, 12 May 2022 20:18:50 -0000 Hi Piotr, On Tue, May 03, 2022 at 12:21:12PM +0200, pkubaj@FreeBSD.org wrote: > FreeBSD/powerpc* has feenableexcept() defined in fenv.h header. Declared, not defined. These are required to be real functions (on all platforms that have these functions), not macros or inlines or whatever. So what library *does* have these functions? It would be much neater to do the similar to the libm test but with that other library. Just libc, maybe? The answer to this will probably also answer Ke Wen's questions, or at least just point to a good and more general way of solving this :-) Maybe the AC_CHECK_LIB could just use GCC_CHECK_MATH_FUNC or such? You also need a changelog entry here. Something like 2022-05-12 Piotr Kubaj libgfortran/ * configure.ac (powerpc*-freebsd*): Define HAVE_FEENABLEEXCEPT if declares the feenableexcept function. * configure: Regenerate. > +case x$target in > + xpowerpc*-freebsd*) > + AC_CACHE_CHECK([for fenv.h and feenableexcept], have_feenableexcept, [ > + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( > + [[ #include ]], > + [[ feenableexcept(FE_DIVBYZERO | FE_INVALID); ]])], > + [ have_feenableexcept="yes" ], > + [ have_feenableexcept="no" ])]) Please get rid of all surplus whitespace here. Imitate existing tests, if you need inspiration :-) Segher