[PATCH] x86/configure: Improve portability of isa level check

Arjun Shankar arjun@redhat.com
Mon Aug 25 13:37:54 GMT 2025


Hi Henrik,

> wc -l pads the output with leading spaces on some systems, e.g. FreeBSD.
> This results in the check `test "$count" = 1` failing. Use -eq for integer
> comparison instead.
>
> Signed-off-by: Henrik Lindström <henrik@lxm.se>

This looks good to me.

Reviewed-by: Arjun Shankar <arjun@redhat.com>

> ---
>  sysdeps/x86/configure    | 2 +-
>  sysdeps/x86/configure.ac | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
> index c7ea9ac6ad..e31cd85f73 100644
> --- a/sysdeps/x86/configure
> +++ b/sysdeps/x86/configure
> @@ -66,7 +66,7 @@ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -nostartfiles -nostdlib -r -o conftest c
>    printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
>    test $ac_status = 0; }; }; then
>    count=`LC_ALL=C $READELF -n conftest | grep NT_GNU_PROPERTY_TYPE_0 | wc -l`
> -  if test "$count" = 1; then
> +  if test "$count" -eq 1; then

OK. Replace a string comparison with an integer comparison.

>      libc_cv_include_x86_isa_level=yes
>    fi
>  fi
> diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
> index 031f91719d..0391c81756 100644
> --- a/sysdeps/x86/configure.ac
> +++ b/sysdeps/x86/configure.ac
> @@ -57,7 +57,7 @@ EOF
>  libc_cv_include_x86_isa_level=no
>  if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -nostartfiles -nostdlib -r -o conftest conftest1.S conftest2.S); then
>    count=`LC_ALL=C $READELF -n conftest | grep NT_GNU_PROPERTY_TYPE_0 | wc -l`
> -  if test "$count" = 1; then
> +  if test "$count" -eq 1; then

OK. The configure change is generated from this one.

>      libc_cv_include_x86_isa_level=yes
>    fi
>  fi
> --
> 2.39.5
>


-- 
Arjun Shankar
he/him/his



More information about the Libc-alpha mailing list