From: David MacKenzie Date: Thu, 15 Sep 1994 18:34:35 +0000 (+0000) Subject: fix makefile targets and recursive generation X-Git-Tag: fsf-origin~448 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=680f86975af00f952d2475635ba0dfb9fa328f6c;p=thirdparty%2Fautoconf.git fix makefile targets and recursive generation --- diff --git a/Makefile.in b/Makefile.in index 69a9c6e07..64718c214 100644 --- a/Makefile.in +++ b/Makefile.in @@ -62,7 +62,7 @@ DISTFILES = COPYING ChangeLog ChangeLog.1 INSTALL \ acconfig.h acfunctions acheaders acidentifiers \ acmakevars acprograms autoconf.info* \ autoconf.sh autoconf.texi install.texi \ - autoheader.sh autoreconf.sh autoscan.pl autoupdate.sh ifnames.sh \ + autoheader.sh autoscan.pl autoreconf.sh autoupdate.sh ifnames.sh \ config.guess config.sub configure configure.in \ install-sh mkinstalldirs texinfo.tex \ testsuite/Makefile.in testsuite/config/*.exp \ @@ -119,8 +119,10 @@ standards.dvi: standards.texi make-stds.texi $(TEXI2DVI) $(srcdir)/standards.texi check: all - rootme=`pwd`; cd testsuite && ${MAKE} $@ AUTOCONF=$$rootme/autoconf \ - AUTOCONFFLAGS="-m $$rootme" + rootme=`pwd`; srcrootme=`cd $(srcdir); pwd`; \ + test -r install-sh || cp $(srcdir)/install-sh .; \ + cd testsuite && ${MAKE} $@ AUTOCONF=$$rootme/autoconf \ + AUTOCONFFLAGS="-m $$srcrootme" installcheck: all install cd testsuite && ${MAKE} AUTOCONF=${bindir}/autoconf $@ @@ -135,7 +137,7 @@ install: all $(M4FILES) acconfig.h installdirs install-info *traditional*) ;; \ *) echo Error: Autoconf requires GNU m4 1.1 or later; exit 1 ;; \ esac - for i in autoconf autoheader autoreconf autoupdate ifnames; do \ + for i in $(APROGS); do \ $(INSTALL_PROGRAM) $$i $(bindir)/$$i; \ done for i in $(M4FILES) acconfig.h; do \ @@ -160,8 +162,7 @@ install-info: info installdirs done uninstall: - rm -f $(bindir)/autoconf $(bindir)/autoheader $(bindir)/autoscan - rm -f $(bindir)/autoreconf $(bindir)/autoupdate $(bindir)/ifnames + cd $(bindir) && rm -f $(PROGS) rm -fr $(acdatadir) cd $(infodir); rm -f autoconf.info* if test -f standards.info || test -f $(srcdir)/standards.info; \ @@ -185,7 +186,7 @@ clean mostlyclean distclean realclean:: done clean mostlyclean distclean realclean:: - rm -f autoconf autoheader autoscan autoreconf autoupdate ifnames *.tmp + rm -f $(PROGS) *.tmp rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs rm -f *.ev *.evs *.ov *.ovs *.cv *.cvs *.ma *.mas diff --git a/NEWS b/NEWS index 0c43e60da..644ce2616 100644 --- a/NEWS +++ b/NEWS @@ -74,14 +74,16 @@ Major changes in release 2.0: * autoscan to generate a preliminary configure.in for a package by scanning its source code for commonly used nonportable functions, programs, and header files. -* autoreconf to recursively remake configure and configuration header - files in a source tree. * autoupdate to update a configure.in to use the new macro names. * ifnames to list the symbols used in #if and #ifdef directives in a source tree. +* autoreconf to recursively remake configure and configuration header + files in a source tree. ** Changed utilities: * autoheader can take pieces of acconfig.h to replace config.h.{top,bot}. +* autoconf and autoheader can look for package-local definition files + in an alternate directory. ** Documentation: * Autoconf manual is reorganized to make information easier to find diff --git a/acgeneral.m4 b/acgeneral.m4 index ee5da5445..1c971cfdb 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -24,7 +24,7 @@ dnl divert(-1)dnl Throw away output until AC_INIT is called. changequote([, ]) -define(AC_ACVERSION, 1.118) +define(AC_ACVERSION, 1.119) dnl Some old m4's don't support m4exit. But they provide dnl equivalent functionality by core dumping because of the @@ -957,7 +957,7 @@ define(AC_MSG_WARN, dnl AC_MSG_ERROR(ERROR-DESCRIPTION) define(AC_MSG_ERROR, -[{ echo "configure: $1" 1>&2; exit 1; }]) +[{ echo "configure: error: $1" 1>&2; exit 1; }]) dnl ### Selecting which language to use for testing @@ -1426,9 +1426,13 @@ undefine([AC_CV_NAME])dnl dnl AC_CHECK_TYPE(TYPE, DEFAULT) AC_DEFUN(AC_CHECK_TYPE, -[AC_MSG_CHECKING(for $1 in sys/types.h) +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_MSG_CHECKING(for $1) AC_CACHE_VAL(ac_cv_type_$1, -[AC_EGREP_HEADER($1, sys/types.h, ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl +[AC_EGREP_CPP($1, [#include +#if STDC_HEADERS +#include +#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl AC_MSG_RESULT($ac_cv_type_$1) if test $ac_cv_type_$1 = no; then AC_DEFINE($1, $2) diff --git a/autoconf.in b/autoconf.in index 846560f9b..a5a6a944d 100644 --- a/autoconf.in +++ b/autoconf.in @@ -21,8 +21,8 @@ # the given template file. usage="\ -Usage: autoconf [-hv] [--help] [-m dir] [--macrodir=dir] - [--version] [template-file]" +Usage: autoconf [-h] [--help] [-m dir] [--macrodir=dir] + [-l dir] [--localdir=dir] [--version] [template-file]" # NLS nuisances. # Only set `LANG' and `LC_ALL' to "C" if already set. @@ -40,12 +40,21 @@ case "${M4}" in esac tmpout=/tmp/acout.$$ +localdir= show_version=no while test $# -gt 0 ; do case "${1}" in -h | --help | --h* ) echo "${usage}" 1>&2; exit 0 ;; + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" shift ;; @@ -54,7 +63,7 @@ while test $# -gt 0 ; do test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } AC_MACRODIR="${1}" shift ;; - -v | --version | --v* ) + --version | --v* ) show_version=yes; shift ;; -- ) # Stop option processing shift; break ;; @@ -86,11 +95,17 @@ if test z$infile = z-; then tmpin=/tmp/acin.$$ infile=$tmpin cat > $infile -elif test ! -r "${infile}"; then +elif test ! -r "$infile"; then echo "autoconf: ${infile}: No such file or directory" >&2 exit 1 fi +if test -n "$localdir"; then + use_localdir="-I$localdir" +else + use_localdir= +fi + # Use the frozen version of Autoconf if available. r= f= # Some non-GNU m4's don't reject the --help option, so give them /dev/null. @@ -100,7 +115,8 @@ case `$M4 --help < /dev/null 2>&1` in *) echo Autoconf requires GNU m4 1.1 or later >&2; rm -f $tmpin; exit 1 ;; esac -$M4 -I$AC_MACRODIR $r autoconf.m4$f $infile > $tmpout || { rm -f $tmpin $tmpout; exit 2; } +$M4 -I$AC_MACRODIR $use_localdir $r autoconf.m4$f $infile > $tmpout || + { rm -f $tmpin $tmpout; exit 2; } # You could add your own prefixes to pattern if you wanted to check for # them too, e.g. pattern="AC_\|ILT_", except that UNIX sed doesn't do @@ -118,7 +134,9 @@ if grep "${pattern}" $tmpout > /dev/null 2>&1; then fi if test $# -eq 0; then - exec > configure; chmod +x configure + exec 4> configure; chmod +x configure +else + exec 4>&1 fi # Put the real line numbers into configure to make config.log more helpful. @@ -127,7 +145,8 @@ awk ' { print } ' $tmpout | sed ' /__oline__/s/^\([0-9][0-9]*\):\(.*\)__oline__\(.*\)$/\2\1\3/ -' +' >&4 rm -f $tmpout + exit $status diff --git a/autoconf.sh b/autoconf.sh index 846560f9b..a5a6a944d 100644 --- a/autoconf.sh +++ b/autoconf.sh @@ -21,8 +21,8 @@ # the given template file. usage="\ -Usage: autoconf [-hv] [--help] [-m dir] [--macrodir=dir] - [--version] [template-file]" +Usage: autoconf [-h] [--help] [-m dir] [--macrodir=dir] + [-l dir] [--localdir=dir] [--version] [template-file]" # NLS nuisances. # Only set `LANG' and `LC_ALL' to "C" if already set. @@ -40,12 +40,21 @@ case "${M4}" in esac tmpout=/tmp/acout.$$ +localdir= show_version=no while test $# -gt 0 ; do case "${1}" in -h | --help | --h* ) echo "${usage}" 1>&2; exit 0 ;; + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" shift ;; @@ -54,7 +63,7 @@ while test $# -gt 0 ; do test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } AC_MACRODIR="${1}" shift ;; - -v | --version | --v* ) + --version | --v* ) show_version=yes; shift ;; -- ) # Stop option processing shift; break ;; @@ -86,11 +95,17 @@ if test z$infile = z-; then tmpin=/tmp/acin.$$ infile=$tmpin cat > $infile -elif test ! -r "${infile}"; then +elif test ! -r "$infile"; then echo "autoconf: ${infile}: No such file or directory" >&2 exit 1 fi +if test -n "$localdir"; then + use_localdir="-I$localdir" +else + use_localdir= +fi + # Use the frozen version of Autoconf if available. r= f= # Some non-GNU m4's don't reject the --help option, so give them /dev/null. @@ -100,7 +115,8 @@ case `$M4 --help < /dev/null 2>&1` in *) echo Autoconf requires GNU m4 1.1 or later >&2; rm -f $tmpin; exit 1 ;; esac -$M4 -I$AC_MACRODIR $r autoconf.m4$f $infile > $tmpout || { rm -f $tmpin $tmpout; exit 2; } +$M4 -I$AC_MACRODIR $use_localdir $r autoconf.m4$f $infile > $tmpout || + { rm -f $tmpin $tmpout; exit 2; } # You could add your own prefixes to pattern if you wanted to check for # them too, e.g. pattern="AC_\|ILT_", except that UNIX sed doesn't do @@ -118,7 +134,9 @@ if grep "${pattern}" $tmpout > /dev/null 2>&1; then fi if test $# -eq 0; then - exec > configure; chmod +x configure + exec 4> configure; chmod +x configure +else + exec 4>&1 fi # Put the real line numbers into configure to make config.log more helpful. @@ -127,7 +145,8 @@ awk ' { print } ' $tmpout | sed ' /__oline__/s/^\([0-9][0-9]*\):\(.*\)__oline__\(.*\)$/\2\1\3/ -' +' >&4 rm -f $tmpout + exit $status diff --git a/autoconf.texi b/autoconf.texi index 2f8cc3ec4..ce0a2595a 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -6,8 +6,8 @@ @c @setchapternewpage odd @c %**end of header -@set EDITION 1.118 -@set VERSION 1.118 +@set EDITION 1.119 +@set VERSION 1.119 @set UPDATED September 1994 @iftex @@ -481,7 +481,7 @@ argument to the macro. To omit the false case, omit the before it. You can include comments in @file{configure.in} files by starting them -with the @code{m4} predefined macro @code{dnl}, which discards text up +with the @code{m4} builtin macro @code{dnl}, which discards text up through the next newline. These comments do not appear in the generated @code{configure} scripts. For example, it is helpful to begin @file{configure.in} files with a line like this: @@ -562,9 +562,11 @@ files in which that identifier occurs. @table @code @item --help +@itemx -h Print a summary of the command line options and exit. @item --macrodir=@var{dir} +@itemx -m @var{dir} @evindex AC_MACRODIR Look for the Autoconf macro files in directory @var{dir} instead of the default installation directory. Only used to get the version number. @@ -603,9 +605,16 @@ definition it reads overrides the earlier ones. @table @code @item --help +@itemx -h Print a summary of the command line options and exit. +@item --localdir=@var{dir} +@itemx -l @var{dir} +Look for the package file @file{aclocal.m4} in directory @var{dir} +instead of in the current directory. + @item --macrodir=@var{dir} +@itemx -m @var{dir} @evindex AC_MACRODIR Look for the installed macro files in directory @var{dir}. You can also set the @code{AC_MACRODIR} environment variable to a directory; this @@ -622,8 +631,12 @@ If you have a lot of Autoconf-generated @code{configure} scripts and you get a new version of Autoconf, the @code{autoreconf} program can be handy. It runs @code{autoconf} (and @code{autoheader}, where appropriate) repeatedly to remake all of the Autoconf @code{configure} -scripts in a directory tree. @xref{Automatic Remaking}, for further -information about automatic remaking of @code{configure} scripts. +scripts in a directory tree. If you give the +@samp{--macrodir=@var{dir}} or @samp{--localdir=@var{dir}} options, it +passes them down (with relative paths adjusted properly). + +@xref{Automatic Remaking}, for information about automatic remaking of +@code{configure} scripts when their source files change. @noindent @code{autoreconf} accepts the following options: @@ -633,6 +646,12 @@ information about automatic remaking of @code{configure} scripts. @itemx -h Print a summary of the command line options and exit. +@item --localdir=@var{dir} +@itemx -l @var{dir} +Look for the package files @file{aclocal.m4} and @file{acconfig.h} (but +not @file{@var{file}.top} and @file{@var{file}.bot}) in directory +@var{dir} instead of in the directory containing each @file{configure.in}. + @item --macrodir=@var{dir} @itemx -m @var{dir} @evindex AC_MACRODIR @@ -644,9 +663,8 @@ environment variable. @item --verbose Print the name of each directory where @code{autoreconf} runs -@code{autoconf} (and @code{autoheader}, if that directory's -@file{configure.in} calls @code{AC_CONFIG_HEADER}). - +@code{autoconf} (and @code{autoheader}, if appropriate). + @item --version Print the version number of Autoconf and exit. @end table @@ -1095,21 +1113,32 @@ 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 or both of those strings may be omitted. -An obsolete way to produce the same effect is to create the files +An alternate 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. +two more files to clutter up the directory. But if you use the +@samp{--localdir=@var{dir}} option to use an @file{acconfig.h} in another +directory, they give you a way to put custom boilerplate in each +individual @file{config.h.in}. @code{autoheader} accepts the following options: @table @code @item --help +@itemx -h Print a summary of the command line options and exit. +@item --localdir=@var{dir} +@itemx -l @var{dir} +Look for the package files @file{aclocal.m4} and @file{acconfig.h} (but +not @file{@var{file}.top} and @file{@var{file}.bot}) in directory +@var{dir} instead of in the current directory. + @item --macrodir=@var{dir} +@itemx -m @var{dir} @evindex AC_MACRODIR Look for the installed macro files and @file{acconfig.h} in directory @var{dir}. You can also set the @code{AC_MACRODIR} environment variable @@ -1214,10 +1243,11 @@ These tests print messages telling the user which feature they're checking for, and what they find. They cache their results for future @code{configure} runs (@pxref{Caching Results}). -Some of these macros set output variables. @xref{Setting Output Variables}, -for details on how this is done. The phrase ``define @var{name}'' is -used below as a shorthand to mean ``define C preprocessor symbol -@var{name} to have the value 1''. +Some of these macros set output variables. @xref{Makefile +Substitutions}, for how to get their values. The phrase ``define +@var{name}'' is used below as a shorthand to mean ``define C +preprocessor symbol @var{name} to the value 1''. @xref{Defining +Symbols}, for how to get those symbol definitions into your program. @menu * Alternative Programs:: Selecting between alternative programs. @@ -2209,9 +2239,9 @@ test macros. @defmac AC_CHECK_TYPE (@var{type}, @var{default}) @maindex CHECK_TYPE -If the type @var{type} is not defined in @file{sys/types.h}, define it -to be the C (or C++) builtin type @var{default}; e.g., @samp{short} or -@samp{unsigned}. +If the type @var{type} is not defined in @file{sys/types.h} or +@file{stdlib.h} (if that is present), define it to be the C (or C++) +builtin type @var{default}; e.g., @samp{short} or @samp{unsigned}. @end defmac @node Compiler Characteristics, System Services, Typedefs, Existing Tests @@ -2876,8 +2906,29 @@ print a message letting the user know the result of the test. @section Defining C Preprocessor Symbols A common action to take in response to a feature test is to define a C -preprocessor symbol indicating the results of the test. These two -macros do that. +preprocessor symbol indicating the results of the test. That is done by +calling @code{AC_DEFINE} or @code{AC_DEFINE_UNQUOTED}. + +By default, @code{AC_OUTPUT} places the symbols defined by these macros +into the output variable @code{DEFS}, which contains an option +@samp{-D@var{symbol}=@var{value}} for each symbol defined. Unlike in +Autoconf version 1, there is no variable @code{DEFS} defined while +@code{configure} is running. To check whether Autoconf macros have +already defined a certain C preprocessor symbol, test the value of the +appropriate cache variable, as in this example: + +@example +AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF)) +if test "$ac_cv_func_vprintf" != yes; then +AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT)) +fi +@end example + +If @code{AC_CONFIG_HEADER} has been called, then instead of creating +@code{DEFS}, @code{AC_OUTPUT} creates a header file by substituting the +correct values into @code{#define} statements in a template file. +@xref{Configuration Headers}, for more information about this kind of +output. @defmac AC_DEFINE (@var{variable} @r{[}, @var{value}@r{]}) @maindex DEFINE @@ -2913,26 +2964,6 @@ AC_DEFINE_UNQUOTED($@{ac_tr_hdr@}) @end example @end defmac -By default, @code{AC_OUTPUT} substitutes the symbols defined by these -macros into the output variable @code{DEFS}, which contains an option -@samp{-D@var{symbol}=@var{value}} for each symbol defined. Unlike in -Autoconf version 1, there is no variable @code{DEFS} defined while -@code{configure} is running. To check whether Autoconf macros have -already defined a certain C preprocessor symbol, test the value of the -appropriate cache variable, as in this example: - -@example -AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF)) -if test "$ac_cv_func_vprintf" != yes; then -AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT)) -fi -@end example - -If @code{AC_CONFIG_HEADER} has been called, then instead of substituting -@code{DEFS}, @code{AC_OUTPUT} creates a header file by substituting the -correct values into @code{#define} statements in a template file. -@xref{Configuration Headers}, for more information about this kind of output. - Due to the syntactical bizarreness of the Bourne shell, do not use semicolons to separate @code{AC_DEFINE} or @code{AC_DEFINE_UNQUOTED} calls from other macro calls or shell code; that can cause syntax errors diff --git a/autoheader.in b/autoheader.in index e8f091324..218963edb 100644 --- a/autoheader.in +++ b/autoheader.in @@ -24,7 +24,7 @@ usage="\ Usage: autoheader [-h] [--help] [-m dir] [--macrodir=dir] - [-v] [--version] [template-file]" + [-l dir] [--localdir=dir] [--version] [template-file]" # NLS nuisances. # Only set `LANG' and `LC_ALL' to "C" if already set. @@ -41,26 +41,36 @@ case "${M4}" in test -f "${M4}" || M4=m4 ;; esac +localdir=. show_version=no + while test $# -gt 0 ; do - case "z${1}" in - z-h | z--help | z--h* ) + case "${1}" in + -h | --help | --h* ) echo "${usage}"; exit 0 ;; - z--macrodir=* | z--m*=* ) + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; + --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" shift ;; - z-m | z--macrodir | z--m* ) + -m | --macrodir | --m* ) shift test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } AC_MACRODIR="${1}" shift ;; - z-v | z--version | z--v* ) + --version | --v* ) show_version=yes; shift ;; - z-- ) # Stop option processing + -- ) # Stop option processing shift; break ;; - z- ) # Use stdin as input. + - ) # Use stdin as input. break ;; - z-* ) + -* ) echo "${usage}" 1>&2; exit 1 ;; * ) break ;; @@ -75,7 +85,7 @@ if test $show_version = yes; then fi TEMPLATES="${AC_MACRODIR}/acconfig.h" -test -r acconfig.h && TEMPLATES="${TEMPLATES} acconfig.h" +test -r $localdir/acconfig.h && TEMPLATES="${TEMPLATES} $localdir/acconfig.h" case $# in 0) infile=configure.in ;; @@ -90,6 +100,12 @@ funcs= headers= libs= +if test "$localdir" != .; then + use_localdir="-I$localdir" +else + use_localdir= +fi + # Use the frozen version of Autoconf if available. r= f= # Some non-GNU m4's don't reject the --help option, so give them /dev/null. @@ -102,7 +118,7 @@ esac # Extract assignments of SYMS, TYPES, FUNCS, HEADERS, and LIBS from the # modified autoconf processing of the input file. The sed hair is # necessary to win for multi-line macro invocations. -eval "`$M4 -I$AC_MACRODIR $r autoheader.m4$f $infile | +eval "`$M4 -I$AC_MACRODIR $use_localdir $r autoheader.m4$f $infile | sed -n -e ' : again /^@@@.*@@@$/s/^@@@\(.*\)@@@$/\1/p @@ -137,8 +153,9 @@ esac echo "/* ${config_h_in}. Generated automatically from $infile by autoheader. */" test -r ${config_h}.top && cat ${config_h}.top -test -r acconfig.h && grep @TOP@ acconfig.h >/dev/null && - sed '/@TOP@/,$d' acconfig.h +test -r $localdir/acconfig.h && + grep @TOP@ $localdir/acconfig.h >/dev/null && + sed '/@TOP@/,$d' $localdir/acconfig.h # This puts each template paragraph on its own line, separated by @s. if test -n "$syms"; then @@ -200,8 +217,9 @@ if test -n "$libs"; then done fi -test -r acconfig.h && grep @BOTTOM@ acconfig.h >/dev/null && - sed '1,/@BOTTOM@/d' acconfig.h +test -r $localdir/acconfig.h && + grep @BOTTOM@ $localdir/acconfig.h >/dev/null && + sed '1,/@BOTTOM@/d' $localdir/acconfig.h test -f ${config_h}.bot && cat ${config_h}.bot status=0 diff --git a/autoheader.sh b/autoheader.sh index e8f091324..218963edb 100644 --- a/autoheader.sh +++ b/autoheader.sh @@ -24,7 +24,7 @@ usage="\ Usage: autoheader [-h] [--help] [-m dir] [--macrodir=dir] - [-v] [--version] [template-file]" + [-l dir] [--localdir=dir] [--version] [template-file]" # NLS nuisances. # Only set `LANG' and `LC_ALL' to "C" if already set. @@ -41,26 +41,36 @@ case "${M4}" in test -f "${M4}" || M4=m4 ;; esac +localdir=. show_version=no + while test $# -gt 0 ; do - case "z${1}" in - z-h | z--help | z--h* ) + case "${1}" in + -h | --help | --h* ) echo "${usage}"; exit 0 ;; - z--macrodir=* | z--m*=* ) + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; + --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" shift ;; - z-m | z--macrodir | z--m* ) + -m | --macrodir | --m* ) shift test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } AC_MACRODIR="${1}" shift ;; - z-v | z--version | z--v* ) + --version | --v* ) show_version=yes; shift ;; - z-- ) # Stop option processing + -- ) # Stop option processing shift; break ;; - z- ) # Use stdin as input. + - ) # Use stdin as input. break ;; - z-* ) + -* ) echo "${usage}" 1>&2; exit 1 ;; * ) break ;; @@ -75,7 +85,7 @@ if test $show_version = yes; then fi TEMPLATES="${AC_MACRODIR}/acconfig.h" -test -r acconfig.h && TEMPLATES="${TEMPLATES} acconfig.h" +test -r $localdir/acconfig.h && TEMPLATES="${TEMPLATES} $localdir/acconfig.h" case $# in 0) infile=configure.in ;; @@ -90,6 +100,12 @@ funcs= headers= libs= +if test "$localdir" != .; then + use_localdir="-I$localdir" +else + use_localdir= +fi + # Use the frozen version of Autoconf if available. r= f= # Some non-GNU m4's don't reject the --help option, so give them /dev/null. @@ -102,7 +118,7 @@ esac # Extract assignments of SYMS, TYPES, FUNCS, HEADERS, and LIBS from the # modified autoconf processing of the input file. The sed hair is # necessary to win for multi-line macro invocations. -eval "`$M4 -I$AC_MACRODIR $r autoheader.m4$f $infile | +eval "`$M4 -I$AC_MACRODIR $use_localdir $r autoheader.m4$f $infile | sed -n -e ' : again /^@@@.*@@@$/s/^@@@\(.*\)@@@$/\1/p @@ -137,8 +153,9 @@ esac echo "/* ${config_h_in}. Generated automatically from $infile by autoheader. */" test -r ${config_h}.top && cat ${config_h}.top -test -r acconfig.h && grep @TOP@ acconfig.h >/dev/null && - sed '/@TOP@/,$d' acconfig.h +test -r $localdir/acconfig.h && + grep @TOP@ $localdir/acconfig.h >/dev/null && + sed '/@TOP@/,$d' $localdir/acconfig.h # This puts each template paragraph on its own line, separated by @s. if test -n "$syms"; then @@ -200,8 +217,9 @@ if test -n "$libs"; then done fi -test -r acconfig.h && grep @BOTTOM@ acconfig.h >/dev/null && - sed '1,/@BOTTOM@/d' acconfig.h +test -r $localdir/acconfig.h && + grep @BOTTOM@ $localdir/acconfig.h >/dev/null && + sed '1,/@BOTTOM@/d' $localdir/acconfig.h test -f ${config_h}.bot && cat ${config_h}.bot status=0 diff --git a/autoreconf.in b/autoreconf.in index 4b51cf446..9f2c4e5d1 100644 --- a/autoreconf.in +++ b/autoreconf.in @@ -18,17 +18,26 @@ usage="\ Usage: autoreconf [-h] [--help] [-m dir] [--macrodir=dir] - [--verbose] [--version] [directory...]" + [-l dir] [--localdir=dir] [--verbose] [--version]" + +localdir= verbose=no show_version=no test -z "$AC_MACRODIR" && AC_MACRODIR=@datadir@ -export AC_MACRODIR # Pass it down to autoconf and autoheader. while test $# -gt 0; do case "$1" in - -h | --help | --hel | --he | --h) + -h | --help | --h*) echo "$usage"; exit 0 ;; + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"$1\" | sed -e 's/^[^=]*=//'`" shift ;; @@ -37,9 +46,9 @@ while test $# -gt 0; do test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } AC_MACRODIR="$1" shift ;; - --verbose | --verbos | --verbo | --verb) + --verbose | --verb*) verbose=yes; shift ;; - --version | --versio | --versi | --vers) + --version | --vers*) show_version=yes; shift ;; --) # Stop option processing. shift; break ;; @@ -55,20 +64,59 @@ if test $show_version = yes; then exit 0 fi -if test $# -eq 0; then paths=.; else paths="$@"; fi +top_autoconf=`echo $0|sed s%autoreconf%autoconf%` +top_autoheader=`echo $0|sed s%autoreconf%autoheader%` # The xargs grep filters out Cygnus configure.in files. -find $paths -name configure.in -print | +find . -name configure.in -print | xargs grep -l AC_OUTPUT | -while read confin; do +sed 's%/configure\.in$%%; s%^./%%' | +while read dir; do ( - dir=`echo $confin|sed 's%/[^/][^/]*$%%'` - cd $dir || exit 1 + cd $dir || continue + + case "$dir" in + .) dots= ;; + *) # A "../" for each directory in /$dir. + dots=`echo /$dir|sed 's%/[^/]*%../%g'` ;; + esac + + case "$0" in + /*) autoconf=$top_autoconf; autoheader=$top_autoheader ;; + */*) autoconf=$dots$top_autoconf; autoheader=$dots$top_autoheader ;; + *) autoconf=$top_autoconf; autoheader=$top_autoheader ;; + esac + + case "$AC_MACRODIR" in + /*) macrodir_opt="--macrodir=$AC_MACRODIR" ;; + *) macrodir_opt="--macrodir=$dots$AC_MACRODIR" ;; + esac + + case "$localdir" in + "") localdir_opt= ;; + /*) localdir_opt="--localdir=$localdir" ;; + *) localdir_opt="--localdir=$dots$localdir" ;; + esac + test $verbose = yes && echo running autoconf in $dir - autoconf - if grep AC_CONFIG_HEADER configure.in > /dev/null; then - test $verbose = yes && echo running autoheader in $dir - autoheader + $autoconf $macrodir_opt $localdir_opt + + if grep AC_CONFIG_HEADER configure.in >/dev/null; then + template=`sed -n '/AC_CONFIG_HEADER/{ +s%[^#]*AC_CONFIG_HEADER(\([^)]*\).*%\1% +t here +: here +s%.*:%% +t hascolon +s%$%.in% +: hascolon +p +q +}' configure.in` + if test ! -f $template || grep autoheader $template >/dev/null; then + test $verbose = yes && echo running autoheader in $dir + $autoheader $macrodir_opt $localdir_opt + fi fi ) done diff --git a/autoreconf.sh b/autoreconf.sh index 4b51cf446..9f2c4e5d1 100644 --- a/autoreconf.sh +++ b/autoreconf.sh @@ -18,17 +18,26 @@ usage="\ Usage: autoreconf [-h] [--help] [-m dir] [--macrodir=dir] - [--verbose] [--version] [directory...]" + [-l dir] [--localdir=dir] [--verbose] [--version]" + +localdir= verbose=no show_version=no test -z "$AC_MACRODIR" && AC_MACRODIR=@datadir@ -export AC_MACRODIR # Pass it down to autoconf and autoheader. while test $# -gt 0; do case "$1" in - -h | --help | --hel | --he | --h) + -h | --help | --h*) echo "$usage"; exit 0 ;; + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"$1\" | sed -e 's/^[^=]*=//'`" shift ;; @@ -37,9 +46,9 @@ while test $# -gt 0; do test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } AC_MACRODIR="$1" shift ;; - --verbose | --verbos | --verbo | --verb) + --verbose | --verb*) verbose=yes; shift ;; - --version | --versio | --versi | --vers) + --version | --vers*) show_version=yes; shift ;; --) # Stop option processing. shift; break ;; @@ -55,20 +64,59 @@ if test $show_version = yes; then exit 0 fi -if test $# -eq 0; then paths=.; else paths="$@"; fi +top_autoconf=`echo $0|sed s%autoreconf%autoconf%` +top_autoheader=`echo $0|sed s%autoreconf%autoheader%` # The xargs grep filters out Cygnus configure.in files. -find $paths -name configure.in -print | +find . -name configure.in -print | xargs grep -l AC_OUTPUT | -while read confin; do +sed 's%/configure\.in$%%; s%^./%%' | +while read dir; do ( - dir=`echo $confin|sed 's%/[^/][^/]*$%%'` - cd $dir || exit 1 + cd $dir || continue + + case "$dir" in + .) dots= ;; + *) # A "../" for each directory in /$dir. + dots=`echo /$dir|sed 's%/[^/]*%../%g'` ;; + esac + + case "$0" in + /*) autoconf=$top_autoconf; autoheader=$top_autoheader ;; + */*) autoconf=$dots$top_autoconf; autoheader=$dots$top_autoheader ;; + *) autoconf=$top_autoconf; autoheader=$top_autoheader ;; + esac + + case "$AC_MACRODIR" in + /*) macrodir_opt="--macrodir=$AC_MACRODIR" ;; + *) macrodir_opt="--macrodir=$dots$AC_MACRODIR" ;; + esac + + case "$localdir" in + "") localdir_opt= ;; + /*) localdir_opt="--localdir=$localdir" ;; + *) localdir_opt="--localdir=$dots$localdir" ;; + esac + test $verbose = yes && echo running autoconf in $dir - autoconf - if grep AC_CONFIG_HEADER configure.in > /dev/null; then - test $verbose = yes && echo running autoheader in $dir - autoheader + $autoconf $macrodir_opt $localdir_opt + + if grep AC_CONFIG_HEADER configure.in >/dev/null; then + template=`sed -n '/AC_CONFIG_HEADER/{ +s%[^#]*AC_CONFIG_HEADER(\([^)]*\).*%\1% +t here +: here +s%.*:%% +t hascolon +s%$%.in% +: hascolon +p +q +}' configure.in` + if test ! -f $template || grep autoheader $template >/dev/null; then + test $verbose = yes && echo running autoheader in $dir + $autoheader $macrodir_opt $localdir_opt + fi fi ) done diff --git a/bin/autoconf.in b/bin/autoconf.in index 846560f9b..a5a6a944d 100644 --- a/bin/autoconf.in +++ b/bin/autoconf.in @@ -21,8 +21,8 @@ # the given template file. usage="\ -Usage: autoconf [-hv] [--help] [-m dir] [--macrodir=dir] - [--version] [template-file]" +Usage: autoconf [-h] [--help] [-m dir] [--macrodir=dir] + [-l dir] [--localdir=dir] [--version] [template-file]" # NLS nuisances. # Only set `LANG' and `LC_ALL' to "C" if already set. @@ -40,12 +40,21 @@ case "${M4}" in esac tmpout=/tmp/acout.$$ +localdir= show_version=no while test $# -gt 0 ; do case "${1}" in -h | --help | --h* ) echo "${usage}" 1>&2; exit 0 ;; + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" shift ;; @@ -54,7 +63,7 @@ while test $# -gt 0 ; do test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } AC_MACRODIR="${1}" shift ;; - -v | --version | --v* ) + --version | --v* ) show_version=yes; shift ;; -- ) # Stop option processing shift; break ;; @@ -86,11 +95,17 @@ if test z$infile = z-; then tmpin=/tmp/acin.$$ infile=$tmpin cat > $infile -elif test ! -r "${infile}"; then +elif test ! -r "$infile"; then echo "autoconf: ${infile}: No such file or directory" >&2 exit 1 fi +if test -n "$localdir"; then + use_localdir="-I$localdir" +else + use_localdir= +fi + # Use the frozen version of Autoconf if available. r= f= # Some non-GNU m4's don't reject the --help option, so give them /dev/null. @@ -100,7 +115,8 @@ case `$M4 --help < /dev/null 2>&1` in *) echo Autoconf requires GNU m4 1.1 or later >&2; rm -f $tmpin; exit 1 ;; esac -$M4 -I$AC_MACRODIR $r autoconf.m4$f $infile > $tmpout || { rm -f $tmpin $tmpout; exit 2; } +$M4 -I$AC_MACRODIR $use_localdir $r autoconf.m4$f $infile > $tmpout || + { rm -f $tmpin $tmpout; exit 2; } # You could add your own prefixes to pattern if you wanted to check for # them too, e.g. pattern="AC_\|ILT_", except that UNIX sed doesn't do @@ -118,7 +134,9 @@ if grep "${pattern}" $tmpout > /dev/null 2>&1; then fi if test $# -eq 0; then - exec > configure; chmod +x configure + exec 4> configure; chmod +x configure +else + exec 4>&1 fi # Put the real line numbers into configure to make config.log more helpful. @@ -127,7 +145,8 @@ awk ' { print } ' $tmpout | sed ' /__oline__/s/^\([0-9][0-9]*\):\(.*\)__oline__\(.*\)$/\2\1\3/ -' +' >&4 rm -f $tmpout + exit $status diff --git a/bin/autoheader.in b/bin/autoheader.in index e8f091324..218963edb 100644 --- a/bin/autoheader.in +++ b/bin/autoheader.in @@ -24,7 +24,7 @@ usage="\ Usage: autoheader [-h] [--help] [-m dir] [--macrodir=dir] - [-v] [--version] [template-file]" + [-l dir] [--localdir=dir] [--version] [template-file]" # NLS nuisances. # Only set `LANG' and `LC_ALL' to "C" if already set. @@ -41,26 +41,36 @@ case "${M4}" in test -f "${M4}" || M4=m4 ;; esac +localdir=. show_version=no + while test $# -gt 0 ; do - case "z${1}" in - z-h | z--help | z--h* ) + case "${1}" in + -h | --help | --h* ) echo "${usage}"; exit 0 ;; - z--macrodir=* | z--m*=* ) + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; + --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" shift ;; - z-m | z--macrodir | z--m* ) + -m | --macrodir | --m* ) shift test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } AC_MACRODIR="${1}" shift ;; - z-v | z--version | z--v* ) + --version | --v* ) show_version=yes; shift ;; - z-- ) # Stop option processing + -- ) # Stop option processing shift; break ;; - z- ) # Use stdin as input. + - ) # Use stdin as input. break ;; - z-* ) + -* ) echo "${usage}" 1>&2; exit 1 ;; * ) break ;; @@ -75,7 +85,7 @@ if test $show_version = yes; then fi TEMPLATES="${AC_MACRODIR}/acconfig.h" -test -r acconfig.h && TEMPLATES="${TEMPLATES} acconfig.h" +test -r $localdir/acconfig.h && TEMPLATES="${TEMPLATES} $localdir/acconfig.h" case $# in 0) infile=configure.in ;; @@ -90,6 +100,12 @@ funcs= headers= libs= +if test "$localdir" != .; then + use_localdir="-I$localdir" +else + use_localdir= +fi + # Use the frozen version of Autoconf if available. r= f= # Some non-GNU m4's don't reject the --help option, so give them /dev/null. @@ -102,7 +118,7 @@ esac # Extract assignments of SYMS, TYPES, FUNCS, HEADERS, and LIBS from the # modified autoconf processing of the input file. The sed hair is # necessary to win for multi-line macro invocations. -eval "`$M4 -I$AC_MACRODIR $r autoheader.m4$f $infile | +eval "`$M4 -I$AC_MACRODIR $use_localdir $r autoheader.m4$f $infile | sed -n -e ' : again /^@@@.*@@@$/s/^@@@\(.*\)@@@$/\1/p @@ -137,8 +153,9 @@ esac echo "/* ${config_h_in}. Generated automatically from $infile by autoheader. */" test -r ${config_h}.top && cat ${config_h}.top -test -r acconfig.h && grep @TOP@ acconfig.h >/dev/null && - sed '/@TOP@/,$d' acconfig.h +test -r $localdir/acconfig.h && + grep @TOP@ $localdir/acconfig.h >/dev/null && + sed '/@TOP@/,$d' $localdir/acconfig.h # This puts each template paragraph on its own line, separated by @s. if test -n "$syms"; then @@ -200,8 +217,9 @@ if test -n "$libs"; then done fi -test -r acconfig.h && grep @BOTTOM@ acconfig.h >/dev/null && - sed '1,/@BOTTOM@/d' acconfig.h +test -r $localdir/acconfig.h && + grep @BOTTOM@ $localdir/acconfig.h >/dev/null && + sed '1,/@BOTTOM@/d' $localdir/acconfig.h test -f ${config_h}.bot && cat ${config_h}.bot status=0 diff --git a/bin/autoreconf.in b/bin/autoreconf.in index 4b51cf446..9f2c4e5d1 100644 --- a/bin/autoreconf.in +++ b/bin/autoreconf.in @@ -18,17 +18,26 @@ usage="\ Usage: autoreconf [-h] [--help] [-m dir] [--macrodir=dir] - [--verbose] [--version] [directory...]" + [-l dir] [--localdir=dir] [--verbose] [--version]" + +localdir= verbose=no show_version=no test -z "$AC_MACRODIR" && AC_MACRODIR=@datadir@ -export AC_MACRODIR # Pass it down to autoconf and autoheader. while test $# -gt 0; do case "$1" in - -h | --help | --hel | --he | --h) + -h | --help | --h*) echo "$usage"; exit 0 ;; + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"$1\" | sed -e 's/^[^=]*=//'`" shift ;; @@ -37,9 +46,9 @@ while test $# -gt 0; do test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } AC_MACRODIR="$1" shift ;; - --verbose | --verbos | --verbo | --verb) + --verbose | --verb*) verbose=yes; shift ;; - --version | --versio | --versi | --vers) + --version | --vers*) show_version=yes; shift ;; --) # Stop option processing. shift; break ;; @@ -55,20 +64,59 @@ if test $show_version = yes; then exit 0 fi -if test $# -eq 0; then paths=.; else paths="$@"; fi +top_autoconf=`echo $0|sed s%autoreconf%autoconf%` +top_autoheader=`echo $0|sed s%autoreconf%autoheader%` # The xargs grep filters out Cygnus configure.in files. -find $paths -name configure.in -print | +find . -name configure.in -print | xargs grep -l AC_OUTPUT | -while read confin; do +sed 's%/configure\.in$%%; s%^./%%' | +while read dir; do ( - dir=`echo $confin|sed 's%/[^/][^/]*$%%'` - cd $dir || exit 1 + cd $dir || continue + + case "$dir" in + .) dots= ;; + *) # A "../" for each directory in /$dir. + dots=`echo /$dir|sed 's%/[^/]*%../%g'` ;; + esac + + case "$0" in + /*) autoconf=$top_autoconf; autoheader=$top_autoheader ;; + */*) autoconf=$dots$top_autoconf; autoheader=$dots$top_autoheader ;; + *) autoconf=$top_autoconf; autoheader=$top_autoheader ;; + esac + + case "$AC_MACRODIR" in + /*) macrodir_opt="--macrodir=$AC_MACRODIR" ;; + *) macrodir_opt="--macrodir=$dots$AC_MACRODIR" ;; + esac + + case "$localdir" in + "") localdir_opt= ;; + /*) localdir_opt="--localdir=$localdir" ;; + *) localdir_opt="--localdir=$dots$localdir" ;; + esac + test $verbose = yes && echo running autoconf in $dir - autoconf - if grep AC_CONFIG_HEADER configure.in > /dev/null; then - test $verbose = yes && echo running autoheader in $dir - autoheader + $autoconf $macrodir_opt $localdir_opt + + if grep AC_CONFIG_HEADER configure.in >/dev/null; then + template=`sed -n '/AC_CONFIG_HEADER/{ +s%[^#]*AC_CONFIG_HEADER(\([^)]*\).*%\1% +t here +: here +s%.*:%% +t hascolon +s%$%.in% +: hascolon +p +q +}' configure.in` + if test ! -f $template || grep autoheader $template >/dev/null; then + test $verbose = yes && echo running autoheader in $dir + $autoheader $macrodir_opt $localdir_opt + fi fi ) done diff --git a/bin/ifnames.in b/bin/ifnames.in index 41ac7ec1b..6b4106c9d 100644 --- a/bin/ifnames.in +++ b/bin/ifnames.in @@ -16,25 +16,25 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# Usage: ifnames [--macrodir=dir] [--help] [--version] [file...] # Reads from stdin if no files are given. # Writes to stdout. # Written by David MacKenzie -usage="Usage: ifnames [--macrodir=dir] [--help] [--version] [file...]" +usage="\ +Usage: ifnames [-h] [--help] [-m dir] [--macrodir=dir] [--version] [file...]" show_version=no test -z "$AC_MACRODIR" && AC_MACRODIR=@datadir@ while test $# -gt 0; do case "$1" in - --help | --hel | --he | --h) + -h | --help | --h* ) echo "$usage"; exit 0 ;; --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"$1\" | sed -e 's/^[^=]*=//'`" shift ;; - -m | --macrodir | --m*) + -m | --macrodir | --m* ) shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } AC_MACRODIR="$1" diff --git a/doc/Makefile.in b/doc/Makefile.in index 69a9c6e07..64718c214 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -62,7 +62,7 @@ DISTFILES = COPYING ChangeLog ChangeLog.1 INSTALL \ acconfig.h acfunctions acheaders acidentifiers \ acmakevars acprograms autoconf.info* \ autoconf.sh autoconf.texi install.texi \ - autoheader.sh autoreconf.sh autoscan.pl autoupdate.sh ifnames.sh \ + autoheader.sh autoscan.pl autoreconf.sh autoupdate.sh ifnames.sh \ config.guess config.sub configure configure.in \ install-sh mkinstalldirs texinfo.tex \ testsuite/Makefile.in testsuite/config/*.exp \ @@ -119,8 +119,10 @@ standards.dvi: standards.texi make-stds.texi $(TEXI2DVI) $(srcdir)/standards.texi check: all - rootme=`pwd`; cd testsuite && ${MAKE} $@ AUTOCONF=$$rootme/autoconf \ - AUTOCONFFLAGS="-m $$rootme" + rootme=`pwd`; srcrootme=`cd $(srcdir); pwd`; \ + test -r install-sh || cp $(srcdir)/install-sh .; \ + cd testsuite && ${MAKE} $@ AUTOCONF=$$rootme/autoconf \ + AUTOCONFFLAGS="-m $$srcrootme" installcheck: all install cd testsuite && ${MAKE} AUTOCONF=${bindir}/autoconf $@ @@ -135,7 +137,7 @@ install: all $(M4FILES) acconfig.h installdirs install-info *traditional*) ;; \ *) echo Error: Autoconf requires GNU m4 1.1 or later; exit 1 ;; \ esac - for i in autoconf autoheader autoreconf autoupdate ifnames; do \ + for i in $(APROGS); do \ $(INSTALL_PROGRAM) $$i $(bindir)/$$i; \ done for i in $(M4FILES) acconfig.h; do \ @@ -160,8 +162,7 @@ install-info: info installdirs done uninstall: - rm -f $(bindir)/autoconf $(bindir)/autoheader $(bindir)/autoscan - rm -f $(bindir)/autoreconf $(bindir)/autoupdate $(bindir)/ifnames + cd $(bindir) && rm -f $(PROGS) rm -fr $(acdatadir) cd $(infodir); rm -f autoconf.info* if test -f standards.info || test -f $(srcdir)/standards.info; \ @@ -185,7 +186,7 @@ clean mostlyclean distclean realclean:: done clean mostlyclean distclean realclean:: - rm -f autoconf autoheader autoscan autoreconf autoupdate ifnames *.tmp + rm -f $(PROGS) *.tmp rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs rm -f *.ev *.evs *.ov *.ovs *.cv *.cvs *.ma *.mas diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 2f8cc3ec4..ce0a2595a 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -6,8 +6,8 @@ @c @setchapternewpage odd @c %**end of header -@set EDITION 1.118 -@set VERSION 1.118 +@set EDITION 1.119 +@set VERSION 1.119 @set UPDATED September 1994 @iftex @@ -481,7 +481,7 @@ argument to the macro. To omit the false case, omit the before it. You can include comments in @file{configure.in} files by starting them -with the @code{m4} predefined macro @code{dnl}, which discards text up +with the @code{m4} builtin macro @code{dnl}, which discards text up through the next newline. These comments do not appear in the generated @code{configure} scripts. For example, it is helpful to begin @file{configure.in} files with a line like this: @@ -562,9 +562,11 @@ files in which that identifier occurs. @table @code @item --help +@itemx -h Print a summary of the command line options and exit. @item --macrodir=@var{dir} +@itemx -m @var{dir} @evindex AC_MACRODIR Look for the Autoconf macro files in directory @var{dir} instead of the default installation directory. Only used to get the version number. @@ -603,9 +605,16 @@ definition it reads overrides the earlier ones. @table @code @item --help +@itemx -h Print a summary of the command line options and exit. +@item --localdir=@var{dir} +@itemx -l @var{dir} +Look for the package file @file{aclocal.m4} in directory @var{dir} +instead of in the current directory. + @item --macrodir=@var{dir} +@itemx -m @var{dir} @evindex AC_MACRODIR Look for the installed macro files in directory @var{dir}. You can also set the @code{AC_MACRODIR} environment variable to a directory; this @@ -622,8 +631,12 @@ If you have a lot of Autoconf-generated @code{configure} scripts and you get a new version of Autoconf, the @code{autoreconf} program can be handy. It runs @code{autoconf} (and @code{autoheader}, where appropriate) repeatedly to remake all of the Autoconf @code{configure} -scripts in a directory tree. @xref{Automatic Remaking}, for further -information about automatic remaking of @code{configure} scripts. +scripts in a directory tree. If you give the +@samp{--macrodir=@var{dir}} or @samp{--localdir=@var{dir}} options, it +passes them down (with relative paths adjusted properly). + +@xref{Automatic Remaking}, for information about automatic remaking of +@code{configure} scripts when their source files change. @noindent @code{autoreconf} accepts the following options: @@ -633,6 +646,12 @@ information about automatic remaking of @code{configure} scripts. @itemx -h Print a summary of the command line options and exit. +@item --localdir=@var{dir} +@itemx -l @var{dir} +Look for the package files @file{aclocal.m4} and @file{acconfig.h} (but +not @file{@var{file}.top} and @file{@var{file}.bot}) in directory +@var{dir} instead of in the directory containing each @file{configure.in}. + @item --macrodir=@var{dir} @itemx -m @var{dir} @evindex AC_MACRODIR @@ -644,9 +663,8 @@ environment variable. @item --verbose Print the name of each directory where @code{autoreconf} runs -@code{autoconf} (and @code{autoheader}, if that directory's -@file{configure.in} calls @code{AC_CONFIG_HEADER}). - +@code{autoconf} (and @code{autoheader}, if appropriate). + @item --version Print the version number of Autoconf and exit. @end table @@ -1095,21 +1113,32 @@ 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 or both of those strings may be omitted. -An obsolete way to produce the same effect is to create the files +An alternate 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. +two more files to clutter up the directory. But if you use the +@samp{--localdir=@var{dir}} option to use an @file{acconfig.h} in another +directory, they give you a way to put custom boilerplate in each +individual @file{config.h.in}. @code{autoheader} accepts the following options: @table @code @item --help +@itemx -h Print a summary of the command line options and exit. +@item --localdir=@var{dir} +@itemx -l @var{dir} +Look for the package files @file{aclocal.m4} and @file{acconfig.h} (but +not @file{@var{file}.top} and @file{@var{file}.bot}) in directory +@var{dir} instead of in the current directory. + @item --macrodir=@var{dir} +@itemx -m @var{dir} @evindex AC_MACRODIR Look for the installed macro files and @file{acconfig.h} in directory @var{dir}. You can also set the @code{AC_MACRODIR} environment variable @@ -1214,10 +1243,11 @@ These tests print messages telling the user which feature they're checking for, and what they find. They cache their results for future @code{configure} runs (@pxref{Caching Results}). -Some of these macros set output variables. @xref{Setting Output Variables}, -for details on how this is done. The phrase ``define @var{name}'' is -used below as a shorthand to mean ``define C preprocessor symbol -@var{name} to have the value 1''. +Some of these macros set output variables. @xref{Makefile +Substitutions}, for how to get their values. The phrase ``define +@var{name}'' is used below as a shorthand to mean ``define C +preprocessor symbol @var{name} to the value 1''. @xref{Defining +Symbols}, for how to get those symbol definitions into your program. @menu * Alternative Programs:: Selecting between alternative programs. @@ -2209,9 +2239,9 @@ test macros. @defmac AC_CHECK_TYPE (@var{type}, @var{default}) @maindex CHECK_TYPE -If the type @var{type} is not defined in @file{sys/types.h}, define it -to be the C (or C++) builtin type @var{default}; e.g., @samp{short} or -@samp{unsigned}. +If the type @var{type} is not defined in @file{sys/types.h} or +@file{stdlib.h} (if that is present), define it to be the C (or C++) +builtin type @var{default}; e.g., @samp{short} or @samp{unsigned}. @end defmac @node Compiler Characteristics, System Services, Typedefs, Existing Tests @@ -2876,8 +2906,29 @@ print a message letting the user know the result of the test. @section Defining C Preprocessor Symbols A common action to take in response to a feature test is to define a C -preprocessor symbol indicating the results of the test. These two -macros do that. +preprocessor symbol indicating the results of the test. That is done by +calling @code{AC_DEFINE} or @code{AC_DEFINE_UNQUOTED}. + +By default, @code{AC_OUTPUT} places the symbols defined by these macros +into the output variable @code{DEFS}, which contains an option +@samp{-D@var{symbol}=@var{value}} for each symbol defined. Unlike in +Autoconf version 1, there is no variable @code{DEFS} defined while +@code{configure} is running. To check whether Autoconf macros have +already defined a certain C preprocessor symbol, test the value of the +appropriate cache variable, as in this example: + +@example +AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF)) +if test "$ac_cv_func_vprintf" != yes; then +AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT)) +fi +@end example + +If @code{AC_CONFIG_HEADER} has been called, then instead of creating +@code{DEFS}, @code{AC_OUTPUT} creates a header file by substituting the +correct values into @code{#define} statements in a template file. +@xref{Configuration Headers}, for more information about this kind of +output. @defmac AC_DEFINE (@var{variable} @r{[}, @var{value}@r{]}) @maindex DEFINE @@ -2913,26 +2964,6 @@ AC_DEFINE_UNQUOTED($@{ac_tr_hdr@}) @end example @end defmac -By default, @code{AC_OUTPUT} substitutes the symbols defined by these -macros into the output variable @code{DEFS}, which contains an option -@samp{-D@var{symbol}=@var{value}} for each symbol defined. Unlike in -Autoconf version 1, there is no variable @code{DEFS} defined while -@code{configure} is running. To check whether Autoconf macros have -already defined a certain C preprocessor symbol, test the value of the -appropriate cache variable, as in this example: - -@example -AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF)) -if test "$ac_cv_func_vprintf" != yes; then -AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT)) -fi -@end example - -If @code{AC_CONFIG_HEADER} has been called, then instead of substituting -@code{DEFS}, @code{AC_OUTPUT} creates a header file by substituting the -correct values into @code{#define} statements in a template file. -@xref{Configuration Headers}, for more information about this kind of output. - Due to the syntactical bizarreness of the Bourne shell, do not use semicolons to separate @code{AC_DEFINE} or @code{AC_DEFINE_UNQUOTED} calls from other macro calls or shell code; that can cause syntax errors diff --git a/ifnames.in b/ifnames.in index 41ac7ec1b..6b4106c9d 100644 --- a/ifnames.in +++ b/ifnames.in @@ -16,25 +16,25 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# Usage: ifnames [--macrodir=dir] [--help] [--version] [file...] # Reads from stdin if no files are given. # Writes to stdout. # Written by David MacKenzie -usage="Usage: ifnames [--macrodir=dir] [--help] [--version] [file...]" +usage="\ +Usage: ifnames [-h] [--help] [-m dir] [--macrodir=dir] [--version] [file...]" show_version=no test -z "$AC_MACRODIR" && AC_MACRODIR=@datadir@ while test $# -gt 0; do case "$1" in - --help | --hel | --he | --h) + -h | --help | --h* ) echo "$usage"; exit 0 ;; --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"$1\" | sed -e 's/^[^=]*=//'`" shift ;; - -m | --macrodir | --m*) + -m | --macrodir | --m* ) shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } AC_MACRODIR="$1" diff --git a/ifnames.sh b/ifnames.sh index 41ac7ec1b..6b4106c9d 100644 --- a/ifnames.sh +++ b/ifnames.sh @@ -16,25 +16,25 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# Usage: ifnames [--macrodir=dir] [--help] [--version] [file...] # Reads from stdin if no files are given. # Writes to stdout. # Written by David MacKenzie -usage="Usage: ifnames [--macrodir=dir] [--help] [--version] [file...]" +usage="\ +Usage: ifnames [-h] [--help] [-m dir] [--macrodir=dir] [--version] [file...]" show_version=no test -z "$AC_MACRODIR" && AC_MACRODIR=@datadir@ while test $# -gt 0; do case "$1" in - --help | --hel | --he | --h) + -h | --help | --h* ) echo "$usage"; exit 0 ;; --macrodir=* | --m*=* ) AC_MACRODIR="`echo \"$1\" | sed -e 's/^[^=]*=//'`" shift ;; - -m | --macrodir | --m*) + -m | --macrodir | --m* ) shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } AC_MACRODIR="$1" diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index ee5da5445..1c971cfdb 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -24,7 +24,7 @@ dnl divert(-1)dnl Throw away output until AC_INIT is called. changequote([, ]) -define(AC_ACVERSION, 1.118) +define(AC_ACVERSION, 1.119) dnl Some old m4's don't support m4exit. But they provide dnl equivalent functionality by core dumping because of the @@ -957,7 +957,7 @@ define(AC_MSG_WARN, dnl AC_MSG_ERROR(ERROR-DESCRIPTION) define(AC_MSG_ERROR, -[{ echo "configure: $1" 1>&2; exit 1; }]) +[{ echo "configure: error: $1" 1>&2; exit 1; }]) dnl ### Selecting which language to use for testing @@ -1426,9 +1426,13 @@ undefine([AC_CV_NAME])dnl dnl AC_CHECK_TYPE(TYPE, DEFAULT) AC_DEFUN(AC_CHECK_TYPE, -[AC_MSG_CHECKING(for $1 in sys/types.h) +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_MSG_CHECKING(for $1) AC_CACHE_VAL(ac_cv_type_$1, -[AC_EGREP_HEADER($1, sys/types.h, ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl +[AC_EGREP_CPP($1, [#include +#if STDC_HEADERS +#include +#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl AC_MSG_RESULT($ac_cv_type_$1) if test $ac_cv_type_$1 = no; then AC_DEFINE($1, $2)