Patchwork bash vs. dash: Avoid unportable shell feature in gcc/configure.ac

login
register
mail settings
Submitter Thomas Schwinge
Date July 13, 2011, 5:17 p.m.
Message ID <87fwma5cds.fsf@kepler.schwinge.homeip.net>
Download mbox | patch
Permalink /patch/104568/
State Accepted, archived
Headers show

Comments

Thomas Schwinge - July 13, 2011, 5:17 p.m.
Hallo!

On Wed, 13 Jul 2011 18:23:50 +0200, Paolo Bonzini <bonzini@gnu.org> wrote:
> On 07/13/2011 06:13 PM, Thomas Schwinge wrote:
> > Alternatively, gcc_GAS_CHECK_FEATURE could be changed to emit the
> > temporary file by using a shell here-doc, which is what AC_TRY_COMPILE is
> > doing, for example.
> 
> Change instead echo ifelse(...) > conftest.s to
> 
>    AS_ECHO([m4_if(...)]) > conftest.s
> 
> in gcc_GAS_CHECK_FEATURE.

Ah, even better.

	gcc/
	* acinclude.m4 (gcc_GAS_CHECK_FEATURE): Use AS_ECHO instead of echo.
	* configure: Regenerate.


The configure differences are strictly s%echo%$as_echo%.


Grüße,
 Thomas
Paolo Bonzini - July 13, 2011, 6:41 p.m.
Ok.

Paolo

On Wed, Jul 13, 2011 at 19:17, Thomas Schwinge <thomas@schwinge.name> wrote:
> Hallo!
>
> On Wed, 13 Jul 2011 18:23:50 +0200, Paolo Bonzini <bonzini@gnu.org> wrote:
>> On 07/13/2011 06:13 PM, Thomas Schwinge wrote:
>> > Alternatively, gcc_GAS_CHECK_FEATURE could be changed to emit the
>> > temporary file by using a shell here-doc, which is what AC_TRY_COMPILE is
>> > doing, for example.
>>
>> Change instead echo ifelse(...) > conftest.s to
>>
>>    AS_ECHO([m4_if(...)]) > conftest.s
>>
>> in gcc_GAS_CHECK_FEATURE.
>
> Ah, even better.
>
>        gcc/
>        * acinclude.m4 (gcc_GAS_CHECK_FEATURE): Use AS_ECHO instead of echo.
>        * configure: Regenerate.
>
> diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
> index ff38682..f092925 100644
> --- a/gcc/acinclude.m4
> +++ b/gcc/acinclude.m4
> @@ -583,7 +583,7 @@ AC_CACHE_CHECK([assembler for $1], [$2],
>   if test $in_tree_gas = yes; then
>     gcc_GAS_VERSION_GTE_IFELSE($3, [[$2]=yes])
>   el])if test x$gcc_cv_as != x; then
> -    echo ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]') > conftest.s
> +    AS_ECHO([ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]')]) > conftest.s
>     if AC_TRY_COMMAND([$gcc_cv_as $gcc_cv_as_flags $4 -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD])
>     then
>        ifelse([$6],, [$2]=yes, [$6])
>
> The configure differences are strictly s%echo%$as_echo%.
>
>
> Grüße,
>  Thomas
>

Patch

diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
index ff38682..f092925 100644
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -583,7 +583,7 @@  AC_CACHE_CHECK([assembler for $1], [$2],
   if test $in_tree_gas = yes; then
     gcc_GAS_VERSION_GTE_IFELSE($3, [[$2]=yes])
   el])if test x$gcc_cv_as != x; then
-    echo ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]') > conftest.s
+    AS_ECHO([ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]')]) > conftest.s
     if AC_TRY_COMMAND([$gcc_cv_as $gcc_cv_as_flags $4 -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD])
     then
 	ifelse([$6],, [$2]=yes, [$6])