+1999-04-26 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * m4/depend.m4 (AM_DEPENDENCIES): Test for depcc -E support.
+ * depcomp (cpp): Extract dependencies from `# nnn "..."' lines.
+
1999-04-25 Alexandre Oliva <oliva@dcc.unicamp.br>
* m4/depend.m4 (AM_DEPENDENCIES): Add a definition to conftest.h,
;;
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.
( IFS=" "
case " $* " in
*" --mode=compile "*) # this is libtool, let us make it quiet
shift # fnord
;;
esac
- set fnord "$@" "$1"
+ set fnord "$@" "$arg"
shift # fnord
- shift # "$1"
+ shift # "$arg"
done
;;
esac
- "$@" -M | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile") &
+ "$@" -M | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ ) &
proc=$!
"$@"
- rm -f "$depfile"
+ stat=$?
wait "$proc"
- cat < "$tmpdepfile" >> "$depfile"
+ if test "$stat" != 0; then exit $stat; fi
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' -e 's/$/ :/' >> "$depfile"
;;
cpp)
- # We want a pre compilation step which runs CPP (but with all
- # the right options! This is hard). Then we want to run sed
- # on the output, extract `#line' or `# NNN' lines, and turn
- # that into correct dependencies. We might as well do this
- # all in one step, so we have no post-compilation step here.
+ # 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 |
+ sed -n '/^# [0-9][0-9]* "\([^"]*\)"/ s::'"$object"'\: \1:p' > "$tmpdepfile"
+ ) &
+ proc=$!
+ "$@"
+ stat=$?
+ wait "$proc"
+ if test "$stat" != 0; then exit $stat; fi
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed < "$tmpdepfile" -e 's/^[^:]*: //' -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
;;
none)
fi
fi
+ if test "$am_cv_[$1]_dependencies_compiler_type" = none; then
+ # -o /dev/null avoids selecting -E for a compiler that would
+ # output dependencies to the object file
+ if test -n "`$depcc -E conftest.c -o /dev/null 2>/dev/null`"; then
+ am_cv_[$1]_dependencies_compiler_type=cpp
+ fi
+ fi
+
dnl As a last resort, see if we can run CPP and extract line
dnl information from the output.
dnl FIXME