source: trunk/grep/m4/header.m4@ 3003

Last change on this file since 3003 was 2557, checked in by bird, 19 years ago

grep 2.5.1a

File size: 2.3 KB
Line 
1# Like AC_CONFIG_HEADER, but automatically create stamp file.
2
3# serial 3
4
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 "/".
9
10AC_PREREQ([2.12])
11
12AC_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
21 dnl with our hook
22 AC_CONFIG_HEADERS(_AM_File,
23dnl COMMANDS, [, INIT-CMDS]
24[# update the timestamp
25echo 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])
29 AC_OUTPUT_COMMANDS(
30 ifelse(patsubst([$1], [[^ ]], []),
31 [],
32 [test -z "$CONFIG_HEADERS" || echo timestamp >dnl
33 patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl
34[am_indx=1
35for am_file in $1; do
36 case " \$CONFIG_HEADERS " in
37 *" \$am_file "*)
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
44 mkdir \$am_tmpdir
45 fi
46 done
47 fi
48 echo timestamp > "\$am_dir"stamp-h\$am_indx
49 ;;
50 esac
51 am_indx=\`expr \$am_indx + 1\`
52done])
53])]) # AM_CONFIG_HEADER
54
55# _AM_DIRNAME(PATH)
56# -----------------
57# Like AS_DIRNAME, only do it during macro expansion
58AC_DEFUN([_AM_DIRNAME],
59 [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
60 m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1,
61 m4_if(m4_regexp([$1], [^/.*]), -1,
62 [.],
63 m4_patsubst([$1], [^\(/\).*], [\1])),
64 m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])),
65 m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl
66]) # _AM_DIRNAME
Note: See TracBrowser for help on using the repository browser.