Re: [PATCH] powerpc: Fix -mlong-double-128 IBM format configure test for Clang

Sam James <[email protected]> Thu, 06 Aug 2026 23:11:10 +0100
Newsgroups gmane.comp.lib.glibc.alpha
Organization Gentoo
Message-ID <[email protected]>
Matt Turner <[email protected]> writes:

> The check for -mlong-double-128 IBM extended format support wrapped its
> test code in AC_LANG_PROGRAM, which places the body inside main().  The
> body defines a function, so it became a nested function definition -- a
> GCC extension that Clang does not implement, making the test fail with
> Clang.
>
> Use AC_LANG_SOURCE so the function is defined at file scope, and
> regenerate configure.

Reviewed-by: Sam James <[email protected]>

> ---
>  sysdeps/unix/sysv/linux/powerpc/configure    | 8 +-------
>  sysdeps/unix/sysv/linux/powerpc/configure.ac | 3 ++-
>  2 files changed, 3 insertions(+), 8 deletions(-)
>
> diff --git ./sysdeps/unix/sysv/linux/powerpc/configure ./sysdeps/unix/sysv/linux/powerpc/configure
> index ef2055db92..eb8578404f 100644
> --- ./sysdeps/unix/sysv/linux/powerpc/configure
> +++ ./sysdeps/unix/sysv/linux/powerpc/configure
> @@ -12,18 +12,12 @@ else case e in #(
>  CFLAGS="$CFLAGS -mlong-double-128"
>  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
>  /* end confdefs.h.  */
> -#include <float.h>
> -int
> -main (void)
> -{
>  
> +#include <float.h>
>  #if LDBL_MANT_DIG != 106
>  # error "compiler doesn't implement IBM extended format of long double"
>  #endif
>  long double foobar (long double x) { return x; }
> -  ;
> -  return 0;
> -}
>  _ACEOF
>  if ac_fn_c_try_compile "$LINENO"
>  then :
> diff --git ./sysdeps/unix/sysv/linux/powerpc/configure.ac ./sysdeps/unix/sysv/linux/powerpc/configure.ac
> index 42347a66fc..ca0f82da08 100644
> --- ./sysdeps/unix/sysv/linux/powerpc/configure.ac
> +++ ./sysdeps/unix/sysv/linux/powerpc/configure.ac
> @@ -6,7 +6,8 @@ AC_CACHE_CHECK(whether $CC $CFLAGS -mlong-double-128 uses IBM extended format,
>  	       libc_cv_mlong_double_128ibm, [dnl
>  save_CFLAGS="$CFLAGS"
>  CFLAGS="$CFLAGS -mlong-double-128"
> -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <float.h>]], [[
> +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
> +#include <float.h>
>  #if LDBL_MANT_DIG != 106
>  # error "compiler doesn't implement IBM extended format of long double"
>  #endif
signature.asc (application/pgp-signature, 418 B)
-----BEGIN PGP SIGNATURE-----

iQEBBAEWCgCpFiEEJaa7iN2bdkxrVUHCc4QJ9SDfkZAFAmp1Bn4bFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQyNUE2QkI4OEREOUI3NjRDNkI1NTQx
QzI3Mzg0MDlGNTIwREY5MTkwDxxzYW1AZ2VudG9vLm9yZwAKCRBzhAn1IN+RkEEb
AQDusYgeVcsNR/pcOjQIePI8JZSaCvSiVDJo/btHMl8LDgEA0fy8VI9c5UhupEJK
8zi1X7iLrzQXP9AIG77zrLVoPAc=
=Ag1W
-----END PGP SIGNATURE-----