AS_ECHO calls finding their way into calls

View: New views
4 Messages — Rating Filter:   Alert me  

AS_ECHO calls finding their way into calls

by BJ Terry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I'm relatively new to autoconf, and I'm having trouble getting the  
configure file to generate properly on another person's computer. It  
appears that when he uses the AC_ERLANG_CHECK_LIB macro, the configure  
file that's generated has an AC_ECHO still embedded in one of the  
strings to be called. To recreate the problem, we made a skeleton  
configure.ac containing only:

AC_INIT

AC_ERLANG_CHECK_LIB(erl_interface)


When my friend runs autoconf on the file, the relevant section (at  
least, I think this is where the problem lies) reads:

{ $as_echo "$as_me:$LINENO: checking for Erlang/OTP 'erl_interface'  
library subdirectory" >&5
$as_echo_n "checking for Erlang/OTP 'erl_interface' library  
subdirectory... " >&6; }
if test "${erlang_cv_lib_dir_erl_interface+set}" = set; then
   $as_echo_n "(cached) " >&6
else
   ac_ext=erl
ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5'
ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 ; echo "#!/bin/
sh" > conftest$ac_exeext ; AS_ECHO(["\"$ERL\" -run conftest start -run  
init stop -noshell"]) >> conftest$ac_exeext ; chmod +x conftest
$ac_exeext'
      if test "$cross_compiling" = yes; then
   { { $as_echo "$as_me:$LINENO: error: cannot run test program while  
cross compiling
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot run test program while cross compiling
See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
else

And when I run it, it reads:

{ echo "$as_me:$LINENO: checking for Erlang/OTP 'erl_interface'  
library subdirectory" >&5
echo $ECHO_N "checking for Erlang/OTP 'erl_interface' library  
subdirectory... $ECHO_C" >&6; }
if test "${erlang_cv_lib_dir_erl_interface+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
else
   ac_ext=erl
ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5'
ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 ; echo "#!/bin/
sh" > conftest$ac_exeext ; echo "\"$ERL\" -run conftest start -run  
init stop -noshell" >> conftest$ac_exeext ; chmod +x conftest$ac_exeext'
      if test "$cross_compiling" = yes; then
   { { echo "$as_me:$LINENO: error: cannot run test program while  
cross compiling
See \`config.log' for more details." >&5
echo "$as_me: error: cannot run test program while cross compiling
See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
else

Now, I did note that his has $as_echo wherever mine had just echo, and  
I don't know why that is, and don't know why google couldn't provide  
any useful links on the matter. The real problem appears to be that  
his "ac_link" variable has AS_ECHO in it instead of echo, which seems  
like it would cause problems to me. This is where he gets an error  
when running ./configure:

./configure: eval: line 1: syntax error near unexpected token `["\"$ERL
\" -run conftest start -run init stop -noshell"]'
./configure: eval: line 1: `$ERLC $ERLCFLAGS -b beam conftest.$ac_ext  
 >&5 ; echo "#!/bin/sh" > conftest$ac_exeext ; AS_ECHO(["\"$ERL\" -run  
conftest start -run init stop -noshell"]) >> conftest$ac_exeext ;  
chmod +x conftest$ac_exeext'


For the record, I am using autoconf 2.60 and M4 version 1.4.5, and he  
is using autoconf 2.62 and M4 version 1.4.11. My platform is Mac OS X  
10.5 running fink versions of these tools and he is using Mac OS X  
10.4 running the darwinports version, if that makes any difference.

Do any of you know what might be happening here, and what my next  
troubleshooting steps should be?

Thanks.


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Re: AS_ECHO calls finding their way into calls

by Eric Blake :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to BJ Terry on 9/15/2008 12:28 AM:
>
> AC_INIT
>
> AC_ERLANG_CHECK_LIB(erl_interface)

I'm not as familiar with Erlang, so it very well could be that you've
discovered a bug in autoconf.

>
> Now, I did note that his has $as_echo wherever mine had just echo, and I
> don't know why that is, and don't know why google couldn't provide any
> useful links on the matter.

Because the use of 'echo' is not always portable, so newer autoconf
guarantees a safe fallback (such as printf) in case it has detected that
your shell's echo does not fit autoconf's needs.

> The real problem appears to be that his
> "ac_link" variable has AS_ECHO in it instead of echo, which seems like
> it would cause problems to me.
>
> For the record, I am using autoconf 2.60 and M4 version 1.4.5, and he is
> using autoconf 2.62 and M4 version 1.4.11. My platform is Mac OS X 10.5
> running fink versions of these tools and he is using Mac OS X 10.4
> running the darwinports version, if that makes any difference.

It looks like you are reporting a regression that occurred sometime
between 2.60 and 2.62.  Could you please check whether 2.63 also has the
bug, so we can fix it?

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjORF4ACgkQ84KuGfSFAYCsfgCgsyKxi1ACHnSfN0iLYJhTZm7S
gvUAnj96rSbrFWWeFe923PqukR2sFiie
=oxP8
-----END PGP SIGNATURE-----


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Re: AS_ECHO calls finding their way into calls

by BJ Terry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eric,

It appears that you are right, and thanks for your help. When I  
upgraded to 2.63 on my machine it now exhibits the same problem.  
Digging around through all of the m4 files it looks like the offending  
function is

In 2.63 (erlang.m4):

# AC_LANG(Erlang)
# ---------------
m4_define([AC_LANG(Erlang)],
[ac_ext=erl
ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext  
 >&AS_MESSAGE_LOG_FD'
ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext  
 >&AS_MESSAGE_LOG_FD ; echo "#!/bin/sh" > conftest$ac_exeext ;  
AS_ECHO(["\"$ERL\" -run conftest start -run init stop -noshell"]) >>  
conftest$ac_exeext ; chmod +x conftest$ac_exeext'
])

In 2.60 (erlang.m4):

# AC_LANG(Erlang)
# ---------------
m4_define([AC_LANG(Erlang)],
[ac_ext=erl
ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext  
 >&AS_MESSAGE_LOG_FD'
ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext  
 >&AS_MESSAGE_LOG_FD ; echo "#!/bin/sh" > conftest$ac_exeext ; echo  
"\"$ERL\" -run conftest start -run init stop -noshell" >> conftest
$ac_exeext ; chmod +x conftest$ac_exeext'
])

I guess to fix this you would change it to read

# AC_LANG(Erlang)
# ---------------
m4_define([AC_LANG(Erlang)],
[ac_ext=erl
ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext  
 >&AS_MESSAGE_LOG_FD'
ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext  
 >&AS_MESSAGE_LOG_FD ; echo "#!/bin/sh" > conftest$ac_exeext ;  
$as_echo $ERL -run conftest start -run init stop -noshell >> conftest
$ac_exeext ; chmod +x conftest$ac_exeext'
])

But why is there another echo statement in there? Do they each do  
something different?


On Sep 15, 2008, at 4:17 AM, Eric Blake wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> According to BJ Terry on 9/15/2008 12:28 AM:
>>
>> AC_INIT
>>
>> AC_ERLANG_CHECK_LIB(erl_interface)
>
> I'm not as familiar with Erlang, so it very well could be that you've
> discovered a bug in autoconf.
>
>>
>> Now, I did note that his has $as_echo wherever mine had just echo,  
>> and I
>> don't know why that is, and don't know why google couldn't provide  
>> any
>> useful links on the matter.
>
> Because the use of 'echo' is not always portable, so newer autoconf
> guarantees a safe fallback (such as printf) in case it has detected  
> that
> your shell's echo does not fit autoconf's needs.
>
>> The real problem appears to be that his
>> "ac_link" variable has AS_ECHO in it instead of echo, which seems  
>> like
>> it would cause problems to me.
>>
>> For the record, I am using autoconf 2.60 and M4 version 1.4.5, and  
>> he is
>> using autoconf 2.62 and M4 version 1.4.11. My platform is Mac OS X  
>> 10.5
>> running fink versions of these tools and he is using Mac OS X 10.4
>> running the darwinports version, if that makes any difference.
>
> It looks like you are reporting a regression that occurred sometime
> between 2.60 and 2.62.  Could you please check whether 2.63 also has  
> the
> bug, so we can fix it?
>
> - --
> Don't work too hard, make some time for fun as well!
>
> Eric Blake             ebb9@...
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (Cygwin)
> Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkjORF4ACgkQ84KuGfSFAYCsfgCgsyKxi1ACHnSfN0iLYJhTZm7S
> gvUAnj96rSbrFWWeFe923PqukR2sFiie
> =oxP8
> -----END PGP SIGNATURE-----



_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Re: AS_ECHO calls finding their way into calls

by Eric Blake :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to BJ Terry on 9/15/2008 11:36 PM:
> Eric,
>
> It appears that you are right, and thanks for your help. When I upgraded
> to 2.63 on my machine it now exhibits the same problem.

Thanks for the investigation.  And sadly, this means that both 2.62 and
2.63 are completely unusable with Erlang (maybe this warrants a 2.64
release soon?)

>
> I guess to fix this you would change it to read
>
> # AC_LANG(Erlang)
> # ---------------
> m4_define([AC_LANG(Erlang)],
> [ac_ext=erl
> ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
> ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&AS_MESSAGE_LOG_FD ;
> echo "#!/bin/sh" > conftest$ac_exeext ; $as_echo $ERL -run conftest
> start -run init stop -noshell >> conftest$ac_exeext ; chmod +x
> conftest$ac_exeext'
> ])
>
> But why is there another echo statement in there? Do they each do
> something different?
Yes.  'echo "#!/bin/sh"' is safe (# cannot be confused with an option, and
the entire string contains no \).  'echo $ERL' is NOT safe ($ERL might
begin with a -, and be confused with an option, or might contain \, which
is not portable).  Hence the use of AS_ECHO, which guarantees the output
of an echo statement that will do the right thing.  The problem is that
AS_ECHO was overquoted (and the testsuite does not adequately test Erlang,
or this would have been caught more than a year ago).

Your proposed patch is insufficient (AS_ECHO does other things, such as
ensure that $as_echo is defined prior to this point in the script).  But
it is along the right lines; the AS_ECHO must be expanded (the bug was
that the # was underquoted, thus the AS_ECHO was intepreted as part of an
m4 comment; worse yet, this meant that the normal m4_pattern_forbid that
is supposed to catch unexpanded macros did not see it, because it does not
look in comments).  I'm committing this:

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjPqVYACgkQ84KuGfSFAYAtFgCeKYfS2DlDybUPC4lvejKpCRxl
cuMAoJ7BLRGu68GYthQFk6rlhtDy7HHk
=Yj9Y
-----END PGP SIGNATURE-----

From c0215a0bb65ba266a1192b2cf32b64cfa4ef0275 Mon Sep 17 00:00:00 2001
From: Eric Blake <ebb9@...>
Date: Tue, 16 Sep 2008 06:37:51 -0600
Subject: [PATCH] Fix Erlang regression, introduced 2006-11-17.

* lib/autoconf/erlang.m4 (AC_LANG(Erlang)): Avoid overquoting.
* NEWS: Mention this fix.
* THANKS: Update.
Reported by BJ Terry.

Signed-off-by: Eric Blake <ebb9@...>
---
 ChangeLog              |    8 ++++++++
 NEWS                   |    5 +++++
 THANKS                 |    1 +
 lib/autoconf/erlang.m4 |    4 ++--
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f01284d..448ae92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-09-16  Eric Blake  <ebb9@...>
+
+ Fix Erlang regression, introduced 2006-11-17.
+ * lib/autoconf/erlang.m4 (AC_LANG(Erlang)): Avoid overquoting.
+ * NEWS: Mention this fix.
+ * THANKS: Update.
+ Reported by BJ Terry.
+
 2008-09-13  Ralf Wildenhues  <Ralf.Wildenhues@...>
 
  * lib/autoconf/general.m4 (AC_CONFIG_AUX_DIRS): Improve a bit.
diff --git a/NEWS b/NEWS
index 4c997ad..0b027a1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,10 @@
 GNU Autoconf NEWS - User visible changes.
 
+* Major changes in Autoconf 2.64 (????-??-??) [stable]
+  Released by Eric Blake, based on git versions 2.63.*.
+
+** AC_LANG_ERLANG works once again (regression introduced in 2.61a).
+
 * Major changes in Autoconf 2.63 (2008-09-09) [stable]
   Released by Eric Blake, based on git versions 2.62.*.
 
diff --git a/THANKS b/THANKS
index f1e2b04..f39e949 100644
diff --git a/lib/autoconf/erlang.m4 b/lib/autoconf/erlang.m4
index 7c2859c..9bed007 100644
--- a/lib/autoconf/erlang.m4
+++ b/lib/autoconf/erlang.m4
@@ -1,6 +1,6 @@
 # This file is part of Autoconf.                       -*- Autoconf -*-
 # Erlang/OTP language support.
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -124,7 +124,7 @@ fi
 m4_define([AC_LANG(Erlang)],
 [ac_ext=erl
 ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
-ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&AS_MESSAGE_LOG_FD ; echo "#!/bin/sh" > conftest$ac_exeext ; AS_ECHO(["\"$ERL\" -run conftest start -run init stop -noshell"]) >> conftest$ac_exeext ; chmod +x conftest$ac_exeext'
+ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&AS_MESSAGE_LOG_FD ; echo "[#]!/bin/sh" > conftest$ac_exeext ; AS_ECHO(["\"$ERL\" -run conftest start -run init stop -noshell"]) >> conftest$ac_exeext ; chmod +x conftest$ac_exeext'
 ])
 
 
--
1.6.0


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf