Re: patch: stamp-h? files in subdirs

2001-01-31 Thread Derek R. Price

Tom Tromey wrote:

> > "Derek" == Derek R Price <[EMAIL PROTECTED]> writes:
>
> Derek> by an automake configure script.  The problem was in
> Derek> AM_CONFIG_HEADERS.  I fixed it, but is dependent on the
> Derek> autoconf beta.
>
> The next automake must be compatible with the old autoconf.  So this
> patch can't go in as-is.
>
> Tom

Ok.  This new patch (attached) does the same thing in shell.  It's not
quite as robust since a configure.in is limited to a single call to
AM_CONFIG_HEADER and no COMMANDS or INIT-CMDS instead of the multiple
calls and shell script hooks like AC_CONFIG_HEADER now allows.

Derek

--
Derek Price  CVS Solutions Architect ( http://CVSHome.org )
mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com )
--
File not found. Should I fake it? (Y/N)




? automake-1.4c-stamph.diff
? automake-1.4c-stamph2.diff
? m4/acheader.m4.sav
? tests/stamph2.test
? tests/dirname.test
Index: ChangeLog
===
RCS file: /cvs/automake/ChangeLog,v
retrieving revision 1.963
diff -u -r1.963 ChangeLog
--- ChangeLog   2001/01/31 04:05:43 1.963
+++ ChangeLog   2001/01/31 22:51:19
@@ -1,3 +1,8 @@
+2001-01-31  Derek Price  <[EMAIL PROTECTED]>
+
+   * m4/header.m4 (AM_CONFIG_HEADER): This macro was broken due to
+   unescaped shell metachars.  also fix stamp-h placement
+
 2001-01-30  Tom Tromey  <[EMAIL PROTECTED]>
 
* automake.in (scan_one_autoconf_file): Don't mention
Index: m4/header.m4
===
RCS file: /cvs/automake/m4/header.m4,v
retrieving revision 1.7
diff -u -r1.7 header.m4
--- m4/header.m42000/08/06 12:36:53 1.7
+++ m4/header.m42001/01/31 22:51:19
@@ -16,13 +16,23 @@
  [],
  [test -z "$CONFIG_HEADERS" || echo timestamp >dnl
   patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),
-  [am_indx=1
-  for am_file in $1; do
-case " $CONFIG_HEADERS " in
-*" $am_file "*)
-  echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx
-  ;;
-esac
-am_indx=\`expr \$am_indx + 1\`
-  done])
-])
+[am_indx=1
+for am_file in $1; do
+  case " \$CONFIG_HEADERS " in
+  *" \$am_file "*)
+am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\`
+if test -n "\$am_dir"; then
+  am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\`
+  for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do
+am_tmpdir=\$am_tmpdir\$am_subdir/
+if test ! -d \$am_tmpdir; then
+  mkdir \$am_tmpdir
+fi
+  done
+fi
+echo timestamp > "\$am_dir"stamp-h\$am_indx
+;;
+  esac
+  am_indx=\`expr \$am_indx + 1\`
+done])
+]) # AM_CONFIG_HEADER
Index: tests/ChangeLog
===
RCS file: /cvs/automake/tests/ChangeLog,v
retrieving revision 1.326
diff -u -r1.326 ChangeLog
--- tests/ChangeLog 2001/01/29 09:41:43 1.326
+++ tests/ChangeLog 2001/01/31 22:51:20
@@ -1,3 +1,8 @@
+2001-01-31  Derek Price  <[EMAIL PROTECTED]>
+
+   * stamph2.test: new file
+   * Makefile.am (TESTS): Added stamph2.test
+ 
 2001-01-29  Akim Demaille  <[EMAIL PROTECTED]>
 
* check.test: New.
Index: tests/Makefile.am
===
RCS file: /cvs/automake/tests/Makefile.am,v
retrieving revision 1.247
diff -u -r1.247 Makefile.am
--- tests/Makefile.am   2001/01/29 09:41:43 1.247
+++ tests/Makefile.am   2001/01/31 22:51:20
@@ -226,6 +226,7 @@
 spell3.test \
 spelling.test \
 stamph.test \
+stamph2.test \
 stdlib.test \
 subdir.test \
 subdir2.test \
Index: tests/Makefile.in
===
RCS file: /cvs/automake/tests/Makefile.in,v
retrieving revision 1.311
diff -u -r1.311 Makefile.in
--- tests/Makefile.in   2001/01/29 09:41:43 1.311
+++ tests/Makefile.in   2001/01/31 22:51:20
@@ -295,6 +295,7 @@
 spell3.test \
 spelling.test \
 stamph.test \
+stamph2.test \
 stdlib.test \
 subdir.test \
 subdir2.test \
@@ -492,7 +493,7 @@
 info-am install install-am install-data install-data-am install-exec \
 install-exec-am install-strip installcheck installcheck-am installdirs \
 maintainer-clean maintainer-clean-generic mostlyclean \
-mostlyclean-generic tags uninstall uninstall-am
+mostlyclean-generic uninstall uninstall-am
 
 
 distclean-local:
--- /dev/null   Thu Aug 24 05:00:32 2000
+++ tests/stamph2.test  Wed Jan 31 16:14:56 2001
@@ -0,0 +1,29 @@
+#! /bin/sh
+
+# Make sure stamp-h* files are created where we expect
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AC_INIT(Makefile.am)
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AM_CONFIG_HEADER(firstfile.h sdir/secondfile.h thirdfile.h)
+AC_OUTPUT(Makefile)
+END
+
+: > Makefile.am
+mkdir sdir
+: > firstfile.h.in
+: > sdir/secondfile.h.in
+: > thirdfile.h.in
+
+# Fail gracefully if no autoconf.
+(autoconf --version) > /dev/null 2>&1 || exit 77
+

Re: patch: stamp-h? files in subdirs

2001-01-31 Thread Derek R. Price

Tim Van Holder wrote:

> >(_AM_DIRNAME): helper function which basically implements an sh
> >`dirname` in m4
> Only have 1 problem with it: no support for DOS-style paths (and this is
> conveniently not tested in your dirname.test either :-P).

Yeah, sorry.  I noticed that, but I decided that if it was good enough for
AS_DIRNAME it was good enough for _AM_DIRNAME.  I stripped the regex verbatim
from AS_DIRNAME and figured if anyone ever updated AS_DIRNAME someone would
catch _AM_DIRNAME eventually.

Derek

--
Derek Price  CVS Solutions Architect ( http://CVSHome.org )
mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com )
--
I will not drive the principal's car.
I will not drive the principal's car.
I will not drive the principal's car...

  - Bart Simpson on chalkboard, _The Simpsons_







Re: patch: stamp-h? files in subdirs

2001-01-31 Thread Tom Tromey

> "Derek" == Derek R Price <[EMAIL PROTECTED]> writes:

Derek> by an automake configure script.  The problem was in
Derek> AM_CONFIG_HEADERS.  I fixed it, but is dependent on the
Derek> autoconf beta.

The next automake must be compatible with the old autoconf.  So this
patch can't go in as-is.

Tom




RE: patch: stamp-h? files in subdirs

2001-01-31 Thread Tim Van Holder

>(_AM_DIRNAME): helper function which basically implements an sh
>`dirname` in m4
Only have 1 problem with it: no support for DOS-style paths (and this is
conveniently not tested in your dirname.test either :-P).
It's bad enough working on patches for proper DOS/Win support when people
AREN'T adding new incompatible macros :-)
Having said that, I haven't sent in a patch for autoconf's AS_DIRNAME yet,
so I suppose it's my fault. I'll just have to make a patch for both
incarnations now.





Re: patch: stamp-h? files in subdirs

2001-01-31 Thread Derek R. Price

"Derek R. Price" wrote:

> stamp-h? files in subdirs are still being created in the wrong locations
> by an automake configure script.  The problem was in AM_CONFIG_HEADERS.
> I fixed it, but is dependent on the autoconf beta.  Patch attached.
>
> I was thinking of attempting to eliminate the need for the recreation of
> stamp-h? files in the Makefile.in targets, but it looked like a hassle
> to get the quotes right in an m4 macro.  If there's interest in this,
> let me know and I'll spend some more time on it.
>
> * m4/header.m4 (AM_CONFIG_HEADERS): fix stamp-h creation to
> occur in
> the correct locations
> (_AM_DIRNAME): helper function which basically implements an sh
> `dirname` in m4
> * automake.in (scan_one_autoconf_file): change the warning
> exception
> for AC_CONFIG_HEADERS to match the new m4/header.m4
> * stamph2.test: new
> * dirname.test: new

Oh, I also tweaked AM_CONFIG_HEADERS to accept and pass through the same $2 & $3 
arguments that
AC_CONFIG_HEADERS uses (COMMANDS & INIT-CMDS).  Seemed like the right thing to do.

Derek

--
Derek Price  CVS Solutions Architect ( http://CVSHome.org )
mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com )
--
It does me no injury for my neighbor to say there are twenty gods or no god.
It neither picks my pocket nor breaks my leg.

- Thomas Jefferson







patch: stamp-h? files in subdirs

2001-01-31 Thread Derek R. Price

stamp-h? files in subdirs are still being created in the wrong locations
by an automake configure script.  The problem was in AM_CONFIG_HEADERS.
I fixed it, but is dependent on the autoconf beta.  Patch attached.

I was thinking of attempting to eliminate the need for the recreation of
stamp-h? files in the Makefile.in targets, but it looked like a hassle
to get the quotes right in an m4 macro.  If there's interest in this,
let me know and I'll spend some more time on it.

* m4/header.m4 (AM_CONFIG_HEADERS): fix stamp-h creation to
occur in
the correct locations
(_AM_DIRNAME): helper function which basically implements an sh
`dirname` in m4
* automake.in (scan_one_autoconf_file): change the warning
exception
for AC_CONFIG_HEADERS to match the new m4/header.m4
* stamph2.test: new
* dirname.test: new

Derek

--
Derek Price  CVS Solutions Architect ( http://CVSHome.org )
mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com )
--
The cafeteria deep fryer is not a toy.
The cafeteria deep fryer is not a toy.
The cafeteria deep fryer is not a toy...

  - Bart Simpson on chalkboard, _The Simpsons_




? automake-1.4c-stamph.diff
? m4/acheader.m4.sav
? tests/stamph2.test
? tests/dirname.test
Index: ChangeLog
===
RCS file: /cvs/automake/ChangeLog,v
retrieving revision 1.963
diff -u -r1.963 ChangeLog
--- ChangeLog   2001/01/31 04:05:43 1.963
+++ ChangeLog   2001/01/31 19:10:27
@@ -1,3 +1,12 @@
+2001-01-31  Derek Price  <[EMAIL PROTECTED]>
+
+   * m4/header.m4 (AM_CONFIG_HEADERS): fix stamp-h creation to occur in
+   the correct locations
+   (_AM_DIRNAME): helper function which basically implements an sh
+   `dirname` in m4
+   * automake.in (scan_one_autoconf_file): change the warning exception
+   for AC_CONFIG_HEADERS to match the new m4/header.m4
+
 2001-01-30  Tom Tromey  <[EMAIL PROTECTED]>
 
* automake.in (scan_one_autoconf_file): Don't mention
Index: automake.in
===
RCS file: /cvs/automake/automake.in,v
retrieving revision 1.839
diff -u -r1.839 automake.in
--- automake.in 2001/01/31 04:00:45 1.839
+++ automake.in 2001/01/31 19:10:31
@@ -4576,7 +4576,7 @@
# means we are actually scanning AM_CONFIG_HEADER from
# aclocal.m4.
if (/A([CM])_CONFIG_HEADERS?\s*\((.*)\)/
-   && $2 ne '[$1]')
+   && $2 !~ /^_AM_File,/)
{
&am_conf_line_error
($filename, $., "\`automake requires \`AM_CONFIG_HEADER', not 
\`AC_CONFIG_HEADER'")
Index: m4/header.m4
===
RCS file: /cvs/automake/m4/header.m4,v
retrieving revision 1.7
diff -u -r1.7 header.m4
--- m4/header.m42000/08/06 12:36:53 1.7
+++ m4/header.m42001/01/31 19:10:31
@@ -1,3 +1,5 @@
+# AM_CONFIG_HEADER(HEADERS..., [COMMANDS], [INIT-CMDS])
+# -
 # Like AC_CONFIG_HEADER, but automatically create stamp file.
 
 # serial 3
@@ -7,22 +9,33 @@
 # that is generated.  We must strip everything past the first ":",
 # and everything past the last "/".
 
-AC_PREREQ([2.12])
+AC_PREREQ([2.49c])
 
 AC_DEFUN([AM_CONFIG_HEADER],
-[AC_CONFIG_HEADER([$1])
-  AC_OUTPUT_COMMANDS(
-   ifelse(patsubst([$1], [[^ ]], []),
- [],
- [test -z "$CONFIG_HEADERS" || echo timestamp >dnl
-  patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),
-  [am_indx=1
-  for am_file in $1; do
-case " $CONFIG_HEADERS " in
-*" $am_file "*)
-  echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx
-  ;;
-esac
-am_indx=\`expr \$am_indx + 1\`
-  done])
-])
+[dnl init our file count if it isn't already
+m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], 
+[0]))
+dnl prepare to store our destination file list for use in config.status
+AC_FOREACH([_AM_File], [$1],
+   [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*]))
+   m4_define([_AM_Config_Header_Index], 
+m4_incr(_AM_Config_Header_Index))
+   dnl and add it to the list of files AC keeps track of, along
+   dnl with our hook
+   AC_CONFIG_HEADERS(_AM_File,
+dnl COMMANDS, [, INIT-CMDS]
+[# update the timestamp
+echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index["
+][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS
+   m4_popdef([_AM_Dest])])
+]) # AM_CONFIG_HEADER
+
+# _AM_DIRNAME(PATH)
+# -
+# Like AS_DIRNAME, only do it during macro expansion
+AC_DEFUN([_AM_DIRNAME],
+[m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
+m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1,
+  m4_if(m4_regexp([$1], [^/.*]), -1,
+