bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ac_vpsub quoting problem


From: Ralf Wildenhues
Subject: Re: ac_vpsub quoting problem
Date: Thu, 21 May 2009 10:46:51 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

[ <http://thread.gmane.org/gmane.comp.sysutils.autoconf.bugs/6535> ]

Hello Bruno, Eric, and sorry for the long delay,

* Bruno Haible wrote on Sat, Feb 28, 2009 at 10:05:36PM CET:
> 
> > do you need these two lines to work?
> 
> No, I don't have a test case for this. I spotted it only while looking at
> config.status in a text editor with syntax colouring.

I looked at this.  The problem it works around is this
(autoconf.info (Build Directories)):

|    If you are using GNU Automake, the remaining details in this section
| are already covered for you, based on the contents of your
| `Makefile.am'.  But if you are using Autoconf in isolation, then
| supporting `VPATH' requires the following in your `Makefile.in':
| 
|      srcdir = @srcdir@
|      VPATH = @srcdir@
| 
|    Do not set `VPATH' to the value of another variable, for example
| `VPATH = $(srcdir)', because some versions of `make' do not do variable
| substitutions on the value of `VPATH'.

I have looked for make implementations that have this problem, but
haven't found any.  Of course that doesn't mean they don't exist any
more, but this issue was documented in the autoconf.texi version from
1993 already, so maybe just maybe vendors have gotten around to fixing
it by now.  A related issue is that ancient SUN `make' only execute the
first of a set of double-colon rules with a VPATH assignment, as
documented in `(autoconf.info)VPATH and Double-colon'.

As to the supposedly broken configure code: I was surprised to see it
working quite well in practice.  Reason is that sed (and POSIX BRE in
general) treat ^ and $ anchors only as special at the beginning resp.
end of the BRE, and maybe at subexpression boundaries; elsewhere, they
both match literal ^ and $ characters.

I confirmed that this works that way with all sed versions I could find,
also on Solaris 2.6.

So, luckily there is nothing to fix here after all.  However, the manual
is slightly confusing in that it has a chapter on VPATH, but this
particular issue is documented elsewhere.  What about this patch to make
the manual a bit more coherent?

Thanks,
Ralf

    Document VPATH = $(variable) issue in VPATH chapter.
    
    * doc/autoconf.texi (Variables listed in VPATH): New node.
    (Top, VPATH and Make): Adjust menus.
    (Build Directories): Refer to it.
    Prompted by report from Bruno Haible.

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 928b417..1a41109 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -518,6 +518,7 @@ Portable Make Programming
 
 @code{VPATH} and Make
 
+* Variables listed in VPATH::   @code{VPATH} must be literal on ancient hosts
 * VPATH and Double-colon::      Problems with @samp{::} on ancient hosts
 * $< in Explicit Rules::        @code{$<} does not work in ordinary rules
 * Automatic Rule Rewriting::    @code{VPATH} goes wild on Solaris
@@ -2952,9 +2953,8 @@ srcdir = @@srcdir@@
 VPATH = @@srcdir@@
 @end example
 
-Do not set @code{VPATH} to the value of another variable, for example
address@hidden = $(srcdir)}, because some versions of @command{make} do not do
-variable substitutions on the value of @code{VPATH}.
+Do not set @code{VPATH} to the value of another variable (@pxref{Variables
+listed in VPATH}.
 
 @command{configure} substitutes the correct value for @code{srcdir} when
 it produces @file{Makefile}.
@@ -17966,6 +17966,7 @@ Here are some known issues with some @code{VPATH}
 implementations.
 
 @menu
+* Variables listed in VPATH::   @code{VPATH} must be literal on ancient hosts
 * VPATH and Double-colon::      Problems with @samp{::} on ancient hosts
 * $< in Explicit Rules::        @code{$<} does not work in ordinary rules
 * Automatic Rule Rewriting::    @code{VPATH} goes wild on Solaris
@@ -17973,6 +17974,25 @@ implementations.
 * Make Target Lookup::          More details about @code{VPATH} lookup
 @end menu
 
address@hidden Variables listed in VPATH
address@hidden Variables listed in @code{VPATH}
address@hidden @code{VPATH} and variables
address@hidden variables and @code{VPATH}
+
+Do not set @code{VPATH} to the value of another variable, for example
address@hidden = $(srcdir)}, because some ancient versions of
address@hidden do not do variable substitutions on the value of
address@hidden  For example, use this
+
address@hidden
+srcdir = @@srcdir@@
+VPATH = @@srcdir@@
address@hidden example
+
address@hidden
+rather than @samp{VPATH = $(srcdir)}.  Note that with @acronym{GNU}
+Automake, there is no need to set this yourself.
+
 @node VPATH and Double-colon
 @subsection @code{VPATH} and Double-colon Rules
 @cindex @code{VPATH} and double-colon rules




reply via email to

[Prev in Thread] Current Thread [Next in Thread]