ldbl-opt: Fix -mlong-double-128 configure test for Clang
Checks
| Context |
Check |
Description |
| redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
| redhat-pt-bot/TryBot-32bit |
success
|
Build for i686
|
| linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Test passed
|
Commit Message
The check for -mlong-double-128 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 (and thus the whole
build error out) with Clang even though it supports -mlong-double-128.
Use AC_LANG_SOURCE so the function is defined at file scope, matching the
pattern already used by the powerpc64le compiler checks, and regenerate
configure.
---
sysdeps/ieee754/ldbl-opt/configure | 7 -------
sysdeps/ieee754/ldbl-opt/configure.ac | 2 +-
2 files changed, 1 insertion(+), 8 deletions(-)
mode change 100644 => 100755 sysdeps/ieee754/ldbl-opt/configure
Comments
Matt Turner <mattst88@gmail.com> writes:
> The check for -mlong-double-128 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 (and thus the whole
> build error out) with Clang even though it supports -mlong-double-128.
Good catch!
>
> Use AC_LANG_SOURCE so the function is defined at file scope, matching the
> pattern already used by the powerpc64le compiler checks, and regenerate
> configure.
Looks like sysdeps/unix/sysv/linux/powerpc/configure.ac has the same
problem.
> ---
> sysdeps/ieee754/ldbl-opt/configure | 7 -------
> sysdeps/ieee754/ldbl-opt/configure.ac | 2 +-
> 2 files changed, 1 insertion(+), 8 deletions(-)
> mode change 100644 => 100755 sysdeps/ieee754/ldbl-opt/configure
>
> diff --git ./sysdeps/ieee754/ldbl-opt/configure ./sysdeps/ieee754/ldbl-opt/configure
> old mode 100644
> new mode 100755
> index bc6552da0b..7769cc9781
> --- ./sysdeps/ieee754/ldbl-opt/configure
> +++ ./sysdeps/ieee754/ldbl-opt/configure
> @@ -13,17 +13,10 @@ CFLAGS="$CFLAGS -mlong-double-128"
> cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> /* end confdefs.h. */
>
> -int
> -main (void)
> -{
> -
> #ifndef __LONG_DOUBLE_128__
> # error "compiler did not predefine __LONG_DOUBLE_128__ as expected"
> #endif
> long double foobar (long double x) { return x; }
> - ;
> - return 0;
> -}
> _ACEOF
> if ac_fn_c_try_compile "$LINENO"
> then :
> diff --git ./sysdeps/ieee754/ldbl-opt/configure.ac ./sysdeps/ieee754/ldbl-opt/configure.ac
> index 70e3b32dc6..1c500ad581 100644
> --- ./sysdeps/ieee754/ldbl-opt/configure.ac
> +++ ./sysdeps/ieee754/ldbl-opt/configure.ac
> @@ -6,7 +6,7 @@ AC_CACHE_CHECK(whether $CC $CFLAGS supports -mlong-double-128,
> libc_cv_mlong_double_128, [dnl
> save_CFLAGS="$CFLAGS"
> CFLAGS="$CFLAGS -mlong-double-128"
> -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
> +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
> #ifndef __LONG_DOUBLE_128__
> # error "compiler did not predefine __LONG_DOUBLE_128__ as expected"
> #endif
On Sun, Jul 26, 2026 at 10:11 AM Sam James <sam@gentoo.org> wrote:
>
> Matt Turner <mattst88@gmail.com> writes:
>
> > The check for -mlong-double-128 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 (and thus the whole
> > build error out) with Clang even though it supports -mlong-double-128.
>
> Good catch!
>
> >
> > Use AC_LANG_SOURCE so the function is defined at file scope, matching the
> > pattern already used by the powerpc64le compiler checks, and regenerate
> > configure.
>
> Looks like sysdeps/unix/sysv/linux/powerpc/configure.ac has the same
> problem.
I've sent another patch for that:
Subject: [PATCH] powerpc: Fix -mlong-double-128 IBM format configure
test for Clang
Matt Turner <mattst88@gmail.com> writes:
> The check for -mlong-double-128 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 (and thus the whole
> build error out) with Clang even though it supports -mlong-double-128.
>
> Use AC_LANG_SOURCE so the function is defined at file scope, matching the
> pattern already used by the powerpc64le compiler checks, and regenerate
> configure.
Reviewed-by: Sam James <sam@gentoo.org>
> ---
> sysdeps/ieee754/ldbl-opt/configure | 7 -------
> sysdeps/ieee754/ldbl-opt/configure.ac | 2 +-
> 2 files changed, 1 insertion(+), 8 deletions(-)
> mode change 100644 => 100755 sysdeps/ieee754/ldbl-opt/configure
>
> diff --git ./sysdeps/ieee754/ldbl-opt/configure ./sysdeps/ieee754/ldbl-opt/configure
> old mode 100644
> new mode 100755
> index bc6552da0b..7769cc9781
> --- ./sysdeps/ieee754/ldbl-opt/configure
> +++ ./sysdeps/ieee754/ldbl-opt/configure
> @@ -13,17 +13,10 @@ CFLAGS="$CFLAGS -mlong-double-128"
> cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> /* end confdefs.h. */
>
> -int
> -main (void)
> -{
> -
> #ifndef __LONG_DOUBLE_128__
> # error "compiler did not predefine __LONG_DOUBLE_128__ as expected"
> #endif
> long double foobar (long double x) { return x; }
> - ;
> - return 0;
> -}
> _ACEOF
> if ac_fn_c_try_compile "$LINENO"
> then :
> diff --git ./sysdeps/ieee754/ldbl-opt/configure.ac ./sysdeps/ieee754/ldbl-opt/configure.ac
> index 70e3b32dc6..1c500ad581 100644
> --- ./sysdeps/ieee754/ldbl-opt/configure.ac
> +++ ./sysdeps/ieee754/ldbl-opt/configure.ac
> @@ -6,7 +6,7 @@ AC_CACHE_CHECK(whether $CC $CFLAGS supports -mlong-double-128,
> libc_cv_mlong_double_128, [dnl
> save_CFLAGS="$CFLAGS"
> CFLAGS="$CFLAGS -mlong-double-128"
> -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
> +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
> #ifndef __LONG_DOUBLE_128__
> # error "compiler did not predefine __LONG_DOUBLE_128__ as expected"
> #endif
old mode 100644
new mode 100755
@@ -13,17 +13,10 @@ CFLAGS="$CFLAGS -mlong-double-128"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-int
-main (void)
-{
-
#ifndef __LONG_DOUBLE_128__
# error "compiler did not predefine __LONG_DOUBLE_128__ as expected"
#endif
long double foobar (long double x) { return x; }
- ;
- return 0;
-}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
@@ -6,7 +6,7 @@ AC_CACHE_CHECK(whether $CC $CFLAGS supports -mlong-double-128,
libc_cv_mlong_double_128, [dnl
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mlong-double-128"
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#ifndef __LONG_DOUBLE_128__
# error "compiler did not predefine __LONG_DOUBLE_128__ as expected"
#endif