Blame depcomp

Packit 1f38fa
#! /bin/sh
Packit 1f38fa
# depcomp - compile a program generating dependencies as side-effects
Packit 1f38fa
Packit 1f38fa
scriptversion=2011-12-04.11; # UTC
Packit 1f38fa
Packit 1f38fa
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
Packit 1f38fa
# 2011 Free Software Foundation, Inc.
Packit 1f38fa
Packit 1f38fa
# This program is free software; you can redistribute it and/or modify
Packit 1f38fa
# it under the terms of the GNU General Public License as published by
Packit 1f38fa
# the Free Software Foundation; either version 2, or (at your option)
Packit 1f38fa
# any later version.
Packit 1f38fa
Packit 1f38fa
# This program is distributed in the hope that it will be useful,
Packit 1f38fa
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 1f38fa
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 1f38fa
# GNU General Public License for more details.
Packit 1f38fa
Packit 1f38fa
# You should have received a copy of the GNU General Public License
Packit 1f38fa
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 1f38fa
Packit 1f38fa
# As a special exception to the GNU General Public License, if you
Packit 1f38fa
# distribute this file as part of a program that contains a
Packit 1f38fa
# configuration script generated by Autoconf, you may include it under
Packit 1f38fa
# the same distribution terms that you use for the rest of that program.
Packit 1f38fa
Packit 1f38fa
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
Packit 1f38fa
Packit 1f38fa
case $1 in
Packit 1f38fa
  '')
Packit 1f38fa
     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
Packit 1f38fa
     exit 1;
Packit 1f38fa
     ;;
Packit 1f38fa
  -h | --h*)
Packit 1f38fa
    cat <<\EOF
Packit 1f38fa
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Packit 1f38fa
Packit 1f38fa
Run PROGRAMS ARGS to compile a file, generating dependencies
Packit 1f38fa
as side-effects.
Packit 1f38fa
Packit 1f38fa
Environment variables:
Packit 1f38fa
  depmode     Dependency tracking mode.
Packit 1f38fa
  source      Source file read by `PROGRAMS ARGS'.
Packit 1f38fa
  object      Object file output by `PROGRAMS ARGS'.
Packit 1f38fa
  DEPDIR      directory where to store dependencies.
Packit 1f38fa
  depfile     Dependency file to output.
Packit 1f38fa
  tmpdepfile  Temporary file to use when outputting dependencies.
Packit 1f38fa
  libtool     Whether libtool is used (yes/no).
Packit 1f38fa
Packit 1f38fa
Report bugs to <bug-automake@gnu.org>.
Packit 1f38fa
EOF
Packit 1f38fa
    exit $?
Packit 1f38fa
    ;;
Packit 1f38fa
  -v | --v*)
Packit 1f38fa
    echo "depcomp $scriptversion"
Packit 1f38fa
    exit $?
Packit 1f38fa
    ;;
Packit 1f38fa
esac
Packit 1f38fa
Packit 1f38fa
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
Packit 1f38fa
  echo "depcomp: Variables source, object and depmode must be set" 1>&2
Packit 1f38fa
  exit 1
Packit 1f38fa
fi
Packit 1f38fa
Packit 1f38fa
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
Packit 1f38fa
depfile=${depfile-`echo "$object" |
Packit 1f38fa
  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
Packit 1f38fa
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
Packit 1f38fa
Packit 1f38fa
rm -f "$tmpdepfile"
Packit 1f38fa
Packit 1f38fa
# Some modes work just like other modes, but use different flags.  We
Packit 1f38fa
# parameterize here, but still list the modes in the big case below,
Packit 1f38fa
# to make depend.m4 easier to write.  Note that we *cannot* use a case
Packit 1f38fa
# here, because this file can only contain one case statement.
Packit 1f38fa
if test "$depmode" = hp; then
Packit 1f38fa
  # HP compiler uses -M and no extra arg.
Packit 1f38fa
  gccflag=-M
Packit 1f38fa
  depmode=gcc
Packit 1f38fa
fi
Packit 1f38fa
Packit 1f38fa
if test "$depmode" = dashXmstdout; then
Packit 1f38fa
   # This is just like dashmstdout with a different argument.
Packit 1f38fa
   dashmflag=-xM
Packit 1f38fa
   depmode=dashmstdout
Packit 1f38fa
fi
Packit 1f38fa
Packit 1f38fa
cygpath_u="cygpath -u -f -"
Packit 1f38fa
if test "$depmode" = msvcmsys; then
Packit 1f38fa
   # This is just like msvisualcpp but w/o cygpath translation.
Packit 1f38fa
   # Just convert the backslash-escaped backslashes to single forward
Packit 1f38fa
   # slashes to satisfy depend.m4
Packit 1f38fa
   cygpath_u='sed s,\\\\,/,g'
Packit 1f38fa
   depmode=msvisualcpp
Packit 1f38fa
fi
Packit 1f38fa
Packit 1f38fa
if test "$depmode" = msvc7msys; then
Packit 1f38fa
   # This is just like msvc7 but w/o cygpath translation.
Packit 1f38fa
   # Just convert the backslash-escaped backslashes to single forward
Packit 1f38fa
   # slashes to satisfy depend.m4
Packit 1f38fa
   cygpath_u='sed s,\\\\,/,g'
Packit 1f38fa
   depmode=msvc7
Packit 1f38fa
fi
Packit 1f38fa
Packit 1f38fa
case "$depmode" in
Packit 1f38fa
gcc3)
Packit 1f38fa
## gcc 3 implements dependency tracking that does exactly what
Packit 1f38fa
## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
Packit 1f38fa
## it if -MD -MP comes after the -MF stuff.  Hmm.
Packit 1f38fa
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
Packit 1f38fa
## the command line argument order; so add the flags where they
Packit 1f38fa
## appear in depend2.am.  Note that the slowdown incurred here
Packit 1f38fa
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
Packit 1f38fa
  for arg
Packit 1f38fa
  do
Packit 1f38fa
    case $arg in
Packit 1f38fa
    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
Packit 1f38fa
    *)  set fnord "$@" "$arg" ;;
Packit 1f38fa
    esac
Packit 1f38fa
    shift # fnord
Packit 1f38fa
    shift # $arg
Packit 1f38fa
  done
Packit 1f38fa
  "$@"
Packit 1f38fa
  stat=$?
Packit 1f38fa
  if test $stat -eq 0; then :
Packit 1f38fa
  else
Packit 1f38fa
    rm -f "$tmpdepfile"
Packit 1f38fa
    exit $stat
Packit 1f38fa
  fi
Packit 1f38fa
  mv "$tmpdepfile" "$depfile"
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
gcc)
Packit 1f38fa
## There are various ways to get dependency output from gcc.  Here's
Packit 1f38fa
## why we pick this rather obscure method:
Packit 1f38fa
## - Don't want to use -MD because we'd like the dependencies to end
Packit 1f38fa
##   up in a subdir.  Having to rename by hand is ugly.
Packit 1f38fa
##   (We might end up doing this anyway to support other compilers.)
Packit 1f38fa
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
Packit 1f38fa
##   -MM, not -M (despite what the docs say).
Packit 1f38fa
## - Using -M directly means running the compiler twice (even worse
Packit 1f38fa
##   than renaming).
Packit 1f38fa
  if test -z "$gccflag"; then
Packit 1f38fa
    gccflag=-MD,
Packit 1f38fa
  fi
Packit 1f38fa
  "$@" -Wp,"$gccflag$tmpdepfile"
Packit 1f38fa
  stat=$?
Packit 1f38fa
  if test $stat -eq 0; then :
Packit 1f38fa
  else
Packit 1f38fa
    rm -f "$tmpdepfile"
Packit 1f38fa
    exit $stat
Packit 1f38fa
  fi
Packit 1f38fa
  rm -f "$depfile"
Packit 1f38fa
  echo "$object : \\" > "$depfile"
Packit 1f38fa
  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
Packit 1f38fa
## The second -e expression handles DOS-style file names with drive letters.
Packit 1f38fa
  sed -e 's/^[^:]*: / /' \
Packit 1f38fa
      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
Packit 1f38fa
## This next piece of magic avoids the `deleted header file' problem.
Packit 1f38fa
## The problem is that when a header file which appears in a .P file
Packit 1f38fa
## is deleted, the dependency causes make to die (because there is
Packit 1f38fa
## typically no way to rebuild the header).  We avoid this by adding
Packit 1f38fa
## dummy dependencies for each header file.  Too bad gcc doesn't do
Packit 1f38fa
## this for us directly.
Packit 1f38fa
  tr ' ' '
Packit 1f38fa
' < "$tmpdepfile" |
Packit 1f38fa
## Some versions of gcc put a space before the `:'.  On the theory
Packit 1f38fa
## that the space means something, we add a space to the output as
Packit 1f38fa
## well.  hp depmode also adds that space, but also prefixes the VPATH
Packit 1f38fa
## to the object.  Take care to not repeat it in the output.
Packit 1f38fa
## Some versions of the HPUX 10.20 sed can't process this invocation
Packit 1f38fa
## correctly.  Breaking it into two sed invocations is a workaround.
Packit 1f38fa
    sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
Packit 1f38fa
      | sed -e 's/$/ :/' >> "$depfile"
Packit 1f38fa
  rm -f "$tmpdepfile"
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
hp)
Packit 1f38fa
  # This case exists only to let depend.m4 do its work.  It works by
Packit 1f38fa
  # looking at the text of this script.  This case will never be run,
Packit 1f38fa
  # since it is checked for above.
Packit 1f38fa
  exit 1
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
sgi)
Packit 1f38fa
  if test "$libtool" = yes; then
Packit 1f38fa
    "$@" "-Wp,-MDupdate,$tmpdepfile"
Packit 1f38fa
  else
Packit 1f38fa
    "$@" -MDupdate "$tmpdepfile"
Packit 1f38fa
  fi
Packit 1f38fa
  stat=$?
Packit 1f38fa
  if test $stat -eq 0; then :
Packit 1f38fa
  else
Packit 1f38fa
    rm -f "$tmpdepfile"
Packit 1f38fa
    exit $stat
Packit 1f38fa
  fi
Packit 1f38fa
  rm -f "$depfile"
Packit 1f38fa
Packit 1f38fa
  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
Packit 1f38fa
    echo "$object : \\" > "$depfile"
Packit 1f38fa
Packit 1f38fa
    # Clip off the initial element (the dependent).  Don't try to be
Packit 1f38fa
    # clever and replace this with sed code, as IRIX sed won't handle
Packit 1f38fa
    # lines with more than a fixed number of characters (4096 in
Packit 1f38fa
    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
Packit 1f38fa
    # the IRIX cc adds comments like `#:fec' to the end of the
Packit 1f38fa
    # dependency line.
Packit 1f38fa
    tr ' ' '
Packit 1f38fa
' < "$tmpdepfile" \
Packit 1f38fa
    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
Packit 1f38fa
    tr '
Packit 1f38fa
' ' ' >> "$depfile"
Packit 1f38fa
    echo >> "$depfile"
Packit 1f38fa
Packit 1f38fa
    # The second pass generates a dummy entry for each header file.
Packit 1f38fa
    tr ' ' '
Packit 1f38fa
' < "$tmpdepfile" \
Packit 1f38fa
   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
Packit 1f38fa
   >> "$depfile"
Packit 1f38fa
  else
Packit 1f38fa
    # The sourcefile does not contain any dependencies, so just
Packit 1f38fa
    # store a dummy comment line, to avoid errors with the Makefile
Packit 1f38fa
    # "include basename.Plo" scheme.
Packit 1f38fa
    echo "#dummy" > "$depfile"
Packit 1f38fa
  fi
Packit 1f38fa
  rm -f "$tmpdepfile"
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
aix)
Packit 1f38fa
  # The C for AIX Compiler uses -M and outputs the dependencies
Packit 1f38fa
  # in a .u file.  In older versions, this file always lives in the
Packit 1f38fa
  # current directory.  Also, the AIX compiler puts `$object:' at the
Packit 1f38fa
  # start of each line; $object doesn't have directory information.
Packit 1f38fa
  # Version 6 uses the directory in both cases.
Packit 1f38fa
  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
Packit 1f38fa
  test "x$dir" = "x$object" && dir=
Packit 1f38fa
  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
Packit 1f38fa
  if test "$libtool" = yes; then
Packit 1f38fa
    tmpdepfile1=$dir$base.u
Packit 1f38fa
    tmpdepfile2=$base.u
Packit 1f38fa
    tmpdepfile3=$dir.libs/$base.u
Packit 1f38fa
    "$@" -Wc,-M
Packit 1f38fa
  else
Packit 1f38fa
    tmpdepfile1=$dir$base.u
Packit 1f38fa
    tmpdepfile2=$dir$base.u
Packit 1f38fa
    tmpdepfile3=$dir$base.u
Packit 1f38fa
    "$@" -M
Packit 1f38fa
  fi
Packit 1f38fa
  stat=$?
Packit 1f38fa
Packit 1f38fa
  if test $stat -eq 0; then :
Packit 1f38fa
  else
Packit 1f38fa
    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
Packit 1f38fa
    exit $stat
Packit 1f38fa
  fi
Packit 1f38fa
Packit 1f38fa
  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
Packit 1f38fa
  do
Packit 1f38fa
    test -f "$tmpdepfile" && break
Packit 1f38fa
  done
Packit 1f38fa
  if test -f "$tmpdepfile"; then
Packit 1f38fa
    # Each line is of the form `foo.o: dependent.h'.
Packit 1f38fa
    # Do two passes, one to just change these to
Packit 1f38fa
    # `$object: dependent.h' and one to simply `dependent.h:'.
Packit 1f38fa
    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
Packit 1f38fa
    # That's a tab and a space in the [].
Packit 1f38fa
    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
Packit 1f38fa
  else
Packit 1f38fa
    # The sourcefile does not contain any dependencies, so just
Packit 1f38fa
    # store a dummy comment line, to avoid errors with the Makefile
Packit 1f38fa
    # "include basename.Plo" scheme.
Packit 1f38fa
    echo "#dummy" > "$depfile"
Packit 1f38fa
  fi
Packit 1f38fa
  rm -f "$tmpdepfile"
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
icc)
Packit 1f38fa
  # Intel's C compiler understands `-MD -MF file'.  However on
Packit 1f38fa
  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
Packit 1f38fa
  # ICC 7.0 will fill foo.d with something like
Packit 1f38fa
  #    foo.o: sub/foo.c
Packit 1f38fa
  #    foo.o: sub/foo.h
Packit 1f38fa
  # which is wrong.  We want:
Packit 1f38fa
  #    sub/foo.o: sub/foo.c
Packit 1f38fa
  #    sub/foo.o: sub/foo.h
Packit 1f38fa
  #    sub/foo.c:
Packit 1f38fa
  #    sub/foo.h:
Packit 1f38fa
  # ICC 7.1 will output
Packit 1f38fa
  #    foo.o: sub/foo.c sub/foo.h
Packit 1f38fa
  # and will wrap long lines using \ :
Packit 1f38fa
  #    foo.o: sub/foo.c ... \
Packit 1f38fa
  #     sub/foo.h ... \
Packit 1f38fa
  #     ...
Packit 1f38fa
Packit 1f38fa
  "$@" -MD -MF "$tmpdepfile"
Packit 1f38fa
  stat=$?
Packit 1f38fa
  if test $stat -eq 0; then :
Packit 1f38fa
  else
Packit 1f38fa
    rm -f "$tmpdepfile"
Packit 1f38fa
    exit $stat
Packit 1f38fa
  fi
Packit 1f38fa
  rm -f "$depfile"
Packit 1f38fa
  # Each line is of the form `foo.o: dependent.h',
Packit 1f38fa
  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
Packit 1f38fa
  # Do two passes, one to just change these to
Packit 1f38fa
  # `$object: dependent.h' and one to simply `dependent.h:'.
Packit 1f38fa
  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
Packit 1f38fa
  # Some versions of the HPUX 10.20 sed can't process this invocation
Packit 1f38fa
  # correctly.  Breaking it into two sed invocations is a workaround.
Packit 1f38fa
  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
Packit 1f38fa
    sed -e 's/$/ :/' >> "$depfile"
Packit 1f38fa
  rm -f "$tmpdepfile"
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
hp2)
Packit 1f38fa
  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
Packit 1f38fa
  # compilers, which have integrated preprocessors.  The correct option
Packit 1f38fa
  # to use with these is +Maked; it writes dependencies to a file named
Packit 1f38fa
  # 'foo.d', which lands next to the object file, wherever that
Packit 1f38fa
  # happens to be.
Packit 1f38fa
  # Much of this is similar to the tru64 case; see comments there.
Packit 1f38fa
  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
Packit 1f38fa
  test "x$dir" = "x$object" && dir=
Packit 1f38fa
  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
Packit 1f38fa
  if test "$libtool" = yes; then
Packit 1f38fa
    tmpdepfile1=$dir$base.d
Packit 1f38fa
    tmpdepfile2=$dir.libs/$base.d
Packit 1f38fa
    "$@" -Wc,+Maked
Packit 1f38fa
  else
Packit 1f38fa
    tmpdepfile1=$dir$base.d
Packit 1f38fa
    tmpdepfile2=$dir$base.d
Packit 1f38fa
    "$@" +Maked
Packit 1f38fa
  fi
Packit 1f38fa
  stat=$?
Packit 1f38fa
  if test $stat -eq 0; then :
Packit 1f38fa
  else
Packit 1f38fa
     rm -f "$tmpdepfile1" "$tmpdepfile2"
Packit 1f38fa
     exit $stat
Packit 1f38fa
  fi
Packit 1f38fa
Packit 1f38fa
  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
Packit 1f38fa
  do
Packit 1f38fa
    test -f "$tmpdepfile" && break
Packit 1f38fa
  done
Packit 1f38fa
  if test -f "$tmpdepfile"; then
Packit 1f38fa
    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
Packit 1f38fa
    # Add `dependent.h:' lines.
Packit 1f38fa
    sed -ne '2,${
Packit 1f38fa
	       s/^ *//
Packit 1f38fa
	       s/ \\*$//
Packit 1f38fa
	       s/$/:/
Packit 1f38fa
	       p
Packit 1f38fa
	     }' "$tmpdepfile" >> "$depfile"
Packit 1f38fa
  else
Packit 1f38fa
    echo "#dummy" > "$depfile"
Packit 1f38fa
  fi
Packit 1f38fa
  rm -f "$tmpdepfile" "$tmpdepfile2"
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
tru64)
Packit 1f38fa
   # The Tru64 compiler uses -MD to generate dependencies as a side
Packit 1f38fa
   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
Packit 1f38fa
   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
Packit 1f38fa
   # dependencies in `foo.d' instead, so we check for that too.
Packit 1f38fa
   # Subdirectories are respected.
Packit 1f38fa
   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
Packit 1f38fa
   test "x$dir" = "x$object" && dir=
Packit 1f38fa
   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
Packit 1f38fa
Packit 1f38fa
   if test "$libtool" = yes; then
Packit 1f38fa
      # With Tru64 cc, shared objects can also be used to make a
Packit 1f38fa
      # static library.  This mechanism is used in libtool 1.4 series to
Packit 1f38fa
      # handle both shared and static libraries in a single compilation.
Packit 1f38fa
      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
Packit 1f38fa
      #
Packit 1f38fa
      # With libtool 1.5 this exception was removed, and libtool now
Packit 1f38fa
      # generates 2 separate objects for the 2 libraries.  These two
Packit 1f38fa
      # compilations output dependencies in $dir.libs/$base.o.d and
Packit 1f38fa
      # in $dir$base.o.d.  We have to check for both files, because
Packit 1f38fa
      # one of the two compilations can be disabled.  We should prefer
Packit 1f38fa
      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
Packit 1f38fa
      # automatically cleaned when .libs/ is deleted, while ignoring
Packit 1f38fa
      # the former would cause a distcleancheck panic.
Packit 1f38fa
      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
Packit 1f38fa
      tmpdepfile2=$dir$base.o.d          # libtool 1.5
Packit 1f38fa
      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
Packit 1f38fa
      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
Packit 1f38fa
      "$@" -Wc,-MD
Packit 1f38fa
   else
Packit 1f38fa
      tmpdepfile1=$dir$base.o.d
Packit 1f38fa
      tmpdepfile2=$dir$base.d
Packit 1f38fa
      tmpdepfile3=$dir$base.d
Packit 1f38fa
      tmpdepfile4=$dir$base.d
Packit 1f38fa
      "$@" -MD
Packit 1f38fa
   fi
Packit 1f38fa
Packit 1f38fa
   stat=$?
Packit 1f38fa
   if test $stat -eq 0; then :
Packit 1f38fa
   else
Packit 1f38fa
      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
Packit 1f38fa
      exit $stat
Packit 1f38fa
   fi
Packit 1f38fa
Packit 1f38fa
   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
Packit 1f38fa
   do
Packit 1f38fa
     test -f "$tmpdepfile" && break
Packit 1f38fa
   done
Packit 1f38fa
   if test -f "$tmpdepfile"; then
Packit 1f38fa
      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
Packit 1f38fa
      # That's a tab and a space in the [].
Packit 1f38fa
      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
Packit 1f38fa
   else
Packit 1f38fa
      echo "#dummy" > "$depfile"
Packit 1f38fa
   fi
Packit 1f38fa
   rm -f "$tmpdepfile"
Packit 1f38fa
   ;;
Packit 1f38fa
Packit 1f38fa
msvc7)
Packit 1f38fa
  if test "$libtool" = yes; then
Packit 1f38fa
    showIncludes=-Wc,-showIncludes
Packit 1f38fa
  else
Packit 1f38fa
    showIncludes=-showIncludes
Packit 1f38fa
  fi
Packit 1f38fa
  "$@" $showIncludes > "$tmpdepfile"
Packit 1f38fa
  stat=$?
Packit 1f38fa
  grep -v '^Note: including file: ' "$tmpdepfile"
Packit 1f38fa
  if test "$stat" = 0; then :
Packit 1f38fa
  else
Packit 1f38fa
    rm -f "$tmpdepfile"
Packit 1f38fa
    exit $stat
Packit 1f38fa
  fi
Packit 1f38fa
  rm -f "$depfile"
Packit 1f38fa
  echo "$object : \\" > "$depfile"
Packit 1f38fa
  # The first sed program below extracts the file names and escapes
Packit 1f38fa
  # backslashes for cygpath.  The second sed program outputs the file
Packit 1f38fa
  # name when reading, but also accumulates all include files in the
Packit 1f38fa
  # hold buffer in order to output them again at the end.  This only
Packit 1f38fa
  # works with sed implementations that can handle large buffers.
Packit 1f38fa
  sed < "$tmpdepfile" -n '
Packit 1f38fa
/^Note: including file:  *\(.*\)/ {
Packit 1f38fa
  s//\1/
Packit 1f38fa
  s/\\/\\\\/g
Packit 1f38fa
  p
Packit 1f38fa
}' | $cygpath_u | sort -u | sed -n '
Packit 1f38fa
s/ /\\ /g
Packit 1f38fa
s/\(.*\)/	\1 \\/p
Packit 1f38fa
s/.\(.*\) \\/\1:/
Packit 1f38fa
H
Packit 1f38fa
$ {
Packit 1f38fa
  s/.*/	/
Packit 1f38fa
  G
Packit 1f38fa
  p
Packit 1f38fa
}' >> "$depfile"
Packit 1f38fa
  rm -f "$tmpdepfile"
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
msvc7msys)
Packit 1f38fa
  # This case exists only to let depend.m4 do its work.  It works by
Packit 1f38fa
  # looking at the text of this script.  This case will never be run,
Packit 1f38fa
  # since it is checked for above.
Packit 1f38fa
  exit 1
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
#nosideeffect)
Packit 1f38fa
  # This comment above is used by automake to tell side-effect
Packit 1f38fa
  # dependency tracking mechanisms from slower ones.
Packit 1f38fa
Packit 1f38fa
dashmstdout)
Packit 1f38fa
  # Important note: in order to support this mode, a compiler *must*
Packit 1f38fa
  # always write the preprocessed file to stdout, regardless of -o.
Packit 1f38fa
  "$@" || exit $?
Packit 1f38fa
Packit 1f38fa
  # Remove the call to Libtool.
Packit 1f38fa
  if test "$libtool" = yes; then
Packit 1f38fa
    while test "X$1" != 'X--mode=compile'; do
Packit 1f38fa
      shift
Packit 1f38fa
    done
Packit 1f38fa
    shift
Packit 1f38fa
  fi
Packit 1f38fa
Packit 1f38fa
  # Remove `-o $object'.
Packit 1f38fa
  IFS=" "
Packit 1f38fa
  for arg
Packit 1f38fa
  do
Packit 1f38fa
    case $arg in
Packit 1f38fa
    -o)
Packit 1f38fa
      shift
Packit 1f38fa
      ;;
Packit 1f38fa
    $object)
Packit 1f38fa
      shift
Packit 1f38fa
      ;;
Packit 1f38fa
    *)
Packit 1f38fa
      set fnord "$@" "$arg"
Packit 1f38fa
      shift # fnord
Packit 1f38fa
      shift # $arg
Packit 1f38fa
      ;;
Packit 1f38fa
    esac
Packit 1f38fa
  done
Packit 1f38fa
Packit 1f38fa
  test -z "$dashmflag" && dashmflag=-M
Packit 1f38fa
  # Require at least two characters before searching for `:'
Packit 1f38fa
  # in the target name.  This is to cope with DOS-style filenames:
Packit 1f38fa
  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
Packit 1f38fa
  "$@" $dashmflag |
Packit 1f38fa
    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
Packit 1f38fa
  rm -f "$depfile"
Packit 1f38fa
  cat < "$tmpdepfile" > "$depfile"
Packit 1f38fa
  tr ' ' '
Packit 1f38fa
' < "$tmpdepfile" | \
Packit 1f38fa
## Some versions of the HPUX 10.20 sed can't process this invocation
Packit 1f38fa
## correctly.  Breaking it into two sed invocations is a workaround.
Packit 1f38fa
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
Packit 1f38fa
  rm -f "$tmpdepfile"
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
dashXmstdout)
Packit 1f38fa
  # This case only exists to satisfy depend.m4.  It is never actually
Packit 1f38fa
  # run, as this mode is specially recognized in the preamble.
Packit 1f38fa
  exit 1
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
makedepend)
Packit 1f38fa
  "$@" || exit $?
Packit 1f38fa
  # Remove any Libtool call
Packit 1f38fa
  if test "$libtool" = yes; then
Packit 1f38fa
    while test "X$1" != 'X--mode=compile'; do
Packit 1f38fa
      shift
Packit 1f38fa
    done
Packit 1f38fa
    shift
Packit 1f38fa
  fi
Packit 1f38fa
  # X makedepend
Packit 1f38fa
  shift
Packit 1f38fa
  cleared=no eat=no
Packit 1f38fa
  for arg
Packit 1f38fa
  do
Packit 1f38fa
    case $cleared in
Packit 1f38fa
    no)
Packit 1f38fa
      set ""; shift
Packit 1f38fa
      cleared=yes ;;
Packit 1f38fa
    esac
Packit 1f38fa
    if test $eat = yes; then
Packit 1f38fa
      eat=no
Packit 1f38fa
      continue
Packit 1f38fa
    fi
Packit 1f38fa
    case "$arg" in
Packit 1f38fa
    -D*|-I*)
Packit 1f38fa
      set fnord "$@" "$arg"; shift ;;
Packit 1f38fa
    # Strip any option that makedepend may not understand.  Remove
Packit 1f38fa
    # the object too, otherwise makedepend will parse it as a source file.
Packit 1f38fa
    -arch)
Packit 1f38fa
      eat=yes ;;
Packit 1f38fa
    -*|$object)
Packit 1f38fa
      ;;
Packit 1f38fa
    *)
Packit 1f38fa
      set fnord "$@" "$arg"; shift ;;
Packit 1f38fa
    esac
Packit 1f38fa
  done
Packit 1f38fa
  obj_suffix=`echo "$object" | sed 's/^.*\././'`
Packit 1f38fa
  touch "$tmpdepfile"
Packit 1f38fa
  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
Packit 1f38fa
  rm -f "$depfile"
Packit 1f38fa
  # makedepend may prepend the VPATH from the source file name to the object.
Packit 1f38fa
  # No need to regex-escape $object, excess matching of '.' is harmless.
Packit 1f38fa
  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
Packit 1f38fa
  sed '1,2d' "$tmpdepfile" | tr ' ' '
Packit 1f38fa
' | \
Packit 1f38fa
## Some versions of the HPUX 10.20 sed can't process this invocation
Packit 1f38fa
## correctly.  Breaking it into two sed invocations is a workaround.
Packit 1f38fa
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
Packit 1f38fa
  rm -f "$tmpdepfile" "$tmpdepfile".bak
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
cpp)
Packit 1f38fa
  # Important note: in order to support this mode, a compiler *must*
Packit 1f38fa
  # always write the preprocessed file to stdout.
Packit 1f38fa
  "$@" || exit $?
Packit 1f38fa
Packit 1f38fa
  # Remove the call to Libtool.
Packit 1f38fa
  if test "$libtool" = yes; then
Packit 1f38fa
    while test "X$1" != 'X--mode=compile'; do
Packit 1f38fa
      shift
Packit 1f38fa
    done
Packit 1f38fa
    shift
Packit 1f38fa
  fi
Packit 1f38fa
Packit 1f38fa
  # Remove `-o $object'.
Packit 1f38fa
  IFS=" "
Packit 1f38fa
  for arg
Packit 1f38fa
  do
Packit 1f38fa
    case $arg in
Packit 1f38fa
    -o)
Packit 1f38fa
      shift
Packit 1f38fa
      ;;
Packit 1f38fa
    $object)
Packit 1f38fa
      shift
Packit 1f38fa
      ;;
Packit 1f38fa
    *)
Packit 1f38fa
      set fnord "$@" "$arg"
Packit 1f38fa
      shift # fnord
Packit 1f38fa
      shift # $arg
Packit 1f38fa
      ;;
Packit 1f38fa
    esac
Packit 1f38fa
  done
Packit 1f38fa
Packit 1f38fa
  "$@" -E |
Packit 1f38fa
    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
Packit 1f38fa
       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
Packit 1f38fa
    sed '$ s: \\$::' > "$tmpdepfile"
Packit 1f38fa
  rm -f "$depfile"
Packit 1f38fa
  echo "$object : \\" > "$depfile"
Packit 1f38fa
  cat < "$tmpdepfile" >> "$depfile"
Packit 1f38fa
  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
Packit 1f38fa
  rm -f "$tmpdepfile"
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
msvisualcpp)
Packit 1f38fa
  # Important note: in order to support this mode, a compiler *must*
Packit 1f38fa
  # always write the preprocessed file to stdout.
Packit 1f38fa
  "$@" || exit $?
Packit 1f38fa
Packit 1f38fa
  # Remove the call to Libtool.
Packit 1f38fa
  if test "$libtool" = yes; then
Packit 1f38fa
    while test "X$1" != 'X--mode=compile'; do
Packit 1f38fa
      shift
Packit 1f38fa
    done
Packit 1f38fa
    shift
Packit 1f38fa
  fi
Packit 1f38fa
Packit 1f38fa
  IFS=" "
Packit 1f38fa
  for arg
Packit 1f38fa
  do
Packit 1f38fa
    case "$arg" in
Packit 1f38fa
    -o)
Packit 1f38fa
      shift
Packit 1f38fa
      ;;
Packit 1f38fa
    $object)
Packit 1f38fa
      shift
Packit 1f38fa
      ;;
Packit 1f38fa
    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
Packit 1f38fa
	set fnord "$@"
Packit 1f38fa
	shift
Packit 1f38fa
	shift
Packit 1f38fa
	;;
Packit 1f38fa
    *)
Packit 1f38fa
	set fnord "$@" "$arg"
Packit 1f38fa
	shift
Packit 1f38fa
	shift
Packit 1f38fa
	;;
Packit 1f38fa
    esac
Packit 1f38fa
  done
Packit 1f38fa
  "$@" -E 2>/dev/null |
Packit 1f38fa
  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
Packit 1f38fa
  rm -f "$depfile"
Packit 1f38fa
  echo "$object : \\" > "$depfile"
Packit 1f38fa
  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
Packit 1f38fa
  echo "	" >> "$depfile"
Packit 1f38fa
  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
Packit 1f38fa
  rm -f "$tmpdepfile"
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
msvcmsys)
Packit 1f38fa
  # This case exists only to let depend.m4 do its work.  It works by
Packit 1f38fa
  # looking at the text of this script.  This case will never be run,
Packit 1f38fa
  # since it is checked for above.
Packit 1f38fa
  exit 1
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
none)
Packit 1f38fa
  exec "$@"
Packit 1f38fa
  ;;
Packit 1f38fa
Packit 1f38fa
*)
Packit 1f38fa
  echo "Unknown depmode $depmode" 1>&2
Packit 1f38fa
  exit 1
Packit 1f38fa
  ;;
Packit 1f38fa
esac
Packit 1f38fa
Packit 1f38fa
exit 0
Packit 1f38fa
Packit 1f38fa
# Local Variables:
Packit 1f38fa
# mode: shell-script
Packit 1f38fa
# sh-indentation: 2
Packit 1f38fa
# eval: (add-hook 'write-file-hooks 'time-stamp)
Packit 1f38fa
# time-stamp-start: "scriptversion="
Packit 1f38fa
# time-stamp-format: "%:y-%02m-%02d.%02H"
Packit 1f38fa
# time-stamp-time-zone: "UTC"
Packit 1f38fa
# time-stamp-end: "; # UTC"
Packit 1f38fa
# End: