Install msysDTK-1.0.1
[msysgit.git] / share / aclocal-1.7 / depout.m4
blobf1900e10bf08c8b111dce1fe0a76c49bdaddfa31
1 # Generate code to set up dependency tracking.   -*- Autoconf -*-
3 # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 # 02111-1307, USA.
20 #serial 2
22 # _AM_OUTPUT_DEPENDENCY_COMMANDS
23 # ------------------------------
24 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
25 [for mf in $CONFIG_FILES; do
26   # Strip MF so we end up with the name of the file.
27   mf=`echo "$mf" | sed -e 's/:.*$//'`
28   # Check whether this is an Automake generated Makefile or not.
29   # We used to match only the files named `Makefile.in', but
30   # some people rename them; so instead we look at the file content.
31   # Grep'ing the first line is not enough: some people post-process
32   # each Makefile.in and add a new line on top of each file to say so.
33   # So let's grep whole file.
34   if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
35     dirpart=`AS_DIRNAME("$mf")`
36   else
37     continue
38   fi
39   grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
40   # Extract the definition of DEP_FILES from the Makefile without
41   # running `make'.
42   DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
43   test -z "$DEPDIR" && continue
44   # When using ansi2knr, U may be empty or an underscore; expand it
45   U=`sed -n -e '/^U = / s///p' < "$mf"`
46   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
47   # We invoke sed twice because it is the simplest approach to
48   # changing $(DEPDIR) to its actual value in the expansion.
49   for file in `sed -n -e '
50     /^DEP_FILES = .*\\\\$/ {
51       s/^DEP_FILES = //
52       :loop
53         s/\\\\$//
54         p
55         n
56         /\\\\$/ b loop
57       p
58     }
59     /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
60        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
61     # Make sure the directory exists.
62     test -f "$dirpart/$file" && continue
63     fdir=`AS_DIRNAME(["$file"])`
64     AS_MKDIR_P([$dirpart/$fdir])
65     # echo "creating $dirpart/$file"
66     echo '# dummy' > "$dirpart/$file"
67   done
68 done
69 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
72 # AM_OUTPUT_DEPENDENCY_COMMANDS
73 # -----------------------------
74 # This macro should only be invoked once -- use via AC_REQUIRE.
76 # This code is only required when automatic dependency tracking
77 # is enabled.  FIXME.  This creates each `.P' file that we will
78 # need in order to bootstrap the dependency handling code.
79 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
80 [AC_CONFIG_COMMANDS([depfiles],
81      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
82      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])