]> sourceware.org Git - automake.git/commitdiff
For PR automake/307:
authorAlexandre Duret-Lutz <adl@gnu.org>
Thu, 25 Apr 2002 07:55:00 +0000 (07:55 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Thu, 25 Apr 2002 07:55:00 +0000 (07:55 +0000)
* lib/depcomp: Never compute dependencies in the background, this
can cause races with libtool.  Compute the dependencies after
the actual compilation.  Don't make libtool silent now that
it's run in the foreground.
* tests/pr307.test: New file.
* tests/Makefile.am (TESTS): Add pr307.test.
Reported by Laurent Morichetti.

ChangeLog
THANKS
lib/depcomp
tests/Makefile.am
tests/Makefile.in
tests/pr307.test [new file with mode: 0755]

index 13fe95961d7c3983938fa3099ab1934413aae3e5..132be99d533fb2a4c83c97d8b1dd135d2bc951a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-04-25  Alexandre Duret-Lutz  <duret_g@epita.fr>
+
+       For PR automake/307:
+       * lib/depcomp: Never compute dependencies in the background, this
+       can cause races with libtool.  Compute the dependencies after
+       the actual compilation.  Don't make libtool silent now that
+       it's run in the foreground.
+       * tests/pr307.test: New file.
+       * tests/Makefile.am (TESTS): Add pr307.test.
+       Reported by Laurent Morichetti.
+
 2002-04-25  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
        * lib/am/check.am: Show skipped tests.  Display the
diff --git a/THANKS b/THANKS
index c5032c7fe8b9251da5974671ad5f04f2bcf6a9d4..7c067ab37437dc88bc51a595a4445b6762681872 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -96,6 +96,7 @@ L. Peter Deutsch      ghost@aladdin.com
 Larry Jones            larry.jones@sdrc.com
 Lars Hecking           lhecking@nmrc.ucc.ie
 Lars J. Aas            larsa@sim.no
+Laurent Morichetti     laurentm@cup.hp.com
 Maciej Stachowiak      mstachow@mit.edu
 Maciej W. Rozycki      macro@ds2.pg.gda.pl
 Manu Rouat             emmanuel.rouat@wanadoo.fr
index 3480ce4e96d431f9d70162fd1cd79366c714996b..094d6812978a711f5da6424831fd72902e9d8621 100755 (executable)
@@ -209,7 +209,7 @@ aix)
 tru64)
    # The Tru64 compiler uses -MD to generate dependencies as a side
    # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
    # dependencies in `foo.d' instead, so we check for that too.
    # Subdirectories are respected.
 
@@ -252,32 +252,9 @@ 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.
+  "$@" || exit $?
   test -z "$dashmflag" && dashmflag=-M
-  ( IFS=" "
-    case " $* " in
-    *" --mode=compile "*) # this is libtool, let us make it quiet
-      for arg
-      do # cycle over the arguments
-        case "$arg" in
-       "--mode=compile")
-         # insert --quiet before "--mode=compile"
-         set fnord "$@" --quiet
-         shift # fnord
-         ;;
-       esac
-       set fnord "$@" "$arg"
-       shift # fnord
-       shift # "$arg"
-      done
-      ;;
-    esac
-    "$@" $dashmflag | sed 's:^[^:]*\:[         ]*:'"$object"'\: :' > "$tmpdepfile"
-  ) &
-  proc=$!
-  "$@"
-  stat=$?
-  wait "$proc"
-  if test "$stat" != 0; then exit $stat; fi
+  "$@" $dashmflag | sed 's:^[^:]*\:[   ]*:'"$object"'\: :' > "$tmpdepfile"
   rm -f "$depfile"
   cat < "$tmpdepfile" > "$depfile"
   tr ' ' '
@@ -295,33 +272,28 @@ dashXmstdout)
   ;;
 
 makedepend)
+  "$@" || exit $?
   # X makedepend
-  (
-    shift
-    cleared=no
-    for arg in "$@"; do
-      case $cleared in no)
-        set ""; shift
-       cleared=yes
-      esac
-      case "$arg" in
-        -D*|-I*)
-         set fnord "$@" "$arg"; shift;;
-       -*)
-         ;;
-       *)
-         set fnord "$@" "$arg"; shift;;
-      esac
-    done
-    obj_suffix="`echo $object | sed 's/^.*\././'`"
-    touch "$tmpdepfile"
-    ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
-  ) &
-  proc=$!
-  "$@"
-  stat=$?
-  wait "$proc"
-  if test "$stat" != 0; then exit $stat; fi
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    -*)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
   rm -f "$depfile"
   cat < "$tmpdepfile" > "$depfile"
   sed '1,2d' "$tmpdepfile" | tr ' ' '
@@ -336,33 +308,10 @@ 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.
-  ( IFS=" "
-    case " $* " in
-    *" --mode=compile "*)
-      for arg
-      do # cycle over the arguments
-        case $arg in
-       "--mode=compile")
-         # insert --quiet before "--mode=compile"
-         set fnord "$@" --quiet
-         shift # fnord
-         ;;
-       esac
-       set fnord "$@" "$arg"
-       shift # fnord
-       shift # "$arg"
-      done
-      ;;
-    esac
-    "$@" -E |
+  "$@" || exit $?
+  "$@" -E |
     sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
     sed '$ s: \\$::' > "$tmpdepfile"
-  ) &
-  proc=$!
-  "$@"
-  stat=$?
-  wait "$proc"
-  if test "$stat" != 0; then exit $stat; fi
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
   cat < "$tmpdepfile" >> "$depfile"
@@ -374,47 +323,25 @@ msvisualcpp)
   # 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.
-  ( IFS=" "
-    case " $* " in
-    *" --mode=compile "*)
-      for arg
-      do # cycle over the arguments
-        case $arg in
-       "--mode=compile")
-         # insert --quiet before "--mode=compile"
-         set fnord "$@" --quiet
-         shift # fnord
-         ;;
-       esac
-       set fnord "$@" "$arg"
-       shift # fnord
-       shift # "$arg"
-      done
-      ;;
-    esac
-    for arg
-    do
-      case "$arg" in
-      "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
        set fnord "$@"
        shift
        shift
        ;;
-      *)
+    *)
        set fnord "$@" "$arg"
        shift
        shift
        ;;
-      esac
-    done
-    "$@" -E |
-    sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
-  ) &
-  proc=$!
-  "$@"
-  stat=$?
-  wait "$proc"
-  if test "$stat" != 0; then exit $stat; fi
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
   . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::   \1 \\:p' >> "$depfile"
index 4f8c4b8dde7c056a07acd44e8fb46e7cca3003ad..54685aaa52b9d6f7ed4a8cd860c45ea0975c120b 100644 (file)
@@ -270,6 +270,7 @@ pr287.test \
 pr300-lib.test \
 pr300-ltlib.test \
 pr300-prog.test \
+pr307.test \
 prefix.test \
 primary.test \
 primary2.test \
index e6b58bb46aa5bf5e8a9ede2c26b18725500e337e..612defcecac48299c2c4aff74488b5806b3a05ea 100644 (file)
@@ -354,6 +354,7 @@ pr287.test \
 pr300-lib.test \
 pr300-ltlib.test \
 pr300-prog.test \
+pr307.test \
 prefix.test \
 primary.test \
 primary2.test \
diff --git a/tests/pr307.test b/tests/pr307.test
new file mode 100755 (executable)
index 0000000..cab6dd3
--- /dev/null
@@ -0,0 +1,49 @@
+#! /bin/sh
+
+# Test for PR 307: depcomp with depmode=dashmstdout libtool race condition
+# Report from Laurent Morichetti.
+# (Also exercises check_LTLIBRARIES.)
+
+required='libtoolize gcc'
+. $srcdir/defs || exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+check_LTLIBRARIES = librace.la
+librace_la_SOURCES = a.c b.c c.c d.c e.c f.c g.c h.c
+END
+
+for i in a b c d e f g h; do
+  echo "int $i() { return 0; }" > $i.c
+done
+
+set -e
+
+libtoolize --force
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+# Sanity check: make sure the variable we are attempting to force
+# is used by configure
+grep am_cv_CC_dependencies_compiler_type configure
+
+./configure am_cv_CC_dependencies_compiler_type=dashmstdout
+$MAKE
+test -f librace.la && exit 1
+$MAKE check
+
+# The failure we check usually occurs during the above build,
+# with an output such as
+#
+# mv -f .libs/f.lo f.lo
+# mv: cannot stat `.libs/f.lo': No such file or directory
+#
+# (This may happen on `f' or on some other files.)
+
+test -f librace.la
This page took 0.03716 seconds and 5 git commands to generate.