| This may look like a medium-sized patch (requiring forms to be signed),
| but it's mostly indentation changes.
Alexandre can judge, I can't.
| 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
Gross :( What is important is the new syntax, but I suppose you do
support it:
./config.status --file=-
and
./config.status --file=-:file.in
Hm, according to your code you do. Do we want things like:
./config.status --file=file:file.in:-
| 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
In fact I don't understand why you prefer to have ac_file= instead of
keeping ac_file=-?
| - # 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
if test x"$ac_file" != x; then
| + # 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
Likewise.
The same comments apply for the HEADER part.
Remember you now have a tmpdir in which you can do whatever you want
to. In particular you could handle the issue of stdin as input file
as: (I am not changing anything to option handing, so CONFIG_FILES may
have -, -:file.in, file:-, file:-:file.in etc.)
cat >>$CONFIG_STATUS <<\EOF
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
*:- | *:-:*)
cat >$tmpdir/stdin.in
ac_file_in=`echo "$ac_file" |
sed -e "s,:-$,:$tmp/stdin.in,"
-e "s,:-:,:$tmp/stdin.in:,"
-e 's%[[^:]]*:%%'`
*:*) ac_file_in=`echo "$ac_file" | sed 's%[[^:]]*:%%'`
ac_file=`echo "$ac_file" | sed 's%:.*%%'` ;;
*) ac_file_in=$ac_file.in ;;
esac
And the rest works alone:
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 ac_file_input in $ac_file_inputs;
do
test -f "$ac_file_input" ||
AC_MSG_ERROR(cannot find input file `$ac_file_input')
done
EOF