diff --git a/ChangeLog b/ChangeLog index 07a45fcf..0127449a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,22 @@ Tue Nov 19 10:29:06 1996 David J MacKenzie - * acgeneral.m4 (AC_TRY_RUN_NATIVE): Fail if linking fails, and - remove conftest* before running success code, like in AC_TRY_LINK. + * testsuite/autoconf.g/sizeof.exp: Use the v2 macro name. + + * acgeneral.m4 (AC_OUTPUT_FILES, AC_OUTPUT_HEADER): Support + creating output files from multiple pieces, concatenated. + Suggested by "Theodore Ts'o" . + (AC_LINK_FILES): If called more than once, concatenate the + arguments. From Roland McGrath. + (AC_CONFIG_SUBDIRS): Likewise. + (AC_OUTPUT_COMMANDS): New macro. Suggested by + Tom Tromey . + (AC_OUTPUT): Use the lists it sets. + + * acgeneral.m4 (AC_TRY_RUN_NATIVE): Fail if linking fails, like + AC_TRY_LINK. (AC_TRY_RUN): Don't require AC_C_CROSS. (AC_TRY_COMPILER): New macro. (AC_LANG_C, AC_LANG_CPLUSPLUS): Set cross_compiling. - * acspecific.m4 (AC_PROG_CC_WORKS, AC_PROG_CXX_WORKS): Use AC_TRY_COMPILER instead of AC_TRY_LINK. (AC_PROG_CC_GNU, AC_PROG_CC_G): Split out of AC_PROG_CC. diff --git a/NEWS b/NEWS index d9b0fbed..dc8e6e1e 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,12 @@ Major changes in release 2.12: +* AC_OUTPUT and AC_CONFIG_HEADER can create output files by + concatenating multiple input files separated by colons, like so: + AC_CONFIG_HEADER(config.h:conf.pre:config.h.in:conf.post) + AC_OUTPUT(Makefile:Makefile.in:Makefile.rules) + The arguments may be shell variables, to compute the lists on the fly. +* AC_LINK_FILES and AC_CONFIG_SUBDIRS may be called multiple times. +* New macro AC_OUTPUT_COMMANDS adds more commands to run in config.status. * Bug fixes. Major changes in release 2.11: diff --git a/TODO b/TODO index 95530c42..01f29b79 100644 --- a/TODO +++ b/TODO @@ -84,6 +84,7 @@ in a dnl comment. (Seems to be hard.) * Look at user contributed macros: prototypes IEEE double precision math + more ------------------------------------------------------------------------------ @@ -365,20 +366,6 @@ Mention automake, libtool, etc. in the autoconf manual. ------------------------------------------------------------------------------ -configure-time pasting together of output files from multiple pieces. -AC_OUTPUT(Makefile:$pre_in:Makefile.in:$pre_out) - -This would concatenate the files $pre_in, Makefile.in, and $pre_out -before running sed to do the substitutions. -From: "Theodore Ts'o" - -Support a way of including makefile fragments that then have @var@ -substitutions done on them. - -Or ac_include? - ------------------------------------------------------------------------------- - I wonder if it is possible to get the path for X11's app-defaults directory by autoconf. Moreover, I'd like to have a general way of accessing imake variables by autoconf, something like @@ -389,21 +376,6 @@ Slaven Rezic ------------------------------------------------------------------------------ -Whichever AC_LINK_FILES directive comes last is that one that gets -done. - -From Jim Meyering - -This is trivial, but I'm unsure of the m4 quoting reality. Is it: - -AC_DEFUN(AC_LINK_FILES, -[define([AC_LIST_FILES], ifdef([AC_LIST_FILES], AC_LIST_FILES ,)[$1])dnl -define([AC_LIST_LINKS], ifdef([AC_LIST_LINKS], AC_LIST_LINKS ,)[$2])]) - -Roland McGrath - ------------------------------------------------------------------------------- - Question: at least one common UNIX variant has a "cc" that is old K&R and "c89" for ANSI C. Is there any reason why AC_PROG_CC couldn't check for c89 before cc if it can't find gcc? @@ -412,18 +384,6 @@ hpa@yggdrasil.com (H. Peter Anvin) ------------------------------------------------------------------------------ -Modify the meaning of autoheader --localdir to add an additional -directory to look for acconfig.h instead of replacing the directory -containing configure.in. Also, autoreconf recurses on all -subdirectories containing a configure.in, not just those given by an -AC_CONFIG_SUBDIRS directive, so you can't have both directories that -are parts of a large package, and directories that are independent -packages. - -Marc Horowitz - ------------------------------------------------------------------------------- - Cache consistency checking: ignore cache if environment (CC or PATH) differs. From Mike Haertel @@ -465,29 +425,6 @@ From: rcb5@win.tue.nl (Richard Verhoeven) ------------------------------------------------------------------------------ -in order to use the AC_CANONICAL_SYSTEM macro, I have to -have install-sh somewhere nearby --- why is this? I have no real -reason to distribute install-sh, other than that its absence breaks -this code. - -Shouldn't the above loop be looking for config.sub and config.guess? -From: jimb@totoro.bio.indiana.edu (Jim Blandy) - -adding AC_CANONICAL_HOST to my configure.in script caused -all sorts of odd/unexplained errors. Obviously, I had to go -get copies of config.guess, config.sub and install-sh from the -autoconf distribution, but the error messages and autoconf docs -didn't explain that very well. -From: bostic@bsdi.com (Keith Bostic) - ------------------------------------------------------------------------------- - -Perhaps also have AC_TRY_COMPILER try to link an invalid program, and -die if the compiler seemed to succeed--in which case it's not usable -with autoconf scripts. - ------------------------------------------------------------------------------- - When using CONFIG_FILES= and CONFIG_HEADERS= for controlling partial configuration, any AC_LINK_FILES is repeated in each case (that is, usually, once for config.h and once per subdirectory). @@ -578,16 +515,6 @@ From: Tom Tromey ------------------------------------------------------------------------------ -It would be nice if there were some way for an autoconf macro to add -code to be run at the same time as the `EXTRA-CMDS' argument to -AC_OUTPUT. -it would be most useful if it could be -run any number of times (and have all the command concatenated). - -From: Tom Tromey - ------------------------------------------------------------------------------- - I'd much prefer to see the absolute paths substituted for all the standard "dir" variables. It would be nice to have variables in configure that held the absolute paths. And it is nice to be able to @@ -610,7 +537,37 @@ Merge the two lex macros, AC_PROG_LEX and AC_DECL_YYTEXT? ------------------------------------------------------------------------------ -Is it safe to remove the getpagesize references from AC_FUNC_MMAP? +Modify the meaning of autoheader --localdir to add an additional +directory to look for acconfig.h instead of replacing the directory +containing configure.in. Also, autoreconf recurses on all +subdirectories containing a configure.in, not just those given by an +AC_CONFIG_SUBDIRS directive, so you can't have both directories that +are parts of a large package, and directories that are independent +packages. + +Marc Horowitz ------------------------------------------------------------------------------ +in order to use the AC_CANONICAL_SYSTEM macro, I have to +have install-sh somewhere nearby --- why is this? I have no real +reason to distribute install-sh, other than that its absence breaks +this code. + +Shouldn't the above loop be looking for config.sub and config.guess? +From: jimb@totoro.bio.indiana.edu (Jim Blandy) + +adding AC_CANONICAL_HOST to my configure.in script caused +all sorts of odd/unexplained errors. Obviously, I had to go +get copies of config.guess, config.sub and install-sh from the +autoconf distribution, but the error messages and autoconf docs +didn't explain that very well. +From: bostic@bsdi.com (Keith Bostic) + +------------------------------------------------------------------------------ + +Perhaps also have AC_TRY_COMPILER try to link an invalid program, and +die if the compiler seemed to succeed--in which case it's not usable +with autoconf scripts. + +------------------------------------------------------------------------------ diff --git a/acgeneral.m4 b/acgeneral.m4 index ac9decb1..e9db16ff 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -1422,10 +1422,10 @@ fi undefine([AC_VAR_NAME])dnl ]) -dnl Check whether the current compiler produces executables, and -dnl whether those executables are native to the build system. +dnl Sets WORKING_VAR to yes if the current compiler works, else no; +dnl sets CROSS-VAR to yes if it produces non-native executables, else no. dnl Before calling this, call AC_LANG_* to set the right language. -dnl AC_TRY_COMPILER(TEST-PROGRAM, WORKING-CACHE-ID, CROSS-CACHE-ID) +dnl AC_TRY_COMPILER(TEST-PROGRAM, WORKING-VAR, CROSS-VAR) AC_DEFUN(AC_TRY_COMPILER, [cat > conftest.$ac_ext </dev/null then - ifelse([$2], , :, [rm -rf conftest* - $2]) +dnl Don't remove the temporary files here, so they can be examined. + ifelse([$2], , :, [$2]) else echo "configure: failed program was:" >&AC_FD_CC cat conftest.$ac_ext >&AC_FD_CC @@ -1835,8 +1835,8 @@ AC_DEFUN(AC_CHECK_TYPE, AC_MSG_CHECKING(for $1) AC_CACHE_VAL(ac_cv_type_$1, [AC_EGREP_CPP(dnl -changequote(<<<,>>>)dnl -<<<$1[^a-zA-Z_0-9]>>>dnl +changequote(<<,>>)dnl +<<$1[^a-zA-Z_0-9]>>dnl changequote([,]), [#include #if STDC_HEADERS #include @@ -1860,12 +1860,27 @@ dnl Link each of the existing files SOURCE... to the corresponding dnl link name in DEST... dnl AC_LINK_FILES(SOURCE..., DEST...) AC_DEFUN(AC_LINK_FILES, -[define([AC_LIST_FILES], [$1])define([AC_LIST_LINKS], [$2])]) +[dnl +define([AC_LIST_FILES], ifdef([AC_LIST_FILES], [AC_LIST_FILES ],)[$1])dnl +define([AC_LIST_LINKS], ifdef([AC_LIST_LINKS], [AC_LIST_LINKS ],)[$2])]) + +dnl Add additional commands for AC_OUTPUT to put into config.status. +dnl I have concluded that m4's quoting rules make it impossible to +dnl make this robust in the presence of commas in $1 or $2 and +dnl an arbitrary number of calls. I tried putting the defines +dnl inside the ifdefs, with no success that way either. -djm +dnl AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS) +AC_DEFUN(AC_OUTPUT_COMMANDS, +[dnl +define([AC_LIST_EXTRA], ifdef([AC_LIST_EXTRA], [AC_LIST_EXTRA +],)[$1])dnl +define([AC_LIST_INIT], ifdef([AC_LIST_INIT], [AC_LIST_INIT +],)[$2])]) dnl AC_CONFIG_SUBDIRS(DIR ...) AC_DEFUN(AC_CONFIG_SUBDIRS, [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -define([AC_LIST_SUBDIRS], [$1])dnl +define([AC_LIST_SUBDIRS], ifdef([AC_LIST_SUBDIRS], [AC_LIST_SUBDIRS ],)[$1])dnl subdirs="AC_LIST_SUBDIRS" AC_SUBST(subdirs)dnl ]) @@ -1947,12 +1962,16 @@ cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF]) +ifdef([AC_LIST_EXTRA], [AC_LIST_EXTRA +],)[]dnl $2 exit 0 EOF @@ -2047,11 +2066,10 @@ CONFIG_FILES=\${CONFIG_FILES-"$1"} EOF cat >> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then -dnl Specifying an input file breaks the trap to clean up on interrupt, -dnl but that's not a huge problem. - # Support "outfile[:infile]", defaulting infile="outfile.in". +changequote(, )dnl + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`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 @@ -2059,7 +2077,6 @@ dnl but that's not a huge problem. # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. -changequote(, )dnl ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` changequote([, ])dnl if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then @@ -2101,6 +2118,8 @@ changequote([, ])dnl # $configure_input" ;; *) ac_comsub= ;; esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g @@ -2108,7 +2127,7 @@ s%@top_srcdir@%$top_srcdir%g ifdef([AC_PROVIDE_AC_PROG_INSTALL], [s%@INSTALL@%$INSTALL%g ])dnl dnl The parens around the eval prevent an "illegal io" in Ultrix sh. -" $ac_given_srcdir/$ac_file_in | (eval "$ac_sed_cmds") > $ac_file +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file dnl This would break Makefile dependencies. dnl if cmp -s $ac_file conftest.out 2>/dev/null; then dnl echo "$ac_file is unchanged" @@ -2156,17 +2175,20 @@ EOF cat >> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then - # Support "outfile[:infile]", defaulting infile="outfile.in". +changequote(, )dnl + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`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 +changequote([, ])dnl echo creating $ac_file rm -f conftest.frag conftest.in conftest.out - cp $ac_given_srcdir/$ac_file_in conftest.in + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in EOF diff --git a/acspecific.m4 b/acspecific.m4 index b83bfb7f..622d1078 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -436,7 +436,7 @@ AC_DEFUN(AC_PROG_INSTALL, AC_MSG_CHECKING(for a BSD compatible install) if test -z "$INSTALL"; then AC_CACHE_VAL(ac_cv_path_install, -[ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" +[ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in @@ -459,7 +459,7 @@ AC_CACHE_VAL(ac_cv_path_install, ;; esac done - IFS="$ac_save_ifs" + IFS="$ac_save_IFS" ])dnl if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" diff --git a/autoconf.texi b/autoconf.texi index e638b6f5..4e8ce3fd 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -789,7 +789,7 @@ Every Autoconf-generated @code{configure} script must finish by calling optional other files resulting from configuration. The only other required macro is @code{AC_INIT} (@pxref{Input}). -@defmac AC_OUTPUT (@r{[}@var{file}@dots{}@r{] [,}@var{extra-cmds}@r{] [,}@var{init-cmds}@r{]}) +@defmac AC_OUTPUT (@r{[}@var{file}@dots{} @r{[}, @var{extra-cmds} @r{[}, @var{init-cmds}@r{]]]}) @maindex OUTPUT Create output files. Call this macro once, at the end of @file{configure.in}. The @var{file}@dots{} argument is a @@ -813,11 +813,14 @@ A typical call to @code{AC_OUTPUT} looks like this: AC_OUTPUT(Makefile src/Makefile man/Makefile X/Imakefile) @end example -You can override an input file name by appending it to @var{file}, -separated by a colon. For example, +You can override an input file name by appending to @var{file} a +colon-separated list of input files. Examples: @example AC_OUTPUT(Makefile:templates/top.mk lib/Makefile:templates/lib.mk) +AC_OUTPUT(Makefile:templates/vars.mk:Makefile.in:templates/rules.mk) @end example +Doing this allows you to keep your file names acceptable to MS-DOS, or +to prepend and/or append boilerplate to the file. If you pass @var{extra-cmds}, those commands will be inserted into @file{config.status} to be run after all its other processing. If @@ -825,7 +828,23 @@ If you pass @var{extra-cmds}, those commands will be inserted into @var{extra-cmds}, with shell variable, command, and backslash substitutions performed on them in @code{configure}. You can use @var{init-cmds} to pass variables from @code{configure} to the -@var{extra-cmds}. +@var{extra-cmds}. If @code{AC_OUTPUT_COMMANDS} has been called, the +commands given to it are run just before the commands passed to this macro. +@end defmac + +@defmac AC_OUTPUT_COMMANDS (@var{extra-cmds} @r{[}, @var{init-cmds}@r{]}) +Specify additional shell commands to run at the end of +@file{config.status}, and shell commands to initialize any variables +from @code{configure}. This macro may be called multiple times. +If the shell commands contain commas, you must add an extra layer of +@code{m4} quotes for each additional time you call this macro, due to +the insanity of @code{m4} quoting. Like this: + +@example +fubar=27 +AC_OUTPUT_COMMANDS([[echo this is extra $fubar, and so on.]], fubar=$fubar) +AC_OUTPUT_COMMANDS([[echo this is another, extra, bit]], [[echo init, bit]]) +@end example @end defmac If you run @code{make} on subdirectories, you should run it using the @@ -1181,13 +1200,16 @@ allows some changes in configuration without needlessly causing object files that depend on the header file to be recompiled. Usually the 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, +however, you can override the input file name by appending to +@var{header-to-create}, a colon-separated list of input files. +Examples: @example AC_CONFIG_HEADER(defines.h:defines.hin) +AC_CONFIG_HEADER(defines.h:defs.pre:defines.h.in:defs.post) @end example @noindent -Doing this allows you to keep your file names acceptable to MS-DOS. +Doing this allows you to keep your file names acceptable to MS-DOS, or +to prepend and/or append boilerplate to the file. @end defmac @menu @@ -1325,13 +1347,16 @@ is not found, no error is reported, so a @code{configure} script can configure whichever parts of a large source tree are present. If a given @var{dir} contains @file{configure.in} but no @code{configure}, the Cygnus @code{configure} script found by @code{AC_CONFIG_AUXDIR} is -used. The subdirectory @code{configure} scripts are given the same +used. + +The subdirectory @code{configure} scripts are given the same command line options that were given to this @code{configure} script, with minor changes if needed (e.g., to adjust a relative path for the cache file or source directory). This macro also sets the output variable @code{subdirs} to the list of directories @samp{@var{dir} @dots{}}. @file{Makefile} rules can use this variable to determine -which subdirectories to recurse into. +which subdirectories to recurse into. This macro may be called multiple +times. @end defmac @node Default Prefix, Versions, Subdirectories, Setup @@ -4019,6 +4044,7 @@ Make @code{AC_OUTPUT} link each of the existing files @var{source} to the corresponding link name @var{dest}. Makes a symbolic link if possible, otherwise a hard link. The @var{dest} and @var{source} names should be relative to the top level source or build directory. +This macro may be called multiple times. For example, this call: diff --git a/configure b/configure index 61ee6b37..79ef1dd9 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.11 +# Generated automatically using autoconf version 2.11.1 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -332,7 +332,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.11" + echo "configure generated by autoconf version 2.11.1" exit 0 ;; -with-* | --with-*) @@ -500,6 +500,7 @@ ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. @@ -679,7 +680,7 @@ if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in @@ -702,7 +703,7 @@ else ;; esac done - IFS="$ac_save_ifs" + IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then @@ -818,7 +819,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.11" + echo "$CONFIG_STATUS generated by autoconf version 2.11.1" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -912,9 +913,9 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile testsuite/Makefile"} EOF cat >> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`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 @@ -956,16 +957,22 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # $configure_input" ;; *) ac_comsub= ;; esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g -" $ac_given_srcdir/$ac_file_in | eval "$ac_sed_cmds" > $ac_file +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF exit 0 EOF diff --git a/doc/autoconf.texi b/doc/autoconf.texi index e638b6f5..4e8ce3fd 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -789,7 +789,7 @@ Every Autoconf-generated @code{configure} script must finish by calling optional other files resulting from configuration. The only other required macro is @code{AC_INIT} (@pxref{Input}). -@defmac AC_OUTPUT (@r{[}@var{file}@dots{}@r{] [,}@var{extra-cmds}@r{] [,}@var{init-cmds}@r{]}) +@defmac AC_OUTPUT (@r{[}@var{file}@dots{} @r{[}, @var{extra-cmds} @r{[}, @var{init-cmds}@r{]]]}) @maindex OUTPUT Create output files. Call this macro once, at the end of @file{configure.in}. The @var{file}@dots{} argument is a @@ -813,11 +813,14 @@ A typical call to @code{AC_OUTPUT} looks like this: AC_OUTPUT(Makefile src/Makefile man/Makefile X/Imakefile) @end example -You can override an input file name by appending it to @var{file}, -separated by a colon. For example, +You can override an input file name by appending to @var{file} a +colon-separated list of input files. Examples: @example AC_OUTPUT(Makefile:templates/top.mk lib/Makefile:templates/lib.mk) +AC_OUTPUT(Makefile:templates/vars.mk:Makefile.in:templates/rules.mk) @end example +Doing this allows you to keep your file names acceptable to MS-DOS, or +to prepend and/or append boilerplate to the file. If you pass @var{extra-cmds}, those commands will be inserted into @file{config.status} to be run after all its other processing. If @@ -825,7 +828,23 @@ If you pass @var{extra-cmds}, those commands will be inserted into @var{extra-cmds}, with shell variable, command, and backslash substitutions performed on them in @code{configure}. You can use @var{init-cmds} to pass variables from @code{configure} to the -@var{extra-cmds}. +@var{extra-cmds}. If @code{AC_OUTPUT_COMMANDS} has been called, the +commands given to it are run just before the commands passed to this macro. +@end defmac + +@defmac AC_OUTPUT_COMMANDS (@var{extra-cmds} @r{[}, @var{init-cmds}@r{]}) +Specify additional shell commands to run at the end of +@file{config.status}, and shell commands to initialize any variables +from @code{configure}. This macro may be called multiple times. +If the shell commands contain commas, you must add an extra layer of +@code{m4} quotes for each additional time you call this macro, due to +the insanity of @code{m4} quoting. Like this: + +@example +fubar=27 +AC_OUTPUT_COMMANDS([[echo this is extra $fubar, and so on.]], fubar=$fubar) +AC_OUTPUT_COMMANDS([[echo this is another, extra, bit]], [[echo init, bit]]) +@end example @end defmac If you run @code{make} on subdirectories, you should run it using the @@ -1181,13 +1200,16 @@ allows some changes in configuration without needlessly causing object files that depend on the header file to be recompiled. Usually the 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, +however, you can override the input file name by appending to +@var{header-to-create}, a colon-separated list of input files. +Examples: @example AC_CONFIG_HEADER(defines.h:defines.hin) +AC_CONFIG_HEADER(defines.h:defs.pre:defines.h.in:defs.post) @end example @noindent -Doing this allows you to keep your file names acceptable to MS-DOS. +Doing this allows you to keep your file names acceptable to MS-DOS, or +to prepend and/or append boilerplate to the file. @end defmac @menu @@ -1325,13 +1347,16 @@ is not found, no error is reported, so a @code{configure} script can configure whichever parts of a large source tree are present. If a given @var{dir} contains @file{configure.in} but no @code{configure}, the Cygnus @code{configure} script found by @code{AC_CONFIG_AUXDIR} is -used. The subdirectory @code{configure} scripts are given the same +used. + +The subdirectory @code{configure} scripts are given the same command line options that were given to this @code{configure} script, with minor changes if needed (e.g., to adjust a relative path for the cache file or source directory). This macro also sets the output variable @code{subdirs} to the list of directories @samp{@var{dir} @dots{}}. @file{Makefile} rules can use this variable to determine -which subdirectories to recurse into. +which subdirectories to recurse into. This macro may be called multiple +times. @end defmac @node Default Prefix, Versions, Subdirectories, Setup @@ -4019,6 +4044,7 @@ Make @code{AC_OUTPUT} link each of the existing files @var{source} to the corresponding link name @var{dest}. Makes a symbolic link if possible, otherwise a hard link. The @var{dest} and @var{source} names should be relative to the top level source or build directory. +This macro may be called multiple times. For example, this call: diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index ac9decb1..e9db16ff 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1422,10 +1422,10 @@ fi undefine([AC_VAR_NAME])dnl ]) -dnl Check whether the current compiler produces executables, and -dnl whether those executables are native to the build system. +dnl Sets WORKING_VAR to yes if the current compiler works, else no; +dnl sets CROSS-VAR to yes if it produces non-native executables, else no. dnl Before calling this, call AC_LANG_* to set the right language. -dnl AC_TRY_COMPILER(TEST-PROGRAM, WORKING-CACHE-ID, CROSS-CACHE-ID) +dnl AC_TRY_COMPILER(TEST-PROGRAM, WORKING-VAR, CROSS-VAR) AC_DEFUN(AC_TRY_COMPILER, [cat > conftest.$ac_ext </dev/null then - ifelse([$2], , :, [rm -rf conftest* - $2]) +dnl Don't remove the temporary files here, so they can be examined. + ifelse([$2], , :, [$2]) else echo "configure: failed program was:" >&AC_FD_CC cat conftest.$ac_ext >&AC_FD_CC @@ -1835,8 +1835,8 @@ AC_DEFUN(AC_CHECK_TYPE, AC_MSG_CHECKING(for $1) AC_CACHE_VAL(ac_cv_type_$1, [AC_EGREP_CPP(dnl -changequote(<<<,>>>)dnl -<<<$1[^a-zA-Z_0-9]>>>dnl +changequote(<<,>>)dnl +<<$1[^a-zA-Z_0-9]>>dnl changequote([,]), [#include #if STDC_HEADERS #include @@ -1860,12 +1860,27 @@ dnl Link each of the existing files SOURCE... to the corresponding dnl link name in DEST... dnl AC_LINK_FILES(SOURCE..., DEST...) AC_DEFUN(AC_LINK_FILES, -[define([AC_LIST_FILES], [$1])define([AC_LIST_LINKS], [$2])]) +[dnl +define([AC_LIST_FILES], ifdef([AC_LIST_FILES], [AC_LIST_FILES ],)[$1])dnl +define([AC_LIST_LINKS], ifdef([AC_LIST_LINKS], [AC_LIST_LINKS ],)[$2])]) + +dnl Add additional commands for AC_OUTPUT to put into config.status. +dnl I have concluded that m4's quoting rules make it impossible to +dnl make this robust in the presence of commas in $1 or $2 and +dnl an arbitrary number of calls. I tried putting the defines +dnl inside the ifdefs, with no success that way either. -djm +dnl AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS) +AC_DEFUN(AC_OUTPUT_COMMANDS, +[dnl +define([AC_LIST_EXTRA], ifdef([AC_LIST_EXTRA], [AC_LIST_EXTRA +],)[$1])dnl +define([AC_LIST_INIT], ifdef([AC_LIST_INIT], [AC_LIST_INIT +],)[$2])]) dnl AC_CONFIG_SUBDIRS(DIR ...) AC_DEFUN(AC_CONFIG_SUBDIRS, [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -define([AC_LIST_SUBDIRS], [$1])dnl +define([AC_LIST_SUBDIRS], ifdef([AC_LIST_SUBDIRS], [AC_LIST_SUBDIRS ],)[$1])dnl subdirs="AC_LIST_SUBDIRS" AC_SUBST(subdirs)dnl ]) @@ -1947,12 +1962,16 @@ cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF]) +ifdef([AC_LIST_EXTRA], [AC_LIST_EXTRA +],)[]dnl $2 exit 0 EOF @@ -2047,11 +2066,10 @@ CONFIG_FILES=\${CONFIG_FILES-"$1"} EOF cat >> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then -dnl Specifying an input file breaks the trap to clean up on interrupt, -dnl but that's not a huge problem. - # Support "outfile[:infile]", defaulting infile="outfile.in". +changequote(, )dnl + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`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 @@ -2059,7 +2077,6 @@ dnl but that's not a huge problem. # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. -changequote(, )dnl ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` changequote([, ])dnl if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then @@ -2101,6 +2118,8 @@ changequote([, ])dnl # $configure_input" ;; *) ac_comsub= ;; esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g @@ -2108,7 +2127,7 @@ s%@top_srcdir@%$top_srcdir%g ifdef([AC_PROVIDE_AC_PROG_INSTALL], [s%@INSTALL@%$INSTALL%g ])dnl dnl The parens around the eval prevent an "illegal io" in Ultrix sh. -" $ac_given_srcdir/$ac_file_in | (eval "$ac_sed_cmds") > $ac_file +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file dnl This would break Makefile dependencies. dnl if cmp -s $ac_file conftest.out 2>/dev/null; then dnl echo "$ac_file is unchanged" @@ -2156,17 +2175,20 @@ EOF cat >> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then - # Support "outfile[:infile]", defaulting infile="outfile.in". +changequote(, )dnl + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`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 +changequote([, ])dnl echo creating $ac_file rm -f conftest.frag conftest.in conftest.out - cp $ac_given_srcdir/$ac_file_in conftest.in + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in EOF diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index b83bfb7f..622d1078 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -436,7 +436,7 @@ AC_DEFUN(AC_PROG_INSTALL, AC_MSG_CHECKING(for a BSD compatible install) if test -z "$INSTALL"; then AC_CACHE_VAL(ac_cv_path_install, -[ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" +[ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in @@ -459,7 +459,7 @@ AC_CACHE_VAL(ac_cv_path_install, ;; esac done - IFS="$ac_save_ifs" + IFS="$ac_save_IFS" ])dnl if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" diff --git a/testsuite/autoconf.g/sizeof.exp b/testsuite/autoconf.g/sizeof.exp index c2bf8390..933deacc 100644 --- a/testsuite/autoconf.g/sizeof.exp +++ b/testsuite/autoconf.g/sizeof.exp @@ -1 +1 @@ -autoconf_test AC_SIZEOF_TYPE "AC_SIZEOF_TYPE(long *)" +autoconf_test AC_CHECK_SIZEOF "AC_CHECK_SIZEOF(long *)"