Blame config/depcomp

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