From: Alexandre Oliva Date: Tue, 1 Jun 1999 00:33:59 +0000 (+0000) Subject: * depcomp: Support -xM for dependency generation, for Sun CC. X-Git-Tag: user-dep-gen-merge-branchpoint~3 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=948116c19c583f266549987bc5a313685dcedf88;p=thirdparty%2Fautomake.git * depcomp: Support -xM for dependency generation, for Sun CC. Reported by Alex Hornby * m4/depend.m4: Extract the list of supported dependency-tracking mechanisms from the depcomp script and use it to test each one. * THANKS: Added Alex Hornby. --- diff --git a/ChangeLog b/ChangeLog index aa67067f6..216c14c0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 1999-06-01 Alexandre Oliva + * depcomp: Support -xM for dependency generation, for Sun CC. + Reported by Alex Hornby + * m4/depend.m4: Extract the list of supported dependency-tracking + mechanisms from the depcomp script and use it to test each one. + * THANKS: Added Alex Hornby. + * depend2.am: Move $(depcomp) to the line of $(...DEPMODE), so as to leave $(...COMPILE) in a line by itself. diff --git a/THANKS b/THANKS index 1725d8bd0..0760becb2 100644 --- a/THANKS +++ b/THANKS @@ -3,8 +3,8 @@ It would not be what it is today without the invaluable help of these people: Akim Demaille demaille@inf.enst.fr +Alex Hornby alex@anvil.co.uk Alexander V. Lukyanov lav@yars.free.net -Alexandre Oliva oliva@dcc.unicamp.br Andreas Schwab schwab@lamothe.informatik.uni-dortmund.de Andrew Cagney cagney@tpgi.com.au Andris Pavenis pavenis@lanet.lv diff --git a/depcomp b/depcomp index 8e57e32fe..cc761d71e 100755 --- a/depcomp +++ b/depcomp @@ -26,10 +26,6 @@ if test -z "$depmode" || test -z "$source" || test -z "$object"; then fi depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} -# depdir=`echo "$depfile" | sed 's,/*[^/]*$,,'` -# test -d "$depdir" || { echo "mkdir \"$depdir\"" && mkdir "$depdir"; } || -# test -d "$depdir" || exit 1 - tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" @@ -85,6 +81,10 @@ sgi) rm -f "$tmpdepfile" ;; +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, @@ -122,6 +122,43 @@ dashmstdout) rm -f "$tmpdepfile" ;; +dashXmstdout) + # 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 + 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 + "$@" -xM | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + 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" + rm -f "$tmpdepfile" + ;; + makedepend) # X makedepend ( diff --git a/m4/depend.m4 b/m4/depend.m4 index 70c489397..23cdadccd 100644 --- a/m4/depend.m4 +++ b/m4/depend.m4 @@ -12,72 +12,41 @@ ifelse([$1],CC,[ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CPP]) depcc="$CC" -depcpp="$CPP" -depgcc="$GCC"],[$1],CXX,[ +depcpp="$CPP"],[$1],CXX,[ AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) depcc="$CXX" -depcpp="$CXXCPP" -depgcc="$GXX"],[$1],OBJC,[ +depcpp="$CXXCPP"],[$1],OBJC,[ am_cv_OBJC_dependencies_compiler_type=gcc],[ AC_REQUIRE([AC_PROG_][$1]) depcc="$[$1]" -depcpp="" -depgcc="no"]) +depcpp=""]) AC_MSG_CHECKING([dependency style of $depcc]) AC_CACHE_VAL(am_cv_[$1]_dependencies_compiler_type,[ -am_cv_[$1]_dependencies_compiler_type=none -if test "$depgcc" = yes; then - am_cv_[$1]_dependencies_compiler_type=gcc -else - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - - dnl SGI compiler has its own method for side-effect dependency - dnl tracking. - if test "$am_cv_[$1]_dependencies_compiler_type" = none; then - rm -f conftest.P - if $depcc -c -MDupdate conftest.P conftest.c 2>/dev/null && - test -f conftest.P; then - am_cv_[$1]_dependencies_compiler_type=sgi - fi - fi - - if test "$am_cv_[$1]_dependencies_compiler_type" = none; then - # -o /dev/null avoids selecting -M for a compiler that would - # output dependencies to the object file. - # The grep tries to ignore compilers that actually output - # something other than dependency information when given the -M - # argument (in particular, linker map information). - rm -f conftest.P - if $depcc -M conftest.c -o /dev/null >conftest.P 2>/dev/null && - grep "conftest.h" conftest.P > /dev/null; then - am_cv_[$1]_dependencies_compiler_type=dashmstdout - fi - fi +am_depcomp=${am_depcomp-"$ac_aux_dir/depcomp"} +if test -f "$am_depcomp"; then + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h - if test "$am_cv_[$1]_dependencies_compiler_type" = none; then - rm -f conftest.P - touch conftest.P - if ${MAKEDEPEND-makedepend} -o.o -fconftest.P conftest.c 2>/dev/null && - grep "conftest.h" conftest.P > /dev/null; then - am_cv_[$1]_dependencies_compiler_type=makedepend - fi - fi + am_cv_[$1]_dependencies_compiler_type=none + for depmode in `sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$am_depcomp"`; do + case "$depmode" in + nosideeffect) continue ;; + none) break ;; + esac + if depmode="$depmode" \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL $am_depcomp $depcc -c conftest.c 2>/dev/null && + grep conftest.h conftest.Po > /dev/null 2>&1; then + am_cv_[$1]_dependencies_compiler_type="$depmode" + break + fi + done - 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 - - rm -f conftest.* + rm -f conftest.* +else + am_cv_[$1]_dependencies_compiler_type=none fi ]) AC_MSG_RESULT($am_cv_[$1]_dependencies_compiler_type)