Blame config/depcomp

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