[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: branch-1_4 - platform recognition macro
From: |
Eric Blake |
Subject: |
Re: branch-1_4 - platform recognition macro |
Date: |
Mon, 03 Jul 2006 07:15:50 -0600 |
User-agent: |
Thunderbird 1.5.0.4 (Windows/20060516) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Eric Blake on 7/2/2006 4:45 PM:
> ...breaks 'make distcheck' because check-them was being executed in a
> read-only directory. I would have noticed sooner, had it not been for a
> cygwin bug that Windows allows the creation of subdirectories (but not
> files) inside a read-only directory. I also figured out why 'make
> installcheck' was not working.
>
> 2006-07-02 Eric Blake <address@hidden>
>
> * checks/Makefile.in (exec_prefix, prefix): New macros, so that
> $(bindir) works in installcheck.
> (check, installcheck): No longer change directory, so that
> distcheck works with a read-only builddir.
> * checks/check-them: Work when pwd is no longer builddir.
>
Still not right; in a VPATH build, included files were not being found.
In the process, I turned the forloop code into actual tests.
2006-07-03 Eric Blake <address@hidden>
Fix 'make check' in VPATH build. All files included by testsuite
now live in a single directory. Use forloop.m4 in testsuite.
* checks/incl.m4, checks/foo, checks/wrapfifo.m4: Move from
here...
* examples/incl.m4, examples/foo, examples/wrapfifo.m4: ...to
here.
* checks/Makefile.in (DISTFILES): Don't distribute moved files.
* examples/Makefile.am (EXTRA_DIST): Distribute new files.
* checks/check-them: Avoid s/// when filename is in pattern.
* examples/forloop.m4: Fix to match documentation.
* doc/m4.texinfo (Include, Undivert, Incompatibilities): Reflect
new locations.
(Loops, Format): Actually use forloop.m4 in tests.
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEqRiG84KuGfSFAYARArfvAKDRT1q33MJjvcLDeJ1ju14a1V4NewCghRJO
dcLWI88lZveZ7S6CLPHhSvo=
=tq/c
-----END PGP SIGNATURE-----
Index: checks/Makefile.in
===================================================================
RCS file: /sources/m4/m4/checks/Attic/Makefile.in,v
retrieving revision 1.1.1.1.2.8
diff -u -p -r1.1.1.1.2.8 Makefile.in
--- checks/Makefile.in 3 Jul 2006 02:36:25 -0000 1.1.1.1.2.8
+++ checks/Makefile.in 3 Jul 2006 13:10:04 -0000
@@ -33,8 +33,7 @@ AWK = @AWK@
# Vern says that the first star is required around an Alpha make bug.
CHECKS = *[0-9][0-9].*
-DISTFILES = Makefile.in get-them check-them stamp-checks \
- incl.m4 foo wrapfifo.m4
+DISTFILES = Makefile.in get-them check-them stamp-checks
all: stamp-checks
Index: checks/check-them
===================================================================
RCS file: /sources/m4/m4/checks/Attic/check-them,v
retrieving revision 1.1.1.1.2.5
diff -u -p -r1.1.1.1.2.5 check-them
--- checks/check-them 3 Jul 2006 02:36:25 -0000 1.1.1.1.2.5
+++ checks/check-them 3 Jul 2006 13:10:04 -0000
@@ -49,7 +49,7 @@ do
continue
fi
- sed -e '/^dnl @result{}/!d' -e 's///' -e "s/m4.input/$file/" $file > $xout
+ sed -e '/^dnl @result{}/!d' -e 's///' -e "s|m4.input|$file|" $file > $xout
if cmp -s $out $xout; then
:
@@ -60,7 +60,7 @@ do
diff $xout $out
fi
- sed -e '/^dnl @error{}/!d' -e 's///' -e "s/m4.input/$file/" \
+ sed -e '/^dnl @error{}/!d' -e 's///' -e "s|m4.input|$file|" \
-e "s| m4:| $m4:|" $file > $xerr
if cmp -s $err $xerr; then
Index: checks/foo
===================================================================
RCS file: checks/foo
diff -N checks/foo
--- checks/foo 17 Feb 2000 03:03:19 -0000 1.1.1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1 +0,0 @@
-bar
Index: checks/incl.m4
===================================================================
RCS file: checks/incl.m4
diff -N checks/incl.m4
--- checks/incl.m4 17 Feb 2000 03:03:19 -0000 1.1.1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
-Include file start
-foo
-Include file end
Index: checks/wrapfifo.m4
===================================================================
RCS file: checks/wrapfifo.m4
diff -N checks/wrapfifo.m4
--- checks/wrapfifo.m4 16 Jun 2006 03:09:14 -0000 1.1.2.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,9 +0,0 @@
-define(`_m4wrap_level', `0')dnl
-define(`m4wrap',
-`ifdef(`m4wrap'_m4wrap_level,
- `define(`m4wrap'_m4wrap_level,
- defn(`m4wrap'_m4wrap_level)`$1')',
- `builtin(`m4wrap', `define(`_m4wrap_level',
- incr(_m4wrap_level))dnl
-m4wrap'_m4wrap_level)dnl
-define(`m4wrap'_m4wrap_level, `$1')')')dnl
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.29
diff -u -p -r1.1.1.1.2.29 m4.texinfo
--- doc/m4.texinfo 30 Jun 2006 18:58:11 -0000 1.1.1.1.2.29
+++ doc/m4.texinfo 3 Jul 2006 13:10:05 -0000
@@ -1629,10 +1629,11 @@ made with @code{shift}, @code{ifelse} an
Here is an example of a loop macro that implements a simple for loop. It
can, for example, be used for simple counting:
address@hidden ignore
@example
+include(`forloop.m4')
address@hidden
forloop(`i', `1', `8', `i ')
address@hidden 2 3 4 5 6 7 8
address@hidden 2 3 4 5 6 7 8 @comment
@end example
The arguments are a name for the iteration variable, the starting value,
@@ -1642,14 +1643,15 @@ the loop, it retains whatever value it m
For-loops can be nested, like
address@hidden ignore
@example
+include(`forloop.m4')
address@hidden
forloop(`i', `1', `4', `forloop(`j', `1', `8', `(i, j) ')
')
address@hidden(1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8)
address@hidden(2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8)
address@hidden(3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8)
address@hidden(4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8)
address@hidden(1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) @comment
address@hidden(2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) @comment
address@hidden(3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) @comment
address@hidden(4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8) @comment
@result{}
@end example
@@ -1664,16 +1666,19 @@ to see if it is finished. If it has not
the iteration variable (using the predefined macro @code{incr},
@pxref{Incr}), and recurses.
-Here is the actual implementation of @code{forloop}:
+Here is the actual implementation of @code{forloop}, distributed as
address@hidden/forloop.m4} in this package:
address@hidden ignore
@example
-define(`forloop',
- `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')')
address@hidden
-define(`_forloop',
- `$4`'ifelse($1, `$3', ,
- `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
+undivert(`forloop.m4')
address@hidden(`-1')
address@hidden forloop(var, from, to, stmt)
address@hidden(`forloop',
address@hidden `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3',
`$4')popdef(`$1')')
address@hidden(`_forloop',
address@hidden `$4`'ifelse($1, `$3', ,
address@hidden `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
address@hidden'dnl
@result{}
@end example
@@ -2365,7 +2370,10 @@ sinclude(`none')
@result{}
@end example
-Assume in the following that the file @file{incl.m4} contains the lines:
+The rest of this section assumes that @code{m4} is invoked with the
address@hidden option pointing to the @file{examples} directory shipped as
+part of the GNU @code{m4} package. The file @file{examples/incl.m4} in
+the distribution contains the lines:
@comment ignore
@example
Include file start
@@ -2602,8 +2610,8 @@ divert`'undivert`'dnl
GNU @code{m4} allows named files to be undiverted. Given a non-numeric
argument, the contents of the file named will be copied, uninterpreted, to
the current output. This complements the builtin @code{include}
-(@pxref{Include}). To illustrate the difference, assume the file
address@hidden contains the word @samp{bar}:
+(@pxref{Include}). To illustrate the difference, the file
address@hidden/foo} contains the word @samp{bar}:
@example
define(`bar', `BAR')
@@ -2978,8 +2986,9 @@ len(format(`%-*X', `300', `1'))
Using the @code{forloop} macro defined in @xref{Loops}, this
example shows how @code{format} can be used to produce tabular output.
address@hidden ignore
@example
+include(`forloop.m4')
address@hidden
forloop(`i', `1', `10', `format(`%6d squared is %10d
', i, eval(i**2))')
@result{} 1 squared is 1
@@ -2992,6 +3001,7 @@ forloop(`i', `1', `10', `format(`%6d squ
@result{} 8 squared is 64
@result{} 9 squared is 81
@result{} 10 squared is 100
address@hidden
@end example
The builtin @code{format} is modeled after the ANSI C @samp{printf}
@@ -3867,10 +3877,11 @@ Furthermore, @acronym{POSIX} states that
processes all arguments, with output separated by spaces.
However, it is possible to emulate @acronym{POSIX} behavior by
-including the sample file @file{wrapfifo.m4}:
+including the file @file{examples/wrapfifo.m4} from the distribution:
@example
undivert(`wrapfifo.m4')dnl
address@hidden Redefine m4wrap to have FIFO semantics.
@result{}define(`_m4wrap_level', `0')dnl
@result{}define(`m4wrap',
@result{}`ifdef(`m4wrap'_m4wrap_level,
Index: examples/Makefile.am
===================================================================
RCS file: /sources/m4/m4/examples/Attic/Makefile.am,v
retrieving revision 1.9.2.1
diff -u -p -r1.9.2.1 Makefile.am
--- examples/Makefile.am 29 May 2006 19:40:03 -0000 1.9.2.1
+++ examples/Makefile.am 3 Jul 2006 13:10:05 -0000
@@ -20,7 +20,8 @@
## This file written by Eric Blake <address@hidden>
EXTRA_DIST = capitalize.m4 comments.m4 ddivert.m4 \
-debug.m4 esyscmd.m4 exp.m4 file.m4 foreach.m4 forloop.m4 fstab.m4 \
-hanoi.m4 incl-test.m4 include.m4 indir.m4 misc.m4 multiquotes.m4 \
+debug.m4 esyscmd.m4 exp.m4 file.m4 foo foreach.m4 forloop.m4 fstab.m4 \
+hanoi.m4 incl.m4 incl-test.m4 include.m4 indir.m4 misc.m4 multiquotes.m4 \
patsubst.m4 pushpop.m4 regexp.m4 reverse.m4 stackovf.sh sync-lines.m4 \
-sysv-args.m4 trace.m4 translit.m4 undivert.incl undivert.m4 wrap.m4
+sysv-args.m4 trace.m4 translit.m4 undivert.incl undivert.m4 wrap.m4 \
+wrapfifo.m4
Index: examples/foo
===================================================================
RCS file: examples/foo
diff -N examples/foo
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ examples/foo 3 Jul 2006 13:10:05 -0000
@@ -0,0 +1 @@
+bar
Index: examples/forloop.m4
===================================================================
RCS file: /sources/m4/m4/examples/forloop.m4,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 forloop.m4
--- examples/forloop.m4 17 Feb 2000 03:03:19 -0000 1.1.1.1
+++ examples/forloop.m4 3 Jul 2006 13:10:05 -0000
@@ -1,8 +1,8 @@
-divert(-1)
-# forloop(i, from, to, stmt)
-
-define(`forloop', `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3',
`$4')popdef(`$1')')
+divert(`-1')
+# forloop(var, from, to, stmt)
+define(`forloop',
+ `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')')
define(`_forloop',
- `$4`'ifelse($1, `$3', ,
- `define(`$1', incr($1))_forloop(`$1', `$2', `$3',
`$4')')')
-divert
+ `$4`'ifelse($1, `$3', ,
+ `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
+divert`'dnl
Index: examples/incl.m4
===================================================================
RCS file: examples/incl.m4
diff -N examples/incl.m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ examples/incl.m4 3 Jul 2006 13:10:05 -0000
@@ -0,0 +1,3 @@
+Include file start
+foo
+Include file end
Index: examples/wrapfifo.m4
===================================================================
RCS file: examples/wrapfifo.m4
diff -N examples/wrapfifo.m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ examples/wrapfifo.m4 3 Jul 2006 13:10:05 -0000
@@ -0,0 +1,10 @@
+dnl Redefine m4wrap to have FIFO semantics.
+define(`_m4wrap_level', `0')dnl
+define(`m4wrap',
+`ifdef(`m4wrap'_m4wrap_level,
+ `define(`m4wrap'_m4wrap_level,
+ defn(`m4wrap'_m4wrap_level)`$1')',
+ `builtin(`m4wrap', `define(`_m4wrap_level',
+ incr(_m4wrap_level))dnl
+m4wrap'_m4wrap_level)dnl
+define(`m4wrap'_m4wrap_level, `$1')')')dnl
- Re: branch-1_4 - platform recognition macro, Andreas Büning, 2006/07/01
- Re: branch-1_4 - platform recognition macro, Eric Blake, 2006/07/01
- Re: branch-1_4 - platform recognition macro, Andreas Büning, 2006/07/01
- Re: branch-1_4 - platform recognition macro, Eric Blake, 2006/07/04
- Re: branch-1_4 - platform recognition macro, Andreas Büning, 2006/07/04
- Re: branch-1_4 - platform recognition macro, Eric Blake, 2006/07/06
- Re: branch-1_4 - platform recognition macro, Andreas Büning, 2006/07/07
- Re: branch-1_4 - platform recognition macro, Eric Blake, 2006/07/11