On Fri, Jul 07, 2000 at 10:01:14AM +0200, Akim Demaille wrote:
: >>>>> "Lars" == Lars J Aas <[EMAIL PROTECTED]> writes:
: Akim> Will you rework your Manhattan?
: Lars> Won't I have to?
:
: Yep, I was afraid you'd let me do that, and I don't have time to.
Well, don't be afraid. Here it is, the continuing saga....
Chapter Two: The Awkimward Way
I rewrote the patch, mostly following Akim's directions,
but I delayed substituting '-' for '$tmp/stdin' until the point
where $ac_given_srcdir is added, which is also the place where
I think the builddir-awareness code will be.
BTW, signed disclaimers from me and Morten Eriksen (mostly
sends in automake patches) for 'the tool trio', are on their
snailmail way to RMS...
Lars J
======================================================================
2000-07-07 Lars J. Aas <[EMAIL PROTECTED]>
* acgeneral.m4 (_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS):
Accept special filename '-' for stdin and stdout.
Index: acgeneral.m4
===================================================================
RCS file: /cvs/autoconf/acgeneral.m4,v
retrieving revision 1.508
diff -u -d -r1.508 acgeneral.m4
--- acgeneral.m4 2000/07/06 16:38:32 1.508
+++ acgeneral.m4 2000/07/07 08:11:17
@@ -4517,9 +4517,13 @@
for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case $ac_file in
- *:*) ac_file_in=`echo "$ac_file" | sed 's%[[^:]]*:%%'`
- ac_file=`echo "$ac_file" | sed 's%:.*%%'` ;;
- *) ac_file_in=$ac_file.in ;;
+ - | *:- | *:-:* ) # input from stdin
+ cat > $tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's%[[^:]]*:%%'`
+ ac_file=`echo "$ac_file" | sed 's%:.*%%'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's%[[^:]]*:%%'`
+ ac_file=`echo "$ac_file" | sed 's%:.*%%'` ;;
+ * ) ac_file_in=$ac_file.in ;;
esac
# Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
@@ -4552,15 +4556,22 @@
esac
])dnl
- echo creating "$ac_file"
- rm -f "$ac_file"
+ if test x"$ac_file" != x-; then
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ fi
configure_input="Generated automatically from `echo $ac_file_in |
sed 's%.*/%%'` by configure."
# Don't redirect the output to AC_FILE directly: use `mv' so that
# updating is atomic, and doesn't need trapping.
ac_file_inputs=`IFS=:
- for f in $ac_file_in; do echo $ac_given_srcdir/$f; done`
+ for f in $ac_file_in; do
+ case "$f" in
+ -) echo $tmp/stdin ;;
+ *) echo $ac_given_srcdir/$f ;;
+ esac
+ done`
for ac_file_input in $ac_file_inputs;
do
test -f "$ac_file_input" ||
@@ -4584,6 +4595,7 @@
])dnl
dnl The parens around the eval prevent an "illegal io" in Ultrix sh.
" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
dnl This would break Makefile dependencies.
dnl if cmp -s $ac_file $tmp/out 2>/dev/null; then
dnl echo "$ac_file is unchanged"
@@ -4591,7 +4603,12 @@
dnl rm -f $ac_file
dnl mv $tmp/out $ac_file
dnl fi
- mv $tmp/out $ac_file
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
ifset([AC_LIST_FILES_COMMANDS],
[ # Run the commands associated with the file.
@@ -4673,15 +4690,24 @@
for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case $ac_file in
- *:*) ac_file_in=`echo "$ac_file" | sed 's%[[^:]]*:%%'`
- ac_file=`echo "$ac_file" | sed 's%:.*%%'` ;;
- *) ac_file_in=$ac_file.in ;;
+ - | *:- | *:-:* ) # input from stdin
+ cat > $tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's%[[^:]]*:%%'`
+ ac_file=`echo "$ac_file" | sed 's%:.*%%'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's%[[^:]]*:%%'`
+ ac_file=`echo "$ac_file" | sed 's%:.*%%'` ;;
+ * ) ac_file_in=$ac_file.in ;;
esac
- echo creating $ac_file
+ test x"$ac_file" = x- || echo creating $ac_file
- ac_file_inputs=`echo "$ac_file_in" |
- sed -e "s%^%$ac_given_srcdir/%;s%:% $ac_given_srcdir/%g"`
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case "$f" in
+ -) echo $tmp/stdin ;;
+ *) echo $ac_given_srcdir/$f ;;
+ esac
+ done`
for ac_file_input in $ac_file_inputs;
do
test -f "$ac_file_input" ||
@@ -4689,6 +4715,7 @@
done
# Remove the trailing spaces.
sed -e 's/[[ ]]*$//' $ac_file_inputs >$tmp/in
+ rm -f $tmp/stdin
EOF
@@ -4783,18 +4810,27 @@
dnl Now back to your regularly scheduled config.status.
cat >>$CONFIG_STATUS <<\EOF
- echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h
+ if test x"$ac_file" = x-; then
+ echo "/* Generated automatically by configure. */" >$tmp/config.h
+ else
+ echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h
+ fi
cat $tmp/in >>$tmp/config.h
rm -f $tmp/in
- if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
- echo "$ac_file is unchanged"
- else
- ac_dir=`_AC_SHELL_DIRNAME("$ac_file")`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- AC_SHELL_MKDIR_P("$ac_dir")
+ if test x"$ac_file" != x-; then
+ if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ else
+ ac_dir=`_AC_SHELL_DIRNAME("$ac_file")`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ AC_SHELL_MKDIR_P("$ac_dir")
+ fi
+ rm -f $ac_file
+ mv $tmp/config.h $ac_file
fi
- rm -f $ac_file
- mv $tmp/config.h $ac_file
+ else
+ cat $tmp/config.h
+ rm -f $tmp/config.h
fi
ifset([AC_LIST_HEADERS_COMMANDS],
[ # Run the commands associated with the file.