* tests/base.m4 (m4_wrap, AC_REQUIRE, AC_SHELL_MKDIR_P): Use it.
* autoconf.sh: Properly handle the case where `$output' is `-'
(i.e., stdout).
Handle `-ofile', not only `-o file'.
+2000-07-10 Akim Demaille <akim@epita.fr>
+
+ * acgeneral.m4 (AC_PLAIN_SCRIPT): New macro.
+ * tests/base.m4 (m4_wrap, AC_REQUIRE, AC_SHELL_MKDIR_P): Use it.
+ * autoconf.sh: Properly handle the case where `$output' is `-'
+ (i.e., stdout).
+ Handle `-ofile', not only `-o file'.
+
2000-07-10 Akim Demaille <akim@epita.fr>
* autoreconf.sh: Formatting changes.
])
+# AC_PLAIN_SCRIPT
+# ------------
+# Simulate AC_INIT, i.e., pretend this is the beginning of the `configure'
+# generation. This is used by some tests, and let `autoconf' be used to
+# generate other scripts than `configure'.
+define([AC_PLAIN_SCRIPT],
+[AC_DIVERT_POP()])
+
+
## ----------------------------- ##
## Selecting optional features. ##
## ----------------------------- ##
--output=* )
outfile=`echo "$1" | sed -e 's/^[^=]*=//'`
shift ;;
+ -o* )
+ outfile=`expr "$1" : '-o\(.*\)'`
+ shift ;;
--warnings | -W )
test $# = 1 && eval "$exit_missing_arg"
# Find the input file.
case $# in
0) infile=configure.in
- test $task = script && test "x$outfile" = x && outfile=configure;;
+ test $task = script && test -z "$outfile" && outfile=configure;;
1) infile=$1 ;;
*) exec >&2
echo "$me: invalid number of arguments."
exit 1 ;;
esac
+# Unless specified, the output is stdout.
+test -z "$outfile" && outfile=-
+
# We need an actual file.
if test z$infile = z-; then
infile=$tmp/stdin
# Output is produced into FD 4. Prepare it.
case "x$outfile" in
- x- | x ) # Output to stdout
+ x-) # Output to stdout
exec 4>&1 ;;
* )
exec 4>$outfile;;
status=1
fi
- if test -n "$outfile"; then
+ if test "x$outfile" != x-; then
chmod +x $outfile
fi
--output=* )
outfile=`echo "$1" | sed -e 's/^[^=]*=//'`
shift ;;
+ -o* )
+ outfile=`expr "$1" : '-o\(.*\)'`
+ shift ;;
--warnings | -W )
test $# = 1 && eval "$exit_missing_arg"
# Find the input file.
case $# in
0) infile=configure.in
- test $task = script && test "x$outfile" = x && outfile=configure;;
+ test $task = script && test -z "$outfile" && outfile=configure;;
1) infile=$1 ;;
*) exec >&2
echo "$me: invalid number of arguments."
exit 1 ;;
esac
+# Unless specified, the output is stdout.
+test -z "$outfile" && outfile=-
+
# We need an actual file.
if test z$infile = z-; then
infile=$tmp/stdin
# Output is produced into FD 4. Prepare it.
case "x$outfile" in
- x- | x ) # Output to stdout
+ x-) # Output to stdout
exec 4>&1 ;;
* )
exec 4>$outfile;;
status=1
fi
- if test -n "$outfile"; then
+ if test "x$outfile" != x-; then
chmod +x $outfile
fi
--output=* )
outfile=`echo "$1" | sed -e 's/^[^=]*=//'`
shift ;;
+ -o* )
+ outfile=`expr "$1" : '-o\(.*\)'`
+ shift ;;
--warnings | -W )
test $# = 1 && eval "$exit_missing_arg"
# Find the input file.
case $# in
0) infile=configure.in
- test $task = script && test "x$outfile" = x && outfile=configure;;
+ test $task = script && test -z "$outfile" && outfile=configure;;
1) infile=$1 ;;
*) exec >&2
echo "$me: invalid number of arguments."
exit 1 ;;
esac
+# Unless specified, the output is stdout.
+test -z "$outfile" && outfile=-
+
# We need an actual file.
if test z$infile = z-; then
infile=$tmp/stdin
# Output is produced into FD 4. Prepare it.
case "x$outfile" in
- x- | x ) # Output to stdout
+ x-) # Output to stdout
exec 4>&1 ;;
* )
exec 4>$outfile;;
status=1
fi
- if test -n "$outfile"; then
+ if test "x$outfile" != x-; then
chmod +x $outfile
fi
])
+# AC_PLAIN_SCRIPT
+# ------------
+# Simulate AC_INIT, i.e., pretend this is the beginning of the `configure'
+# generation. This is used by some tests, and let `autoconf' be used to
+# generate other scripts than `configure'.
+define([AC_PLAIN_SCRIPT],
+[AC_DIVERT_POP()])
+
+
## ----------------------------- ##
## Selecting optional features. ##
## ----------------------------- ##
# commas are not swallowed. This can easily happen because of
# m4-listification.
-AT_DATA(libm4.in,
-[[include(libm4.m4)divert(0)dnl
+AT_DATA(configure.in,
+[[AC_PLAIN_SCRIPT()dnl
m4_wrap([Short string */], [ ], [/* ], 20)
m4_wrap([Much longer string */], [ ], [/* ], 20)
First, second , third, [,quoted]
]])
-AT_CHECK([$M4 -I $at_top_srcdir libm4.in], 0, expout)
+AT_CHECK([../autoconf -m .. -l $at_srcdir -o-], 0, expout)
AT_CLEANUP()
[REQUIRE_AND_CHECK([TEST2a])
test3=set])
-AC_DIVERT_POP()
+AC_PLAIN_SCRIPT
TEST1
test -z "$test1" && exit 1
exit 0
AT_SETUP(AC_SHELL_MKDIR_P)
AT_DATA(configure.in,
-[[AC_DIVERT_POP()
+[[AC_PLAIN_SCRIPT
pwd=`pwd`
set -e
# Absolute