automake-patches
[Top][All Lists]
Advanced

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

depcomp and libtool on AIX


From: Ralf Wildenhues
Subject: depcomp and libtool on AIX
Date: Tue, 17 Oct 2006 21:02:20 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On AIX, --disable-static is the default for libtool (for some reason
not important for the following issue).  This exposed a bug in depcomp.

So let's try this systematically, by testing both --disable-shared and
--disable-static, and fixing the fallout.  I think doing a third test
without either switch is not really necessary, the two do good coverage.

Luckily, it seems the `aix' depmode is the only one bitten by this bug
(I've tested at least one compiler for each depmode, except icc and
msvisualcpp).  I don't have access to an AIX compiler that outputs in
the current directory though (pre version 6).

OK after updating $scriptversion to HEAD?  Also branch-1-10?

Hehe.  This has been buggy ever since the change on 2003-07-31 to
support compiler version V6, which, incidentally, was my very first
patch to Automake, even to GNU software at all I think.  At least I
get to expose and fix it.  ;-)

Cheers,
Ralf

2006-10-17  Ralf Wildenhues  <address@hidden>

        * lib/depcomp (aix): Rewrite depmode in the spirit of the tru64
        one.  Fixes failure to catch dependencies with libtool and xlc
        in case of enable_static=no (which is the default on AIX without
        runtimelinking).
        * tests/depcomp7.test: Run test once with --disable-shared and
        once with --disable-static, to expose failure systematically.

Index: lib/depcomp
===================================================================
RCS file: /cvs/automake/automake/lib/depcomp,v
retrieving revision 1.60
diff -u -r1.60 depcomp
--- lib/depcomp 15 Oct 2006 17:02:34 -0000      1.60
+++ lib/depcomp 17 Oct 2006 18:39:13 -0000
@@ -1,7 +1,7 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2006-10-15.18
+scriptversion=2006-10-17.21
 
 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
 # Foundation, Inc.
@@ -215,34 +215,39 @@
   # current directory.  Also, the AIX compiler puts `$object:' at the
   # start of each line; $object doesn't have directory information.
   # Version 6 uses the directory in both cases.
-  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
-  tmpdepfile="$stripped.u"
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
   if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$base.u
+    tmpdepfile3=$dir.libs/$base.u
     "$@" -Wc,-M
   else
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$dir$base.u
+    tmpdepfile3=$dir$base.u
     "$@" -M
   fi
   stat=$?
 
-  if test -f "$tmpdepfile"; then :
-  else
-    stripped=`echo "$stripped" | sed 's,^.*/,,'`
-    tmpdepfile="$stripped.u"
-  fi
-
   if test $stat -eq 0; then :
   else
-    rm -f "$tmpdepfile"
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
     exit $stat
   fi
 
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
   if test -f "$tmpdepfile"; then
-    outname="$stripped.o"
     # Each line is of the form `foo.o: dependent.h'.
     # Do two passes, one to just change these to
     # `$object: dependent.h' and one to simply `dependent.h:'.
-    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
-    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+    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"
   else
     # The sourcefile does not contain any dependencies, so just
     # store a dummy comment line, to avoid errors with the Makefile
Index: tests/depcomp7.test
===================================================================
RCS file: /cvs/automake/automake/tests/depcomp7.test,v
retrieving revision 1.4
diff -u -r1.4 depcomp7.test
--- tests/depcomp7.test 10 May 2006 21:16:21 -0000      1.4
+++ tests/depcomp7.test 17 Oct 2006 18:39:13 -0000
@@ -65,7 +65,7 @@
 int bar() { return 0; }
 END
 
-touch sub2/sub3/ba3.h
+echo 'extern int x;' > sub2/sub3/ba3.h
 
 cat >sub/bar.h <<'END'
 #include <stdio.h>
@@ -91,7 +91,7 @@
 $AUTOCONF
 $AUTOMAKE -a
 
-./configure --enable-dependency-tracking
+./configure --enable-dependency-tracking --disable-shared
 $MAKE 
 
 # check that dependency tracking works
@@ -101,5 +101,28 @@
   $sleep
   echo 'choke me' > sub3/ba3.h
   if $MAKE; then exit 1; fi
+  cd ..
 fi
-:
+
+$MAKE distclean
+test ! -f sub2/sub3/ba3.u
+test ! -f sub2/sub3/ba3.d
+
+echo 'extern int x;' > sub2/sub3/ba3.h
+
+./configure --enable-dependency-tracking --disable-static
+$MAKE 
+
+# check that dependency tracking works
+if grep 'depmode=none' Makefile; then :
+else
+  cd sub2
+  $sleep
+  echo 'choke me' > sub3/ba3.h
+  if $MAKE; then exit 1; fi
+  cd ..
+fi
+
+$MAKE distclean
+test ! -f sub2/sub3/ba3.u
+test ! -f sub2/sub3/ba3.d




reply via email to

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