This may look like a medium-sized patch (requiring forms to be signed),
but it's mostly indentation changes.
What stdin/stdout support does is that it allows me to pipe config.status
to itself so I can have a file be both of the CONFIG_FILE type and the
CONFIG_HEADER type.
Sample usages:
cat file.in | CONFIG_HEADERS= CONFIG_FILES=- config.status | \
CONFIG_HEADERS=- CONFIG_FILES= config.status > file
or like this
CONFIG_HEADERS= CONFIG_FILES=-:file.in config.status | \
CONFIG_HEADERS=file:- CONFIG_FILES= config.status
ChangeLog entry:
2000-07-06 Lars J. Aas <[EMAIL PROTECTED]>
* acgeneral.m4 (_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS):
Accept stdin as input source and stdout as output destination
through the use of the special file '-'.
Index: acgeneral.m4
===================================================================
RCS file: /cvs/autoconf/acgeneral.m4,v
retrieving revision 1.507
diff -u -r1.507 acgeneral.m4
--- acgeneral.m4 2000/07/06 13:05:47 1.507
+++ acgeneral.m4 2000/07/06 15:26:17
@@ -4517,33 +4517,40 @@
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= ac_file= ;;
+ -:-) ac_file_in= ac_file= ;;
+ -:*) ac_file_in=`echo "$ac_file" | sed 's/^..//'` ac_file= ;;
+ *:-) ac_file_in= 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 ;;
+ *) ac_file_in=$ac_file.in ;;
esac
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
- ac_dir=`_AC_SHELL_DIRNAME("$ac_file")`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- AC_SHELL_MKDIR_P("$ac_dir")
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo "$ac_dir_suffix" | sed 's%/[[^/]]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
+ # is output going to a file?
+ if test x"$ac_file" = x; then :; else
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+ ac_dir=`_AC_SHELL_DIRNAME("$ac_file")`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ AC_SHELL_MKDIR_P("$ac_dir")
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo "$ac_dir_suffix" | sed 's%/[[^/]]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
- case $ac_given_srcdir in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots | sed 's%/$%%'`; fi ;;
- [[\\/]]* | ?:[[\\/]]* )
- srcdir=$ac_given_srcdir$ac_dir_suffix;
- top_srcdir=$ac_given_srcdir ;;
- *) # Relative path.
- srcdir=$ac_dots$ac_given_srcdir$ac_dir_suffix
- top_srcdir=$ac_dots$ac_given_srcdir ;;
- esac
+ case $ac_given_srcdir in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots | sed 's%/$%%'`; fi ;;
+ [[\\/]]* | ?:[[\\/]]* )
+ srcdir=$ac_given_srcdir$ac_dir_suffix;
+ top_srcdir=$ac_given_srcdir ;;
+ *) # Relative path.
+ srcdir=$ac_dots$ac_given_srcdir$ac_dir_suffix
+ top_srcdir=$ac_dots$ac_given_srcdir ;;
+ esac
+ fi
AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
[ case $ac_given_INSTALL in
@@ -4551,11 +4558,19 @@
*) INSTALL=$ac_dots$ac_given_INSTALL ;;
esac
])dnl
+
+ # don't make noise on stdout if output goes there
+ if test x"$ac_file" = x; then :; else
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ fi
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in |
- sed 's%.*/%%'` by configure."
+ if test x"$ac_file_in" = x; then
+ configure_input="Generated automatically from stdin by configure."
+ else
+ configure_input="Generated automatically from `echo $ac_file_in |
+ sed 's%.*/%%'` by configure."
+ fi
# Don't redirect the output to AC_FILE directly: use `mv' so that
# updating is atomic, and doesn't need trapping.
@@ -4591,7 +4606,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
+ cat $tmp/out
+ rm -f $tmp/out
+ else
+ mv $tmp/out $ac_file
+ fi
ifset([AC_LIST_FILES_COMMANDS],
[ # Run the commands associated with the file.
@@ -4673,15 +4693,21 @@
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= ac_file_in= ;;
+ -:-) ac_file= ac_file_in= ;;
+ -:*) ac_file_in=`echo "$ac_file" | sed 's/^..//'` ac_file= ;;
+ *:-) ac_file_in= 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 ;;
+ *) 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"`
+ if test x"$ac_file_in" = x; then :; else
+ ac_file_inputs=`echo "$ac_file_in" |
+ sed -e "s%^%$ac_given_srcdir/%;s%:% $ac_given_srcdir/%g"`
+ fi
for ac_file_input in $ac_file_inputs;
do
test -f "$ac_file_input" ||
@@ -4783,18 +4809,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"
+ if test x"$ac_file" = x; then
+ cat $tmp/config.h
+ rm -f $tmp/config.h
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 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
fi
ifset([AC_LIST_HEADERS_COMMANDS],
[ # Run the commands associated with the file.