1 # Like AC_CONFIG_HEADER, but automatically create stamp file.
5 # When config.status generates a header, we must update the stamp-h file.
6 # This file resides in the same directory as the config header
7 # that is generated. We must strip everything past the first ":",
8 # and everything past the last "/".
12 AC_DEFUN([AM_CONFIG_HEADER],
13 [ifdef([AC_FOREACH],dnl
14 [dnl init our file count if it isn't already
15 m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0]))
16 dnl prepare to store our destination file list for use in config.status
17 AC_FOREACH([_AM_File], [$1],
18 [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*]))
19 m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index))
20 dnl and add it to the list of files AC keeps track of, along
22 AC_CONFIG_HEADERS(_AM_File,
23 dnl COMMANDS, [, INIT-CMDS]
24 [# update the timestamp
25 echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index["
26 ][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS
27 m4_popdef([_AM_Dest])])],dnl
28 [AC_CONFIG_HEADER([$1])
30 ifelse(patsubst([$1], [[^ ]], []),
32 [test -z "$CONFIG_HEADERS" || echo timestamp >dnl
33 patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl
36 case " \$CONFIG_HEADERS " in
38 am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\`
39 if test -n "\$am_dir"; then
40 am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\`
41 for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do
42 am_tmpdir=\$am_tmpdir\$am_subdir/
43 if test ! -d \$am_tmpdir; then
48 echo timestamp > "\$am_dir"stamp-h\$am_indx
51 am_indx=\`expr \$am_indx + 1\`
53 ])]) # AM_CONFIG_HEADER
57 # Like AS_DIRNAME, only do it during macro expansion
58 AC_DEFUN([_AM_DIRNAME],
59 [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
60 m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1,
61 m4_if(m4_regexp([$1], [^/.*]), -1,
63 m4_patsubst([$1], [^\(/\).*], [\1])),
64 m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])),
65 m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl