Blame config.aux/depcomp

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