Cope with whitespace in $MISSING and $install_sh.
[automake/ericb.git] / m4 / depout.m4
blob3f5d6cf1a5437a9109b7288d91999430cf7ddda9
1 # Generate code to set up dependency tracking.              -*- Autoconf -*-
3 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
4 # Free Software Foundation, Inc.
6 # This file is free software; the Free Software Foundation
7 # gives unlimited permission to copy and/or distribute it,
8 # with or without modifications, as long as this notice is preserved.
10 #serial 4
12 # _AM_OUTPUT_DEPENDENCY_COMMANDS
13 # ------------------------------
14 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
15 [# Autoconf 2.62 quotes --file arguments for eval, but not when files
16 # are listed without --file.  Let's play safe and only enable the eval
17 # if we detect the quoting.
18 case $CONFIG_FILES in
19 *\'*) eval set x "$CONFIG_FILES" ;;
20 *)   set x $CONFIG_FILES ;;
21 esac
22 shift
23 for mf
25   # Strip MF so we end up with the name of the file.
26   mf=`echo "$mf" | sed -e 's/:.*$//'`
27   # Check whether this is an Automake generated Makefile or not.
28   # We used to match only the files named `Makefile.in', but
29   # some people rename them; so instead we look at the file content.
30   # Grep'ing the first line is not enough: some people post-process
31   # each Makefile.in and add a new line on top of each file to say so.
32   # Grep'ing the whole file is not good either: AIX grep has a line
33   # limit of 2048, but all sed's we know have understand at least 4000.
34   if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
35     dirpart=`AS_DIRNAME("$mf")`
36   else
37     continue
38   fi
39   # Extract the definition of DEPDIR, am__include, and am__quote
40   # from the Makefile without running `make'.
41   DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
42   test -z "$DEPDIR" && continue
43   am__include=`sed -n 's/^am__include = //p' < "$mf"`
44   test -z "am__include" && continue
45   am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
46   # When using ansi2knr, U may be empty or an underscore; expand it
47   U=`sed -n 's/^U = //p' < "$mf"`
48   # Find all dependency output files, they are included files with
49   # $(DEPDIR) in their names.  We invoke sed twice because it is the
50   # simplest approach to changing $(DEPDIR) to its actual value in the
51   # expansion.
52   for file in `sed -n "
53     s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
54        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
55     # Make sure the directory exists.
56     test -f "$dirpart/$file" && continue
57     fdir=`AS_DIRNAME(["$file"])`
58     AS_MKDIR_P([$dirpart/$fdir])
59     # echo "creating $dirpart/$file"
60     echo '# dummy' > "$dirpart/$file"
61   done
62 done
63 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
66 # AM_OUTPUT_DEPENDENCY_COMMANDS
67 # -----------------------------
68 # This macro should only be invoked once -- use via AC_REQUIRE.
70 # This code is only required when automatic dependency tracking
71 # is enabled.  FIXME.  This creates each `.P' file that we will
72 # need in order to bootstrap the dependency handling code.
73 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
74 [AC_CONFIG_COMMANDS([depfiles],
75      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
76      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])