Blame config/depcomp

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