automake-patches
[Top][All Lists]
Advanced

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

Re: CVS automake testsuite failure under Tru64 unix


From: Alexandre Duret-Lutz
Subject: Re: CVS automake testsuite failure under Tru64 unix
Date: Sat, 27 Dec 2003 02:38:21 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

>>> "Nicolas" == Nicolas Joly <address@hidden> writes:

 Nicolas> Hi,

 Nicolas> I checked CVS automake on my Tru64 vV5.1A unix
 Nicolas> workstation and noticed one testsuite failure
 Nicolas> (subpkg2.test).

Thanks you!  That was an interesting bug.

I'm installing the following fix on HEAD and branch-1-8.
(A documentation patch for this is pending in autoconf-patches.)

2003-12-27  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (maybe_push_required_file): Add $(srcdir) in front
        a required files outside the current directory or its subdirectories.
        * lib/am/distdir.am (distdir): Update comment.
        Report from Nicolas Joly.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1526
diff -u -r1.1526 automake.in
--- automake.in 8 Dec 2003 18:00:01 -0000       1.1526
+++ automake.in 26 Dec 2003 23:41:04 -0000
@@ -6434,22 +6434,52 @@
 # encodes the rules for deciding when to do so.
 sub maybe_push_required_file
 {
-    my ($dir, $file, $fullfile) = @_;
+  my ($dir, $file, $fullfile) = @_;
 
-    if ($dir eq $relative_dir)
+  if ($dir eq $relative_dir)
     {
-       push_dist_common ($file);
-       return 1;
+      push_dist_common ($file);
+      return 1;
     }
-    elsif ($relative_dir eq '.' && ! &is_make_dir ($dir))
+  elsif ($relative_dir eq '.' && ! &is_make_dir ($dir))
     {
-       # If we are doing the topmost directory, and the file is in a
-       # subdir which does not have a Makefile, then we distribute it
-       # here.
-       push_dist_common ($fullfile);
-       return 1;
+      # If we are doing the topmost directory, and the file is in a
+      # subdir which does not have a Makefile, then we distribute it
+      # here.
+
+      # If a required file is above the source tree, it is important
+      # to prefix it with `$(srcdir)' so that no VPATH search is
+      # performed.  Otherwise problems occur with Make implementations
+      # that rewrite and simplify rules whose dependencies are found in a
+      # VPATH location.  Here is an example with OSF1/Tru64 Make.
+      #
+      #   % cat Makefile
+      #   VPATH = sub
+      #   distdir: ../a
+      #                  echo ../a
+      #   % ls
+      #   Makefile a
+      #   % make
+      #   echo a
+      #   a
+      #
+      # Dependency `../a' was found in `sub/../a', but this make
+      # implementation simplified it as `a'.  (Note that the sub/
+      # directory does not even exist.)
+      #
+      # This kind of VPATH rewriting seems hard to cancel.  The
+      # distdir.am hack against VPATH rewriting works only when no
+      # simplification is done, i.e., for dependencies which are in
+      # subdirectories, not in enclosing directories.  Hence, in
+      # the latter case we use a full path to make sure no VPATH
+      # search occurs.
+      $fullfile = '$(srcdir)/' . $fullfile
+       if $dir =~ m,^\.\.(?:$|/),;
+
+      push_dist_common ($fullfile);
+      return 1;
     }
-    return 0;
+  return 0;
 }
 
 
Index: lib/am/distdir.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/distdir.am,v
retrieving revision 1.52
diff -u -r1.52 distdir.am
--- lib/am/distdir.am   10 Nov 2003 20:55:32 -0000      1.52
+++ lib/am/distdir.am   26 Dec 2003 23:41:04 -0000
@@ -64,25 +64,39 @@
 ## Yet another hack to support SUN make.
 ##
 ## Let's assume `foo' appears in DISTFILES and is not a built file.
-## When building with VPATH=$(srcdir), SUN make will rewrite `foo' as
-## `$(srcdir)/foo'.  An attempt to install the file with
+## When building with VPATH=$(srcdir), SUN make and OSF1/Tru64 will
+## rewrite `foo' as `$(srcdir)/foo'.  An attempt to install the file
+## with
 ##    cp $file $(distdir)/$file
 ## will thus install $(srcdir)/foo as $(distdir)/$(srcdir)/foo
 ## instead of $(distdir)/foo.
 ##
 ## So let's strip this leading $(srcdir)/ when it exists.  (As far we
-## know, only SUN make adds it.)  Searching whether the file is to be
-## found in the source or build directory will be done latter.
+## know, only SUN make and OSF1/Tru64 make add it.)  Searching whether
+## the file is to be found in the source or build directory will be
+## done latter.
 ##
-## In case we are _not_ using SUN make, how can we be sure we are
-## not stripping a legitimate filename that starts with the same
-## pattern as $(srcdir)?
+## In case we are _not_ using SUN or OSF1/Tru64 make, how can we be sure
+## we are not stripping a legitimate filename that starts with the
+## same pattern as $(srcdir)?
 ## Well, it can't happen without the Makefile author distributing
 ## something out of the distribution (which is bad).   As an example,
 ## consider `EXTRA_DIST = ../bar'.  This is an issue if $srcdir is `..',
 ## however getting this value for srcdir is impossible: `EXTRA_DIST = ../bar'
 ## implies we are in a subdirectory (so `../bar' is within the package),
 ## hence `$srcdir' is something like `../../subdir'.
+##
+## There is more to say about files which are above the current directory,
+## like `../bar' in the previous example.  The OSF1/Tru64 make
+## implementation can simplify filenames resulting from a VPATH lookup.
+## For instance if `VPATH = ../../subdir' and `../bar' is found in that
+## VPATH directory, then occurrences of `../bar' will be replaced by
+## `../../bar' (instead of `../../subdir/../bar').  This obviously defeats
+## any attempt to strip a leading $srcdir.  Presently we have no workaround
+## for this.  We avoid this issue by writing `EXTRA_DIST = $(srcdir)/../bar'
+## instead of `EXTRA_DIST = ../bar'.  This prefixing is needed only for files
+## above the current directory.  Fortunately, apart from auxdir files which
+## can be located in .. or ../.., this situation hardly occurs in practice.
 ##
          case $$file in \
            $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-- 
Alexandre Duret-Lutz





reply via email to

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