Blame SOURCES/libsodium-1.0.18/build-aux/depcomp

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