]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
support alternate input file names
authorDavid MacKenzie <djm@djmnet.org>
Tue, 9 Aug 1994 18:35:50 +0000 (18:35 +0000)
committerDavid MacKenzie <djm@djmnet.org>
Tue, 9 Aug 1994 18:35:50 +0000 (18:35 +0000)
14 files changed:
Makefile.in
NEWS
TODO
acgeneral.m4
autoconf.in
autoconf.sh
autoconf.texi
autoheader.in
autoheader.sh
bin/autoconf.in
bin/autoheader.in
doc/Makefile.in
doc/autoconf.texi
lib/autoconf/general.m4

index e46e545dcd386f5216dcf5cdbe9dac7ed770993f..2c58c59c75df73a8aaa32b6aac6f1f5adbb845a9 100644 (file)
@@ -52,7 +52,8 @@ SUBDIRS = testsuite
 # Files that can be generated, but should be up to date for a distribution.
 DISTDEP = info Makefile
 # Files to distribute.
-DISTFILES = COPYING ChangeLog INSTALL Makefile.in NEWS README TODO \
+DISTFILES = COPYING ChangeLog ChangeLog.1 INSTALL Makefile.in NEWS \
+       README TODO \ 
        acconfig.h acfunctions acgeneral.m4 acheaders acidentifiers \
        acmakevars acoldnames.m4 acprograms acspecific.m4 autoconf.info* \
        autoconf.sh autoconf.texi install.texi \
diff --git a/NEWS b/NEWS
index 6166bd641906f67a7a675b61677f9aad4b8de171..467b29fc99556ed96023fde1edd0f5935c1f7312 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,7 @@ Major changes in release 2.0:
   files when they are not enclosed in @ signs.
 * AC_OUTPUT allows the optional environment variable CONFIG_STATUS to
   override the file name "config.status".
+* AC_OUTPUT and AC_CONFIG_HEADER allow you to override the input-file names.
 * AC_PROG_INSTALL looks for install.sh in the directory specified by
   AC_CONFIG_AUXDIR, or srcdir or srcdir/.. or srcdir/../.. by default.
 
@@ -43,6 +44,9 @@ Major changes in release 2.0:
   configure. 
 * ifnames to list the symbols used in #if and #ifdef directives in a
   source tree.
+
+* Changed utilities:
+* autoheader can take pieces of acconfig.h to replace config.h.{top,bot}.
 \f
 Major changes in release 1.11:
 
diff --git a/TODO b/TODO
index 78905ddfe639d469aa9a7e4435888ce8134269e0..809885a60d1d89cbc61fd30e6d2fbb1da53557e1 100644 (file)
--- a/TODO
+++ b/TODO
@@ -6,11 +6,6 @@ Required for 2.0:
 
 ------------------------------------------------------------------------------
 
-* Support AC_OUTPUT and AC_CONFIG_HEADER creating FILE from other than FILE.in.
-(Design is a problem; might not do it.)
-
-------------------------------------------------------------------------------
-
 * Add AC_{INCLUDE,LIB}_DIR?  (Noah Friedman's suggestion.)
 
 ------------------------------------------------------------------------------
@@ -19,13 +14,6 @@ Required for 2.0:
 
 ------------------------------------------------------------------------------
 
-* Integrate aclocal.m4, config.h.top, config.h.bot, config.h.in (?).
-Make autoheader search the resulting file.  Use @DEFS@ (?) to
-indicate where autoheader should insert its stuff, defaulting to the
-end.
-
-------------------------------------------------------------------------------
-
 * Document chapter addressing misconceptions.
 
 ------------------------------------------------------------------------------
index d6c345d093201df37b61e681639375fe61255f91..a17c65bd69e89fdb29eeee3892f2e63794deb37f 100644 (file)
@@ -26,6 +26,9 @@ undefine([include])dnl
 undefine([shift])dnl
 undefine([format])dnl
 dnl
+dnl Some old m4's don't support m4exit.  But they provide
+dnl equivalent functionality by core dumping because of the
+dnl long macros we define.
 ifdef([__gnu__], , [errprint(Autoconf requires GNU m4.
 Install it before installing Autoconf or set the
 M4 environment variable to its path name.
@@ -1446,6 +1449,13 @@ ac_given_INSTALL=$INSTALL
 
 CONFIG_FILES=${CONFIG_FILES-"$1"}
 for ac_file in .. ${CONFIG_FILES}; do if test "x$ac_file" != x..; then
+  # Support "outfile[: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" ;;
+  esac
+
   # Remove last slash and all that follows it.  Not all systems have dirname.
 changequote(, )dnl
   ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
@@ -1481,7 +1491,7 @@ changequote([, ])dnl
 
   echo creating "$ac_file"
   rm -f "$ac_file"
-  comment_str="Generated automatically from `echo $ac_file|sed 's|.*/||'`.in by configure."
+  comment_str="Generated automatically from `echo $ac_file_in|sed 's|.*/||'` by configure."
   case "$ac_file" in
     *.c | *.h | *.C | *.cc | *.m )
     ac_comsub="1i\\
@@ -1508,7 +1518,7 @@ dnl Shell code in configure.in might set extrasub.
 $extrasub
 dnl Insert the sed substitutions.
 undivert(AC_DIVERSION_SED)dnl
-" $ac_given_srcdir/${ac_file}.in > $ac_file
+" $ac_given_srcdir/$ac_file_in > $ac_file
 fi; done
 ifdef([AC_LIST_HEADERS], [AC_OUTPUT_HEADER(AC_LIST_HEADERS)])dnl
 ifdef([AC_LIST_LINKS], [AC_OUTPUT_LINKS(AC_LIST_LINKS, AC_LIST_FILES)])dnl
@@ -1599,9 +1609,16 @@ ac_max_sed_lines=20
 
 CONFIG_HEADERS=${CONFIG_HEADERS-"$1"}
 for ac_file in .. ${CONFIG_HEADERS}; do if test "x$ac_file" != x..; then
+  # Support "outfile[: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" ;;
+  esac
+
   echo creating $ac_file
 
-  cp $ac_given_srcdir/$ac_file.in conftest.h1
+  cp $ac_given_srcdir/$ac_file_in conftest.h1
   cp conftest.sed conftest.stm
   while :
   do
index 0cb5859d40a5dd5ece66d5688ec3a7633d8088d6..2316bbb74882420b756c82e2bc1b0b8cab7cba61 100644 (file)
@@ -95,7 +95,7 @@ test -r ${AC_MACRODIR}/aclocal.m4 &&
 test -r aclocal.m4 && MACROFILES="${MACROFILES} aclocal.m4"
 MACROFILES="${print_version} ${MACROFILES} ${infile}"
 
-$M4 $MACROFILES > $tmpout || { st=$?; rm -f $tmpin $tmpout; exit $st; }
+$M4 $MACROFILES > $tmpout || { rm -f $tmpin $tmpout; exit 2; }
 
 if test -n "$print_version"; then
   cat $tmpout
index 0cb5859d40a5dd5ece66d5688ec3a7633d8088d6..2316bbb74882420b756c82e2bc1b0b8cab7cba61 100644 (file)
@@ -95,7 +95,7 @@ test -r ${AC_MACRODIR}/aclocal.m4 &&
 test -r aclocal.m4 && MACROFILES="${MACROFILES} aclocal.m4"
 MACROFILES="${print_version} ${MACROFILES} ${infile}"
 
-$M4 $MACROFILES > $tmpout || { st=$?; rm -f $tmpin $tmpout; exit $st; }
+$M4 $MACROFILES > $tmpout || { rm -f $tmpin $tmpout; exit 2; }
 
 if test -n "$print_version"; then
   cat $tmpout
index ea6456ea10b7a646988e9806ba799d94f42f22a3..8a6272437d9fa308e35d2c93fe22ea73bb156998 100644 (file)
@@ -322,9 +322,9 @@ Autoconf input file (@file{configure.in}) and run Autoconf on it to
 produce the script.  If you write your own feature tests to supplement
 those that come with Autoconf, you might also write a file called
 @file{aclocal.m4}.  If you use a C header file to contain @code{#define}
-directives, you might also write @file{config.h.top},
-@file{config.h.bot}, and @file{acconfig.h}, and you will distribute the
-Autoconf-generated file @file{config.h.in} with the package.
+directives, you might also write @file{acconfig.h}, @file{config.h.top},
+and @file{config.h.bot}, and you will distribute the Autoconf-generated
+file @file{config.h.in} with the package.
 
 Here is a diagram showing how the files that can be used in
 configuration are produced.  Programs that are executed are suffixed by
@@ -490,12 +490,22 @@ or @code{AC_CHECK_LIB},
 rather than copying them from a file, since the possible symbols are
 effectively limitless.
 
-The file that @code{autoheader} creates usually contains only
-@code{#define} and @code{#undef} statements and their accompanying
-comments.  However, if a file called @file{@var{file}.top} (typically
-@file{config.h.top}) exists in the current directory, @code{autoheader}
-copies that file to the beginning of its output.  Similarly, if
-@file{@var{file}.bot} exists, it copies that file to the end of its output.
+The file that @code{autoheader} creates contains mainly @code{#define}
+and @code{#undef} statements and their accompanying comments.  If
+@file{./acconfig.h} contains the string @samp{@@TOP@@},
+@code{autoheader} copies the lines before the line containing
+@samp{@@TOP@@} into the top of the file that it generates.  Similarly,
+if @file{./acconfig.h} contains the string @samp{@@BOTTOM@@},
+@code{autoheader} copies the lines after that line to the end of the
+file it generates.  Either of those strings may be omitted.
+
+An obsolete way to produce the same effect is to create the files
+@file{@var{file}.top} (typically @file{config.h.top}) and/or
+@file{@var{file}.bot} in the current directory.  If they exist,
+@code{autoheader} copies them to the beginning and end, respectively, of
+its output.  Their use is discouraged because they have file names that
+contain two periods, and so can not be stored on MS-DOS; also, they are
+two more files to clutter up the directory.
 
 If you give @code{autoheader} an argument, it uses that file instead of
 @file{configure.in} and writes the header file to the standard output
@@ -1751,15 +1761,23 @@ to what @code{AC_OUTPUT} would put in it, it is left alone.  Doing this
 allows some changes in configuration without needlessly causing object
 files that depend on the header file to be recompiled.
 
-Your distribution should contain a file @file{@var{header-to-create}.in}
+Your distribution should contain an input file
 that looks as you want the final header file to look, including
 comments, with default values in the @code{#define} statements.  A
 default value can be to @code{#undef} the variable instead of to define
 it to a value, if your code tests for configuration options using
-@code{#ifdef} instead of @code{#if}.
+@code{#ifdef} instead of @code{#if}.  Usually this input file is named
+@file{@var{header-to-create}.in}; however, you can override the input file
+name by appending it to @var{header-to-create}, separated by a colon.
+For example,
+@example
+AC_CONFIG_HEADER(defines.h:defines.hin)
+@end example
+@noindent
+Doing this allows you to keep your filenames acceptable to MS-DOS.
 
-You can use the program @code{autoheader} to create
-@file{@var{header-to-create}.in} (@pxref{Invoking autoheader}).
+You can use the program @code{autoheader} to create the input file
+(@pxref{Invoking autoheader}).
 @end defmac
 
 @defmac AC_CONFIG_SUBDIRS (@var{dir} @dots{})
@@ -1795,12 +1813,18 @@ Create output files (typically one or more @file{Makefile}s) and
 create the header file that was named as its argument.  The argument is
 a whitespace-separated list of files to create; if it is omitted, no
 files are created.  @code{AC_OUTPUT} creates each file @file{@var{file}}
-in the list by copying @file{@var{file}.in}, substituting the variable
-values that have been selected by calling @code{AC_SUBST}.  It creates
-the directory that each file is in if it doesn't exist (but not the
-parents of that directory).  A plausible value for the argument to
-@code{AC_OUTPUT} is @samp{Makefile src/Makefile man/Makefile
-X/Imakefile}.
+in the list by copying an input file (by default named
+@file{@var{file}.in}), substituting the variable values that have been
+selected by calling @code{AC_SUBST}.  It creates the directory that each
+file is in if it doesn't exist (but not the parents of that directory).
+A plausible value for the argument to @code{AC_OUTPUT} is @samp{Makefile
+src/Makefile man/Makefile X/Imakefile}.
+
+You can override an input file name by appending it to @var{file},
+separated by a colon.  For example,
+@example
+AC_OUTPUT(Makefile:templates/top.mk lib/Makefile:templates/lib.mk)
+@end example
 
 If you pass @var{extra-cmds}, those commands will be inserted into
 @file{config.status} to be run after all its other processing.
index 9a3c6d8de42508cd956839973011d6f2a32894aa..972def1d3efbf488a9050ff09d1d021e12c04ec4 100644 (file)
@@ -158,11 +158,20 @@ if test $# -eq 0; then
   exec > $tmpout
 fi
 
+# Support "outfile[:infile]", defaulting infile="outfile.in".
+case "$config_h" in
+*:*) config_h_in=`echo "$config_h"|sed 's%.*:%%'`
+     config_h=`echo "$config_h"|sed 's%:.*%%'` ;;
+*) config_h_in="${config_h}.in" ;;
+esac
+
 # Don't write "do not edit" -- it will get copied into the
 # config.h, which it's ok to edit.
-echo "/* ${config_h}.in.  Generated automatically from $infile by autoheader.  */"
+echo "/* ${config_h_in}.  Generated automatically from $infile by autoheader.  */"
 
-test -f ${config_h}.top && cat ${config_h}.top
+test -r ${config_h}.top && cat ${config_h}.top
+test -r acconfig.h && grep @TOP@ acconfig.h >/dev/null &&
+  sed '/@TOP@/,$d' acconfig.h
 
 # This puts each template paragraph on its own line, separated by @s.
 if test -n "$syms"; then
@@ -217,6 +226,8 @@ for lib in `for x in $libs; do echo $x; done | sort | uniq`; do
 #undef HAVE_LIB${sym}"
 done
 
+test -r acconfig.h && grep @BOTTOM@ acconfig.h >/dev/null &&
+  sed '1,/@BOTTOM@/d' acconfig.h
 test -f ${config_h}.bot && cat ${config_h}.bot
 
 status=0
@@ -232,10 +243,10 @@ done
 
 if test $# -eq 0; then
   if test $status -eq 0; then
-    if cmp -s $tmpout ${config_h}.in; then
+    if cmp -s $tmpout ${config_h_in}; then
       rm -f $tmpout
     else
-      mv -f $tmpout ${config_h}.in
+      mv -f $tmpout ${config_h_in}
     fi
   else
     rm -f $tmpout
index 9a3c6d8de42508cd956839973011d6f2a32894aa..972def1d3efbf488a9050ff09d1d021e12c04ec4 100644 (file)
@@ -158,11 +158,20 @@ if test $# -eq 0; then
   exec > $tmpout
 fi
 
+# Support "outfile[:infile]", defaulting infile="outfile.in".
+case "$config_h" in
+*:*) config_h_in=`echo "$config_h"|sed 's%.*:%%'`
+     config_h=`echo "$config_h"|sed 's%:.*%%'` ;;
+*) config_h_in="${config_h}.in" ;;
+esac
+
 # Don't write "do not edit" -- it will get copied into the
 # config.h, which it's ok to edit.
-echo "/* ${config_h}.in.  Generated automatically from $infile by autoheader.  */"
+echo "/* ${config_h_in}.  Generated automatically from $infile by autoheader.  */"
 
-test -f ${config_h}.top && cat ${config_h}.top
+test -r ${config_h}.top && cat ${config_h}.top
+test -r acconfig.h && grep @TOP@ acconfig.h >/dev/null &&
+  sed '/@TOP@/,$d' acconfig.h
 
 # This puts each template paragraph on its own line, separated by @s.
 if test -n "$syms"; then
@@ -217,6 +226,8 @@ for lib in `for x in $libs; do echo $x; done | sort | uniq`; do
 #undef HAVE_LIB${sym}"
 done
 
+test -r acconfig.h && grep @BOTTOM@ acconfig.h >/dev/null &&
+  sed '1,/@BOTTOM@/d' acconfig.h
 test -f ${config_h}.bot && cat ${config_h}.bot
 
 status=0
@@ -232,10 +243,10 @@ done
 
 if test $# -eq 0; then
   if test $status -eq 0; then
-    if cmp -s $tmpout ${config_h}.in; then
+    if cmp -s $tmpout ${config_h_in}; then
       rm -f $tmpout
     else
-      mv -f $tmpout ${config_h}.in
+      mv -f $tmpout ${config_h_in}
     fi
   else
     rm -f $tmpout
index 0cb5859d40a5dd5ece66d5688ec3a7633d8088d6..2316bbb74882420b756c82e2bc1b0b8cab7cba61 100644 (file)
@@ -95,7 +95,7 @@ test -r ${AC_MACRODIR}/aclocal.m4 &&
 test -r aclocal.m4 && MACROFILES="${MACROFILES} aclocal.m4"
 MACROFILES="${print_version} ${MACROFILES} ${infile}"
 
-$M4 $MACROFILES > $tmpout || { st=$?; rm -f $tmpin $tmpout; exit $st; }
+$M4 $MACROFILES > $tmpout || { rm -f $tmpin $tmpout; exit 2; }
 
 if test -n "$print_version"; then
   cat $tmpout
index 9a3c6d8de42508cd956839973011d6f2a32894aa..972def1d3efbf488a9050ff09d1d021e12c04ec4 100644 (file)
@@ -158,11 +158,20 @@ if test $# -eq 0; then
   exec > $tmpout
 fi
 
+# Support "outfile[:infile]", defaulting infile="outfile.in".
+case "$config_h" in
+*:*) config_h_in=`echo "$config_h"|sed 's%.*:%%'`
+     config_h=`echo "$config_h"|sed 's%:.*%%'` ;;
+*) config_h_in="${config_h}.in" ;;
+esac
+
 # Don't write "do not edit" -- it will get copied into the
 # config.h, which it's ok to edit.
-echo "/* ${config_h}.in.  Generated automatically from $infile by autoheader.  */"
+echo "/* ${config_h_in}.  Generated automatically from $infile by autoheader.  */"
 
-test -f ${config_h}.top && cat ${config_h}.top
+test -r ${config_h}.top && cat ${config_h}.top
+test -r acconfig.h && grep @TOP@ acconfig.h >/dev/null &&
+  sed '/@TOP@/,$d' acconfig.h
 
 # This puts each template paragraph on its own line, separated by @s.
 if test -n "$syms"; then
@@ -217,6 +226,8 @@ for lib in `for x in $libs; do echo $x; done | sort | uniq`; do
 #undef HAVE_LIB${sym}"
 done
 
+test -r acconfig.h && grep @BOTTOM@ acconfig.h >/dev/null &&
+  sed '1,/@BOTTOM@/d' acconfig.h
 test -f ${config_h}.bot && cat ${config_h}.bot
 
 status=0
@@ -232,10 +243,10 @@ done
 
 if test $# -eq 0; then
   if test $status -eq 0; then
-    if cmp -s $tmpout ${config_h}.in; then
+    if cmp -s $tmpout ${config_h_in}; then
       rm -f $tmpout
     else
-      mv -f $tmpout ${config_h}.in
+      mv -f $tmpout ${config_h_in}
     fi
   else
     rm -f $tmpout
index e46e545dcd386f5216dcf5cdbe9dac7ed770993f..2c58c59c75df73a8aaa32b6aac6f1f5adbb845a9 100644 (file)
@@ -52,7 +52,8 @@ SUBDIRS = testsuite
 # Files that can be generated, but should be up to date for a distribution.
 DISTDEP = info Makefile
 # Files to distribute.
-DISTFILES = COPYING ChangeLog INSTALL Makefile.in NEWS README TODO \
+DISTFILES = COPYING ChangeLog ChangeLog.1 INSTALL Makefile.in NEWS \
+       README TODO \ 
        acconfig.h acfunctions acgeneral.m4 acheaders acidentifiers \
        acmakevars acoldnames.m4 acprograms acspecific.m4 autoconf.info* \
        autoconf.sh autoconf.texi install.texi \
index ea6456ea10b7a646988e9806ba799d94f42f22a3..8a6272437d9fa308e35d2c93fe22ea73bb156998 100644 (file)
@@ -322,9 +322,9 @@ Autoconf input file (@file{configure.in}) and run Autoconf on it to
 produce the script.  If you write your own feature tests to supplement
 those that come with Autoconf, you might also write a file called
 @file{aclocal.m4}.  If you use a C header file to contain @code{#define}
-directives, you might also write @file{config.h.top},
-@file{config.h.bot}, and @file{acconfig.h}, and you will distribute the
-Autoconf-generated file @file{config.h.in} with the package.
+directives, you might also write @file{acconfig.h}, @file{config.h.top},
+and @file{config.h.bot}, and you will distribute the Autoconf-generated
+file @file{config.h.in} with the package.
 
 Here is a diagram showing how the files that can be used in
 configuration are produced.  Programs that are executed are suffixed by
@@ -490,12 +490,22 @@ or @code{AC_CHECK_LIB},
 rather than copying them from a file, since the possible symbols are
 effectively limitless.
 
-The file that @code{autoheader} creates usually contains only
-@code{#define} and @code{#undef} statements and their accompanying
-comments.  However, if a file called @file{@var{file}.top} (typically
-@file{config.h.top}) exists in the current directory, @code{autoheader}
-copies that file to the beginning of its output.  Similarly, if
-@file{@var{file}.bot} exists, it copies that file to the end of its output.
+The file that @code{autoheader} creates contains mainly @code{#define}
+and @code{#undef} statements and their accompanying comments.  If
+@file{./acconfig.h} contains the string @samp{@@TOP@@},
+@code{autoheader} copies the lines before the line containing
+@samp{@@TOP@@} into the top of the file that it generates.  Similarly,
+if @file{./acconfig.h} contains the string @samp{@@BOTTOM@@},
+@code{autoheader} copies the lines after that line to the end of the
+file it generates.  Either of those strings may be omitted.
+
+An obsolete way to produce the same effect is to create the files
+@file{@var{file}.top} (typically @file{config.h.top}) and/or
+@file{@var{file}.bot} in the current directory.  If they exist,
+@code{autoheader} copies them to the beginning and end, respectively, of
+its output.  Their use is discouraged because they have file names that
+contain two periods, and so can not be stored on MS-DOS; also, they are
+two more files to clutter up the directory.
 
 If you give @code{autoheader} an argument, it uses that file instead of
 @file{configure.in} and writes the header file to the standard output
@@ -1751,15 +1761,23 @@ to what @code{AC_OUTPUT} would put in it, it is left alone.  Doing this
 allows some changes in configuration without needlessly causing object
 files that depend on the header file to be recompiled.
 
-Your distribution should contain a file @file{@var{header-to-create}.in}
+Your distribution should contain an input file
 that looks as you want the final header file to look, including
 comments, with default values in the @code{#define} statements.  A
 default value can be to @code{#undef} the variable instead of to define
 it to a value, if your code tests for configuration options using
-@code{#ifdef} instead of @code{#if}.
+@code{#ifdef} instead of @code{#if}.  Usually this input file is named
+@file{@var{header-to-create}.in}; however, you can override the input file
+name by appending it to @var{header-to-create}, separated by a colon.
+For example,
+@example
+AC_CONFIG_HEADER(defines.h:defines.hin)
+@end example
+@noindent
+Doing this allows you to keep your filenames acceptable to MS-DOS.
 
-You can use the program @code{autoheader} to create
-@file{@var{header-to-create}.in} (@pxref{Invoking autoheader}).
+You can use the program @code{autoheader} to create the input file
+(@pxref{Invoking autoheader}).
 @end defmac
 
 @defmac AC_CONFIG_SUBDIRS (@var{dir} @dots{})
@@ -1795,12 +1813,18 @@ Create output files (typically one or more @file{Makefile}s) and
 create the header file that was named as its argument.  The argument is
 a whitespace-separated list of files to create; if it is omitted, no
 files are created.  @code{AC_OUTPUT} creates each file @file{@var{file}}
-in the list by copying @file{@var{file}.in}, substituting the variable
-values that have been selected by calling @code{AC_SUBST}.  It creates
-the directory that each file is in if it doesn't exist (but not the
-parents of that directory).  A plausible value for the argument to
-@code{AC_OUTPUT} is @samp{Makefile src/Makefile man/Makefile
-X/Imakefile}.
+in the list by copying an input file (by default named
+@file{@var{file}.in}), substituting the variable values that have been
+selected by calling @code{AC_SUBST}.  It creates the directory that each
+file is in if it doesn't exist (but not the parents of that directory).
+A plausible value for the argument to @code{AC_OUTPUT} is @samp{Makefile
+src/Makefile man/Makefile X/Imakefile}.
+
+You can override an input file name by appending it to @var{file},
+separated by a colon.  For example,
+@example
+AC_OUTPUT(Makefile:templates/top.mk lib/Makefile:templates/lib.mk)
+@end example
 
 If you pass @var{extra-cmds}, those commands will be inserted into
 @file{config.status} to be run after all its other processing.
index d6c345d093201df37b61e681639375fe61255f91..a17c65bd69e89fdb29eeee3892f2e63794deb37f 100644 (file)
@@ -26,6 +26,9 @@ undefine([include])dnl
 undefine([shift])dnl
 undefine([format])dnl
 dnl
+dnl Some old m4's don't support m4exit.  But they provide
+dnl equivalent functionality by core dumping because of the
+dnl long macros we define.
 ifdef([__gnu__], , [errprint(Autoconf requires GNU m4.
 Install it before installing Autoconf or set the
 M4 environment variable to its path name.
@@ -1446,6 +1449,13 @@ ac_given_INSTALL=$INSTALL
 
 CONFIG_FILES=${CONFIG_FILES-"$1"}
 for ac_file in .. ${CONFIG_FILES}; do if test "x$ac_file" != x..; then
+  # Support "outfile[: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" ;;
+  esac
+
   # Remove last slash and all that follows it.  Not all systems have dirname.
 changequote(, )dnl
   ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
@@ -1481,7 +1491,7 @@ changequote([, ])dnl
 
   echo creating "$ac_file"
   rm -f "$ac_file"
-  comment_str="Generated automatically from `echo $ac_file|sed 's|.*/||'`.in by configure."
+  comment_str="Generated automatically from `echo $ac_file_in|sed 's|.*/||'` by configure."
   case "$ac_file" in
     *.c | *.h | *.C | *.cc | *.m )
     ac_comsub="1i\\
@@ -1508,7 +1518,7 @@ dnl Shell code in configure.in might set extrasub.
 $extrasub
 dnl Insert the sed substitutions.
 undivert(AC_DIVERSION_SED)dnl
-" $ac_given_srcdir/${ac_file}.in > $ac_file
+" $ac_given_srcdir/$ac_file_in > $ac_file
 fi; done
 ifdef([AC_LIST_HEADERS], [AC_OUTPUT_HEADER(AC_LIST_HEADERS)])dnl
 ifdef([AC_LIST_LINKS], [AC_OUTPUT_LINKS(AC_LIST_LINKS, AC_LIST_FILES)])dnl
@@ -1599,9 +1609,16 @@ ac_max_sed_lines=20
 
 CONFIG_HEADERS=${CONFIG_HEADERS-"$1"}
 for ac_file in .. ${CONFIG_HEADERS}; do if test "x$ac_file" != x..; then
+  # Support "outfile[: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" ;;
+  esac
+
   echo creating $ac_file
 
-  cp $ac_given_srcdir/$ac_file.in conftest.h1
+  cp $ac_given_srcdir/$ac_file_in conftest.h1
   cp conftest.sed conftest.stm
   while :
   do