Blame depcomp

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