This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Automake 1.6.1b


>>> "Nishio" == Nishio Futoshi <fut_nis@d3.dion.ne.jp> writes:

 Nishio> FAIL: pr307.test

Thanks!  Looks like it was worth making this snapshot.

The reason why you see this

 Nishio> mv -f .libs/g.lo g.lo
 Nishio> mv: .libs/g.lo: No such file or directory

and why I didn't see it is because not all gcc version will
create an object file when given the `-M' option.  
2.95.x do, but 3.x doesn't.

Now, what seems more dreadful is how depcomp's dashstdout mode works
when libtool is used:

 1. call `libtool --mode=compile gcc ... -c -o g.lo' to build g.lo
 2. call `libtool --mode=compile gcc ... -c -o g.lo -M > output' 
    the dependencies from the output.

I think this is completly bogus.  

`libtool --mode=compile gcc ... -c -o g.lo -M' outputs much more
than what `gcc ... -c -o g.lo -M' does (because libtool prints
the gcc commands it runs).

Striping `libtool --mode=compile' at step #2 is not enough right
because the compiler (e.g. gcc 2.95.x) could overwrite g.lo.
Therefore I suggest changing `g.lo' into `/dev/null' in addition:

   `gcc ... -c -o /dev/null -M > output'

Simply removing `-o g.lo' is not an option because then we don't
control where the object is created (if an object is created) and 
we might overwrite something by mistake.

Tom, what do you think?  I always feel apprehensive when changing depcomp.

2002-06-11  Alexandre Duret-Lutz  <duret_g@epita.fr>

        Fix pr307.test failure with gcc 3.x.
	* lib/depcomp (dashmstdout): Strip the call to libtool, and
	replace `-o $object' by `-o /dev/null' before running "$@"
	to generate dependencies.
	(cpp): Strip the call to libtool as well as `-o $object'.

Index: lib/depcomp
===================================================================
RCS file: /cvs/automake/automake/lib/depcomp,v
retrieving revision 1.32.2.1
diff -u -r1.32.2.1 depcomp
--- lib/depcomp	25 Apr 2002 07:55:51 -0000	1.32.2.1
+++ lib/depcomp	11 Jun 2002 21:35:09 -0000
@@ -250,11 +250,40 @@
 
 dashmstdout)
   # Important note: in order to support this mode, a compiler *must*
-  # always write the proprocessed file to stdout, regardless of -o,
-  # because we must use -o when running libtool.
+  # always write the proprocessed file to stdout, regardless of -o.
   "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.  We will use -o /dev/null later,
+  # however we can't do the remplacement now because
+  # `-o $object' might simply not be used
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
   test -z "$dashmflag" && dashmflag=-M
-  "$@" $dashmflag | sed 's:^[^:]*\:[ 	]*:'"$object"'\: :' > "$tmpdepfile"
+  "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ 	]*:'"$object"'\: :' > "$tmpdepfile"
   rm -f "$depfile"
   cat < "$tmpdepfile" > "$depfile"
   tr ' ' '
@@ -306,9 +335,36 @@
 
 cpp)
   # Important note: in order to support this mode, a compiler *must*
-  # always write the proprocessed file to stdout, regardless of -o,
-  # because we must use -o when running libtool.
+  # always write the proprocessed file to stdout.
   "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
   "$@" -E |
     sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
     sed '$ s: \\$::' > "$tmpdepfile"

-- 
Alexandre Duret-Lutz



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]