Subject: bug#10434: FAIL: depmod.tap 50 - tru64 [long VPATH] make & remake

From: Stefano Lattarini <[email-masked]>
Date: Thu, 02 Feb 2012 22:45:22 +0100

Reference:
  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10434>

OK, the attached patch fixes the two spurious failures of GCC forced into
Tru64 mode.  About time I'd say.

But I'm not sure whether we should apply this without first testing it
on a real Tru64 compiler, lest we cause a real regression just to fix a
spurious failure.  Thoughts?

Regards,
  Stefano
>From e783412d288270976ca4a6475816bc36b76ded6f Mon Sep 17 00:00:00 2001
Message-Id: <e783412d2[email-masked]>
From: Stefano Lattarini <[email-masked]>
Date: Thu, 2 Feb 2012 22:44:58 +0100
Subject: [PATCH] tru64 depcomp: handle line continuations more graciously

Fixes automake bug#10434.

* lib/depcomp (tru64): Take into account the possibility of line
continuations (by a trailing '\' character) when post-processing
the generated dependency file.  This fixes a failure for when
the compiler is GCC and the Tru64 dependency mode is forced at
configure time.  In case some versions of the Tru64 compiler
suffer from the same weakness, this change should improve the
situation for them as well.  Otherwise, no semantic change on
Tru64 is expected from this patch.
---
 lib/depcomp |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/depcomp b/lib/depcomp
index ff4e08f..0b14e6f 100755
--- a/lib/depcomp
+++ b/lib/depcomp
@@ -1,10 +1,10 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2011-12-04.11; # UTC
+scriptversion=2012-02-02.21; # UTC
 
 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
-# 2011 Free Software Foundation, Inc.
+# 2011, 2012 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
@@ -408,7 +408,10 @@ tru64)
    if test -f "$tmpdepfile"; then
       sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
       # That's a tab and a space in the [].
-      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+      # The second '-e' command handles possible line continuations;
+      # see automake bug#10434.
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's/[	 ]*\\$//' \
+          -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
    else
       echo "#dummy" > "$depfile"
    fi
-- 
1.7.7.3