diff mbox series

configure.ac: fix bashism in configure.ac

Message ID 20220321230343.2582331-1-sam@gentoo.org
State New
Headers show
Series configure.ac: fix bashism in configure.ac | expand

Commit Message

Sam James March 21, 2022, 11:03 p.m. UTC
configure scripts need to be runnable with a POSIX-compliant /bin/sh.

On many (but not all!) systems, /bin/sh is provided by Bash, so errors
like this aren't spotted. Notably Debian defaults to /bin/sh provided
by dash which doesn't tolerate such bashisms as '=='.

This retains compatibility with bash.

Fixes configure warnings/errors like:
```
checking if compiler warns about alias for function with incompatible types... yes
/var/tmp/portage/sys-libs/glibc-2.34-r10/work/glibc-2.34/configure: 4209: test: xyes: unexpected operator
```

Signed-off-by: Sam James <sam@gentoo.org>
---
 configure    | 2 +-
 configure.ac | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Adhemerval Zanella Netto March 22, 2022, 12:46 p.m. UTC | #1
On 21/03/2022 20:03, Sam James via Libc-alpha wrote:
> configure scripts need to be runnable with a POSIX-compliant /bin/sh.
> 
> On many (but not all!) systems, /bin/sh is provided by Bash, so errors
> like this aren't spotted. Notably Debian defaults to /bin/sh provided
> by dash which doesn't tolerate such bashisms as '=='.
> 
> This retains compatibility with bash.
> 
> Fixes configure warnings/errors like:
> ```
> checking if compiler warns about alias for function with incompatible types... yes
> /var/tmp/portage/sys-libs/glibc-2.34-r10/work/glibc-2.34/configure: 4209: test: xyes: unexpected operator
> ```
> 
> Signed-off-by: Sam James <sam@gentoo.org>

There are other occurrences of this bashism as on other configure.ac:

sysdeps/powerpc/powerpc64/le/configure.ac:66:AS_IF([test "$libc_cv_compiler_powerpc64le_ldbl128_mabi" == "no"],
sysdeps/powerpc/powerpc64/le/fpu/multiarch/configure.ac:12:AS_IF([[test "$libc_cv_mcpu_power10" == "yes"]],[

Should we fix it them as well?

Beside LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>


> ---
>  configure    | 2 +-
>  configure.ac | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/configure b/configure
> index 8e5bee775a..2a3cb49b0b 100755
> --- a/configure
> +++ b/configure
> @@ -4232,7 +4232,7 @@ if test x"$libc_cv_gcc_indirect_function" != xyes; then
>    # GCC 8+ emits a warning for alias with incompatible types and it might
>    # fail to build ifunc resolvers aliases to either weak or internal
>    # symbols.  Disables multiarch build in this case.
> -  if test x"$libc_cv_gcc_incompatible_alias" == xyes; then
> +  if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
>      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gcc emits a warning for alias between functions of incompatible types" >&5
>  $as_echo "$as_me: WARNING: gcc emits a warning for alias between functions of incompatible types" >&2;}
>      if test x"$multi_arch" = xyes; then
> diff --git a/configure.ac b/configure.ac
> index 87f67d25ec..fa7d3c025b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -767,7 +767,7 @@ if test x"$libc_cv_gcc_indirect_function" != xyes; then
>    # GCC 8+ emits a warning for alias with incompatible types and it might
>    # fail to build ifunc resolvers aliases to either weak or internal
>    # symbols.  Disables multiarch build in this case.
> -  if test x"$libc_cv_gcc_incompatible_alias" == xyes; then
> +  if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
>      AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
>      if test x"$multi_arch" = xyes; then
>        AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
Sam James March 22, 2022, 5:15 p.m. UTC | #2
> On 22 Mar 2022, at 12:46, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> 
> 
> 
> On 21/03/2022 20:03, Sam James via Libc-alpha wrote:
>> configure scripts need to be runnable with a POSIX-compliant /bin/sh.
>> 
>> On many (but not all!) systems, /bin/sh is provided by Bash, so errors
>> like this aren't spotted. Notably Debian defaults to /bin/sh provided
>> by dash which doesn't tolerate such bashisms as '=='.
>> 
>> This retains compatibility with bash.
>> 
>> Fixes configure warnings/errors like:
>> ```
>> checking if compiler warns about alias for function with incompatible types... yes
>> /var/tmp/portage/sys-libs/glibc-2.34-r10/work/glibc-2.34/configure: 4209: test: xyes: unexpected operator
>> ```
>> 
>> Signed-off-by: Sam James <sam@gentoo.org>
> 
> There are other occurrences of this bashism as on other configure.ac:
> 
> sysdeps/powerpc/powerpc64/le/configure.ac:66:AS_IF([test "$libc_cv_compiler_powerpc64le_ldbl128_mabi" == "no"],
> sysdeps/powerpc/powerpc64/le/fpu/multiarch/configure.ac:12:AS_IF([[test "$libc_cv_mcpu_power10" == "yes"]],[
> 
> Should we fix it them as well?
> 

Thanks, I goofed up the grep. Fixed!

> Beside LGTM, thanks.
> 
> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

I forgot to add your tag on sending v2, but I didn't want to send a v3 for it (unless I should?)

Best,
sam
diff mbox series

Patch

diff --git a/configure b/configure
index 8e5bee775a..2a3cb49b0b 100755
--- a/configure
+++ b/configure
@@ -4232,7 +4232,7 @@  if test x"$libc_cv_gcc_indirect_function" != xyes; then
   # GCC 8+ emits a warning for alias with incompatible types and it might
   # fail to build ifunc resolvers aliases to either weak or internal
   # symbols.  Disables multiarch build in this case.
-  if test x"$libc_cv_gcc_incompatible_alias" == xyes; then
+  if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gcc emits a warning for alias between functions of incompatible types" >&5
 $as_echo "$as_me: WARNING: gcc emits a warning for alias between functions of incompatible types" >&2;}
     if test x"$multi_arch" = xyes; then
diff --git a/configure.ac b/configure.ac
index 87f67d25ec..fa7d3c025b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -767,7 +767,7 @@  if test x"$libc_cv_gcc_indirect_function" != xyes; then
   # GCC 8+ emits a warning for alias with incompatible types and it might
   # fail to build ifunc resolvers aliases to either weak or internal
   # symbols.  Disables multiarch build in this case.
-  if test x"$libc_cv_gcc_incompatible_alias" == xyes; then
+  if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
     AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
     if test x"$multi_arch" = xyes; then
       AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])