]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
add new utilities, cache specific macros, document new stuff
authorDavid MacKenzie <djm@djmnet.org>
Tue, 19 Jul 1994 14:44:16 +0000 (14:44 +0000)
committerDavid MacKenzie <djm@djmnet.org>
Tue, 19 Jul 1994 14:44:16 +0000 (14:44 +0000)
22 files changed:
Makefile.in
NEWS
acgeneral.m4
acspecific.m4
autoconf.in
autoconf.sh
autoconf.texi
autoheader.in
autoheader.sh
autoreconf.in
autoreconf.sh
autoscan.in
autoscan.pl
bin/autoconf.in
bin/autoheader.in
bin/autoreconf.in
bin/autoscan.in
configure.in
doc/Makefile.in
doc/autoconf.texi
lib/autoconf/general.m4
lib/autoconf/specific.m4

index 701ee6d92f9c03f1198a900a243555c8d4978c93..83241422b04064f77d11be3f15fad7728da20cd8 100644 (file)
@@ -27,7 +27,7 @@ MAKEINFO = makeinfo
 TEXI2DVI = texi2dvi
 M4 = @M4@
 
-PROGS = autoconf autoheader autoreconf @PROGS@
+PROGS = autoconf autoheader autoreconf ifnames @PROGS@
 # Path of the perl interpreter.
 PERL = @PERL@
 
@@ -54,9 +54,13 @@ DISTDEP = info Makefile
 DISTFILES = COPYING ChangeLog INSTALL Makefile.in NEWS README \
        acconfig.h acfunctions acgeneral.m4 acheaders acidentifiers \
        acmakevars acprograms acspecific.m4 autoconf.info* \
-       autoconf.sh autoconf.texi autoheader.sh autoreconf.sh autoscan.pl \
+       autoconf.sh autoconf.texi install.texi \
+       autoheader.sh autoreconf.sh autoscan.pl shindent.sh ifnames.sh \
        config.guess config.sub configure configure.in \
        install.sh mkinstalldirs texinfo.tex \
+       testsuite/Makefile.in testsuite/config/*.exp \
+       testsuite/lib/*.exp \
+       testsuite/autoconf.0/*.exp \
        standards.texi make-stds.texi standards.info*
 
 editsh = sed -e 's,@''datadir''@,$(acdatadir),g' -e 's,@''M4''@,$(M4),g'
@@ -76,15 +80,27 @@ autoreconf: autoreconf.sh
        rm -f $@ $@.tmp
        $(editsh) $(srcdir)/autoreconf.sh > $@.tmp && mv $@.tmp $@ && chmod +x $@
 
+shindent: shindent.sh
+       rm -f $@ $@.tmp
+       $(editsh) $(srcdir)/shindent.sh > $@.tmp && mv $@.tmp $@ && chmod +x $@
+
+ifnames: ifnames.sh
+       rm -f $@ $@.tmp
+       $(editsh) $(srcdir)/ifnames.sh > $@.tmp && mv $@.tmp $@ && chmod +x $@
+
 autoscan: autoscan.pl
        rm -f $@ $@.tmp
        $(editpl) $(srcdir)/autoscan.pl > $@.tmp && mv $@.tmp $@ && chmod +x $@
 
-info: autoconf.info @standards_info@
+info: autoconf.info @standards_info@ INSTALL
 
-autoconf.info: autoconf.texi
+autoconf.info: autoconf.texi install.texi
        $(MAKEINFO) -I$(srcdir) $(srcdir)/autoconf.texi --output=$@
 
+INSTALL: install.texi
+       $(MAKEINFO) -I$(srcdir) $(srcdir)/install.texi --output=$@ \
+       --no-headers --no-validate
+
 standards.info: standards.texi make-stds.texi
        $(MAKEINFO) -I$(srcdir) $(srcdir)/standards.texi --output=$@
 
@@ -96,8 +112,11 @@ autoconf.dvi: autoconf.texi
 standards.dvi: standards.texi make-stds.texi
        $(TEXI2DVI) $(srcdir)/standards.texi
 
-check:
-installcheck:
+check: all
+       rootme=`pwd`; cd testsuite && ${MAKE} $@ AUTOCONF=$$rootme/autoconf \
+       AUTOCONFFLAGS="-m $$rootme"
+installcheck: all install
+       cd testsuite && ${MAKE} AUTOCONF=${bindir}/autoconf $@
 
 installdirs:
        $(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir) $(acdatadir)
@@ -107,11 +126,14 @@ install: all acgeneral.m4 acspecific.m4 acconfig.h installdirs install-info
        $(INSTALL_PROGRAM) autoconf $(bindir)/autoconf
        $(INSTALL_PROGRAM) autoheader $(bindir)/autoheader
        $(INSTALL_PROGRAM) autoreconf $(bindir)/autoreconf
+       $(INSTALL_PROGRAM) ifnames $(bindir)/ifnames
        $(INSTALL_DATA) $(srcdir)/acgeneral.m4 $(acdatadir)/acgeneral.m4
        $(INSTALL_DATA) $(srcdir)/acspecific.m4 $(acdatadir)/acspecific.m4
        $(INSTALL_DATA) $(srcdir)/acconfig.h $(acdatadir)/acconfig.h
        -if test -f autoscan; then \
        $(INSTALL_PROGRAM) autoscan $(bindir)/autoscan; \
+       -if test -f shindent; then \
+       $(INSTALL_PROGRAM) shindent $(bindir)/shindent; \
        $(INSTALL_DATA) $(srcdir)/acfunctions $(acdatadir)/acfunctions; \
        $(INSTALL_DATA) $(srcdir)/acheaders $(acdatadir)/acheaders; \
        $(INSTALL_DATA) $(srcdir)/acidentifiers $(acdatadir)/acidentifiers; \
@@ -131,7 +153,7 @@ install-info: info installdirs
 
 uninstall:
        rm -f $(bindir)/autoconf $(bindir)/autoheader $(bindir)/autoscan 
-       rm -f $(bindir)/autoreconf
+       rm -f $(bindir)/autoreconf $(bindir)/shindent $(bindir)/ifnames
        rm -fr $(acdatadir)
        cd $(infodir); rm -f autoconf.info*
        if test -f standards.info || test -f $(srcdir)/standards.info; \
@@ -149,7 +171,7 @@ config.status: configure
        ./config.status --recheck
 
 clean:
-       rm -f autoconf autoheader autoscan autoreconf *.tmp
+       rm -f autoconf autoheader autoscan autoreconf shindent ifnames *.tmp
        rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log
        rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs *.ma *.mas
 
@@ -159,7 +181,7 @@ distclean: clean
        rm -f Makefile config.status config.cache config.log
 
 realclean: distclean
-       rm -f TAGS *.info*
+       rm -f TAGS *.info* INSTALL
 
 TAGS:
        etags ${srcdir}/*.m4 ${srcdir}/*.sh ${srcdir}/[a-z]*.in ${srcdir}/*.texi
@@ -169,10 +191,11 @@ dist: $(DISTDEP)
        distname=`sed -e '/define(AC_ACVERSION,/!d' \
        -e 's/[^0-9.]*\([0-9.]*\).*/autoconf-\1/' -e q acgeneral.m4`; \
        rm -fr $$distname; \
-       mkdir $$distname; \
+       mkdir $$distname $$distname/testsuite $$distname/testsuite/config; \
+       mkdir $$distname/testsuite/lib $$distname/testsuite/autoconf.0; \
        for file in $(DISTFILES); do \
-         ln $$file $$distname \
-         || { echo copying $$file instead; cp -p $$file $$distname;}; \
+         ln $$file $$distname/$$file \
+         || { echo copying $$file instead; cp -p $$file $$distname/$$file;}; \
        done; \
        chmod -R a+rX $$distname; \
        tar -chz -f $$distname.tar.gz $$distname; \
diff --git a/NEWS b/NEWS
index 4dbe8fb6e6b0ad5c465d9b783514a828c2e1d41a..e84006ea0bda44866de6959e1aa125953e403004 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,16 +7,19 @@ Major changes in release 2.0:
 * Uses optional shell scripts $exec_prefix/lib/config.site and
   $prefix/lib/config.site to perform site or system specific initializations. 
 * configure saves compiler output to ./config.log for debugging.
+* Has the beginnings of a DejaGnu test suite.
 
 ** New macros:
 * AC_CACHE_VAL to share results of tests between configure runs.
 * AC_CONFIG_AUX_DIR, AC_CANONICAL_SYSTEM, AC_LINK_FILES to
   support deciding unguessable features based on the host and target types.
 * AC_CONFIG_SUBDIRS to recursively configure a source tree.
+* AC_CHECK_TYPE, which checks whether sys/types.h defines a given type.
 * AC_TEST_LINK, which obsoletes AC_COMPILE_CHECK.
 * AC_TEST_RUN, which obsoletes AC_TEST_PROGRAM.
 * AC_PREFIX_PROGRAM, which obsoletes AC_PREFIX.
 * AC_ARG_ENABLE and AC_ARG_WITH, which obsolete AC_ENABLE and AC_WITH.
+* AC_SUBST_FILE, to insert one file into another.
 
 ** Changed macros:
 * AC_OUTPUT adds the "automatically generated" comment after "#!" lines, 
@@ -34,6 +37,10 @@ Major changes in release 2.0:
   programs, and header files.
 * autoreconf to recursively remake configure and configuration header
   files in a source tree.
+* shindent to produce consistent indentation in shell scripts, such as
+  configure. 
+* ifnames to list the symbols used in #if and #ifdef directives in a
+  source tree.
 \f
 Major changes in release 1.11:
 
index 6c3e5cfdf779a18e6a921ee87b1acbacf3133d46..429cef7b89c3d7143641a82b8c23cb74de4b30d4 100644 (file)
@@ -29,10 +29,10 @@ dnl
 ifdef([__gnu__], , [errprint(Autoconf requires GNU m4
 )m4exit(2)])dnl
 dnl
-define(AC_ACVERSION, 1.93)dnl
+define(AC_ACVERSION, 1.94)dnl
 dnl This is defined by the --version option of the autoconf script.
-ifdef([AC_PRINT_VERSION], [errprint(Autoconf version AC_ACVERSION
-)m4exit(0)])dnl
+ifdef([AC_PRINT_VERSION], [Autoconf version AC_ACVERSION
+m4exit(0)])dnl
 dnl
 dnl
 dnl ### Controlling Autoconf operation
@@ -71,7 +71,7 @@ define(AC_PARSEARGS,
 [AC_BEFORE([$0], [AC_ARG_ENABLE])dnl
 AC_BEFORE([$0], [AC_ARG_WITH])dnl
 # Save the original args to write them into config.status later.
-configure_args="[$]*"
+configure_args="[$]@"
 
 # Omit some internal, obsolete, or unimplemented options to make the
 # list less imposing.
@@ -124,6 +124,8 @@ verbose=
 x_includes=
 x_libraries=
 
+subdirs=
+
 ac_prev=
 for ac_option
 do
@@ -395,8 +397,9 @@ running configure, to aid debugging if configure makes a mistake.
 " 1>&6
 
 # Save the original args if we used an alternate arg parser.
-ac_configure_temp="${configure_args-[$]*}"
+ac_configure_temp="${configure_args-[$]@}"
 # Strip out --no-create and --norecursion so they do not pile up.
+# Also quote any args containing spaces.
 configure_args=
 for ac_arg in $ac_configure_temp; do
   case "$ac_arg" in
@@ -404,6 +407,9 @@ for ac_arg in $ac_configure_temp; do
   | --no-cr | --no-c) ;;
   -norecursion | --norecursion | --norecursio | --norecursi \
   | --norecurs | --norecur | --norecu | --norec | --nore | --nor) ;;
+changequote(,)dnl
+  *["  "]*) configure_args="$configure_args '$ac_arg'" ;;
+changequote([,])dnl
   *) configure_args="$configure_args $ac_arg" ;;
   esac
 done
@@ -448,6 +454,8 @@ if test ! -r $srcdir/$ac_unique_file; then
   fi
 fi
 
+ifdef([AC_LIST_SUBDIRS],[subdirs="AC_LIST_SUBDIRS"
+AC_SUBST(subdirs)])dnl
 ifdef([AC_LIST_PREFIX_PROGRAM], [AC_PREFIX(AC_LIST_PREFIX_PROGRAM)])dnl
 dnl Let the site file select an alternate cache file if it wants to.
 AC_SITE_LOAD
@@ -630,7 +638,7 @@ define(AC_CANONICAL_SYSTEM,
 #    as determined by config.guess.
 # 4. Target defaults to nonopt.
 # 5. If nonopt is not specified, then target defaults to host.
-# 6. build defaults to empty.
+# 6. build defaults to empty (but implicitly to host).
 
 # The aliases save the names the user supplied, while $host etc.
 # will get canonicalized.
@@ -675,6 +683,9 @@ host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
 test -n "$host" && AC_VERBOSE(setting host to $host)
 AC_SUBST(host)dnl
 AC_SUBST(host_alias)dnl
+AC_SUBST(host_cpu)dnl
+AC_SUBST(host_vendor)dnl
+AC_SUBST(host_os)dnl
 ])dnl
 dnl
 define(AC_CANONICAL_TARGET,
@@ -695,6 +706,9 @@ target_os=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
 test -n "$target" && AC_VERBOSE(setting target to $target)
 AC_SUBST(target)dnl
 AC_SUBST(target_alias)dnl
+AC_SUBST(target_cpu)dnl
+AC_SUBST(target_vendor)dnl
+AC_SUBST(target_os)dnl
 ])dnl
 dnl
 define(AC_CANONICAL_BUILD,
@@ -712,6 +726,9 @@ esac
 test -n "$build" && AC_VERBOSE(setting build to $build)
 AC_SUBST(build)dnl
 AC_SUBST(build_alias)dnl
+AC_SUBST(build_cpu)dnl
+AC_SUBST(build_vendor)dnl
+AC_SUBST(build_os)dnl
 ])dnl
 dnl
 dnl Link each of the existing files in $2 to the corresponding
@@ -772,7 +789,8 @@ cat > $cache_file <<\CEOF
 CEOF
 changequote(,)dnl
 dnl Allow a site initialization script to override cache values.
-set | sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1-'\2'}/p" >> $cache_file
+# Ultrix sh set writes to stderr and can't be redirected directly.
+(set) 2>&1 | sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1-'\2'}/p" >> $cache_file
 changequote([,])dnl
 fi])dnl
 dnl
@@ -781,7 +799,7 @@ dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved.
 define(AC_CACHE_VAL,
 [dnl We used to use the below line, but it fails if the 1st arg is a
 dnl shell variable, so we need the eval.
-dnl if test "${$1+set}" = set; then 
+dnl if test "${$1+set}" = set; then
 if eval "test \"`echo '${'$1'+set}'`\" = set"; then
 dnl This verbose message is just for testing the caching code.
   AC_VERBOSE(using cached value for $1)
@@ -891,6 +909,27 @@ $1='[$]$1'
 divert(AC_DIVERSION_NORMAL)dnl
 ])])dnl
 dnl
+dnl AC_SUBST_FILE(VARIABLE, FILE)
+define(AC_SUBST_FILE,
+[if test -f $2; then
+  AC_VERBOSE(using $2 for $1)
+  AC_INSERT_FILE($1, $2)
+elif test -f ${srcdir}/$2; then
+  AC_VERBOSE(using ${srcdir}/$2 for $1)
+  AC_INSERT_FILE($1, ${srcdir}/$2)
+fi
+])dnl
+define(AC_INSERT_FILE,
+[ifdef([AC_SUBST_$1], ,
+[define([AC_SUBST_$1], )dnl
+divert(AC_DIVERSION_SED)dnl
+/@$1@/r [$]$1
+s%@$1@%%g
+divert(AC_DIVERSION_VAR)dnl
+$1='$2'
+divert(AC_DIVERSION_NORMAL)dnl
+])])dnl
+dnl
 dnl
 dnl ### Printing messages
 dnl
@@ -1051,7 +1090,8 @@ done
 ifelse([$3],,, [test -n "[$]$1" || $1="$3"
 ])])dnl
 dnl
-dnl AC_HAVE_LIBRARY(LIBRARY [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl AC_HAVE_LIBRARY(LIBRARY [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
+dnl                 [, OTHER-LIBRARIES]]])
 define(AC_HAVE_LIBRARY, [dnl
 changequote(/,/)dnl
 define(/AC_LIB_NAME/, dnl
@@ -1061,23 +1101,21 @@ changequote([,])dnl
 AC_CHECKING([for -l[]AC_LIB_NAME])
 AC_CACHE_VAL(AC_CV_NAME,
 [ac_save_LIBS="${LIBS}"
-LIBS="${LIBS} -l[]AC_LIB_NAME[]"
-AC_TEST_LINK( , [main();],
-AC_CV_NAME=yes, AC_CV_NAME=no)dnl
+LIBS="${LIBS} -l[]AC_LIB_NAME[] $4"
+AC_TEST_LINK( , [main();], AC_CV_NAME=yes, AC_CV_NAME=no)dnl
 LIBS="${ac_save_LIBS}"
 ])dnl
 if test "${AC_CV_NAME}" = yes; then
-ifelse($#, 1, [dnl
-   AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z]))
-   LIBS="${LIBS} -l[]AC_LIB_NAME[]"
-undefine(AC_LIB_NAME)dnl
-undefine(AC_CV_NAME)dnl
-], [dnl
-   :; $2
-else
-   :; $3
+  ifelse([$2], , 
+[AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z]))
+  LIBS="${LIBS} -l[]AC_LIB_NAME[]"
+], [$2])
+ifelse([$3], , , [else
+  $3
 ])dnl
 fi
+undefine(AC_LIB_NAME)dnl
+undefine(AC_CV_NAME)dnl
 ])dnl
 dnl
 dnl
@@ -1133,7 +1171,9 @@ cat > conftest.${ac_ext} <<EOF
 #include "confdefs.h"
 [$1]
 int main() { return 0; }
-int t() { [$2]; return 0; }
+int t() {
+[$2]
+; return 0; }
 EOF
 if eval $ac_compile; then
   ifelse([$3], , :, [rm -rf conftest*
@@ -1274,8 +1314,8 @@ AC_SUBST(LIBOBJS)dnl
 ])dnl
 dnl
 dnl AC_SIZEOF_TYPE(TYPE)
-define(AC_SIZEOF_TYPE, [dnl
-changequote(<<,>>)dnl
+define(AC_SIZEOF_TYPE,
+[changequote(<<,>>)dnl
 dnl The name to #define.
 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
 dnl The cache variable name.
@@ -1296,6 +1336,16 @@ undefine(AC_TYPE_NAME)dnl
 undefine(AC_CV_NAME)dnl
 ])dnl
 dnl
+dnl AC_CHECK_TYPE(TYPE, DEFAULT)
+define(AC_CHECK_TYPE,
+[AC_CHECKING(for $1 in sys/types.h)
+AC_CACHE_VAL(ac_cv_type_$1,
+[AC_HEADER_EGREP($1, sys/types.h, ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
+if test $ac_cv_type_$1 = no; then
+  AC_DEFINE($1, $2)
+fi
+])dnl
+dnl
 dnl
 dnl ### The big finish
 dnl
@@ -1462,8 +1512,8 @@ dnl
 dnl Create the header files listed in $1.
 dnl This is a subroutine of AC_OUTPUT.  It is called inside a quoted
 dnl here document whose contents are going into config.status.
-define(AC_OUTPUT_HEADER,[dnl
-changequote(<<,>>)dnl
+define(AC_OUTPUT_HEADER,
+[changequote(<<,>>)dnl
 
 # These sed commands are put into ac_sed_defs when defining a macro.
 # They are broken into pieces to make the sed script easier to manage.
@@ -1595,7 +1645,7 @@ dnl
 define(AC_OUTPUT_SUBDIRS,
 [if test -z "${norecursion}"; then
 
-  # Remove --cache-file arguments so they do not pile up.
+  # Remove --cache-file and --srcdir arguments so they do not pile up.
   ac_sub_configure_args=
   ac_prev=
   for ac_arg in $configure_args; do
@@ -1610,6 +1660,13 @@ define(AC_OUTPUT_SUBDIRS,
     -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
     | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
       ;;
+    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+      ac_prev=srcdir ;;
+    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+      ;;
+changequote(,)dnl
+    *["        "]*) ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
+changequote([,])dnl
     *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
     esac
   done
@@ -1669,8 +1726,8 @@ changequote([,])dnl
 
     # The recursion is here.
     if test -n "${ac_sub_configure}"; then
-      AC_VERBOSE([running ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file])
-      if ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file
+      AC_VERBOSE([running ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file] --srcdir=${ac_sub_srcdir})
+      if ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file --srcdir=${ac_sub_srcdir}
       then :
       else
         AC_ERROR(${ac_sub_configure} failed for ${ac_config_dir})
index 3024af70850af674f5fa7ad2bb15b634bac85ab3..ac384226ea1438ac4ecd05cacd03b26f03d307bb 100644 (file)
@@ -41,7 +41,7 @@ if ${CC-cc} -E conftest.c 2>&6 | egrep yes >/dev/null 2>&1; then
 else
   ac_cv_prog_gcc=no
 fi])dnl
-if test "$ac_cv_prog_gcc" = yes; then GCC=yes; else GCC= ; fi
+if test $ac_cv_prog_gcc = yes; then GCC=yes; else GCC= ; fi
 ])dnl
 dnl
 define(AC_PROG_CXX,
@@ -61,13 +61,13 @@ if ${CXX-gcc} -E conftest.C 2>&6 | egrep yes >/dev/null 2>&1; then
 else
   ac_cv_prog_gxx=no
 fi])dnl
-if test "$ac_cv_prog_gxx" = yes; then GXX=yes; else GXX= ; fi
+if test $ac_cv_prog_gxx = yes; then GXX=yes; else GXX= ; fi
 ])dnl
 dnl
 define(AC_GCC_TRADITIONAL,
 [AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([AC_PROG_CPP])dnl
-if test "$ac_cv_prog_gcc" = yes; then
+if test $ac_cv_prog_gcc = yes; then
   AC_CHECKING(whether -traditional is needed)
 AC_CACHE_VAL(ac_cv_prog_gcc_traditional,
 [  ac_pattern="Autoconf.*'x'"
@@ -76,12 +76,12 @@ Autoconf TIOCGETP'
   AC_PROGRAM_EGREP($ac_pattern, $ac_prog,
   ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no)
 
-  if test "$ac_cv_prog_gcc_traditional" = no; then
+  if test $ac_cv_prog_gcc_traditional = no; then
     ac_prog='#include <termio.h>
 Autoconf TCGETA'
     AC_PROGRAM_EGREP($ac_pattern, $ac_prog, ac_cv_prog_gcc_traditional=yes)
   fi])dnl
-  if test "$ac_cv_prog_gcc_traditional" = yes; then
+  if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
     AC_VERBOSE(setting CC to $CC)
   fi
@@ -94,6 +94,9 @@ define(AC_MINUS_C_MINUS_O,
 else
   AC_CHECKING(whether cc understands -c and -o together)
 fi
+set dummy $CC; ac_cc=[$]2
+AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
+[ac_cv_prog_cc_${ac_cc}_c_o=no
 echo 'foo(){}' > conftest.c
 # Make sure it works both with $CC and with simple cc.
 # We do the test twice because some compilers refuse to overwrite an
@@ -108,22 +111,24 @@ then
       if cc -c conftest.c -o conftest2.o 1>&6 2>&6 &&
         test -f conftest2.o && cc -c conftest.c -o conftest2.o 1>&6 2>&6
       then
-        :
-      else
-        AC_DEFINE(NO_MINUS_C_MINUS_O)
+        ac_cv_prog_cc_${ac_cc}_c_o=yes
       fi
     fi
   fi
-else
-  AC_DEFINE(NO_MINUS_C_MINUS_O)
 fi
 rm -f conftest*
 ])dnl
+if test $ac_cv_prog_cc_${ac_cc}_c_o = no; then
+  AC_DEFINE(NO_MINUS_C_MINUS_O)
+fi
+])dnl
 dnl
 dnl Define SET_MAKE to set ${MAKE} if make doesn't.
 define(AC_SET_MAKE,
 [AC_CHECKING(whether ${MAKE-make} sets \$MAKE)
-cat > conftestmake <<'EOF'
+set dummy ${MAKE-make}; ac_make=[$]2
+AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
+[cat > conftestmake <<'EOF'
 all:
        @echo 'ac_maketemp="${MAKE}"'
 EOF
@@ -132,12 +137,17 @@ changequote(,)dnl
 eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
 changequote([,])dnl
 if test -n "$ac_maketemp"; then
+  ac_cv_prog_make_${ac_make}_set=yes
+else
+  ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake])dnl
+if test $ac_cv_prog_make_${ac_make}_set = yes; then
   SET_MAKE=
 else
   SET_MAKE="MAKE=${MAKE-make}"
   AC_VERBOSE(setting MAKE to ${MAKE-make} in Makefiles)
 fi
-rm -f conftestmake
 AC_SUBST([SET_MAKE])dnl
 ])dnl
 dnl
@@ -151,18 +161,20 @@ define(AC_PROG_CPP,
 [AC_PROVIDE([$0])dnl
 AC_CHECKING(how to run the C preprocessor)
 if test -z "$CPP"; then
-  # This must be in double quotes, not single quotes, because CPP may get
-  # substituted into the Makefile and "${CC-cc}" will simply confuse
-  # make.  It must be expanded now.
+AC_CACHE_VAL(ac_cv_prog_CPP,
+[  # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
   CPP="${CC-cc} -E"
-dnl On the NeXT, cc -E runs the code through the compiler's parser,
-dnl not just through cpp.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
   AC_TEST_CPP([#include <stdio.h>
 Syntax Error], ,
   CPP="${CC-cc} -E -traditional-cpp"
   AC_TEST_CPP([#include <stdio.h>
 Syntax Error], ,CPP=/lib/cpp))
+  ac_cv_prog_CPP="$CPP"])dnl
 fi
+CPP="$ac_cv_prog_CPP"
 AC_VERBOSE(setting CPP to $CPP)
 AC_SUBST(CPP)dnl
 ])dnl
@@ -170,14 +182,17 @@ dnl
 define(AC_PROG_CXXCPP,
 [AC_PROVIDE([$0])dnl
 AC_CHECKING(how to run the C++ preprocessor)
-AC_LANG_SAVE[]dnl
-AC_LANG_CPLUSPLUS[]dnl
 if test -z "$CXXCPP"; then
+AC_CACHE_VAL(ac_cv_prog_CXXCPP,
+[AC_LANG_SAVE[]dnl
+AC_LANG_CPLUSPLUS[]dnl
   CXXCPP="${CXX-c++} -E"
   AC_TEST_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
-fi
-AC_VERBOSE(setting CXXCPP to $CXXCPP)
+  ac_cv_prog_CXXCPP="$CXXCPP"
 AC_LANG_RESTORE[]dnl
+fi])dnl
+CXXCPP="$ac_cv_prog_CXXCPP"
+AC_VERBOSE(setting CXXCPP to $CXXCPP)
 AC_SUBST(CXXCPP)dnl
 ])dnl
 dnl
@@ -199,16 +214,18 @@ fi
 AC_VERBOSE(setting LEXLIB to $LEXLIB)
 AC_SUBST(LEXLIB)])dnl
 dnl
-define(AC_YYTEXT_POINTER,[dnl
-AC_REQUIRE_CPP()dnl
+define(AC_YYTEXT_POINTER,
+[AC_REQUIRE_CPP()dnl
 AC_REQUIRE([AC_PROG_LEX])dnl
 AC_CHECKING(for yytext declaration)
-# POSIX says lex can declare yytext either as a pointer or an array; the
+AC_CACHE_VALUE(ac_cv_prog_lex_yytext_pointer,
+[# POSIX says lex can declare yytext either as a pointer or an array; the
 # default is implementation-dependent. Figure out which it is, since
 # not all implementations provide the %pointer and %array declarations.
 #
 # The minimal lex program is just a single line: %%.  But some broken lexes
 # (Solaris, I think it was) want two %% lines, so accommodate them.
+ac_cv_prog_lex_yytext_pointer=no
   echo '%%
 %%' | ${LEX}
 if test -f lex.yy.c; then
@@ -216,17 +233,16 @@ if test -f lex.yy.c; then
 elif test -f lexyy.c; then
   LEX_OUTPUT_ROOT=lexyy
 else
-  # Do not know what to do here.
-  AC_ERROR(cannot find output from $LEX, giving up on yytext declaration)
-  LEX_OUTPUT_ROOT=
-fi
-if test -n "$LEX_OUTPUT_ROOT"; then
-  echo 'extern char *yytext; main () { exit (0); }' >>$LEX_OUTPUT_ROOT.c
-  ac_save_LIBS="$LIBS"
-  LIBS="$LIBS $LEXLIB"
-  AC_TEST_LINK(`cat $LEX_OUTPUT_ROOT.c`, AC_DEFINE(YYTEXT_POINTER))
-  LIBS="$ac_save_LIBS"
-  rm -f "${LEX_OUTPUT_ROOT}.c"
+  AC_ERROR(cannot find output from $LEX, giving up)
+fi
+echo 'extern char *yytext; main () { exit (0); }' >>$LEX_OUTPUT_ROOT.c
+ac_save_LIBS="$LIBS"
+LIBS="$LIBS $LEXLIB"
+AC_TEST_LINK(`cat $LEX_OUTPUT_ROOT.c`, ac_cv_prog_lex_yytext_pointer=yes)
+LIBS="$ac_save_LIBS"
+rm -f "${LEX_OUTPUT_ROOT}.c"])dnl
+if test $ac_cv_prog_lex_yytext_pointer = yes; then
+  AC_DEFINE(YYTEXT_POINTER)
 fi
 AC_SUBST(LEX_OUTPUT_ROOT)dnl
 ])dnl
@@ -258,7 +274,7 @@ AC_CACHE_VAL(ac_cv_path_install,
     ''|.|/etc|/sbin|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
     *)
       # OSF1 and SCO ODT 3.0 have their own names for install.
-      for ac_prog in installbsd scoinst install; do
+      for ac_prog in ginstall installbsd scoinst install; do
         if test -f $ac_dir/$ac_prog; then
          if test $ac_prog = install &&
             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
@@ -294,35 +310,47 @@ AC_VERBOSE(setting INSTALL_DATA to $INSTALL_DATA)
 ])dnl
 dnl
 define(AC_LN_S,
-[AC_CHECKING(for ln -s)
-rm -f conftestdata
+[AC_CHECKING(whether ln -s works)
+AC_CACHE_VAL(ac_cv_prog_LN_S,
+[rm -f conftestdata
 if ln -s X conftestdata 2>/dev/null
 then
   rm -f conftestdata
-  LN_S="ln -s"
+  ac_cv_prog_LN_S="ln -s"
+else
+  ac_cv_prog_LN_S=ln
+fi])dnl
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
   AC_VERBOSE(ln -s is supported)
 else
-  LN_S=ln
   AC_VERBOSE(ln -s is not supported)
 fi
-AC_SUBST(LN_S)
+AC_SUBST(LN_S)dnl
 ])dnl
 dnl
 define(AC_RSH,
 [AC_CHECKING(for remote shell)
+AC_CACHE_VAL(ac_cv_path_RSH,
+[ac_cv_path_RSH=true
 for ac_file in \
   /usr/ucb/rsh /usr/bin/remsh /usr/bin/rsh /usr/bsd/rsh /usr/bin/nsh
 do
   if test -f $ac_file; then
-    AC_VERBOSE(found remote shell $ac_file)
-    RTAPELIB=rtapelib.o
+    ac_cv_path_RSH=$ac_file
     break
   fi
-done
-if test -z "$RTAPELIB"; then
-  AC_HEADER_CHECK(netdb.h, AC_DEFINE(HAVE_NETDB_H) RTAPELIB=rtapelib.o,
-    AC_DEFINE(NO_REMOTE))
+done])dnl
+RSH="$ac_cv_path_RSH"
+if test $RSH != true; then
+  AC_VERBOSE(found remote shell $RSH)
+  RTAPELIB=rtapelib.o
+else
+  AC_VERBOSE(found no remote shell)
+  AC_HEADER_CHECK(netdb.h, RTAPELIB=rtapelib.o AC_DEFINE(HAVE_NETDB_H),
+    RTAPELIB= AC_DEFINE(NO_REMOTE))
 fi
+AC_SUBST(RSH)dnl
 AC_SUBST(RTAPELIB)dnl
 ])dnl
 dnl
@@ -333,22 +361,23 @@ dnl
 define(AC_STDC_HEADERS,
 [AC_REQUIRE_CPP()dnl
 AC_CHECKING(for ANSI C header files)
-AC_TEST_CPP([#include <stdlib.h>
+AC_CACHE_VAL(ac_cv_header_stdc,
+[AC_TEST_CPP([#include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
-#include <float.h>], ac_stdc_hdrs=yes, ac_stdc_hdrs=no)
+#include <float.h>], ac_cv_header_stdc=yes, ac_cv_header_stdc=no)
 
-if test "$ac_stdc_hdrs" = yes; then
+if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-AC_HEADER_EGREP(memchr, string.h, , ac_stdc_hdrs=no)
+AC_HEADER_EGREP(memchr, string.h, , ac_cv_header_stdc=no)
 fi
 
-if test "$ac_stdc_hdrs" = yes; then
+if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-AC_HEADER_EGREP(free, stdlib.h, , ac_stdc_hdrs=no)
+AC_HEADER_EGREP(free, stdlib.h, , ac_cv_header_stdc=no)
 fi
 
-if test "$ac_stdc_hdrs" = yes; then
+if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
 AC_TEST_RUN([#include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -358,20 +387,21 @@ int main () { int i; for (i = 0; i < 256; i++)
 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 ], , ac_stdc_headers=no)
-fi
-
-if test "$ac_stdc_hdrs" = yes; then
+fi])dnl
+if test $ac_cv_header_stdc = yes; then
   AC_DEFINE(STDC_HEADERS)
 fi])dnl
 dnl
-define(AC_UNISTD_H, [AC_OBSOLETE([$0], [; instead use AC_HAVE_HEADERS(unistd.h)])AC_HEADER_CHECK(unistd.h,
-  AC_DEFINE(HAVE_UNISTD_H))])dnl
+define(AC_UNISTD_H,
+[AC_OBSOLETE([$0], [; instead use AC_HAVE_HEADERS(unistd.h)])dnl
+AC_HEADER_CHECK(unistd.h, AC_DEFINE(HAVE_UNISTD_H))])dnl
 dnl
 define(AC_USG,
 [AC_OBSOLETE([$0],
   [; instead use AC_HAVE_HEADERS(string.h) and HAVE_STRING_H])dnl
 AC_CHECKING([for BSD string and memory functions])
-AC_TEST_LINK([#include <strings.h>], [rindex(0, 0); bzero(0, 0);], , AC_DEFINE(USG))])dnl
+AC_TEST_LINK([#include <strings.h>], [rindex(0, 0); bzero(0, 0);], ,
+  AC_DEFINE(USG))])dnl
 dnl
 dnl
 dnl If memchr and the like aren't declared in <string.h>, include <memory.h>.
@@ -384,46 +414,53 @@ AC_HEADER_EGREP(memchr, string.h, ,
 dnl
 define(AC_MAJOR_HEADER,
 [AC_CHECKING([for major, minor and makedev header])
-AC_TEST_LINK([#include <sys/types.h>],
-[return makedev(0, 0);], ac_have_makedev=yes, ac_have_makedev=no)
-if test "$ac_have_makedev" = no; then
-AC_HEADER_CHECK(sys/mkdev.h, AC_DEFINE(MAJOR_IN_MKDEV) ac_have_makedev=yes)
-fi
-if test "$ac_have_makedev" = no; then
-AC_HEADER_CHECK(sys/sysmacros.h, AC_DEFINE(MAJOR_IN_SYSMACROS))
-fi]
-)dnl
+AC_CACHE_VAL(ac_cv_header_major,
+[AC_TEST_LINK([#include <sys/types.h>],
+[return makedev(0, 0);], ac_cv_header_major=sys/types.h, ac_cv_header_major=no)
+if test $ac_cv_header_major = no; then
+AC_HEADER_CHECK(sys/mkdev.h, ac_cv_header_major=sys/mkdev.h)
+fi
+if test $ac_cv_header_major = no; then
+AC_HEADER_CHECK(sys/sysmacros.h, ac_cv_header_major=sys/sysmacros.h)
+fi])dnl
+case "$ac_cv_header_major" in
+sys/mkdev.h) AC_DEFINE(MAJOR_IN_MKDEV) ;;
+sys/sysmacros.h) AC_DEFINE(MAJOR_IN_SYSMACROS) ;;
+esac
+])dnl
 dnl
 define(AC_DIR_HEADER,
 [AC_PROVIDE([$0])dnl
 AC_CHECKING(for directory library header)
-ac_dir_header=
-AC_DIR_HEADER_CHECK(dirent.h, DIRENT)
-AC_DIR_HEADER_CHECK(sys/ndir.h, SYSNDIR)
-AC_DIR_HEADER_CHECK(sys/dir.h, SYSDIR)
-AC_DIR_HEADER_CHECK(ndir.h, NDIR)
+AC_CACHE_VAL(ac_cv_header_dir,
+[ac_cv_header_dir=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+  AC_CHECKING([for $ac_hdr])
+AC_TEST_LINK([#include <sys/types.h>
+#include <$ac_hdr>], [DIR *dirp = 0;], ac_cv_header_dir=$ac_hdr; break)
+done])dnl
+case "$ac_cv_header_dir" in
+dirent.h) AC_DEFINE(DIRENT) ;;
+sys/ndir.h) AC_DEFINE(SYSNDIR) ;;
+sys/dir.h) AC_DEFINE(SYSDIR) ;;
+ndir.h) AC_DEFINE(NDIR) ;;
+esac
 
 AC_CHECKING(for closedir return value)
-AC_TEST_RUN([#include <sys/types.h>
-#include <$ac_dir_header>
-int closedir(); main() { exit(closedir(opendir(".")) != 0); }], ,
-AC_DEFINE(VOID_CLOSEDIR))
+AC_CACHE_VAL(ac_cv_func_closedir_void,
+[AC_TEST_RUN([#include <sys/types.h>
+#include <$ac_cv_header_dir>
+int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
+  ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes)])dnl
+if test $ac_cv_func_closedir_void = yes; then
+  AC_DEFINE(VOID_CLOSEDIR)
+fi
 ])dnl
-dnl Subroutine of AC_DIR_HEADER.
-dnl Check if $1 is the winning directory library header file.
-dnl It must not only exist, but also correctly define the `DIR' type.
-dnl If it is really winning, define $2 and set shell var `ac_dir_header' to $1.
-define(AC_DIR_HEADER_CHECK, [dnl
-if test -z "$ac_dir_header"; then
-  AC_CHECKING([for $1])
-  AC_TEST_LINK([#include <sys/types.h>
-#include <]$1[>],
-                  [DIR *dirp = 0;],
-                  AC_DEFINE($2) ac_dir_header=$1)dnl
-fi])dnl
 dnl
-define(AC_STAT_MACROS_BROKEN,[AC_CHECKING(for broken stat file mode macros)
-AC_PROGRAM_EGREP([You lose], [#include <sys/types.h>
+define(AC_STAT_MACROS_BROKEN,
+[AC_CHECKING(for broken stat file mode macros)
+AC_CACHE_VAL(ac_cv_header_stat_broken,
+[AC_PROGRAM_EGREP([You lose], [#include <sys/types.h>
 #include <sys/stat.h>
 #ifdef S_ISBLK
 #if S_ISBLK (S_IFDIR)
@@ -445,16 +482,26 @@ You lose.
 You lose.
 #endif
 #endif /* S_ISSOCK */
-], AC_DEFINE(STAT_MACROS_BROKEN))])dnl
+], ac_cv_header_stat_broken=yes, ac_cv_header_stat_broken=no)])dnl
+if test $ac_cv_header_stat_broken = yes; then
+  AC_DEFINE(STAT_MACROS_BROKEN)
+fi
+])dnl
 dnl
-define(AC_SYS_SIGLIST_DECLARED,[dnl
-AC_CHECKING([for sys_siglist declaration in signal.h or unistd.h])
-AC_TEST_LINK([#include <signal.h>
+define(AC_SYS_SIGLIST_DECLARED,
+[AC_CHECKING([for sys_siglist declaration in signal.h or unistd.h])
+AC_CACHE_VAL(ac_cv_decl_sys_siglist,
+[AC_TEST_LINK([#include <sys/types.h>
+#include <signal.h>
 /* NetBSD declares sys_siglist in unistd.h.  */
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif], [char *msg = *(sys_siglist + 1);],
-                AC_DEFINE(SYS_SIGLIST_DECLARED))])dnl
+  ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)])dnl
+if test $ac_cv_decl_sys_siglist = yes; then
+  AC_DEFINE(SYS_SIGLIST_DECLARED)
+fi
+])dnl
 dnl
 dnl
 dnl ### Checks for typedefs
@@ -463,8 +510,9 @@ dnl
 define(AC_GETGROUPS_T,
 [AC_REQUIRE([AC_UID_T])dnl
 AC_CHECKING(for type of array argument to getgroups)
-changequote(,)dnl
-dnl Do not put single quotes in the C program text!!
+AC_CACHE_VAL(ac_cv_type_getgroups,
+[changequote(,)dnl
+dnl Do not put single quotes in the C program text!
 ac_prog='/* Thanks to Mike Rendell for this test.  */
 #include <sys/types.h>
 #define NGID 256
@@ -487,55 +535,55 @@ main()
 }'
 changequote([,])dnl
 AC_TEST_RUN([$ac_prog],
-               AC_DEFINE(GETGROUPS_T, gid_t), AC_DEFINE(GETGROUPS_T, int))
+  ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int)])dnl
+AC_DEFINE(GETGROUPS_T, $ac_cv_type_getgroups)
 ])dnl
 dnl
 define(AC_UID_T,
 [AC_PROVIDE([$0])dnl
 AC_CHECKING(for uid_t in sys/types.h)
-AC_HEADER_EGREP(uid_t, sys/types.h, ,
-  AC_DEFINE(uid_t, int) AC_DEFINE(gid_t, int))])dnl
+AC_CACHE_VAL(ac_cv_type_uid_t,
+[AC_HEADER_EGREP(uid_t, sys/types.h,
+  ac_cv_type_uid_t=yes, ac_cv_type_uid_t=no)])dnl
+if test $ac_cv_type_uid_t = no; then
+  AC_DEFINE(uid_t, int)
+  AC_DEFINE(gid_t, int)
+fi
+])dnl
 dnl
-define(AC_SIZE_T,
-[AC_CHECKING(for size_t in sys/types.h)
-AC_HEADER_EGREP(size_t, sys/types.h, , AC_DEFINE(size_t, unsigned))])dnl
+define(AC_SIZE_T, [AC_CHECK_TYPE(size_t, unsigned)])dnl
 dnl
-define(AC_PID_T,
-[AC_PROVIDE([$0])dnl
-AC_CHECKING(for pid_t in sys/types.h)
-AC_HEADER_EGREP(pid_t, sys/types.h, , AC_DEFINE(pid_t, int))])dnl
+define(AC_PID_T, [AC_CHECK_TYPE(pid_t, int)])dnl
 dnl
 define(AC_OFF_T,
 [AC_PROVIDE([$0])dnl
-AC_CHECKING(for off_t in sys/types.h)
-AC_HEADER_EGREP(off_t, sys/types.h, , AC_DEFINE(off_t, long))])dnl
+AC_CHECK_TYPE(off_t, long)])dnl
 dnl
-define(AC_MODE_T,
-[AC_CHECKING(for mode_t in sys/types.h)
-AC_HEADER_EGREP(mode_t, sys/types.h, , AC_DEFINE(mode_t, int))])dnl
+define(AC_MODE_T, [AC_CHECK_TYPE(mode_t, int)])dnl
 dnl
 dnl Note that identifiers starting with SIG are reserved by ANSI C.
 define(AC_RETSIGTYPE,
 [AC_PROVIDE([$0])dnl
 AC_CHECKING([return type of signal handlers])
-AC_TEST_LINK([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_type_signal,
+[AC_TEST_LINK([#include <sys/types.h>
 #include <signal.h>
 #ifdef signal
 #undef signal
 #endif
 extern void (*signal ()) ();],
-[int i;],
-[AC_DEFINE(RETSIGTYPE, void)],
-[AC_DEFINE(RETSIGTYPE, int)])]
-)dnl
+[int i;], ac_cv_type_signal=void, ac_cv_type_signal=int)])dnl
+AC_DEFINE(RETSIGTYPE, $ac_cv_type_signal)
+])dnl
 dnl
 dnl
 dnl ### Checks for functions
 dnl
 dnl
-define(AC_MMAP, [
-AC_CHECKING(for working mmap)
-AC_TEST_RUN([/* Thanks to Mike Haertel and Jim Avera for this test. */
+define(AC_MMAP,
+[AC_CHECKING(for working mmap)
+AC_CACHE_VAL(ac_cv_func_mmap,
+[AC_TEST_RUN([/* Thanks to Mike Haertel and Jim Avera for this test. */
 #include <sys/types.h>
 #include <fcntl.h>
 #include <sys/mman.h>
@@ -601,7 +649,10 @@ main()
       exit(1);
   exit(0);
 }
-], AC_DEFINE(HAVE_MMAP))
+], ac_cv_func_mmap=yes, ac_cv_func_mmap=no)])dnl
+if test $ac_cv_func_mmap = yes; then
+  AC_DEFINE(HAVE_MMAP)
+fi
 ])dnl
 dnl
 define(AC_VPRINTF,
@@ -615,7 +666,8 @@ define(AC_VFORK,
 [AC_REQUIRE([AC_PID_T])dnl
 AC_HEADER_CHECK(vfork.h, AC_DEFINE(HAVE_VFORK_H))
 AC_CHECKING(for working vfork)
-AC_REQUIRE([AC_RETSIGTYPE])
+AC_CACHE_VAL(ac_cv_func_vfork,
+[AC_REQUIRE([AC_RETSIGTYPE])
 AC_TEST_RUN([/* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
 #include <sys/types.h>
@@ -627,22 +679,41 @@ AC_TEST_RUN([/* Thanks to Paul Eggert for this test.  */
 #ifdef HAVE_VFORK_H
 #include <vfork.h>
 #endif
+/* On sparc systems, changes by the child to local and incoming
+   argument registers are propagated back to the parent.
+   The compiler is told about this with #include <vfork.h>,
+   but some compilers (e.g. gcc -O) don't grok <vfork.h>.
+   Test for this by using a static variable whose address
+   is put into a register that is clobbered by the vfork.  */
+static
+sparc_address_test (arg) int arg; {
+  static pid_t child;
+  if (!child) {
+    child = vfork ();
+    if (child < 0)
+      perror ("vfork");
+    if (!child) {
+      arg = getpid();
+      write(-1, "", 0);
+      _exit (arg);
+    }
+  }
+}
 static int signalled;
 static RETSIGTYPE catch (s) int s; { signalled = 1; }
 main() {
   pid_t parent = getpid ();
   pid_t child;
 
+  sparc_address_test ();
+
   signal (SIGINT, catch);
 
   child = vfork ();
 
   if (child == 0) {
-    /* On sparc systems, changes by the child to local and incoming
-       argument registers are propagated back to the parent.
-       The compiler is told about this with #include <vfork.h>,
-       but some compilers (e.g. gcc -O) don't grok <vfork.h>.
-       Test for this by using lots of local variables, at least
+    /* Here is another test for sparc vfork register problems.
+       This test uses lots of local variables, at least
        as many local variables as main has allocated so far
        including compiler temporaries.  4 locals are enough for
        gcc 1.40.3 on a sparc, but we use 8 to be safe.
@@ -696,12 +767,16 @@ main() {
         || fstat(fileno(stdout), &st) != 0
         );
   }
-}], , AC_DEFINE(vfork, fork))
+}], ac_cv_func_vfork=yes, ac_cv_func_vfork=no)])dnl
+if test $ac_cv_func_vfork = no; then
+  AC_DEFINE(vfork, fork)
+fi
 ])dnl
 dnl
 define(AC_WAIT3,
 [AC_CHECKING(for wait3 that fills in rusage)
-AC_TEST_RUN([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_func_wait3,
+[AC_TEST_RUN([#include <sys/types.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <stdio.h>
@@ -727,17 +802,26 @@ main() {
     exit(r.ru_nvcsw == 0
         && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0);
   }
-}], AC_DEFINE(HAVE_WAIT3))
+}], ac_cv_func_wait3=yes, ac_cv_func_wait3=no)])dnl
+if test $ac_cv_func_wait3 = yes; then
+  AC_DEFINE(HAVE_WAIT3)
+fi
 ])dnl
 dnl
 define(AC_ALLOCA,
 [# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 AC_CHECKING([for working alloca.h])
-AC_TEST_LINK([#include <alloca.h>],
-  [char *p = alloca(2 * sizeof(int));], AC_DEFINE(HAVE_ALLOCA_H))
+AC_CACHE_VAL(ac_cv_header_alloca_h,
+[AC_TEST_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));],
+  ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)])dnl
+if test $ac_cv_header_alloca_h = yes; then
+  AC_DEFINE(HAVE_ALLOCA_H)
+fi
 
-ac_decl="#ifdef __GNUC__
+AC_CHECKING([for alloca])
+AC_CACHE_VAL(ac_cv_func_alloca,
+[AC_TEST_LINK([#ifdef __GNUC__
 #define alloca __builtin_alloca
 #else
 #if HAVE_ALLOCA_H
@@ -752,13 +836,13 @@ char *alloca ();
 #endif
 #endif
 #endif
-"
-AC_CHECKING([for alloca])
-AC_TEST_LINK($ac_decl,
-[char *p = (char *) alloca(1);],
-[ac_have_alloca=yes AC_DEFINE([HAVE_ALLOCA])], ac_have_alloca=no)
+], [char *p = (char *) alloca(1);],
+  ac_cv_func_alloca=yes, ac_cv_func_alloca=no)])dnl
+if test $ac_cv_func_alloca = yes; then
+  AC_DEFINE(HAVE_ALLOCA)
+fi
 
-if test "$ac_have_alloca" = no; then
+if test $ac_cv_func_alloca = no; then
   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
   # that cause trouble.  Some versions do not even contain alloca or
   # contain a buggy version.  If you still want to use their alloca,
@@ -774,12 +858,13 @@ webecray
 wenotbecray
 #endif
 ],
-AC_FUNC_CHECK([_getb67],AC_DEFINE([CRAY_STACKSEG_END],[_getb67]),
-AC_FUNC_CHECK([GETB67],AC_DEFINE([CRAY_STACKSEG_END],[GETB67]),
-AC_FUNC_CHECK([getb67],AC_DEFINE([CRAY_STACKSEG_END],[getb67])))))
+AC_FUNC_CHECK([_getb67],AC_DEFINE(CRAY_STACKSEG_END, _getb67),
+AC_FUNC_CHECK([GETB67],AC_DEFINE(CRAY_STACKSEG_END, GETB67),
+AC_FUNC_CHECK([getb67],AC_DEFINE(CRAY_STACKSEG_END, getb67)))))
 
 AC_CHECKING(stack direction for C alloca)
-AC_TEST_RUN([find_stack_direction ()
+AC_CACHE_VAL(ac_cv_c_stack_direction,
+[AC_TEST_RUN([find_stack_direction ()
 {
   static char *addr = 0;
   auto char dummy;
@@ -794,99 +879,112 @@ AC_TEST_RUN([find_stack_direction ()
 main ()
 {
   exit (find_stack_direction() < 0);
-}],
-AC_DEFINE(STACK_DIRECTION,1), AC_DEFINE(STACK_DIRECTION,-1),
-AC_DEFINE(STACK_DIRECTION,0))
+}], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
+  ac_cv_c_stack_direction=0)])dnl
+AC_DEFINE(STACK_DIRECTION, $ac_cv_c_stack_direction)
 fi
 AC_SUBST(ALLOCA)dnl
 ])dnl
 dnl
 define(AC_GETLOADAVG,
 [# Some definitions of getloadavg require that the program be installed setgid.
-AC_SUBST(NEED_SETGID)NEED_SETGID=false
-ac_need_func=yes
+NEED_SETGID=false
+AC_SUBST(NEED_SETGID)dnl
+ac_have_func=no
 
 # Check for the 4.4BSD definition of getloadavg.
-AC_HAVE_LIBRARY(util, LIBS="$LIBS -lutil" ac_need_func=no)
+AC_HAVE_LIBRARY(util, [LIBS="$LIBS -lutil" ac_have_func=yes
 # Some systems with -lutil have (and need) -lkvm as well, some do not.
-AC_HAVE_LIBRARY(kvm, LIBS="$LIBS -lkvm")
+AC_HAVE_LIBRARY(kvm, LIBS="$LIBS -lkvm")])
 
-if test "$ac_need_func" = yes; then
+if test $ac_have_func = no; then
 # There is a commonly available library for RS/6000 AIX.
 # Since it is not a standard part of AIX, it might be installed locally.
-ac_save_LIBS="$LIBS"
-LIBS="-L/usr/local/lib $LIBS"
-AC_HAVE_LIBRARY(getloadavg, LIBS="$LIBS -lgetloadavg" ac_need_func=no,
-       LIBS="$ac_save_LIBS")
+ac_save_LIBS="$LIBS" LIBS="-L/usr/local/lib $LIBS"
+AC_HAVE_LIBRARY(getloadavg, LIBS="$LIBS -lgetloadavg", LIBS="$ac_save_LIBS")
 fi
 
-# Make sure it is really in the library, if we think we found it at all.
+# Make sure it is really in the library, if we think we found it.
 AC_REPLACE_FUNCS(getloadavg)
 
-case "$LIBOBJS" in
-*getloadavg*)
-ac_need_func=yes
-AC_HEADER_CHECK(sys/dg_sys_info.h, [dnl
-AC_DEFINE(DGUX) ac_need_func=no
+if test $ac_cv_func_getloadavg = yes; then
+  AC_DEFINE(HAVE_GETLOADAVG)
+else
+ac_have_func=no
+AC_HEADER_CHECK(sys/dg_sys_info.h,
+[ac_have_func=yes AC_DEFINE(DGUX)
 # Some versions of DGUX need -ldgc for dg_sys_info.
 AC_HAVE_LIBRARY(dgc)])
-if test "$ac_need_func" = yes; then
+if test $ac_have_func = no; then
 # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
 # uses stabs), but it is still SVR4.  We cannot check for <elf.h> because
 # Irix 4.0.5F has the header but not the library.
-AC_HAVE_LIBRARY(elf, AC_DEFINE(SVR4) LIBS="$LIBS -lelf" ac_need_func=no
-  AC_HAVE_LIBRARY(kvm, LIBS="$LIBS -lkvm"))
+AC_HAVE_LIBRARY(elf,
+  [LIBS="$LIBS -lelf" ac_have_func=yes AC_DEFINE(SVR4)
+  AC_HAVE_LIBRARY(kvm, LIBS="$LIBS -lkvm")])
 fi
-if test "$ac_need_func" = yes; then
-AC_HEADER_CHECK(inq_stats/cpustats.h, AC_DEFINE(UMAX4_3) AC_DEFINE(UMAX)
-  ac_need_func=no)
+if test $ac_have_func = no; then
+AC_HEADER_CHECK(inq_stats/cpustats.h,
+  [ac_have_func=yes AC_DEFINE(UMAX4_3) AC_DEFINE(UMAX)])
 fi
-if test "$ac_need_func" = yes; then
-AC_HEADER_CHECK(sys/cpustats.h, AC_DEFINE(UMAX) ac_need_func=no)
+if test $ac_have_func = no; then
+AC_HEADER_CHECK(sys/cpustats.h,
+  [ac_have_func=yes AC_DEFINE(UMAX)])
 fi
-if test "$ac_need_func" = yes; then
+if test $ac_have_func = no; then
 AC_HAVE_HEADERS(mach/mach.h)
 fi
 
 AC_HEADER_CHECK(nlist.h,
 [AC_DEFINE(NLIST_STRUCT)
 AC_CHECKING([for n_un in struct nlist])
-AC_TEST_LINK([#include <nlist.h>],
+AC_CACHE_VAL(ac_cv_struct_nlist_n_un,
+[AC_TEST_LINK([#include <nlist.h>],
 [struct nlist n; n.n_un.n_name = 0;],
-AC_DEFINE(NLIST_NAME_UNION))])dnl
+ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])dnl
+if test $ac_cv_struct_nlist_n_un = yes; then
+  AC_DEFINE(NLIST_NAME_UNION)
+fi
+])dnl
 
-# Figure out whether we will need to install setgid.
-AC_PROGRAM_EGREP([Yowza Am I SETGID yet], [dnl
-#include "${srcdir}/getloadavg.c"
+AC_CHECKING(whether getloadavg requires setgid)
+AC_CACHE_VAL(ac_cv_func_getloadavg_setgid,
+[AC_PROGRAM_EGREP([Yowza Am I SETGID yet],
+[#include "${srcdir}/getloadavg.c"
 #ifdef LDAV_PRIVILEGED
 Yowza Am I SETGID yet
-#endif], [AC_DEFINE(GETLOADAVG_PRIVILEGED) NEED_SETGID=true])dnl
-;;
+#endif],
+  ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])dnl
+if test $ac_cv_func_getloadavg_setgid = yes; then
+  NEED_SETGID=true AC_DEFINE(GETLOADAVG_PRIVILEGED)
+fi
 
-*) AC_DEFINE(HAVE_GETLOADAVG) ;;
-esac
+fi # Do not have getloadavg in system libraries.
 
 if test "$NEED_SETGID" = true; then
-AC_SUBST(KMEM_GROUP)dnl
-  # Figure out what group owns /dev/kmem.
-  # The installed program will need to be setgid and owned by that group.
-changequote(,)dnl
+  AC_CHECKING(group of /dev/kmem)
+AC_CACHE_VAL(ac_cv_group_kmem,
+[changequote(,)dnl
   # On Solaris, /dev/kmem is a symlink.  Get info on the real file.
   ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
   # If we got an error (system does not support symlinks), try without -L.
   test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
-  KMEM_GROUP=`echo $ac_ls_output \
+  ac_cv_group_kmem=`echo $ac_ls_output \
     | sed -ne 's/[     ][      ]*/ /g;
               s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\)  *.*/\1/;
               / /s/.* //;p;'`
 changequote([,])dnl
+])dnl
+  KMEM_GROUP=$ac_cv_group_kmem
   AC_VERBOSE(/dev/kmem is owned by $KMEM_GROUP)
 fi
+AC_SUBST(KMEM_GROUP)dnl
 ])dnl
 dnl
 define(AC_UTIME_NULL,
 [AC_CHECKING(utime with null argument)
-rm -f conftestdata; > conftestdata
+AC_CACHE_VAL(ac_cv_func_utime_null,
+[rm -f conftestdata; > conftestdata
 # Sequent interprets utime(file, 0) to mean use start of epoch.  Wrong.
 AC_TEST_RUN([#include <sys/types.h>
 #include <sys/stat.h>
@@ -895,22 +993,32 @@ struct stat s, t;
 exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0
 && stat("conftestdata", &t) == 0 && t.st_mtime >= s.st_mtime
 && t.st_mtime - s.st_mtime < 120));
-}], AC_DEFINE(HAVE_UTIME_NULL))
-rm -f core
+}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no)
+rm -f core])dnl
+if test $ac_cv_func_utime_null = yes; then
+  AC_DEFINE(HAVE_UTIME_NULL)
+fi
 ])dnl
 dnl
-define(AC_STRCOLL, [AC_CHECKING(for strcoll)
-AC_TEST_RUN([#include <string.h>
+define(AC_STRCOLL,
+[AC_CHECKING(for strcoll)
+AC_CACHE_VAL(ac_cv_func_strcoll,
+[AC_TEST_RUN([#include <string.h>
 main ()
 {
   exit (strcoll ("abc", "def") >= 0 ||
        strcoll ("ABC", "DEF") >= 0 ||
        strcoll ("123", "456") >= 0);
-}], AC_DEFINE(HAVE_STRCOLL))])dnl
+}], ac_cv_func_strcoll=yes, ac_cv_func_strcoll=no)])dnl
+if test $ac_cv_func_strcoll = yes; then
+  AC_DEFINE(HAVE_STRCOLL)
+fi
+])dnl
 dnl
 define(AC_SETVBUF_REVERSED,
 [AC_CHECKING(whether setvbuf arguments are reversed)
-AC_TEST_RUN([#include <stdio.h>
+AC_CACHE_VAL(ac_cv_func_setvbuf_reversed,
+[AC_TEST_RUN([#include <stdio.h>
 /* If setvbuf has the reversed format, exit 0. */
 main () {
   /* This call has the arguments reversed.
@@ -920,8 +1028,11 @@ main () {
     exit(1);
   putc('\r', stdout);
   exit(0);                     /* Non-reversed systems segv here.  */
-}], AC_DEFINE(SETVBUF_REVERSED))
-rm -f core
+}], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no)
+rm -f core])dnl
+if test $ac_cv_func_setvbuf_reversed = yes; then
+  AC_DEFINE(SETVBUF_REVERSED)
+fi
 ])dnl
 dnl
 dnl
@@ -931,64 +1042,87 @@ dnl
 define(AC_STRUCT_TM,
 [AC_PROVIDE([$0])dnl
 AC_CHECKING([for struct tm in sys/time.h instead of time.h])
-AC_TEST_LINK([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_struct_tm,
+[AC_TEST_LINK([#include <sys/types.h>
 #include <time.h>],
-[struct tm *tp; tp->tm_sec;], , AC_DEFINE(TM_IN_SYS_TIME))])dnl
+[struct tm *tp; tp->tm_sec;],
+  ac_cv_struct_tm=time.h, ac_cv_struct_tm=sys/time.h)])dnl
+if test $ac_cv_struct_tm = sys/time.h; then
+  AC_DEFINE(TM_IN_SYS_TIME)
+fi
+])dnl
 dnl
 define(AC_TIME_WITH_SYS_TIME,
 [AC_CHECKING([whether time.h and sys/time.h may both be included])
-AC_TEST_LINK([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_header_time,
+[AC_TEST_LINK([#include <sys/types.h>
 #include <sys/time.h>
 #include <time.h>],
-[struct tm *tp;], AC_DEFINE(TIME_WITH_SYS_TIME))])dnl
+[struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)])dnl
+if test $ac_cv_header_time = yes; then
+  AC_DEFINE(TIME_WITH_SYS_TIME)
+fi
+])dnl
 dnl
 define(AC_TIMEZONE,
 [AC_REQUIRE([AC_STRUCT_TM])dnl
-ac_decl='#include <sys/types.h>
-'
-case "$DEFS" in
-  *TM_IN_SYS_TIME*) ac_decl="$ac_decl
-#include <sys/time.h>
-" ;;
-  *) ac_decl="$ac_decl
-#include <time.h>
-" ;;
-esac
 AC_CHECKING([for tm_zone in struct tm])
-AC_TEST_LINK($ac_decl,
-[struct tm tm; tm.tm_zone;],
-[ac_have_tm_zone=yes AC_DEFINE(HAVE_TM_ZONE)], ac_have_tm_zone=no)
-
-if test "$ac_have_tm_zone" = no; then
-AC_CHECKING([for tzname])
-AC_TEST_LINK(changequote(<<,>>)dnl
+AC_CACHE_VAL(ac_cv_struct_tm_zone,
+[AC_TEST_LINK([#include <sys/types.h>
+#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
+  ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])dnl
+if test "$ac_cv_struct_tm_zone" = yes; then
+  AC_DEFINE(HAVE_TM_ZONE)
+else
+  AC_CHECKING([for tzname])
+AC_CACHE_VAL(ac_cv_var_tzname,
+[AC_TEST_LINK(changequote(<<,>>)dnl
 <<#include <time.h>
 #ifndef tzname /* For SGI.  */
 extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
 #endif>>, changequote([,])dnl
-[atoi(*tzname);], AC_DEFINE(HAVE_TZNAME))
+[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])dnl
+  if test $ac_cv_var_tzname = yes; then
+    AC_DEFINE(HAVE_TZNAME)
+  fi
 fi
 ])dnl
 dnl
 define(AC_ST_BLOCKS,
 [AC_CHECKING([for st_blocks in struct stat])
-AC_TEST_LINK([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_struct_st_blocks,
+[AC_TEST_LINK([#include <sys/types.h>
 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
-AC_DEFINE(HAVE_ST_BLOCKS), LIBOBJS="$LIBOBJS fileblocks.o")dnl
+ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])dnl
+if test $ac_cv_struct_st_blocks = yes; then
+  AC_DEFINE(HAVE_ST_BLOCKS)
+else
+  LIBOBJS="$LIBOBJS fileblocks.o"
+fi
 AC_SUBST(LIBOBJS)dnl
 ])dnl
 dnl
 define(AC_ST_BLKSIZE,
 [AC_CHECKING([for st_blksize in struct stat])
-AC_TEST_LINK([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_struct_st_blksize,
+[AC_TEST_LINK([#include <sys/types.h>
 #include <sys/stat.h>], [struct stat s; s.st_blksize;],
-AC_DEFINE(HAVE_ST_BLKSIZE))])dnl
+ac_cv_struct_st_blksize=yes, ac_cv_struct_st_blksize=no)])dnl
+if test $ac_cv_struct_st_blksize = yes; then
+  AC_DEFINE(HAVE_ST_BLKSIZE)
+fi
+])dnl
 dnl
 define(AC_ST_RDEV,
 [AC_CHECKING([for st_rdev in struct stat])
-AC_TEST_LINK([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_struct_st_rdev,
+[AC_TEST_LINK([#include <sys/types.h>
 #include <sys/stat.h>], [struct stat s; s.st_rdev;],
-AC_DEFINE(HAVE_ST_RDEV))])dnl
+ac_cv_struct_st_rdev=yes, ac_cv_struct_st_rdev=no)])dnl
+if test $ac_cv_struct_st_rdev = yes; then
+  AC_DEFINE(HAVE_ST_RDEV)
+fi
+])dnl
 dnl
 dnl
 dnl ### Checks for compiler characteristics
@@ -996,16 +1130,21 @@ dnl
 dnl
 define(AC_CROSS_CHECK,
 [AC_PROVIDE([$0])dnl
-AC_CHECKING(whether cross-compiling)
 # If we cannot run a trivial program, we must be cross compiling.
-AC_TEST_RUN([main(){exit(0);}], cross_compiling=, cross_compiling=yes)
-if test "$cross_compiling" = yes; then
+AC_CHECKING(whether cross-compiling)
+AC_CACHE_VAL(ac_cv_c_cross,
+[AC_TEST_RUN([main(){exit(0);}], ac_cv_c_cross=no, ac_cv_c_cross=yes)])dnl
+cross_compiling=$ac_cv_c_cross
+if test $ac_cv_c_cross = yes; then
   AC_VERBOSE(we are cross-compiling)
+else
+  AC_VERBOSE(we are not cross-compiling)
 fi])dnl
 dnl
 define(AC_CHAR_UNSIGNED,
 [AC_CHECKING(for unsigned characters)
-AC_TEST_RUN(
+AC_CACHE_VAL(ac_cv_c_char_unsigned,
+[AC_TEST_RUN(
 [/* volatile prevents gcc2 from optimizing the test away on sparcs.  */
 #if !__STDC__
 #define volatile
@@ -1016,21 +1155,28 @@ main() {
 #else
   volatile char c = 255; exit(c < 0);
 #endif
-}], AC_DEFINE(__CHAR_UNSIGNED__))]
-)dnl
+}], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no)])dnl
+if test $ac_cv_c_char_unsigned = yes; then
+  AC_DEFINE(__CHAR_UNSIGNED__)
+fi
+])dnl
 dnl
 define(AC_LONG_DOUBLE,
 [AC_REQUIRE([AC_PROG_CC])dnl
 AC_CHECKING(for long double)
-if test "$GCC" = yes; then
-AC_DEFINE(HAVE_LONG_DOUBLE)
+AC_CACHE_VAL(ac_cv_c_long_double,
+[if test "$GCC" = yes; then
+  ac_cv_c_long_double=yes
 else
 AC_TEST_RUN([int main() {
 /* The Stardent Vistra knows sizeof(long double), but does not support it.  */
 long double foo = 0.0;
 /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
 exit(sizeof(long double) < sizeof(double)); }],
-AC_DEFINE(HAVE_LONG_DOUBLE))
+ac_cv_c_long_double=yes, ac_cv_c_long_double=no)
+fi])dnl
+if test $ac_cv_c_long_double = yes; then
+  AC_DEFINE(HAVE_LONG_DOUBLE)
 fi
 ])dnl
 dnl
@@ -1050,7 +1196,8 @@ AC_TEST_RUN([main() { exit(sizeof(long int) != 8); }],
 dnl
 define(AC_WORDS_BIGENDIAN,
 [AC_CHECKING(byte ordering)
-AC_TEST_RUN([main () {
+AC_CACHE_VAL(ac_cv_c_bigendian,
+[AC_TEST_RUN([main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
   union
   {
@@ -1059,12 +1206,16 @@ AC_TEST_RUN([main () {
   } u;
   u.l = 1;
   exit (u.c[sizeof (long) - 1] == 1);
-}], , AC_DEFINE(WORDS_BIGENDIAN))
+}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes)])dnl
+if test $ac_cv_c_bigendian = yes; then
+  AC_DEFINE(WORDS_BIGENDIAN)
+fi
 ])dnl
 dnl
 define(AC_ARG_ARRAY,
 [AC_CHECKING(whether the address of an argument can be used as an array)
-AC_TEST_RUN([main() {
+AC_CACHE_VAL(ac_cv_c_arg_array,
+[AC_TEST_RUN([main() {
 /* Return 0 iff arg arrays are ok.  */
 exit(!x(1, 2, 3, 4));
 }
@@ -1074,20 +1225,32 @@ x(a, b, c, d) {
 /* Return 1 iff arg arrays are ok.  */
 y(a, b) int *b; {
   return a == 1 && b[0] == 2 && b[1] == 3 && b[2] == 4;
-}], , AC_DEFINE(NO_ARG_ARRAY))
-rm -f core
+}], ac_cv_c_arg_array=no, ac_cv_c_arg_array=yes)
+rm -f core])dnl
+if test $ac_cv_c_arg_array = no; then
+  AC_DEFINE(NO_ARG_ARRAY)
+fi
 ])dnl
 dnl
 define(AC_INLINE,
 [AC_REQUIRE([AC_PROG_CC])dnl
-if test "$GCC" = yes; then
 AC_CHECKING([for inline])
-AC_TEST_LINK( , [} inline foo() {], , AC_DEFINE(inline, __inline))
+AC_CACHE_VAL(ac_cv_c_inline,
+[if test "$GCC" = yes; then
+AC_TEST_LINK( , [} inline foo() {], ac_cv_c_inline=yes, ac_cv_c_inline=no)
+else
+  ac_cv_c_inline=no
+fi])dnl
+if test $ac_cv_c_inline = no; then
+  AC_DEFINE(inline, __inline)
 fi
 ])dnl
 define(AC_CONST,
+[dnl Do not "break" this again.
+AC_CHECKING([for lack of working const])
+AC_CACHE_VAL(ac_cv_c_const,
 [changequote(,)dnl
-dnl Do not put single quotes in the C program text!!
+dnl Do not put single quotes in the C program text!
 ac_prog='/* Ultrix mips cc rejects this.  */
 typedef int charset[2]; const charset x;
 /* SunOS 4.1.1 cc rejects this.  */
@@ -1127,42 +1290,56 @@ ccp = (char const *const *) p;
   const int foo = 10;
 }'
 changequote([,])dnl
-dnl Do not "break" this again.
-AC_CHECKING([for lack of working const])
-AC_TEST_LINK( , [$ac_prog], , AC_DEFINE(const,))])dnl
+AC_TEST_LINK( , [$ac_prog], ac_cv_c_const=yes, ac_cv_c_const=no)])dnl
+if test $ac_cv_c_const = no; then
+  AC_DEFINE(const,)
+fi
+])dnl
 dnl
 dnl
 dnl ### Checks for operating system services
 dnl
 dnl
-define(AC_HAVE_POUNDBANG, [dnl
-AC_CHECKING(whether [#]! works in shell scripts)
-echo '#!/bin/cat
+define(AC_HAVE_POUNDBANG,
+[AC_CHECKING(whether [#]! works in shell scripts)
+AC_CACHE_VAL(ac_cv_sys_interpreter,
+[echo '#!/bin/cat
 exit 69
 ' > conftest
 chmod u+x conftest
 (SHELL=/bin/sh; export SHELL; ./conftest > /dev/null)
 if test $? -ne 69; then
-   :; $1
+   ac_cv_sys_interpreter=yes
 else
-   :; $2
+   ac_cv_sys_interpreter=no
+fi
+rm -f conftest])dnl
+if test $ac_cv_sys_interpreter = yes; then
+  ifelse([$1], , :, [$1])
+ifelse([$2], , , [else
+  $2
+])dnl
 fi
-rm -f conftest
 ])dnl
 define(AC_REMOTE_TAPE,
 [AC_CHECKING(for remote tape and socket header files)
-AC_HEADER_CHECK(sys/mtio.h,
-[ac_have_mtio_h=yes AC_DEFINE(HAVE_SYS_MTIO_H)], ac_have_mtio_h=no)
+AC_HEADER_CHECK(sys/mtio.h, AC_DEFINE(HAVE_SYS_MTIO_H))
 
-if test "$ac_have_mtio_h" = yes; then
-AC_TEST_CPP([#include <sgtty.h>
-#include <sys/socket.h>], PROGS="$PROGS rmt")
+if test "$ac_cv_header_mtio_h" = yes; then
+AC_CACHE_VAL(ac_cv_header_rmt,
+[AC_TEST_CPP([#include <sgtty.h>
+#include <sys/socket.h>], ac_cv_header_rmt=yes, ac_cv_header_rmt=no)])dnl
+ if test $ac_cv_header_rmt = yes; then
+    PROGS="$PROGS rmt"
+  fi
 fi
+AC_SUBST(PROGS)dnl
 ])dnl
 dnl
 define(AC_LONG_FILE_NAMES,
 [AC_CHECKING(for long file names)
-ac_some_dir_failed=no
+AC_CACHE_VAL(ac_cv_sys_long_file_names,
+[ac_cv_sys_long_file_names=yes
 # Test for long file names in all the places we know might matter:
 #      .               the current directory, where building will happen
 #      /tmp            where it might want to write temporary files
@@ -1177,15 +1354,22 @@ for ac_dir in `eval echo . /tmp /var/tmp /usr/tmp $prefix/lib $exec_prefix/lib`
   (echo 1 > $ac_dir/conftest9012345) 2>/dev/null
   (echo 2 > $ac_dir/conftest9012346) 2>/dev/null
   val=`cat $ac_dir/conftest9012345 2>/dev/null`
-  test -f $ac_dir/conftest9012345 && test "$val" = 1 || ac_some_dir_failed=yes
+  if test ! -f $ac_dir/conftest9012345 || test "$val" != 1; then
+    ac_cv_sys_long_file_names=no
+    rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2> /dev/null
+    break
+  fi
   rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2> /dev/null
-done
-test "$ac_some_dir_failed" = yes || AC_DEFINE(HAVE_LONG_FILE_NAMES)
+done])dnl
+if test $ac_cv_sys_long_file_names = yes; then
+  AC_DEFINE(HAVE_LONG_FILE_NAMES)
+fi
 ])dnl
 dnl
 define(AC_RESTARTABLE_SYSCALLS,
 [AC_CHECKING(for restartable system calls)
-AC_TEST_RUN(
+AC_CACHE_VAL(ac_cv_sys_restartable_syscalls,
+[AC_TEST_RUN(
 [/* Exit 0 (true) if wait returns something other than -1,
    i.e. the pid of the child, which means that wait was restarted
    after getting the signal.  */
@@ -1200,7 +1384,10 @@ main () {
   if (status == -1) wait(&i);
   exit (status == -1);
 }
-], AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS))
+], ac_cv_sys_restartable_syscalls=yes, ac_cv_sys_restartable_syscalls=no)])dnl
+if test $ac_cv_sys_restartable_syscalls = yes; then
+  AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS)
+fi
 ])dnl
 dnl
 define(AC_FIND_X,
@@ -1209,13 +1396,36 @@ AC_PROVIDE([$0])dnl
 # If we find X, set shell vars x_includes and x_libraries to the paths.
 no_x=yes
 if test "x$with_x" != xno; then
+
+# Command line options override cache.
+# FIXME We need to allow --x=includes= to work, I think.
+test -n "$x_includes" && ac_cv_x_includes="$x_includes"
+test -n "$x_libraries" && ac_cv_x_includes="$x_libraries"
+if test "${ac_cv_x_includes+set}" = set &&
+  test "${ac_cv_x_libraries+set}" = set; then
+  AC_VERBOSE(using cached values for ac_cv_x_includes and ac_cv_x_libraries)
+else
 AC_FIND_X_XMKMF
-if test -z "$ac_im_usrlibdir"; then
+fi
+if test "${ac_cv_x_includes+set}" != set ||
+  test "${ac_cv_x_libraries+set}" != set; then
 AC_FIND_X_DIRECT
 fi
+test -z "$ac_cv_x_includes" && ac_cv_x_includes=NONE
+test -z "$ac_cv_x_libraries" && ac_cv_x_libraries=NONE
+
+# FIXME can we reliably distinguish cache values that are set to empty
+# from those that aren't set?
+if test -z "$x_includes" && test "$ac_cv_x_includes" != NONE; then
+  x_includes="$ac_cv_x_includes"
+fi
+if test -z "$x_libraries" && test "$ac_cv_x_libraries" != NONE; then
+  x_libraries="$ac_cv_x_libraries"
+fi
+
 test -n "$x_includes" && AC_VERBOSE(X11 headers are in $x_includes)
 test -n "$x_libraries" && AC_VERBOSE(X11 libraries are in $x_libraries)
-fi
+fi # No --with-x=no.
 ])dnl
 dnl
 dnl Internal subroutine of AC_FIND_X.
@@ -1240,11 +1450,11 @@ EOF
     fi
     case "$ac_im_incroot" in
        /usr/include) ;;
-       *) test -z "$x_includes" && x_includes="$ac_im_incroot" ;;
+       *) test -z "$ac_cv_x_includes" && ac_cv_x_includes="$ac_im_incroot" ;;
     esac
     case "$ac_im_usrlibdir" in
        /usr/lib | /lib) ;;
-       *) test -z "$x_libraries" && x_libraries="$ac_im_usrlibdir" ;;
+       *) test -z "$ac_cv_x_libraries" && ac_cv_x_libraries="$ac_im_usrlibdir" ;;
     esac
   fi
   cd ..
@@ -1255,12 +1465,8 @@ dnl
 dnl Internal subroutine of AC_FIND_X.
 define(AC_FIND_X_DIRECT,
 [AC_CHECKING(for X include and library files directly)
-if test ".$x_direct_test_library" = . ; then
-   x_direct_test_library='Xt'
-fi
-if test ".$x_direct_test_include" = . ; then
-   x_direct_test_include='X11/Intrinsic.h'
-fi
+test -z "$x_direct_test_library" && x_direct_test_library=Xt
+test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
 AC_TEST_CPP([#include <$x_direct_test_include>], no_x=,
   for ac_dir in               \
     /usr/X11R6/include        \
@@ -1300,7 +1506,7 @@ AC_TEST_CPP([#include <$x_direct_test_include>], no_x=,
     ; \
   do
     if test -r "$ac_dir/$x_direct_test_include"; then
-      test -z "$x_includes" && x_includes=$ac_dir
+      test -z "$ac_cv_x_includes" && ac_cv_x_includes=$ac_dir
       no_x=
       break
     fi
@@ -1309,7 +1515,7 @@ AC_TEST_CPP([#include <$x_direct_test_include>], no_x=,
 # Check for the libraries.  First see if replacing the include by
 # lib works.
 AC_HAVE_LIBRARY("$x_direct_test_library", no_x=,
-for ac_dir in `echo "$x_includes" | sed s/include/lib/` \
+for ac_dir in `echo "$ac_cv_x_includes" | sed s/include/lib/` \
     /usr/X11R6/lib        \
     /usr/X11R5/lib        \
     /usr/X11R4/lib        \
@@ -1348,7 +1554,7 @@ for ac_dir in `echo "$x_includes" | sed s/include/lib/` \
 do
   for ac_extension in a so sl; do
     if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
-      test -z "$x_libraries" && x_libraries=$ac_dir
+      test -z "$ac_cv_x_libraries" && ac_cv_x_libraries=$ac_dir
       no_x=
       break 2
     fi
index cc037b03ef5fdf8f777fad541b6c755b6cd27b5c..f1c73e6cf7b659eb1f9c7f7fb157e54bd0b2b336 100644 (file)
@@ -43,26 +43,26 @@ tmpout=/tmp/acout.$$
 
 print_version=
 while test $# -gt 0 ; do
-   case "z${1}" in 
-      z-h | z--help | z--h* )
+   case "${1}" in 
+      -h | --help | --h* )
          echo "${usage}" 1>&2; exit 0 ;;
-      z--macrodir=* | z--m*=* )
+      --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* )
+      -v | --version | --v* )
          print_version="-DAC_PRINT_VERSION"
-         infile=/dev/null tmpout=/dev/null
+         infile=/dev/null
          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 ;;
@@ -82,7 +82,7 @@ if test -z "$print_version"; then
     tmpin=/tmp/acin.$$
     infile=$tmpin
     cat > $infile
-  elif test ! -s "${infile}"; then
+  elif test ! -r "${infile}"; then
     echo "autoconf: ${infile}: No such file or directory" >&2
     exit 1
   fi
@@ -96,7 +96,11 @@ MACROFILES="${print_version} ${MACROFILES}"
 
 $M4 $MACROFILES $infile > $tmpout || { st=$?; rm -f $tmpin $tmpout; exit $st; }
 
-test -n "$print_version" && exit 0
+if test -n "$print_version"; then
+  cat $tmpout
+  rm -f $tmpout
+  exit 0
+fi
 
 # 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
index cc037b03ef5fdf8f777fad541b6c755b6cd27b5c..f1c73e6cf7b659eb1f9c7f7fb157e54bd0b2b336 100644 (file)
@@ -43,26 +43,26 @@ tmpout=/tmp/acout.$$
 
 print_version=
 while test $# -gt 0 ; do
-   case "z${1}" in 
-      z-h | z--help | z--h* )
+   case "${1}" in 
+      -h | --help | --h* )
          echo "${usage}" 1>&2; exit 0 ;;
-      z--macrodir=* | z--m*=* )
+      --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* )
+      -v | --version | --v* )
          print_version="-DAC_PRINT_VERSION"
-         infile=/dev/null tmpout=/dev/null
+         infile=/dev/null
          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 ;;
@@ -82,7 +82,7 @@ if test -z "$print_version"; then
     tmpin=/tmp/acin.$$
     infile=$tmpin
     cat > $infile
-  elif test ! -s "${infile}"; then
+  elif test ! -r "${infile}"; then
     echo "autoconf: ${infile}: No such file or directory" >&2
     exit 1
   fi
@@ -96,7 +96,11 @@ MACROFILES="${print_version} ${MACROFILES}"
 
 $M4 $MACROFILES $infile > $tmpout || { st=$?; rm -f $tmpin $tmpout; exit $st; }
 
-test -n "$print_version" && exit 0
+if test -n "$print_version"; then
+  cat $tmpout
+  rm -f $tmpout
+  exit 0
+fi
 
 # 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
index 654ae8463ddbfa66e5fbf728f22c24247b81d74e..879b3ce5b91092262608910a7513065299a05bda 100644 (file)
@@ -6,8 +6,8 @@
 @c @setchapternewpage odd
 @c %**end of header
 
-@set EDITION 1.93
-@set VERSION 1.93
+@set EDITION 1.94
+@set VERSION 1.94
 @set UPDATED June 1994
 
 @iftex
@@ -96,9 +96,13 @@ package.  This is edition @value{EDITION}, for Autoconf version @value{VERSION}.
 * Making configure Scripts::    How to organize and produce Autoconf scripts.
 * Specific Tests::              Macros that check for particular features.
 * General Purpose Macros::      Macros that check for kinds of features.
+* Manual Configuration::        Selecting features that can't be guessed.
 * Writing Macros::              How to add your own macros to Autoconf.
+* Caching Values::              Speeding up subsequent @code{configure} runs.
 * Makefiles::                   Information Autoconf uses in @file{Makefile}s.
 * Invoking configure::          How to use the Autoconf output.
+* Invoking config.status::      Recreating a configuration.
+* Site Default Values::         Providing local defaults for @code{configure}.
 * Example::                     Sample Autoconf input files.
 * Preprocessor Symbol Index::   Index of C preprocessor symbols defined.
 * Macro Index::                 Index of Autoconf macros.
@@ -110,6 +114,10 @@ Making @code{configure} Scripts
 * Writing configure.in::       What to put in an Autoconf input file.
 * Invoking autoconf::          How to create configuration scripts.
 * Invoking autoheader::                How to create configuration header files.
+* Invoking autoscan::           Semi-automatic @file{configure.in} writing.
+* Invoking ifnames::            Listing the conditionals in source code.
+* Invoking autoreconf::         Remaking multiple @code{configure} scripts.
+* Invoking shindent::           Making @code{configure} scripts more readable.
 
 Specific Tests
 
@@ -161,8 +169,12 @@ Makefiles
 
 Running @code{configure} Scripts
 
-* Overriding variables::        Workarounds for unusual systems.
-* Invoking config.status::      Recreating a configuration.
+* Basic Installation::          Instructions for typical cases.
+* Build Directory::             Configuring in a different directory.
+* Installation Directories::    Installing in different directories.
+* System Type::                 Specifying the system type.
+* Optional Features::           Selecting optional features.
+* Compilers and Options::       Selecting compilers and optimization.
 
 An Example
 
@@ -348,6 +360,10 @@ Makefile.in ---'                    `-> Makefile ---'
 * Writing configure.in::       What to put in an Autoconf input file.
 * Invoking autoconf::          How to create configuration scripts.
 * Invoking autoheader::                How to create configuration header files.
+* Invoking autoscan::           Semi-automatic @file{configure.in} writing.
+* Invoking ifnames::            Listing the conditionals in source code.
+* Invoking autoreconf::         Remaking multiple @code{configure} scripts.
+* Invoking shindent::           Making @code{configure} scripts more readable.
 @end menu
 
 @node Writing configure.in, Invoking autoconf, , Making configure Scripts
@@ -443,7 +459,7 @@ the @samp{--macrodir} option, which overrides @code{AC_MACRODIR}.
 the Autoconf version number and exits, and @code{--help}, which prints a
 summary of the command-line options and exits.
 
-@node Invoking autoheader, , Invoking autoconf, Making configure Scripts
+@node Invoking autoheader, Invoking autoscan, Invoking autoconf, Making configure Scripts
 @section Invoking @code{autoheader}
 
 You can use the @code{autoheader} program to create a template file of C
@@ -488,6 +504,160 @@ overrides @code{AC_MACRODIR}.
 the Autoconf version number and exits, and @code{--help}, which prints a
 summary of the command-line options and exits.
 
+@node Invoking autoscan, Invoking ifnames, Invoking autoheader, Making configure Scripts
+@section Invoking autoscan
+
+The @code{autoscan} program can help you create a @file{configure.in}
+file for a software package.  @code{autoscan} examines source files in
+the directory given as a command line argument, or the current directory
+if none is given.  It searches the source files for common portability
+problems and creates a file @file{configure.scan} which is a preliminary
+@file{configure.in} for that package.  You should manually examine
+@file{configure.scan} before renaming it to @file{configure.in}; it will
+probably need some adjustments.  If you want the package to use a
+configuration header file, you will have to add a call to
+@code{AC_CONFIG_HEADER}.  You might have to change or add some
+@code{#if} directives in order to make the package work with Autoconf
+(@pxref{Invoking ifnames}, for information about a program that might
+help with that job).
+
+@code{autoscan} uses several data files, which are installed with the
+distributed Autoconf macro files, to determine which macros to output
+when it finds particular symbols in a package's source files.  These
+files all have the same format.  Each line consists of a symbol,
+whitespace, and the Autoconf macro to output if that symbol is
+encountered.  Lines starting with @samp{#} are comments.
+
+@code{autoscan} is only installed if you already have Perl installed.
+
+@code{autoscan} accepts the following options:
+
+@table @code
+@item --help
+Print a summary of the command line options and exit.
+
+@item --macrodir=@var{dir}
+Look for the data files in directory @var{dir} instead of the default
+installation directory.
+
+@item --verbose
+Print the names of the files it examines and the potentially interesting
+symbols it finds in them.  This output can be voluminous.
+
+@item --version
+Print the version number of @code{autoscan} and exit.
+@end table
+
+@node Invoking ifnames, Invoking autoreconf, Invoking autoscan, Making configure Scripts
+@section Invoking ifnames
+
+@code{ifnames} can help when writing a @file{configure.in} for a
+software package.  It prints the identifiers used in C preprocessor
+conditionals.  If a package has already been set up to have some
+portability, this program can help you figure out what its
+@code{configure} needs to check for.  It may fill in some gaps in a
+@file{configure.in} generated by @code{autoscan} (@pxref{Invoking autoscan}).
+
+@code{ifnames} scans all of the C source files named on the command line
+(or the standard input, if none are given) and writes to the standard
+output a sorted list of all the identifiers that appear in those files
+in @code{#if}, @code{#elif}, or @code{#ifdef} directives.  It prints
+each identifier on a line, followed by a space-separated list of the
+files in which that identifier occurs.
+
+@noindent
+@code{ifnames} accepts the following options:
+
+@table @code
+@item --help
+Print a summary of the command line options and exit.
+
+@item --macrodir=@var{dir}
+Look for the Autoconf macro files in directory @var{dir} instead of the
+default installation directory.  Only used to get the version number.
+
+@item --version
+Print the version number of @code{ifnames} and exit.
+@end table
+
+@node Invoking autoreconf, Invoking shindent, Invoking ifnames, Making configure Scripts
+@section Invoking autoreconf
+
+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.
+
+@noindent
+@code{autoreconf} accepts the following options:
+
+@table @code
+@item --help
+Print a summary of the command line options and exit.
+
+@item --macrodir=@var{dir}
+Look for the Autoconf macro files in directory @var{dir} instead of the
+default installation directory.
+
+@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}).
+
+@item --version
+Print the version number of @code{autoreconf} and exit.
+@end table
+
+@node Invoking shindent, , Invoking autoreconf, Making configure Scripts
+@section Invoking shindent
+
+Autoconf-generated @code{configure} scripts can be somewhat hard to
+read, because they @emph{look} machine-generated---mainly because they
+do not use whitespace rationally.  Unfortunately, it is impossible to do
+proper indentation using a macro processor like @code{m4}.  However, if
+you have GNU @code{bash} installed, you can use the @code{shindent}
+program, which uses @code{bash} to give a Bourne shell script readable
+indentation. 
+
+@code{shindent} indents each script named on the command line, backing
+up the original version using the original file name with @samp{~} appended.
+@code{shindent} places some restrictions on its input, due to the way it
+uses @code{bash} to do the indentation:
+
+@itemize @bullet
+@item
+It removes comments and blank lines between cases case statements.
+
+@item
+Doing odd things in case statements might cause odd problems.
+
+@item
+The script must not define any shell functions.
+
+@item
+If any string literals or here-documents contain lines that start
+with four spaces, those spaces will be removed.
+
+@item
+The script must not be @code{shindent} itself.
+@end itemize
+
+@noindent
+@code{shindent} accepts the following options:
+
+@table @code
+@item --help
+Print a summary of the command line options and exit.
+
+@item --macrodir=@var{dir}
+Look for the Autoconf macro files in directory @var{dir} instead of the
+default installation directory.  Only used to get the version number.
+
+@item --version
+Print the version number of @code{shindent} and exit.
+@end table
+
 @node Specific Tests, General Purpose Macros, Making configure Scripts, Top
 @chapter Specific Tests
 
@@ -538,9 +708,9 @@ GNU C compiler and @code{ioctl} does not work properly without
 
 @defmac AC_LN_S
 @maindex LN_S
-If @samp{ln -s} works on the current filesystem (the O.S. and filesystem
-support symbolic links), set shell and @code{make} variable @code{LN_S}
-to @samp{ln -s}, otherwise set it to @samp{ln}.
+If @samp{ln -s} works on the current filesystem (the operating system
+and filesystem support symbolic links), set shell and @code{make}
+variable @code{LN_S} to @samp{ln -s}, otherwise set it to @samp{ln}.
 @end defmac
 
 @defmac AC_MINUS_C_MINUS_O
@@ -648,13 +818,14 @@ to @samp{byacc}.  Otherwise set @code{YACC} to @samp{yacc}.
 
 @defmac AC_RSH
 @maindex RSH
+@vindex RSH
 @vindex NO_REMOTE
 @vindex HAVE_NETDB_H
-If a remote shell is available, put @samp{rtapelib.o} in @code{make}
-variable @code{RTAPELIB}.  Otherwise, also do so if @file{netdb.h}
-exists (implying the @code{rexec} function), and in addition define
-@code{HAVE_NETDB_H}.  If neither a remote shell nor @code{rexec} is
-available, define @code{NO_REMOTE}.
+If a remote shell is available, set @code{make} variable @code{RSH} to
+its pathname.  Otherwise, if @file{netdb.h} exists (implying the
+@code{rexec} function), define @code{HAVE_NETDB_H}.  If either is true,
+also put @samp{rtapelib.o} in @code{make} variable @code{RTAPELIB}.
+Otherwise, define @code{NO_REMOTE}.
 @end defmac
 
 @defmac AC_SET_MAKE
@@ -801,22 +972,30 @@ Then, in the code, use a test like this:
 #if !STDC_HEADERS && HAVE_MEMORY_H
 #include <memory.h>
 #endif /* not STDC_HEADERS and HAVE_MEMORY_H */
-#define index strchr
-#define rindex strrchr
-#define bcopy(s, d, n) memcpy ((d), (s), (n))
-#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
-#define bzero(s, n) memset ((s), 0, (n))
 #else /* not STDC_HEADERS and not HAVE_STRING_H */
 #include <strings.h>
 /* memory.h and strings.h conflict on some systems.  */
+#ifndef strchr
+#define strchr index
+#endif
+#ifndef strrchr
+#define strrchr rindex
+#endif
+#ifndef memcpy
+#define memcpy(d, s, n) bcopy ((s), (d), (n))
+#endif
+#ifndef memcmp
+#define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
+#endif
 #endif /* not STDC_HEADERS and not HAVE_STRING_H */
 @end group
 @end example
 
 @noindent
-This example asssumes that your code uses the BSD style functions.  If
-you use the System V/ANSI C style functions, you will need to replace
-the macro definitions with ones that go in the other direction.
+This example asssumes that your code uses the ANSI C/System V style
+functions.  If you use the BSD style functions, replace the macro
+definitions with ones that go in the other direction.  (Or, better,
+modernize your code.)
 
 This macro calls @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP} (depending
 on which language is current, @pxref{Language Choice}), if it hasn't
@@ -1198,9 +1377,10 @@ were an array of values.
 @maindex CROSS_CHECK
 If the C compiler being used does not produce executables that can run
 on the system where @code{configure} is being run, set the shell
-variable @code{cross_compiling} to 1.  This information can be used by
-@code{AC_TEST_RUN} to determine whether to take a default action
-instead of trying to run a test program (@pxref{C Features}).
+variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.
+This information can be used by @code{AC_TEST_RUN} to determine whether
+to take a default action instead of trying to run a test program
+(@pxref{C Features}).
 @end defmac
 
 @defmac AC_CHAR_UNSIGNED
@@ -1338,7 +1518,9 @@ by a signal, define @code{HAVE_RESTARTABLE_SYSCALLS}.
 
 The following macros check for certain operating systems that need
 special treatment for some programs, due to exceptional oddities in
-their header files or libraries:
+their header files or libraries.  These macros are kludges; they should
+be replaced someday with a more systematic approach, based either on the
+functions they make available or the environments they provide.
 
 @defmac AC_AIX
 @maindex AIX
@@ -1401,7 +1583,7 @@ directory reading functions.  This macro must be called after
 @code{AC_DIR_HEADER}.
 @end defmac
 
-@node General Purpose Macros, Writing Macros, Specific Tests, Top
+@node General Purpose Macros, Manual Configuration, Specific Tests, Top
 @chapter General Purpose Macros
 
 These macros provide ways for other macros to control the kind of output
@@ -1495,15 +1677,18 @@ You can use the program @code{autoheader} to create
 @defmac AC_CONFIG_SUBDIRS (@var{dir} @dots{})
 @maindex CONFIG_SUBDIRS
 Run @code{configure} in each subdirectory @var{dir} in the given
-whitespace-separated list If a given @var{dir} 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
+whitespace-separated list.  If a given @var{dir} 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 @file{configure}, the Cygnus @code{configure}
-script found by @code{AC_CONFIG_AUXDIR} is 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).
+script found by @code{AC_CONFIG_AUXDIR} is 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 shell and @code{make} 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.
 @end defmac
 
 @defmac AC_INIT (@var{unique-file-in-source-dir})
@@ -1607,10 +1792,10 @@ produces this in @file{configure}:
 
 These macros check whether particular files exist.
 
-@defmac AC_HAVE_LIBRARY (@var{library} @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]})
+@defmac AC_HAVE_LIBRARY (@var{library} @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found} @r{[}, @var{other-libraries}@r{]]]})
 @maindex HAVE_LIBRARY
 Create a test C program to see whether that program can be linked with
-the specified library.  @var{action-if-found} is a list of shell
+the library @var{library}.  @var{action-if-found} is a list of shell
 commands to run if the link succeeds (which means that the library is
 present); @var{action-if-not-found} is a list of shell commands to run
 if the link fails.  If @var{action-if-found} and
@@ -1619,6 +1804,13 @@ add @samp{-lfoo} to @code{LIBS} and define @samp{HAVE_LIBfoo}
 for library @samp{foo}.  @var{library} can be written as any of
 @samp{foo}, @samp{-lfoo}, or @samp{libfoo.a}.  In all of those cases,
 the compiler is passed @samp{-lfoo}.
+
+If linking with @var{library} results in unresolved symbols, which would
+be resolved by linking with additional libraries, give those libraries
+as the @var{other-libraries} argument, separated by spaces: @samp{-lX11
+-lXt}.  Otherwise this macro will fail to detect that @var{library} is
+present, because linking the test program will always fail with
+unresolved symbols.
 @end defmac
 
 @defmac AC_PREFIX (@var{program})
@@ -1666,6 +1858,13 @@ found.
 
 These macros check for features of the C compiler, libraries, and headers.
 
+@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}.
+@end defmac
+
 @defmac AC_COMPILE_CHECK (@var{echo-text}, @var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
 @maindex COMPILE_CHECK
 This is an obsolete alias for @code{AC_TEST_LINK}, with the addition that it
@@ -2007,7 +2206,6 @@ LIBS="$LIBS -ltermcap"
 @end example
 @end defmac
 
-@ignore
 @defmac AC_SUBST_FILE (@var{variable}, @var{file})
 @maindex SUBST_FILE
 Substitute the contents of the file @file{@var{srcdir}/@var{file}} into
@@ -2016,7 +2214,6 @@ Substitute the contents of the file @file{@var{srcdir}/@var{file}} into
 inserting @file{Makefile} fragments for particular host or tartet types
 into @file{Makefile}s.
 @end defmac
-@end ignore
 
 @node Printing Messages, Language Choice, Setting Variables, General Purpose Macros
 @section Printing Messages
@@ -2193,7 +2390,126 @@ is only called if it is needed, and only called once.
 @xref{Dependencies Between Macros}, for more information.
 @end defmac
 
-@node Writing Macros, Makefiles, General Purpose Macros, Top
+@node Manual Configuration, Writing Macros, General Purpose Macros, Top
+@chapter Manual Configuration
+
+Some kinds of features can't be guessed automatically by running test
+programs.  For example, how to allocate a pty, or the details of the
+object file format, or special options that need to be passed to the
+compiler or linker to provide a POSIX or ANSI C environment.  It is
+possible to check for such features using ad-hoc means, such as having
+@code{configure} check the output of the @code{uname} program, or
+looking for libraries that are unique to particular systems.  However,
+Autoconf provides a uniform method for handling unguessable features.
+
+Like other GNU @code{configure} scripts, Autoconf-generated
+@code{configure} scripts can make decisions based on a canonical name
+for the system type, which has the form:
+
+@example
+@var{cpu}-@var{company}-@var{system}
+@end example
+
+@code{configure} can usually guess the canonical name for the type of
+system it's running on.  To do so it runs a script called
+@code{config.guess}, which derives the name using the @code{uname}
+command or symbols predefined by the C preprocessor.
+
+Alternately, the user can specify the system type with command line
+arguments to @code{configure}.  Doing so is necessary when
+cross-compiling.  In the most complex case of cross-compiling, three
+system types are involved.  The options to specify them are:
+
+@table @code
+@item --build=@var{build-type}
+the type of system on which the package is being configured and
+compiled;
+
+@item --host=@var{host-type}
+the type of system on which the package will run;
+
+@item --target=@var{target-type}
+the type of system for which any compiler tools in the package will
+produce code.
+@end table
+
+@noindent
+If the user gives @code{configure} a non-option argument, it is used as
+the default for the host, target, and build system types if the user
+does not specify them explicitly with options.  The target and build
+types default to the host type if it is given and they are not.  Note
+that if you are cross-compiling, you still have to specify the names of
+the cross-tools you use, in particular the C compiler, on the
+@code{configure} and @code{make} command lines, e.g.,
+
+@example
+CC=m68k-coff-gcc configure --target=m68k-coff; CC=m68k-coff-gcc make
+@end example
+
+@code{configure} recognizes short aliases for many system types; for
+example, @samp{decstation} can be given on the command line instead of
+@samp{mips-dec-ultrix4.2}.  @code{configure} runs a script called
+@code{config.sub} to canonicalize system type aliases.
+
+@defmac AC_CANONICAL_SYSTEM
+@maindex CANONICAL_SYSTEM
+Set shell and @code{make} variables to the names of the canonical system
+types.  If the user did not specify one or more of those values on the
+command line, run @code{config.guess} to determine them.  Run
+@code{config.sub} to canonicalize any aliases the user gave.  If you use
+this macro, you must distribute those two shell scripts along with your
+source code (@pxref{Setup}, for information about the
+@code{AC_CONFIG_AUX_DIR} macro which you can use to control which
+directory @code{configure} looks for those scripts in).  If you do not
+run this macro, @code{configure} ignores any @samp{--host}, etc. options
+given to it.  The variables set are:
+
+@table @code
+@item @code{build}, @code{host}, @code{target}
+the canonical system names;
+
+@item @code{build_alias}, @code{host_alias}, @code{target_alias}
+the names the user specified, or the canonical names if
+@code{config.guess} was used;
+
+@item @code{build_cpu}, @code{build_vendor}, @code{build_os}
+@itemx @code{host_cpu}, @code{host_vendor}, @code{host_os}
+@itemx @code{target_cpu}, @code{target_vendor}, @code{target_os}
+the individual parts of the canonical names (for convenience).
+@end table
+@end defmac
+
+How do you use a canonical system type?  Usually, you use it in one or
+more @code{case} statements in @file{configure.in} to select
+system-specific C files.  Then link those files, which have names based
+on the system name, to generic names, such as @file{host.h} or
+@file{target.c}.  The @code{case} statement patterns can use shell
+wildcards to group several cases together, like in this fragment:
+
+@example
+case "$target" in
+i386-*-mach* | i386-*-gnu*) obj_format=aout emulation=mach bfd_gas=yes ;;
+i960-*-bout) obj_format=bout ;;
+esac
+@end example
+
+@defmac AC_LINK_FILES (@var{link} @dots{}, @var{file} @dots{})
+@maindex LINK_FILES
+Link each of the existing files @var{file} to the corresponding link
+name @var{link}.  Makes a symbolic link if possible, otherwise a hard
+link.  For example, this call:
+
+@example
+AC_LINK_FILES(config/sun3.h config/aout.h, host.h object.h)
+@end example
+
+@noindent
+creates in the current directory @file{host.h}, which is a link to
+@file{@var{srcdir}/config/sun3.h}, and @file{object.h}, which is a link
+to @file{@var{srcdir}/config/aout.h}.
+@end defmac
+
+@node Writing Macros, Caching Values, Manual Configuration, Top
 @chapter Writing Macros
 
 If your package needs to test for some feature that none of the macros
@@ -2266,7 +2582,8 @@ several times; each evaluation might require another layer of quotes to
 prevent unwanted expansions of macros or @code{m4} builtins, such as
 @samp{define} and @samp{$1}.  Quotes are also required around macro
 arguments that contain commas, since commas separate the arguments from
-each other.
+each other.  It's a good idea to quote any macro arguments that contain
+newlines or calls to other macros, as well.
 
 Autoconf (in @file{acgeneral.m4}) changes the @code{m4} quote characters
 from the default @samp{`} and @samp{'} to @samp{[} and @samp{]}, because
@@ -2547,7 +2864,143 @@ fi
 @end group
 @end example
 
-@node Makefiles, Invoking configure, Writing Macros, Top
+@node Caching Values, Makefiles, Writing Macros, Top
+@chapter Caching Values
+
+To avoid checking for the same features repeatedly in various
+@code{configure} scripts (or repeated runs of one script),
+@code{configure} saves the results of many of its checks in a @dfn{cache
+file}.  If, when a @code{configure} script runs, it finds a cache file,
+it reads from it the results from previous runs and avoids rerunning
+those checks.  As a result, @code{configure} can run much faster than if
+it had to perform all of the checks every time.
+
+The cache file is a shell script that caches the results of configure
+tests run on one system so they can be shared between configure scripts
+and configure runs.  It is not useful on other systems.  If its contents
+are invalid for some reason, the user may delete or edit it.
+
+By default, configure uses @file{./config.cache} as the cache file,
+creating it if it does not exist already.  @code{configure} accepts the
+@samp{--cache-file=@var{file}} option to use a different cache file;
+that is what @code{configure} does when it calls @code{configure}
+scripts in subdirectories, so they share the cache.  @xref{Setup}, for
+information on configuring subdirectories with the
+@code{AC_CONFIG_SUBDIRS} macro.  @file{config.status} only pays
+attention to the cache file if it is given the @samp{--recheck} option,
+which makes it rerun @code{configure}.
+
+It is wrong to try to distribute cache files for particular system types.
+There is too much room for error in doing that, and too much
+administrative overhead in maintaining them.  For any features that
+can't be guessed automatically, use the standard method of the canonical
+system type and linking files (@pxref{Manual Configuration}).
+
+The cache file on a particular system will gradually accumulate whenever
+someone runs a @code{configure} script; it will be initially
+nonexistent.  Running @code{configure} merges the new cache results with
+the existing cache file.  The site initialization script can specify a
+site-wide cache file to use instead of the default, to make it work
+transparently (@pxref{Site Default Values}).
+
+@defmac AC_CACHE_VAL (@var{cache-id}, @var{commands-to-set-it})
+@maindex CACHE_VAL
+Ensure that the results of the check identified by @var{cache-id} are
+available.  If the results of the check were in the cache file that was
+read, print a verbose message saying so; otherwise, run the shell
+commands @var{commands-to-set-it}.  Those commands should have no side
+effects except for setting the variable @var{cache-id}.  In particular,
+they should not call @code{AC_DEFINE}; the code that follows the call to
+@code{AC_CACHE_VAL} should do that, based on the cached value.  Also,
+they should not print any messages, for example with @code{AC_CHECKING};
+do that before calling @code{AC_CACHE_VAL}, so the messages are printed
+regardless of whether the results of the check are retrieved from the
+cache or determined by running the shell commands.  If the shell
+commands are run to determine the value, the value will be saved in the
+cache file just before @code{configure} creates its output files.
+
+@noindent
+The names of cache variables should have this format:
+
+@example
+@var{package-prefix}_cv_@var{value-type}_@var{specific-value}@r{[}_@var{additional-options}@r{]}
+@end example
+
+@noindent
+for example, @samp{ac_cv_header_stat_broken} or
+@samp{ac_cv_prog_gcc_traditional}.  The parts of the variable name are:
+
+@table @asis
+@item @var{package-prefix}
+An abbreviation for your package or organization; the same prefix you
+begin local Autoconf macros with, except lowercase by convention.
+For cache values used by the distributed Autoconf macros, this value is
+@samp{ac}. 
+
+@item @code{_cv_}
+Indicates that this shell variable is a cache value.
+
+@item @var{value-type}
+A convention for classifying cache values, to produce a rational naming
+system.  The values used in Autoconf are for the following classes of
+features; use them where applicable, otherwise invent your own categories:
+
+@table @code
+@item c
+C language
+
+@item func
+C functions
+
+@item group
+Unix groups
+
+@item header
+C header files
+
+@item lib
+C libraries
+
+@item path
+the absolute path names of programs
+
+@item prog
+the base names of programs
+
+@item struct
+C structures
+
+@item sys
+operating systems
+
+@item type
+C types
+
+@item var
+C variables in libraries
+
+@item x
+X Window System
+@end table
+
+@item @var{specific-value}
+Which member of the class of cache values this test applies to.
+For example, which function (@samp{alloca}), program (@samp{gcc}), or
+@code{make} variable (@samp{INSTALL}).
+
+@item @var{additional-options}
+Any particular behavior of the specific member that this test applies to.
+For example, @samp{broken} or @samp{set}.  This part of the name may
+be omitted if it does not apply.
+@end table
+
+Like their names, the values the may be assigned to cache variables have
+a few restrictions.  The values may not contain single quotes or curly braces.
+Usually, their values will be boolean (@samp{yes} or @samp{no}) or the
+names of files or functions; so this is not an important restriction.
+@end defmac
+
+@node Makefiles, Invoking configure, Caching Values, Top
 @chapter Makefiles
 
 Each subdirectory in a distribution should come with a file
@@ -2698,9 +3151,10 @@ stamp-h.in: configure.in aclocal.m4 acconfig.h config.h.top config.h.bot
         touch $@{srcdir@}/stamp-h.in
 
 # config.status might not change config.h
+# Don't rerun config.status if we just configured.
 config.h: stamp-h
 stamp-h: config.h.in config.status
-        ./config.status
+        test ! -f stamp-h || ./config.status
         touch stamp-h
 
 Makefile: Makefile.in config.status
@@ -2714,149 +3168,30 @@ config.status: configure
 @xref{Invoking config.status}, for more information on handling
 configuration-related dependencies.
 
-@node Invoking configure, Example, Makefiles, Top
+@node Invoking configure, Invoking config.status, Makefiles, Top
 @chapter Running @code{configure} Scripts
 
 A software package that uses a @code{configure} script
 should be distributed with a file @file{Makefile.in}, but no
 @file{Makefile}; that way, the user has to properly configure the
 package for the local system before compiling it.
-Here is how to configure a package that uses a @code{configure} script.
-
-Normally, you just @code{cd} to the directory containing the package's
-source code and type @samp{./configure}.  If you're using @code{csh} on
-an old version of System V, you might need to type @samp{sh configure}
-instead to prevent @code{csh} from trying to execute @code{configure}
-itself.
-
-Running @code{configure} takes awhile.  While it is running, it
-prints some messages that tell what it is doing.  If you don't want to
-see any messages, run @code{configure} with its standard output
-redirected to @file{/dev/null}; for example, @samp{./configure >/dev/null}.
-
-To compile the package in a different directory from the one containing
-the source code, you must use a version of @code{make} that supports the
-@code{VPATH} variable, such as GNU @code{make}.  @code{cd} to the
-directory where you want the object files and executables to go and run
-the @code{configure} script.  @code{configure} automatically checks for
-the source code in the directory that @code{configure} is in and in
-@file{..}.  If for some reason @code{configure} is not in the source
-code directory that you are configuring, then it will report that it
-can't find the source code.  In that case, run @code{configure} with the
-option @samp{--srcdir=@var{dir}}, where @var{dir} is the directory that
-contains the source code.
-
-By default, @samp{make install} will install the package's files in
-@file{/usr/local/bin}, @file{/usr/local/man}, etc.  You can specify an
-installation prefix other than @file{/usr/local} by giving
-@code{configure} the option @samp{--prefix=@var{path}}.  Alternately,
-you can do so by consistently giving a value for the @samp{prefix}
-variable when you run @code{make}, e.g.,
-@example
-make prefix=/usr/gnu
-make prefix=/usr/gnu install
-@end example
-
-You can specify separate installation prefixes for architecture-specific
-files and architecture-independent files.  If you give @code{configure}
-the option @samp{--exec-prefix=@var{path}} or set the @code{make}
-variable @samp{exec_prefix} to @var{path}, the package will use
-@var{path} as the prefix for installing programs and libraries.  Data
-files and documentation will still use the regular prefix.  Normally,
-all files are installed using the same prefix.
-
-Some packages pay attention to @samp{--with-@var{package}} options to
-@code{configure}, where @var{package} is something like @samp{gnu-as} or
-@samp{x} (for the X Window System).  They may also pay attention to
-@samp{--enable-@var{feature}} options, where @var{feature} indicates an
-optional part of the package.  The README should mention any
-@samp{--with-} and @samp{--enable-} options that the package recognizes.
-
-@code{configure} also recognizes the following options:
-
-@table @code
-@item --help
-Print a summary of the options to @code{configure}, and exit.
-
-@itemx --quiet
-@item --silent
-Do not print messages saying which checks are being made.
-
-@item --verbose
-Print the results of the checks.
-
-@item --version
-Print the version of Autoconf used to generate the @code{configure}
-script, and exit.
-
-@item --x-includes=@var{dir}
-X include files are in @var{dir}.
-
-@item --x-libraries=@var{dir}
-X library files are in @var{dir}.
-@end table
-
-@code{configure} also accepts and ignores some other options.
+Below are instructions on how to configure a package that uses a
+@code{configure} script, suitable for inclusion as an @file{INSTALL}
+file in the package.
 
 @menu
-* Overriding variables::        Workarounds for unusual systems.
-* Invoking config.status::      Recreating a configuration.
+* Basic Installation::          Instructions for typical cases.
+* Compilers and Options::       Selecting compilers and optimization.
+* Build Directory::             Configuring in a different directory.
+* Installation Directories::    Installing in different directories.
+* System Type::                 Specifying the system type.
+* Optional Features::           Selecting optional features.
 @end menu
 
-@node Overriding variables, Invoking config.status, , Invoking configure
-@section Overriding variables
-
-On systems that require unusual options for compilation or linking that
-the package's @code{configure} script does not know about, you can give
-@code{configure} initial values for variables by setting them in the
-environment.  In Bourne-compatible shells, you can do that on the
-command line like this:
-
-@example
-CC='gcc -traditional' LIBS=-lposix ./configure
-@end example
-
-@noindent
-On systems that have the @code{env} program, you can do it like this:
-
-@example
-env CC='gcc -traditional' LIBS=-lposix ./configure
-@end example
-
-Here are the @code{make} variables that you might want to override with
-environment variables when running @code{configure}.
-
-For these variables, any value given in the environment overrides the
-value that @code{configure} would choose:
-
-@defvar CC
-C compiler program.  The default is @code{cc}.
-@end defvar
-
-@defvar INSTALL
-Program to use to install files.  The default is @code{install} if you
-have it, @code{cp} otherwise.
-@end defvar
-
-For these variables, any value given in the environment is added to
-the value that @code{configure} chooses:
-
-@defvar DEFS
-Configuration options, in the form @samp{-Dfoo -Dbar@dots{}}.  Do not
-use this variable in packages that create a configuration header file.
-@end defvar
-
-@defvar LIBS
-Libraries to link with, in the form @samp{-lfoo -lbar@dots{}}.
-@end defvar
-
-In the long term, most problems requiring manual intervention should be
-fixed by updating either the Autoconf macros or the @file{configure.in}
-file for that package.  @xref{Making configure Scripts}, for a
-discussion of that subject.
+@include install.texi
 
-@node Invoking config.status, , Overriding variables, Invoking configure
-@section Recreating a Configuration
+@node Invoking config.status, Site Default Values, Invoking configure, Top
+@chapter Recreating a Configuration
 
 The @code{configure} script creates a file named @file{config.status}
 which describes which configuration options were specified when the
@@ -2934,7 +3269,44 @@ Makefile: Makefile.in config.status
 (If @file{configure.in} does not call @code{AC_CONFIG_HEADER}, there is
 no need to set @code{CONFIG_HEADERS} in the @code{make} rules.)
 
-@node Example, Preprocessor Symbol Index, Invoking configure, Top
+@node Site Default Values, Example, Invoking config.status, Top
+@chapter Site Default Values
+
+Autoconf-generated @code{configure} scripts support site and system wide
+initialization files.  You can create these files to provide default
+values for some configuration values, both on all of your systems and
+separately for each architecture.
+
+@code{configure} reads the shell script
+@file{@var{exec_prefix}/lib/config.site} if it exists, then
+@file{@var{prefix}/lib/config.site} if it exists.  Thus, settings in
+system dependent files override those in system independent ones in case
+of conflict.  @code{configure} reads any cache file after it has read
+any site files.  This way, the site file can define a default cache
+file, to be shared between all Autoconf-generated @code{configure}
+scripts run on that system.
+
+Site files can be arbitrary shell scripts, but only certain kinds of
+code are really appropriate to be in them.  Besides a cache file, they
+are good places to set default values for other shell variables like
+@code{CC}, if you need to give them unusual values: anything you would
+normally do, repetitively, on the command line.  If you use non-default
+values for @var{prefix} or @var{exec_prefix}, you can't set them in the
+site file, since you have to specify them on the command line in order
+for @code{configure} to find the site file!
+
+In addition, it is possible to set some cache values in the site file.
+If you are cross-compiling, it is impossible to check features that
+require running a test program.  You could ``prime the cache'' by
+setting those values correctly for that system in
+@file{@var{exec_prefix}/lib/config.site}.  The cache file is careful to
+not override any variables set in the site files.  Similarly, you should
+not override command-line options in the site files.  Your code should
+check that variables such as @code{prefix} and @code{cache_file} have
+their default values (as set near the top of @code{configure}) before
+changing them.
+
+@node Example, Preprocessor Symbol Index, Site Default Values, Top
 @chapter An Example
 
 Here are sample @file{configure.in} and @file{Makefile.in} files, to
index ddade82b02984737aa2a62876476180406d8840b..f8daf37e31309827a8ffd51d65925dea9e29360d 100644 (file)
@@ -191,7 +191,7 @@ done
 for func in `for x in $funcs; do echo $x; done | sort | uniq`; do
   sym="`echo ${func} | sed 's/[^a-zA-Z0-9_]/_/g' | tr '[a-z]' '[A-Z]'`"
   echo "
-/* Define if you have ${func}.  */
+/* Define if you have the ${func} function.  */
 #undef HAVE_${sym}"
 done
 
index ddade82b02984737aa2a62876476180406d8840b..f8daf37e31309827a8ffd51d65925dea9e29360d 100644 (file)
@@ -191,7 +191,7 @@ done
 for func in `for x in $funcs; do echo $x; done | sort | uniq`; do
   sym="`echo ${func} | sed 's/[^a-zA-Z0-9_]/_/g' | tr '[a-z]' '[A-Z]'`"
   echo "
-/* Define if you have ${func}.  */
+/* Define if you have the ${func} function.  */
 #undef HAVE_${sym}"
 done
 
index d8ce191b2f142a41176aae42cb6615d000af40b6..159e92966c0bac57ee8ee01294ffa5db9b897d9b 100644 (file)
@@ -19,8 +19,8 @@
 usage="\
 Usage: autoreconf [--help] [--macrodir=dir] [--verbose] [--version]
        [directory...]"
-verbose=
-show_version=
+verbose=no
+show_version=no
 
 test -z "$AC_MACRODIR" && AC_MACRODIR=@datadir@
 export AC_MACRODIR # Pass it down to autoconf and autoheader.
@@ -38,9 +38,9 @@ while test $# -gt 0; do
     AC_MACRODIR="$1"
     shift ;;
   --verbose | --verbos | --verbo | --verb)
-    verbose=t; shift ;;
+    verbose=yes; shift ;;
   --version | --versio | --versi | --vers)
-    show_version=t; shift ;;
+    show_version=yes; shift ;;
   --)     # Stop option processing.
     shift; break ;;
   -*) echo "$usage" 1>&2; exit 1 ;;
@@ -48,7 +48,7 @@ while test $# -gt 0; do
   esac
 done
 
-if test -n "$show_version"; then
+if test $show_version = yes; then
   version=`sed -n 's/define.AC_ACVERSION.[     ]*\([0-9.]*\).*/\1/p' \
     $AC_MACRODIR/acgeneral.m4`
   echo "Autoconf version $version"
@@ -64,10 +64,11 @@ while read confin; do
   (
   dir=`echo $confin|sed 's%/[^/][^/]*$%%'`
   cd $dir || exit 1
-  test -n "$verbose" && echo running autoconf in $dir
+  test $verbose = yes && echo running autoconf in $dir
   autoconf
+  # FIXME maybe we should have an option to run shindent here.
   if grep AC_CONFIG_HEADER configure.in > /dev/null; then
-    test -n "$verbose" && echo running autoheader in $dir
+    test $verbose = yes && echo running autoheader in $dir
     autoheader
   fi
   )
index d8ce191b2f142a41176aae42cb6615d000af40b6..159e92966c0bac57ee8ee01294ffa5db9b897d9b 100644 (file)
@@ -19,8 +19,8 @@
 usage="\
 Usage: autoreconf [--help] [--macrodir=dir] [--verbose] [--version]
        [directory...]"
-verbose=
-show_version=
+verbose=no
+show_version=no
 
 test -z "$AC_MACRODIR" && AC_MACRODIR=@datadir@
 export AC_MACRODIR # Pass it down to autoconf and autoheader.
@@ -38,9 +38,9 @@ while test $# -gt 0; do
     AC_MACRODIR="$1"
     shift ;;
   --verbose | --verbos | --verbo | --verb)
-    verbose=t; shift ;;
+    verbose=yes; shift ;;
   --version | --versio | --versi | --vers)
-    show_version=t; shift ;;
+    show_version=yes; shift ;;
   --)     # Stop option processing.
     shift; break ;;
   -*) echo "$usage" 1>&2; exit 1 ;;
@@ -48,7 +48,7 @@ while test $# -gt 0; do
   esac
 done
 
-if test -n "$show_version"; then
+if test $show_version = yes; then
   version=`sed -n 's/define.AC_ACVERSION.[     ]*\([0-9.]*\).*/\1/p' \
     $AC_MACRODIR/acgeneral.m4`
   echo "Autoconf version $version"
@@ -64,10 +64,11 @@ while read confin; do
   (
   dir=`echo $confin|sed 's%/[^/][^/]*$%%'`
   cd $dir || exit 1
-  test -n "$verbose" && echo running autoconf in $dir
+  test $verbose = yes && echo running autoconf in $dir
   autoconf
+  # FIXME maybe we should have an option to run shindent here.
   if grep AC_CONFIG_HEADER configure.in > /dev/null; then
-    test -n "$verbose" && echo running autoheader in $dir
+    test $verbose = yes && echo running autoheader in $dir
     autoheader
   fi
   )
index cbae762f1140dc81d7048eb48a696af8bf9ed486..6fe9b380de0cf3e24539135a03dafb24b5260a12 100644 (file)
@@ -39,10 +39,13 @@ exit 0;
 # Process any command line arguments.
 sub parse_args
 {
-    local ($usage) = "Usage: $0 [--help] [--verbose] [--version] [srcdir]\n"; 
+    local ($usage) = \
+       "Usage: $0 [--macrodir=dir] [--help] [--verbose] [--version] [srcdir]\n"; 
 
     foreach $_ (@ARGV) {
-       if (/^--h/) {
+       if (/^--m[a-z]*=(.*)/) {
+           $datadir = $1;
+       } elsif (/^--h/) {
            print "$usage";
            exit 0;
        } elsif (/^--verb/) {
index cbae762f1140dc81d7048eb48a696af8bf9ed486..6fe9b380de0cf3e24539135a03dafb24b5260a12 100644 (file)
@@ -39,10 +39,13 @@ exit 0;
 # Process any command line arguments.
 sub parse_args
 {
-    local ($usage) = "Usage: $0 [--help] [--verbose] [--version] [srcdir]\n"; 
+    local ($usage) = \
+       "Usage: $0 [--macrodir=dir] [--help] [--verbose] [--version] [srcdir]\n"; 
 
     foreach $_ (@ARGV) {
-       if (/^--h/) {
+       if (/^--m[a-z]*=(.*)/) {
+           $datadir = $1;
+       } elsif (/^--h/) {
            print "$usage";
            exit 0;
        } elsif (/^--verb/) {
index cc037b03ef5fdf8f777fad541b6c755b6cd27b5c..f1c73e6cf7b659eb1f9c7f7fb157e54bd0b2b336 100644 (file)
@@ -43,26 +43,26 @@ tmpout=/tmp/acout.$$
 
 print_version=
 while test $# -gt 0 ; do
-   case "z${1}" in 
-      z-h | z--help | z--h* )
+   case "${1}" in 
+      -h | --help | --h* )
          echo "${usage}" 1>&2; exit 0 ;;
-      z--macrodir=* | z--m*=* )
+      --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* )
+      -v | --version | --v* )
          print_version="-DAC_PRINT_VERSION"
-         infile=/dev/null tmpout=/dev/null
+         infile=/dev/null
          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 ;;
@@ -82,7 +82,7 @@ if test -z "$print_version"; then
     tmpin=/tmp/acin.$$
     infile=$tmpin
     cat > $infile
-  elif test ! -s "${infile}"; then
+  elif test ! -r "${infile}"; then
     echo "autoconf: ${infile}: No such file or directory" >&2
     exit 1
   fi
@@ -96,7 +96,11 @@ MACROFILES="${print_version} ${MACROFILES}"
 
 $M4 $MACROFILES $infile > $tmpout || { st=$?; rm -f $tmpin $tmpout; exit $st; }
 
-test -n "$print_version" && exit 0
+if test -n "$print_version"; then
+  cat $tmpout
+  rm -f $tmpout
+  exit 0
+fi
 
 # 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
index ddade82b02984737aa2a62876476180406d8840b..f8daf37e31309827a8ffd51d65925dea9e29360d 100644 (file)
@@ -191,7 +191,7 @@ done
 for func in `for x in $funcs; do echo $x; done | sort | uniq`; do
   sym="`echo ${func} | sed 's/[^a-zA-Z0-9_]/_/g' | tr '[a-z]' '[A-Z]'`"
   echo "
-/* Define if you have ${func}.  */
+/* Define if you have the ${func} function.  */
 #undef HAVE_${sym}"
 done
 
index d8ce191b2f142a41176aae42cb6615d000af40b6..159e92966c0bac57ee8ee01294ffa5db9b897d9b 100644 (file)
@@ -19,8 +19,8 @@
 usage="\
 Usage: autoreconf [--help] [--macrodir=dir] [--verbose] [--version]
        [directory...]"
-verbose=
-show_version=
+verbose=no
+show_version=no
 
 test -z "$AC_MACRODIR" && AC_MACRODIR=@datadir@
 export AC_MACRODIR # Pass it down to autoconf and autoheader.
@@ -38,9 +38,9 @@ while test $# -gt 0; do
     AC_MACRODIR="$1"
     shift ;;
   --verbose | --verbos | --verbo | --verb)
-    verbose=t; shift ;;
+    verbose=yes; shift ;;
   --version | --versio | --versi | --vers)
-    show_version=t; shift ;;
+    show_version=yes; shift ;;
   --)     # Stop option processing.
     shift; break ;;
   -*) echo "$usage" 1>&2; exit 1 ;;
@@ -48,7 +48,7 @@ while test $# -gt 0; do
   esac
 done
 
-if test -n "$show_version"; then
+if test $show_version = yes; then
   version=`sed -n 's/define.AC_ACVERSION.[     ]*\([0-9.]*\).*/\1/p' \
     $AC_MACRODIR/acgeneral.m4`
   echo "Autoconf version $version"
@@ -64,10 +64,11 @@ while read confin; do
   (
   dir=`echo $confin|sed 's%/[^/][^/]*$%%'`
   cd $dir || exit 1
-  test -n "$verbose" && echo running autoconf in $dir
+  test $verbose = yes && echo running autoconf in $dir
   autoconf
+  # FIXME maybe we should have an option to run shindent here.
   if grep AC_CONFIG_HEADER configure.in > /dev/null; then
-    test -n "$verbose" && echo running autoheader in $dir
+    test $verbose = yes && echo running autoheader in $dir
     autoheader
   fi
   )
index cbae762f1140dc81d7048eb48a696af8bf9ed486..6fe9b380de0cf3e24539135a03dafb24b5260a12 100644 (file)
@@ -39,10 +39,13 @@ exit 0;
 # Process any command line arguments.
 sub parse_args
 {
-    local ($usage) = "Usage: $0 [--help] [--verbose] [--version] [srcdir]\n"; 
+    local ($usage) = \
+       "Usage: $0 [--macrodir=dir] [--help] [--verbose] [--version] [srcdir]\n"; 
 
     foreach $_ (@ARGV) {
-       if (/^--h/) {
+       if (/^--m[a-z]*=(.*)/) {
+           $datadir = $1;
+       } elsif (/^--h/) {
            print "$usage";
            exit 0;
        } elsif (/^--verb/) {
index 219e0e6191c1db1b28423ce31b7682d526d33346..c41915b7de5fad16b19e0cf645b632eba8cec1df 100644 (file)
@@ -17,12 +17,20 @@ else
   AC_VERBOSE(autoscan will not be built since perl is not found)
 fi
 
+AC_PROGRAM_CHECK(BASH, bash, no-bash)
+if test "$BASH" != no-bash; then
+  PROGS="$PROGS shindent"
+else
+  AC_VERBOSE(shindent will not be built since bash is not found)
+fi
+
 AC_PROG_INSTALL
 
 # Work with the GNU or Cygnus source tree layout.
 if test -f $srcdir/standards.texi; then
   standards_info=standards.info standards_dvi=standards.dvi
 fi
-AC_SUBST(standards_info)AC_SUBST(standards_dvi)dnl
+AC_SUBST(standards_info)dnl
+AC_SUBST(standards_dvi)dnl
 
-AC_OUTPUT(Makefile)
+AC_OUTPUT(Makefile testsuite/Makefile)
index 701ee6d92f9c03f1198a900a243555c8d4978c93..83241422b04064f77d11be3f15fad7728da20cd8 100644 (file)
@@ -27,7 +27,7 @@ MAKEINFO = makeinfo
 TEXI2DVI = texi2dvi
 M4 = @M4@
 
-PROGS = autoconf autoheader autoreconf @PROGS@
+PROGS = autoconf autoheader autoreconf ifnames @PROGS@
 # Path of the perl interpreter.
 PERL = @PERL@
 
@@ -54,9 +54,13 @@ DISTDEP = info Makefile
 DISTFILES = COPYING ChangeLog INSTALL Makefile.in NEWS README \
        acconfig.h acfunctions acgeneral.m4 acheaders acidentifiers \
        acmakevars acprograms acspecific.m4 autoconf.info* \
-       autoconf.sh autoconf.texi autoheader.sh autoreconf.sh autoscan.pl \
+       autoconf.sh autoconf.texi install.texi \
+       autoheader.sh autoreconf.sh autoscan.pl shindent.sh ifnames.sh \
        config.guess config.sub configure configure.in \
        install.sh mkinstalldirs texinfo.tex \
+       testsuite/Makefile.in testsuite/config/*.exp \
+       testsuite/lib/*.exp \
+       testsuite/autoconf.0/*.exp \
        standards.texi make-stds.texi standards.info*
 
 editsh = sed -e 's,@''datadir''@,$(acdatadir),g' -e 's,@''M4''@,$(M4),g'
@@ -76,15 +80,27 @@ autoreconf: autoreconf.sh
        rm -f $@ $@.tmp
        $(editsh) $(srcdir)/autoreconf.sh > $@.tmp && mv $@.tmp $@ && chmod +x $@
 
+shindent: shindent.sh
+       rm -f $@ $@.tmp
+       $(editsh) $(srcdir)/shindent.sh > $@.tmp && mv $@.tmp $@ && chmod +x $@
+
+ifnames: ifnames.sh
+       rm -f $@ $@.tmp
+       $(editsh) $(srcdir)/ifnames.sh > $@.tmp && mv $@.tmp $@ && chmod +x $@
+
 autoscan: autoscan.pl
        rm -f $@ $@.tmp
        $(editpl) $(srcdir)/autoscan.pl > $@.tmp && mv $@.tmp $@ && chmod +x $@
 
-info: autoconf.info @standards_info@
+info: autoconf.info @standards_info@ INSTALL
 
-autoconf.info: autoconf.texi
+autoconf.info: autoconf.texi install.texi
        $(MAKEINFO) -I$(srcdir) $(srcdir)/autoconf.texi --output=$@
 
+INSTALL: install.texi
+       $(MAKEINFO) -I$(srcdir) $(srcdir)/install.texi --output=$@ \
+       --no-headers --no-validate
+
 standards.info: standards.texi make-stds.texi
        $(MAKEINFO) -I$(srcdir) $(srcdir)/standards.texi --output=$@
 
@@ -96,8 +112,11 @@ autoconf.dvi: autoconf.texi
 standards.dvi: standards.texi make-stds.texi
        $(TEXI2DVI) $(srcdir)/standards.texi
 
-check:
-installcheck:
+check: all
+       rootme=`pwd`; cd testsuite && ${MAKE} $@ AUTOCONF=$$rootme/autoconf \
+       AUTOCONFFLAGS="-m $$rootme"
+installcheck: all install
+       cd testsuite && ${MAKE} AUTOCONF=${bindir}/autoconf $@
 
 installdirs:
        $(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir) $(acdatadir)
@@ -107,11 +126,14 @@ install: all acgeneral.m4 acspecific.m4 acconfig.h installdirs install-info
        $(INSTALL_PROGRAM) autoconf $(bindir)/autoconf
        $(INSTALL_PROGRAM) autoheader $(bindir)/autoheader
        $(INSTALL_PROGRAM) autoreconf $(bindir)/autoreconf
+       $(INSTALL_PROGRAM) ifnames $(bindir)/ifnames
        $(INSTALL_DATA) $(srcdir)/acgeneral.m4 $(acdatadir)/acgeneral.m4
        $(INSTALL_DATA) $(srcdir)/acspecific.m4 $(acdatadir)/acspecific.m4
        $(INSTALL_DATA) $(srcdir)/acconfig.h $(acdatadir)/acconfig.h
        -if test -f autoscan; then \
        $(INSTALL_PROGRAM) autoscan $(bindir)/autoscan; \
+       -if test -f shindent; then \
+       $(INSTALL_PROGRAM) shindent $(bindir)/shindent; \
        $(INSTALL_DATA) $(srcdir)/acfunctions $(acdatadir)/acfunctions; \
        $(INSTALL_DATA) $(srcdir)/acheaders $(acdatadir)/acheaders; \
        $(INSTALL_DATA) $(srcdir)/acidentifiers $(acdatadir)/acidentifiers; \
@@ -131,7 +153,7 @@ install-info: info installdirs
 
 uninstall:
        rm -f $(bindir)/autoconf $(bindir)/autoheader $(bindir)/autoscan 
-       rm -f $(bindir)/autoreconf
+       rm -f $(bindir)/autoreconf $(bindir)/shindent $(bindir)/ifnames
        rm -fr $(acdatadir)
        cd $(infodir); rm -f autoconf.info*
        if test -f standards.info || test -f $(srcdir)/standards.info; \
@@ -149,7 +171,7 @@ config.status: configure
        ./config.status --recheck
 
 clean:
-       rm -f autoconf autoheader autoscan autoreconf *.tmp
+       rm -f autoconf autoheader autoscan autoreconf shindent ifnames *.tmp
        rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log
        rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs *.ma *.mas
 
@@ -159,7 +181,7 @@ distclean: clean
        rm -f Makefile config.status config.cache config.log
 
 realclean: distclean
-       rm -f TAGS *.info*
+       rm -f TAGS *.info* INSTALL
 
 TAGS:
        etags ${srcdir}/*.m4 ${srcdir}/*.sh ${srcdir}/[a-z]*.in ${srcdir}/*.texi
@@ -169,10 +191,11 @@ dist: $(DISTDEP)
        distname=`sed -e '/define(AC_ACVERSION,/!d' \
        -e 's/[^0-9.]*\([0-9.]*\).*/autoconf-\1/' -e q acgeneral.m4`; \
        rm -fr $$distname; \
-       mkdir $$distname; \
+       mkdir $$distname $$distname/testsuite $$distname/testsuite/config; \
+       mkdir $$distname/testsuite/lib $$distname/testsuite/autoconf.0; \
        for file in $(DISTFILES); do \
-         ln $$file $$distname \
-         || { echo copying $$file instead; cp -p $$file $$distname;}; \
+         ln $$file $$distname/$$file \
+         || { echo copying $$file instead; cp -p $$file $$distname/$$file;}; \
        done; \
        chmod -R a+rX $$distname; \
        tar -chz -f $$distname.tar.gz $$distname; \
index 654ae8463ddbfa66e5fbf728f22c24247b81d74e..879b3ce5b91092262608910a7513065299a05bda 100644 (file)
@@ -6,8 +6,8 @@
 @c @setchapternewpage odd
 @c %**end of header
 
-@set EDITION 1.93
-@set VERSION 1.93
+@set EDITION 1.94
+@set VERSION 1.94
 @set UPDATED June 1994
 
 @iftex
@@ -96,9 +96,13 @@ package.  This is edition @value{EDITION}, for Autoconf version @value{VERSION}.
 * Making configure Scripts::    How to organize and produce Autoconf scripts.
 * Specific Tests::              Macros that check for particular features.
 * General Purpose Macros::      Macros that check for kinds of features.
+* Manual Configuration::        Selecting features that can't be guessed.
 * Writing Macros::              How to add your own macros to Autoconf.
+* Caching Values::              Speeding up subsequent @code{configure} runs.
 * Makefiles::                   Information Autoconf uses in @file{Makefile}s.
 * Invoking configure::          How to use the Autoconf output.
+* Invoking config.status::      Recreating a configuration.
+* Site Default Values::         Providing local defaults for @code{configure}.
 * Example::                     Sample Autoconf input files.
 * Preprocessor Symbol Index::   Index of C preprocessor symbols defined.
 * Macro Index::                 Index of Autoconf macros.
@@ -110,6 +114,10 @@ Making @code{configure} Scripts
 * Writing configure.in::       What to put in an Autoconf input file.
 * Invoking autoconf::          How to create configuration scripts.
 * Invoking autoheader::                How to create configuration header files.
+* Invoking autoscan::           Semi-automatic @file{configure.in} writing.
+* Invoking ifnames::            Listing the conditionals in source code.
+* Invoking autoreconf::         Remaking multiple @code{configure} scripts.
+* Invoking shindent::           Making @code{configure} scripts more readable.
 
 Specific Tests
 
@@ -161,8 +169,12 @@ Makefiles
 
 Running @code{configure} Scripts
 
-* Overriding variables::        Workarounds for unusual systems.
-* Invoking config.status::      Recreating a configuration.
+* Basic Installation::          Instructions for typical cases.
+* Build Directory::             Configuring in a different directory.
+* Installation Directories::    Installing in different directories.
+* System Type::                 Specifying the system type.
+* Optional Features::           Selecting optional features.
+* Compilers and Options::       Selecting compilers and optimization.
 
 An Example
 
@@ -348,6 +360,10 @@ Makefile.in ---'                    `-> Makefile ---'
 * Writing configure.in::       What to put in an Autoconf input file.
 * Invoking autoconf::          How to create configuration scripts.
 * Invoking autoheader::                How to create configuration header files.
+* Invoking autoscan::           Semi-automatic @file{configure.in} writing.
+* Invoking ifnames::            Listing the conditionals in source code.
+* Invoking autoreconf::         Remaking multiple @code{configure} scripts.
+* Invoking shindent::           Making @code{configure} scripts more readable.
 @end menu
 
 @node Writing configure.in, Invoking autoconf, , Making configure Scripts
@@ -443,7 +459,7 @@ the @samp{--macrodir} option, which overrides @code{AC_MACRODIR}.
 the Autoconf version number and exits, and @code{--help}, which prints a
 summary of the command-line options and exits.
 
-@node Invoking autoheader, , Invoking autoconf, Making configure Scripts
+@node Invoking autoheader, Invoking autoscan, Invoking autoconf, Making configure Scripts
 @section Invoking @code{autoheader}
 
 You can use the @code{autoheader} program to create a template file of C
@@ -488,6 +504,160 @@ overrides @code{AC_MACRODIR}.
 the Autoconf version number and exits, and @code{--help}, which prints a
 summary of the command-line options and exits.
 
+@node Invoking autoscan, Invoking ifnames, Invoking autoheader, Making configure Scripts
+@section Invoking autoscan
+
+The @code{autoscan} program can help you create a @file{configure.in}
+file for a software package.  @code{autoscan} examines source files in
+the directory given as a command line argument, or the current directory
+if none is given.  It searches the source files for common portability
+problems and creates a file @file{configure.scan} which is a preliminary
+@file{configure.in} for that package.  You should manually examine
+@file{configure.scan} before renaming it to @file{configure.in}; it will
+probably need some adjustments.  If you want the package to use a
+configuration header file, you will have to add a call to
+@code{AC_CONFIG_HEADER}.  You might have to change or add some
+@code{#if} directives in order to make the package work with Autoconf
+(@pxref{Invoking ifnames}, for information about a program that might
+help with that job).
+
+@code{autoscan} uses several data files, which are installed with the
+distributed Autoconf macro files, to determine which macros to output
+when it finds particular symbols in a package's source files.  These
+files all have the same format.  Each line consists of a symbol,
+whitespace, and the Autoconf macro to output if that symbol is
+encountered.  Lines starting with @samp{#} are comments.
+
+@code{autoscan} is only installed if you already have Perl installed.
+
+@code{autoscan} accepts the following options:
+
+@table @code
+@item --help
+Print a summary of the command line options and exit.
+
+@item --macrodir=@var{dir}
+Look for the data files in directory @var{dir} instead of the default
+installation directory.
+
+@item --verbose
+Print the names of the files it examines and the potentially interesting
+symbols it finds in them.  This output can be voluminous.
+
+@item --version
+Print the version number of @code{autoscan} and exit.
+@end table
+
+@node Invoking ifnames, Invoking autoreconf, Invoking autoscan, Making configure Scripts
+@section Invoking ifnames
+
+@code{ifnames} can help when writing a @file{configure.in} for a
+software package.  It prints the identifiers used in C preprocessor
+conditionals.  If a package has already been set up to have some
+portability, this program can help you figure out what its
+@code{configure} needs to check for.  It may fill in some gaps in a
+@file{configure.in} generated by @code{autoscan} (@pxref{Invoking autoscan}).
+
+@code{ifnames} scans all of the C source files named on the command line
+(or the standard input, if none are given) and writes to the standard
+output a sorted list of all the identifiers that appear in those files
+in @code{#if}, @code{#elif}, or @code{#ifdef} directives.  It prints
+each identifier on a line, followed by a space-separated list of the
+files in which that identifier occurs.
+
+@noindent
+@code{ifnames} accepts the following options:
+
+@table @code
+@item --help
+Print a summary of the command line options and exit.
+
+@item --macrodir=@var{dir}
+Look for the Autoconf macro files in directory @var{dir} instead of the
+default installation directory.  Only used to get the version number.
+
+@item --version
+Print the version number of @code{ifnames} and exit.
+@end table
+
+@node Invoking autoreconf, Invoking shindent, Invoking ifnames, Making configure Scripts
+@section Invoking autoreconf
+
+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.
+
+@noindent
+@code{autoreconf} accepts the following options:
+
+@table @code
+@item --help
+Print a summary of the command line options and exit.
+
+@item --macrodir=@var{dir}
+Look for the Autoconf macro files in directory @var{dir} instead of the
+default installation directory.
+
+@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}).
+
+@item --version
+Print the version number of @code{autoreconf} and exit.
+@end table
+
+@node Invoking shindent, , Invoking autoreconf, Making configure Scripts
+@section Invoking shindent
+
+Autoconf-generated @code{configure} scripts can be somewhat hard to
+read, because they @emph{look} machine-generated---mainly because they
+do not use whitespace rationally.  Unfortunately, it is impossible to do
+proper indentation using a macro processor like @code{m4}.  However, if
+you have GNU @code{bash} installed, you can use the @code{shindent}
+program, which uses @code{bash} to give a Bourne shell script readable
+indentation. 
+
+@code{shindent} indents each script named on the command line, backing
+up the original version using the original file name with @samp{~} appended.
+@code{shindent} places some restrictions on its input, due to the way it
+uses @code{bash} to do the indentation:
+
+@itemize @bullet
+@item
+It removes comments and blank lines between cases case statements.
+
+@item
+Doing odd things in case statements might cause odd problems.
+
+@item
+The script must not define any shell functions.
+
+@item
+If any string literals or here-documents contain lines that start
+with four spaces, those spaces will be removed.
+
+@item
+The script must not be @code{shindent} itself.
+@end itemize
+
+@noindent
+@code{shindent} accepts the following options:
+
+@table @code
+@item --help
+Print a summary of the command line options and exit.
+
+@item --macrodir=@var{dir}
+Look for the Autoconf macro files in directory @var{dir} instead of the
+default installation directory.  Only used to get the version number.
+
+@item --version
+Print the version number of @code{shindent} and exit.
+@end table
+
 @node Specific Tests, General Purpose Macros, Making configure Scripts, Top
 @chapter Specific Tests
 
@@ -538,9 +708,9 @@ GNU C compiler and @code{ioctl} does not work properly without
 
 @defmac AC_LN_S
 @maindex LN_S
-If @samp{ln -s} works on the current filesystem (the O.S. and filesystem
-support symbolic links), set shell and @code{make} variable @code{LN_S}
-to @samp{ln -s}, otherwise set it to @samp{ln}.
+If @samp{ln -s} works on the current filesystem (the operating system
+and filesystem support symbolic links), set shell and @code{make}
+variable @code{LN_S} to @samp{ln -s}, otherwise set it to @samp{ln}.
 @end defmac
 
 @defmac AC_MINUS_C_MINUS_O
@@ -648,13 +818,14 @@ to @samp{byacc}.  Otherwise set @code{YACC} to @samp{yacc}.
 
 @defmac AC_RSH
 @maindex RSH
+@vindex RSH
 @vindex NO_REMOTE
 @vindex HAVE_NETDB_H
-If a remote shell is available, put @samp{rtapelib.o} in @code{make}
-variable @code{RTAPELIB}.  Otherwise, also do so if @file{netdb.h}
-exists (implying the @code{rexec} function), and in addition define
-@code{HAVE_NETDB_H}.  If neither a remote shell nor @code{rexec} is
-available, define @code{NO_REMOTE}.
+If a remote shell is available, set @code{make} variable @code{RSH} to
+its pathname.  Otherwise, if @file{netdb.h} exists (implying the
+@code{rexec} function), define @code{HAVE_NETDB_H}.  If either is true,
+also put @samp{rtapelib.o} in @code{make} variable @code{RTAPELIB}.
+Otherwise, define @code{NO_REMOTE}.
 @end defmac
 
 @defmac AC_SET_MAKE
@@ -801,22 +972,30 @@ Then, in the code, use a test like this:
 #if !STDC_HEADERS && HAVE_MEMORY_H
 #include <memory.h>
 #endif /* not STDC_HEADERS and HAVE_MEMORY_H */
-#define index strchr
-#define rindex strrchr
-#define bcopy(s, d, n) memcpy ((d), (s), (n))
-#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
-#define bzero(s, n) memset ((s), 0, (n))
 #else /* not STDC_HEADERS and not HAVE_STRING_H */
 #include <strings.h>
 /* memory.h and strings.h conflict on some systems.  */
+#ifndef strchr
+#define strchr index
+#endif
+#ifndef strrchr
+#define strrchr rindex
+#endif
+#ifndef memcpy
+#define memcpy(d, s, n) bcopy ((s), (d), (n))
+#endif
+#ifndef memcmp
+#define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
+#endif
 #endif /* not STDC_HEADERS and not HAVE_STRING_H */
 @end group
 @end example
 
 @noindent
-This example asssumes that your code uses the BSD style functions.  If
-you use the System V/ANSI C style functions, you will need to replace
-the macro definitions with ones that go in the other direction.
+This example asssumes that your code uses the ANSI C/System V style
+functions.  If you use the BSD style functions, replace the macro
+definitions with ones that go in the other direction.  (Or, better,
+modernize your code.)
 
 This macro calls @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP} (depending
 on which language is current, @pxref{Language Choice}), if it hasn't
@@ -1198,9 +1377,10 @@ were an array of values.
 @maindex CROSS_CHECK
 If the C compiler being used does not produce executables that can run
 on the system where @code{configure} is being run, set the shell
-variable @code{cross_compiling} to 1.  This information can be used by
-@code{AC_TEST_RUN} to determine whether to take a default action
-instead of trying to run a test program (@pxref{C Features}).
+variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.
+This information can be used by @code{AC_TEST_RUN} to determine whether
+to take a default action instead of trying to run a test program
+(@pxref{C Features}).
 @end defmac
 
 @defmac AC_CHAR_UNSIGNED
@@ -1338,7 +1518,9 @@ by a signal, define @code{HAVE_RESTARTABLE_SYSCALLS}.
 
 The following macros check for certain operating systems that need
 special treatment for some programs, due to exceptional oddities in
-their header files or libraries:
+their header files or libraries.  These macros are kludges; they should
+be replaced someday with a more systematic approach, based either on the
+functions they make available or the environments they provide.
 
 @defmac AC_AIX
 @maindex AIX
@@ -1401,7 +1583,7 @@ directory reading functions.  This macro must be called after
 @code{AC_DIR_HEADER}.
 @end defmac
 
-@node General Purpose Macros, Writing Macros, Specific Tests, Top
+@node General Purpose Macros, Manual Configuration, Specific Tests, Top
 @chapter General Purpose Macros
 
 These macros provide ways for other macros to control the kind of output
@@ -1495,15 +1677,18 @@ You can use the program @code{autoheader} to create
 @defmac AC_CONFIG_SUBDIRS (@var{dir} @dots{})
 @maindex CONFIG_SUBDIRS
 Run @code{configure} in each subdirectory @var{dir} in the given
-whitespace-separated list If a given @var{dir} 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
+whitespace-separated list.  If a given @var{dir} 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 @file{configure}, the Cygnus @code{configure}
-script found by @code{AC_CONFIG_AUXDIR} is 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).
+script found by @code{AC_CONFIG_AUXDIR} is 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 shell and @code{make} 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.
 @end defmac
 
 @defmac AC_INIT (@var{unique-file-in-source-dir})
@@ -1607,10 +1792,10 @@ produces this in @file{configure}:
 
 These macros check whether particular files exist.
 
-@defmac AC_HAVE_LIBRARY (@var{library} @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]})
+@defmac AC_HAVE_LIBRARY (@var{library} @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found} @r{[}, @var{other-libraries}@r{]]]})
 @maindex HAVE_LIBRARY
 Create a test C program to see whether that program can be linked with
-the specified library.  @var{action-if-found} is a list of shell
+the library @var{library}.  @var{action-if-found} is a list of shell
 commands to run if the link succeeds (which means that the library is
 present); @var{action-if-not-found} is a list of shell commands to run
 if the link fails.  If @var{action-if-found} and
@@ -1619,6 +1804,13 @@ add @samp{-lfoo} to @code{LIBS} and define @samp{HAVE_LIBfoo}
 for library @samp{foo}.  @var{library} can be written as any of
 @samp{foo}, @samp{-lfoo}, or @samp{libfoo.a}.  In all of those cases,
 the compiler is passed @samp{-lfoo}.
+
+If linking with @var{library} results in unresolved symbols, which would
+be resolved by linking with additional libraries, give those libraries
+as the @var{other-libraries} argument, separated by spaces: @samp{-lX11
+-lXt}.  Otherwise this macro will fail to detect that @var{library} is
+present, because linking the test program will always fail with
+unresolved symbols.
 @end defmac
 
 @defmac AC_PREFIX (@var{program})
@@ -1666,6 +1858,13 @@ found.
 
 These macros check for features of the C compiler, libraries, and headers.
 
+@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}.
+@end defmac
+
 @defmac AC_COMPILE_CHECK (@var{echo-text}, @var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
 @maindex COMPILE_CHECK
 This is an obsolete alias for @code{AC_TEST_LINK}, with the addition that it
@@ -2007,7 +2206,6 @@ LIBS="$LIBS -ltermcap"
 @end example
 @end defmac
 
-@ignore
 @defmac AC_SUBST_FILE (@var{variable}, @var{file})
 @maindex SUBST_FILE
 Substitute the contents of the file @file{@var{srcdir}/@var{file}} into
@@ -2016,7 +2214,6 @@ Substitute the contents of the file @file{@var{srcdir}/@var{file}} into
 inserting @file{Makefile} fragments for particular host or tartet types
 into @file{Makefile}s.
 @end defmac
-@end ignore
 
 @node Printing Messages, Language Choice, Setting Variables, General Purpose Macros
 @section Printing Messages
@@ -2193,7 +2390,126 @@ is only called if it is needed, and only called once.
 @xref{Dependencies Between Macros}, for more information.
 @end defmac
 
-@node Writing Macros, Makefiles, General Purpose Macros, Top
+@node Manual Configuration, Writing Macros, General Purpose Macros, Top
+@chapter Manual Configuration
+
+Some kinds of features can't be guessed automatically by running test
+programs.  For example, how to allocate a pty, or the details of the
+object file format, or special options that need to be passed to the
+compiler or linker to provide a POSIX or ANSI C environment.  It is
+possible to check for such features using ad-hoc means, such as having
+@code{configure} check the output of the @code{uname} program, or
+looking for libraries that are unique to particular systems.  However,
+Autoconf provides a uniform method for handling unguessable features.
+
+Like other GNU @code{configure} scripts, Autoconf-generated
+@code{configure} scripts can make decisions based on a canonical name
+for the system type, which has the form:
+
+@example
+@var{cpu}-@var{company}-@var{system}
+@end example
+
+@code{configure} can usually guess the canonical name for the type of
+system it's running on.  To do so it runs a script called
+@code{config.guess}, which derives the name using the @code{uname}
+command or symbols predefined by the C preprocessor.
+
+Alternately, the user can specify the system type with command line
+arguments to @code{configure}.  Doing so is necessary when
+cross-compiling.  In the most complex case of cross-compiling, three
+system types are involved.  The options to specify them are:
+
+@table @code
+@item --build=@var{build-type}
+the type of system on which the package is being configured and
+compiled;
+
+@item --host=@var{host-type}
+the type of system on which the package will run;
+
+@item --target=@var{target-type}
+the type of system for which any compiler tools in the package will
+produce code.
+@end table
+
+@noindent
+If the user gives @code{configure} a non-option argument, it is used as
+the default for the host, target, and build system types if the user
+does not specify them explicitly with options.  The target and build
+types default to the host type if it is given and they are not.  Note
+that if you are cross-compiling, you still have to specify the names of
+the cross-tools you use, in particular the C compiler, on the
+@code{configure} and @code{make} command lines, e.g.,
+
+@example
+CC=m68k-coff-gcc configure --target=m68k-coff; CC=m68k-coff-gcc make
+@end example
+
+@code{configure} recognizes short aliases for many system types; for
+example, @samp{decstation} can be given on the command line instead of
+@samp{mips-dec-ultrix4.2}.  @code{configure} runs a script called
+@code{config.sub} to canonicalize system type aliases.
+
+@defmac AC_CANONICAL_SYSTEM
+@maindex CANONICAL_SYSTEM
+Set shell and @code{make} variables to the names of the canonical system
+types.  If the user did not specify one or more of those values on the
+command line, run @code{config.guess} to determine them.  Run
+@code{config.sub} to canonicalize any aliases the user gave.  If you use
+this macro, you must distribute those two shell scripts along with your
+source code (@pxref{Setup}, for information about the
+@code{AC_CONFIG_AUX_DIR} macro which you can use to control which
+directory @code{configure} looks for those scripts in).  If you do not
+run this macro, @code{configure} ignores any @samp{--host}, etc. options
+given to it.  The variables set are:
+
+@table @code
+@item @code{build}, @code{host}, @code{target}
+the canonical system names;
+
+@item @code{build_alias}, @code{host_alias}, @code{target_alias}
+the names the user specified, or the canonical names if
+@code{config.guess} was used;
+
+@item @code{build_cpu}, @code{build_vendor}, @code{build_os}
+@itemx @code{host_cpu}, @code{host_vendor}, @code{host_os}
+@itemx @code{target_cpu}, @code{target_vendor}, @code{target_os}
+the individual parts of the canonical names (for convenience).
+@end table
+@end defmac
+
+How do you use a canonical system type?  Usually, you use it in one or
+more @code{case} statements in @file{configure.in} to select
+system-specific C files.  Then link those files, which have names based
+on the system name, to generic names, such as @file{host.h} or
+@file{target.c}.  The @code{case} statement patterns can use shell
+wildcards to group several cases together, like in this fragment:
+
+@example
+case "$target" in
+i386-*-mach* | i386-*-gnu*) obj_format=aout emulation=mach bfd_gas=yes ;;
+i960-*-bout) obj_format=bout ;;
+esac
+@end example
+
+@defmac AC_LINK_FILES (@var{link} @dots{}, @var{file} @dots{})
+@maindex LINK_FILES
+Link each of the existing files @var{file} to the corresponding link
+name @var{link}.  Makes a symbolic link if possible, otherwise a hard
+link.  For example, this call:
+
+@example
+AC_LINK_FILES(config/sun3.h config/aout.h, host.h object.h)
+@end example
+
+@noindent
+creates in the current directory @file{host.h}, which is a link to
+@file{@var{srcdir}/config/sun3.h}, and @file{object.h}, which is a link
+to @file{@var{srcdir}/config/aout.h}.
+@end defmac
+
+@node Writing Macros, Caching Values, Manual Configuration, Top
 @chapter Writing Macros
 
 If your package needs to test for some feature that none of the macros
@@ -2266,7 +2582,8 @@ several times; each evaluation might require another layer of quotes to
 prevent unwanted expansions of macros or @code{m4} builtins, such as
 @samp{define} and @samp{$1}.  Quotes are also required around macro
 arguments that contain commas, since commas separate the arguments from
-each other.
+each other.  It's a good idea to quote any macro arguments that contain
+newlines or calls to other macros, as well.
 
 Autoconf (in @file{acgeneral.m4}) changes the @code{m4} quote characters
 from the default @samp{`} and @samp{'} to @samp{[} and @samp{]}, because
@@ -2547,7 +2864,143 @@ fi
 @end group
 @end example
 
-@node Makefiles, Invoking configure, Writing Macros, Top
+@node Caching Values, Makefiles, Writing Macros, Top
+@chapter Caching Values
+
+To avoid checking for the same features repeatedly in various
+@code{configure} scripts (or repeated runs of one script),
+@code{configure} saves the results of many of its checks in a @dfn{cache
+file}.  If, when a @code{configure} script runs, it finds a cache file,
+it reads from it the results from previous runs and avoids rerunning
+those checks.  As a result, @code{configure} can run much faster than if
+it had to perform all of the checks every time.
+
+The cache file is a shell script that caches the results of configure
+tests run on one system so they can be shared between configure scripts
+and configure runs.  It is not useful on other systems.  If its contents
+are invalid for some reason, the user may delete or edit it.
+
+By default, configure uses @file{./config.cache} as the cache file,
+creating it if it does not exist already.  @code{configure} accepts the
+@samp{--cache-file=@var{file}} option to use a different cache file;
+that is what @code{configure} does when it calls @code{configure}
+scripts in subdirectories, so they share the cache.  @xref{Setup}, for
+information on configuring subdirectories with the
+@code{AC_CONFIG_SUBDIRS} macro.  @file{config.status} only pays
+attention to the cache file if it is given the @samp{--recheck} option,
+which makes it rerun @code{configure}.
+
+It is wrong to try to distribute cache files for particular system types.
+There is too much room for error in doing that, and too much
+administrative overhead in maintaining them.  For any features that
+can't be guessed automatically, use the standard method of the canonical
+system type and linking files (@pxref{Manual Configuration}).
+
+The cache file on a particular system will gradually accumulate whenever
+someone runs a @code{configure} script; it will be initially
+nonexistent.  Running @code{configure} merges the new cache results with
+the existing cache file.  The site initialization script can specify a
+site-wide cache file to use instead of the default, to make it work
+transparently (@pxref{Site Default Values}).
+
+@defmac AC_CACHE_VAL (@var{cache-id}, @var{commands-to-set-it})
+@maindex CACHE_VAL
+Ensure that the results of the check identified by @var{cache-id} are
+available.  If the results of the check were in the cache file that was
+read, print a verbose message saying so; otherwise, run the shell
+commands @var{commands-to-set-it}.  Those commands should have no side
+effects except for setting the variable @var{cache-id}.  In particular,
+they should not call @code{AC_DEFINE}; the code that follows the call to
+@code{AC_CACHE_VAL} should do that, based on the cached value.  Also,
+they should not print any messages, for example with @code{AC_CHECKING};
+do that before calling @code{AC_CACHE_VAL}, so the messages are printed
+regardless of whether the results of the check are retrieved from the
+cache or determined by running the shell commands.  If the shell
+commands are run to determine the value, the value will be saved in the
+cache file just before @code{configure} creates its output files.
+
+@noindent
+The names of cache variables should have this format:
+
+@example
+@var{package-prefix}_cv_@var{value-type}_@var{specific-value}@r{[}_@var{additional-options}@r{]}
+@end example
+
+@noindent
+for example, @samp{ac_cv_header_stat_broken} or
+@samp{ac_cv_prog_gcc_traditional}.  The parts of the variable name are:
+
+@table @asis
+@item @var{package-prefix}
+An abbreviation for your package or organization; the same prefix you
+begin local Autoconf macros with, except lowercase by convention.
+For cache values used by the distributed Autoconf macros, this value is
+@samp{ac}. 
+
+@item @code{_cv_}
+Indicates that this shell variable is a cache value.
+
+@item @var{value-type}
+A convention for classifying cache values, to produce a rational naming
+system.  The values used in Autoconf are for the following classes of
+features; use them where applicable, otherwise invent your own categories:
+
+@table @code
+@item c
+C language
+
+@item func
+C functions
+
+@item group
+Unix groups
+
+@item header
+C header files
+
+@item lib
+C libraries
+
+@item path
+the absolute path names of programs
+
+@item prog
+the base names of programs
+
+@item struct
+C structures
+
+@item sys
+operating systems
+
+@item type
+C types
+
+@item var
+C variables in libraries
+
+@item x
+X Window System
+@end table
+
+@item @var{specific-value}
+Which member of the class of cache values this test applies to.
+For example, which function (@samp{alloca}), program (@samp{gcc}), or
+@code{make} variable (@samp{INSTALL}).
+
+@item @var{additional-options}
+Any particular behavior of the specific member that this test applies to.
+For example, @samp{broken} or @samp{set}.  This part of the name may
+be omitted if it does not apply.
+@end table
+
+Like their names, the values the may be assigned to cache variables have
+a few restrictions.  The values may not contain single quotes or curly braces.
+Usually, their values will be boolean (@samp{yes} or @samp{no}) or the
+names of files or functions; so this is not an important restriction.
+@end defmac
+
+@node Makefiles, Invoking configure, Caching Values, Top
 @chapter Makefiles
 
 Each subdirectory in a distribution should come with a file
@@ -2698,9 +3151,10 @@ stamp-h.in: configure.in aclocal.m4 acconfig.h config.h.top config.h.bot
         touch $@{srcdir@}/stamp-h.in
 
 # config.status might not change config.h
+# Don't rerun config.status if we just configured.
 config.h: stamp-h
 stamp-h: config.h.in config.status
-        ./config.status
+        test ! -f stamp-h || ./config.status
         touch stamp-h
 
 Makefile: Makefile.in config.status
@@ -2714,149 +3168,30 @@ config.status: configure
 @xref{Invoking config.status}, for more information on handling
 configuration-related dependencies.
 
-@node Invoking configure, Example, Makefiles, Top
+@node Invoking configure, Invoking config.status, Makefiles, Top
 @chapter Running @code{configure} Scripts
 
 A software package that uses a @code{configure} script
 should be distributed with a file @file{Makefile.in}, but no
 @file{Makefile}; that way, the user has to properly configure the
 package for the local system before compiling it.
-Here is how to configure a package that uses a @code{configure} script.
-
-Normally, you just @code{cd} to the directory containing the package's
-source code and type @samp{./configure}.  If you're using @code{csh} on
-an old version of System V, you might need to type @samp{sh configure}
-instead to prevent @code{csh} from trying to execute @code{configure}
-itself.
-
-Running @code{configure} takes awhile.  While it is running, it
-prints some messages that tell what it is doing.  If you don't want to
-see any messages, run @code{configure} with its standard output
-redirected to @file{/dev/null}; for example, @samp{./configure >/dev/null}.
-
-To compile the package in a different directory from the one containing
-the source code, you must use a version of @code{make} that supports the
-@code{VPATH} variable, such as GNU @code{make}.  @code{cd} to the
-directory where you want the object files and executables to go and run
-the @code{configure} script.  @code{configure} automatically checks for
-the source code in the directory that @code{configure} is in and in
-@file{..}.  If for some reason @code{configure} is not in the source
-code directory that you are configuring, then it will report that it
-can't find the source code.  In that case, run @code{configure} with the
-option @samp{--srcdir=@var{dir}}, where @var{dir} is the directory that
-contains the source code.
-
-By default, @samp{make install} will install the package's files in
-@file{/usr/local/bin}, @file{/usr/local/man}, etc.  You can specify an
-installation prefix other than @file{/usr/local} by giving
-@code{configure} the option @samp{--prefix=@var{path}}.  Alternately,
-you can do so by consistently giving a value for the @samp{prefix}
-variable when you run @code{make}, e.g.,
-@example
-make prefix=/usr/gnu
-make prefix=/usr/gnu install
-@end example
-
-You can specify separate installation prefixes for architecture-specific
-files and architecture-independent files.  If you give @code{configure}
-the option @samp{--exec-prefix=@var{path}} or set the @code{make}
-variable @samp{exec_prefix} to @var{path}, the package will use
-@var{path} as the prefix for installing programs and libraries.  Data
-files and documentation will still use the regular prefix.  Normally,
-all files are installed using the same prefix.
-
-Some packages pay attention to @samp{--with-@var{package}} options to
-@code{configure}, where @var{package} is something like @samp{gnu-as} or
-@samp{x} (for the X Window System).  They may also pay attention to
-@samp{--enable-@var{feature}} options, where @var{feature} indicates an
-optional part of the package.  The README should mention any
-@samp{--with-} and @samp{--enable-} options that the package recognizes.
-
-@code{configure} also recognizes the following options:
-
-@table @code
-@item --help
-Print a summary of the options to @code{configure}, and exit.
-
-@itemx --quiet
-@item --silent
-Do not print messages saying which checks are being made.
-
-@item --verbose
-Print the results of the checks.
-
-@item --version
-Print the version of Autoconf used to generate the @code{configure}
-script, and exit.
-
-@item --x-includes=@var{dir}
-X include files are in @var{dir}.
-
-@item --x-libraries=@var{dir}
-X library files are in @var{dir}.
-@end table
-
-@code{configure} also accepts and ignores some other options.
+Below are instructions on how to configure a package that uses a
+@code{configure} script, suitable for inclusion as an @file{INSTALL}
+file in the package.
 
 @menu
-* Overriding variables::        Workarounds for unusual systems.
-* Invoking config.status::      Recreating a configuration.
+* Basic Installation::          Instructions for typical cases.
+* Compilers and Options::       Selecting compilers and optimization.
+* Build Directory::             Configuring in a different directory.
+* Installation Directories::    Installing in different directories.
+* System Type::                 Specifying the system type.
+* Optional Features::           Selecting optional features.
 @end menu
 
-@node Overriding variables, Invoking config.status, , Invoking configure
-@section Overriding variables
-
-On systems that require unusual options for compilation or linking that
-the package's @code{configure} script does not know about, you can give
-@code{configure} initial values for variables by setting them in the
-environment.  In Bourne-compatible shells, you can do that on the
-command line like this:
-
-@example
-CC='gcc -traditional' LIBS=-lposix ./configure
-@end example
-
-@noindent
-On systems that have the @code{env} program, you can do it like this:
-
-@example
-env CC='gcc -traditional' LIBS=-lposix ./configure
-@end example
-
-Here are the @code{make} variables that you might want to override with
-environment variables when running @code{configure}.
-
-For these variables, any value given in the environment overrides the
-value that @code{configure} would choose:
-
-@defvar CC
-C compiler program.  The default is @code{cc}.
-@end defvar
-
-@defvar INSTALL
-Program to use to install files.  The default is @code{install} if you
-have it, @code{cp} otherwise.
-@end defvar
-
-For these variables, any value given in the environment is added to
-the value that @code{configure} chooses:
-
-@defvar DEFS
-Configuration options, in the form @samp{-Dfoo -Dbar@dots{}}.  Do not
-use this variable in packages that create a configuration header file.
-@end defvar
-
-@defvar LIBS
-Libraries to link with, in the form @samp{-lfoo -lbar@dots{}}.
-@end defvar
-
-In the long term, most problems requiring manual intervention should be
-fixed by updating either the Autoconf macros or the @file{configure.in}
-file for that package.  @xref{Making configure Scripts}, for a
-discussion of that subject.
+@include install.texi
 
-@node Invoking config.status, , Overriding variables, Invoking configure
-@section Recreating a Configuration
+@node Invoking config.status, Site Default Values, Invoking configure, Top
+@chapter Recreating a Configuration
 
 The @code{configure} script creates a file named @file{config.status}
 which describes which configuration options were specified when the
@@ -2934,7 +3269,44 @@ Makefile: Makefile.in config.status
 (If @file{configure.in} does not call @code{AC_CONFIG_HEADER}, there is
 no need to set @code{CONFIG_HEADERS} in the @code{make} rules.)
 
-@node Example, Preprocessor Symbol Index, Invoking configure, Top
+@node Site Default Values, Example, Invoking config.status, Top
+@chapter Site Default Values
+
+Autoconf-generated @code{configure} scripts support site and system wide
+initialization files.  You can create these files to provide default
+values for some configuration values, both on all of your systems and
+separately for each architecture.
+
+@code{configure} reads the shell script
+@file{@var{exec_prefix}/lib/config.site} if it exists, then
+@file{@var{prefix}/lib/config.site} if it exists.  Thus, settings in
+system dependent files override those in system independent ones in case
+of conflict.  @code{configure} reads any cache file after it has read
+any site files.  This way, the site file can define a default cache
+file, to be shared between all Autoconf-generated @code{configure}
+scripts run on that system.
+
+Site files can be arbitrary shell scripts, but only certain kinds of
+code are really appropriate to be in them.  Besides a cache file, they
+are good places to set default values for other shell variables like
+@code{CC}, if you need to give them unusual values: anything you would
+normally do, repetitively, on the command line.  If you use non-default
+values for @var{prefix} or @var{exec_prefix}, you can't set them in the
+site file, since you have to specify them on the command line in order
+for @code{configure} to find the site file!
+
+In addition, it is possible to set some cache values in the site file.
+If you are cross-compiling, it is impossible to check features that
+require running a test program.  You could ``prime the cache'' by
+setting those values correctly for that system in
+@file{@var{exec_prefix}/lib/config.site}.  The cache file is careful to
+not override any variables set in the site files.  Similarly, you should
+not override command-line options in the site files.  Your code should
+check that variables such as @code{prefix} and @code{cache_file} have
+their default values (as set near the top of @code{configure}) before
+changing them.
+
+@node Example, Preprocessor Symbol Index, Site Default Values, Top
 @chapter An Example
 
 Here are sample @file{configure.in} and @file{Makefile.in} files, to
index 6c3e5cfdf779a18e6a921ee87b1acbacf3133d46..429cef7b89c3d7143641a82b8c23cb74de4b30d4 100644 (file)
@@ -29,10 +29,10 @@ dnl
 ifdef([__gnu__], , [errprint(Autoconf requires GNU m4
 )m4exit(2)])dnl
 dnl
-define(AC_ACVERSION, 1.93)dnl
+define(AC_ACVERSION, 1.94)dnl
 dnl This is defined by the --version option of the autoconf script.
-ifdef([AC_PRINT_VERSION], [errprint(Autoconf version AC_ACVERSION
-)m4exit(0)])dnl
+ifdef([AC_PRINT_VERSION], [Autoconf version AC_ACVERSION
+m4exit(0)])dnl
 dnl
 dnl
 dnl ### Controlling Autoconf operation
@@ -71,7 +71,7 @@ define(AC_PARSEARGS,
 [AC_BEFORE([$0], [AC_ARG_ENABLE])dnl
 AC_BEFORE([$0], [AC_ARG_WITH])dnl
 # Save the original args to write them into config.status later.
-configure_args="[$]*"
+configure_args="[$]@"
 
 # Omit some internal, obsolete, or unimplemented options to make the
 # list less imposing.
@@ -124,6 +124,8 @@ verbose=
 x_includes=
 x_libraries=
 
+subdirs=
+
 ac_prev=
 for ac_option
 do
@@ -395,8 +397,9 @@ running configure, to aid debugging if configure makes a mistake.
 " 1>&6
 
 # Save the original args if we used an alternate arg parser.
-ac_configure_temp="${configure_args-[$]*}"
+ac_configure_temp="${configure_args-[$]@}"
 # Strip out --no-create and --norecursion so they do not pile up.
+# Also quote any args containing spaces.
 configure_args=
 for ac_arg in $ac_configure_temp; do
   case "$ac_arg" in
@@ -404,6 +407,9 @@ for ac_arg in $ac_configure_temp; do
   | --no-cr | --no-c) ;;
   -norecursion | --norecursion | --norecursio | --norecursi \
   | --norecurs | --norecur | --norecu | --norec | --nore | --nor) ;;
+changequote(,)dnl
+  *["  "]*) configure_args="$configure_args '$ac_arg'" ;;
+changequote([,])dnl
   *) configure_args="$configure_args $ac_arg" ;;
   esac
 done
@@ -448,6 +454,8 @@ if test ! -r $srcdir/$ac_unique_file; then
   fi
 fi
 
+ifdef([AC_LIST_SUBDIRS],[subdirs="AC_LIST_SUBDIRS"
+AC_SUBST(subdirs)])dnl
 ifdef([AC_LIST_PREFIX_PROGRAM], [AC_PREFIX(AC_LIST_PREFIX_PROGRAM)])dnl
 dnl Let the site file select an alternate cache file if it wants to.
 AC_SITE_LOAD
@@ -630,7 +638,7 @@ define(AC_CANONICAL_SYSTEM,
 #    as determined by config.guess.
 # 4. Target defaults to nonopt.
 # 5. If nonopt is not specified, then target defaults to host.
-# 6. build defaults to empty.
+# 6. build defaults to empty (but implicitly to host).
 
 # The aliases save the names the user supplied, while $host etc.
 # will get canonicalized.
@@ -675,6 +683,9 @@ host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
 test -n "$host" && AC_VERBOSE(setting host to $host)
 AC_SUBST(host)dnl
 AC_SUBST(host_alias)dnl
+AC_SUBST(host_cpu)dnl
+AC_SUBST(host_vendor)dnl
+AC_SUBST(host_os)dnl
 ])dnl
 dnl
 define(AC_CANONICAL_TARGET,
@@ -695,6 +706,9 @@ target_os=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
 test -n "$target" && AC_VERBOSE(setting target to $target)
 AC_SUBST(target)dnl
 AC_SUBST(target_alias)dnl
+AC_SUBST(target_cpu)dnl
+AC_SUBST(target_vendor)dnl
+AC_SUBST(target_os)dnl
 ])dnl
 dnl
 define(AC_CANONICAL_BUILD,
@@ -712,6 +726,9 @@ esac
 test -n "$build" && AC_VERBOSE(setting build to $build)
 AC_SUBST(build)dnl
 AC_SUBST(build_alias)dnl
+AC_SUBST(build_cpu)dnl
+AC_SUBST(build_vendor)dnl
+AC_SUBST(build_os)dnl
 ])dnl
 dnl
 dnl Link each of the existing files in $2 to the corresponding
@@ -772,7 +789,8 @@ cat > $cache_file <<\CEOF
 CEOF
 changequote(,)dnl
 dnl Allow a site initialization script to override cache values.
-set | sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1-'\2'}/p" >> $cache_file
+# Ultrix sh set writes to stderr and can't be redirected directly.
+(set) 2>&1 | sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1-'\2'}/p" >> $cache_file
 changequote([,])dnl
 fi])dnl
 dnl
@@ -781,7 +799,7 @@ dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved.
 define(AC_CACHE_VAL,
 [dnl We used to use the below line, but it fails if the 1st arg is a
 dnl shell variable, so we need the eval.
-dnl if test "${$1+set}" = set; then 
+dnl if test "${$1+set}" = set; then
 if eval "test \"`echo '${'$1'+set}'`\" = set"; then
 dnl This verbose message is just for testing the caching code.
   AC_VERBOSE(using cached value for $1)
@@ -891,6 +909,27 @@ $1='[$]$1'
 divert(AC_DIVERSION_NORMAL)dnl
 ])])dnl
 dnl
+dnl AC_SUBST_FILE(VARIABLE, FILE)
+define(AC_SUBST_FILE,
+[if test -f $2; then
+  AC_VERBOSE(using $2 for $1)
+  AC_INSERT_FILE($1, $2)
+elif test -f ${srcdir}/$2; then
+  AC_VERBOSE(using ${srcdir}/$2 for $1)
+  AC_INSERT_FILE($1, ${srcdir}/$2)
+fi
+])dnl
+define(AC_INSERT_FILE,
+[ifdef([AC_SUBST_$1], ,
+[define([AC_SUBST_$1], )dnl
+divert(AC_DIVERSION_SED)dnl
+/@$1@/r [$]$1
+s%@$1@%%g
+divert(AC_DIVERSION_VAR)dnl
+$1='$2'
+divert(AC_DIVERSION_NORMAL)dnl
+])])dnl
+dnl
 dnl
 dnl ### Printing messages
 dnl
@@ -1051,7 +1090,8 @@ done
 ifelse([$3],,, [test -n "[$]$1" || $1="$3"
 ])])dnl
 dnl
-dnl AC_HAVE_LIBRARY(LIBRARY [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl AC_HAVE_LIBRARY(LIBRARY [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
+dnl                 [, OTHER-LIBRARIES]]])
 define(AC_HAVE_LIBRARY, [dnl
 changequote(/,/)dnl
 define(/AC_LIB_NAME/, dnl
@@ -1061,23 +1101,21 @@ changequote([,])dnl
 AC_CHECKING([for -l[]AC_LIB_NAME])
 AC_CACHE_VAL(AC_CV_NAME,
 [ac_save_LIBS="${LIBS}"
-LIBS="${LIBS} -l[]AC_LIB_NAME[]"
-AC_TEST_LINK( , [main();],
-AC_CV_NAME=yes, AC_CV_NAME=no)dnl
+LIBS="${LIBS} -l[]AC_LIB_NAME[] $4"
+AC_TEST_LINK( , [main();], AC_CV_NAME=yes, AC_CV_NAME=no)dnl
 LIBS="${ac_save_LIBS}"
 ])dnl
 if test "${AC_CV_NAME}" = yes; then
-ifelse($#, 1, [dnl
-   AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z]))
-   LIBS="${LIBS} -l[]AC_LIB_NAME[]"
-undefine(AC_LIB_NAME)dnl
-undefine(AC_CV_NAME)dnl
-], [dnl
-   :; $2
-else
-   :; $3
+  ifelse([$2], , 
+[AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z]))
+  LIBS="${LIBS} -l[]AC_LIB_NAME[]"
+], [$2])
+ifelse([$3], , , [else
+  $3
 ])dnl
 fi
+undefine(AC_LIB_NAME)dnl
+undefine(AC_CV_NAME)dnl
 ])dnl
 dnl
 dnl
@@ -1133,7 +1171,9 @@ cat > conftest.${ac_ext} <<EOF
 #include "confdefs.h"
 [$1]
 int main() { return 0; }
-int t() { [$2]; return 0; }
+int t() {
+[$2]
+; return 0; }
 EOF
 if eval $ac_compile; then
   ifelse([$3], , :, [rm -rf conftest*
@@ -1274,8 +1314,8 @@ AC_SUBST(LIBOBJS)dnl
 ])dnl
 dnl
 dnl AC_SIZEOF_TYPE(TYPE)
-define(AC_SIZEOF_TYPE, [dnl
-changequote(<<,>>)dnl
+define(AC_SIZEOF_TYPE,
+[changequote(<<,>>)dnl
 dnl The name to #define.
 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
 dnl The cache variable name.
@@ -1296,6 +1336,16 @@ undefine(AC_TYPE_NAME)dnl
 undefine(AC_CV_NAME)dnl
 ])dnl
 dnl
+dnl AC_CHECK_TYPE(TYPE, DEFAULT)
+define(AC_CHECK_TYPE,
+[AC_CHECKING(for $1 in sys/types.h)
+AC_CACHE_VAL(ac_cv_type_$1,
+[AC_HEADER_EGREP($1, sys/types.h, ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
+if test $ac_cv_type_$1 = no; then
+  AC_DEFINE($1, $2)
+fi
+])dnl
+dnl
 dnl
 dnl ### The big finish
 dnl
@@ -1462,8 +1512,8 @@ dnl
 dnl Create the header files listed in $1.
 dnl This is a subroutine of AC_OUTPUT.  It is called inside a quoted
 dnl here document whose contents are going into config.status.
-define(AC_OUTPUT_HEADER,[dnl
-changequote(<<,>>)dnl
+define(AC_OUTPUT_HEADER,
+[changequote(<<,>>)dnl
 
 # These sed commands are put into ac_sed_defs when defining a macro.
 # They are broken into pieces to make the sed script easier to manage.
@@ -1595,7 +1645,7 @@ dnl
 define(AC_OUTPUT_SUBDIRS,
 [if test -z "${norecursion}"; then
 
-  # Remove --cache-file arguments so they do not pile up.
+  # Remove --cache-file and --srcdir arguments so they do not pile up.
   ac_sub_configure_args=
   ac_prev=
   for ac_arg in $configure_args; do
@@ -1610,6 +1660,13 @@ define(AC_OUTPUT_SUBDIRS,
     -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
     | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
       ;;
+    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+      ac_prev=srcdir ;;
+    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+      ;;
+changequote(,)dnl
+    *["        "]*) ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
+changequote([,])dnl
     *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
     esac
   done
@@ -1669,8 +1726,8 @@ changequote([,])dnl
 
     # The recursion is here.
     if test -n "${ac_sub_configure}"; then
-      AC_VERBOSE([running ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file])
-      if ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file
+      AC_VERBOSE([running ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file] --srcdir=${ac_sub_srcdir})
+      if ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file --srcdir=${ac_sub_srcdir}
       then :
       else
         AC_ERROR(${ac_sub_configure} failed for ${ac_config_dir})
index 3024af70850af674f5fa7ad2bb15b634bac85ab3..ac384226ea1438ac4ecd05cacd03b26f03d307bb 100644 (file)
@@ -41,7 +41,7 @@ if ${CC-cc} -E conftest.c 2>&6 | egrep yes >/dev/null 2>&1; then
 else
   ac_cv_prog_gcc=no
 fi])dnl
-if test "$ac_cv_prog_gcc" = yes; then GCC=yes; else GCC= ; fi
+if test $ac_cv_prog_gcc = yes; then GCC=yes; else GCC= ; fi
 ])dnl
 dnl
 define(AC_PROG_CXX,
@@ -61,13 +61,13 @@ if ${CXX-gcc} -E conftest.C 2>&6 | egrep yes >/dev/null 2>&1; then
 else
   ac_cv_prog_gxx=no
 fi])dnl
-if test "$ac_cv_prog_gxx" = yes; then GXX=yes; else GXX= ; fi
+if test $ac_cv_prog_gxx = yes; then GXX=yes; else GXX= ; fi
 ])dnl
 dnl
 define(AC_GCC_TRADITIONAL,
 [AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([AC_PROG_CPP])dnl
-if test "$ac_cv_prog_gcc" = yes; then
+if test $ac_cv_prog_gcc = yes; then
   AC_CHECKING(whether -traditional is needed)
 AC_CACHE_VAL(ac_cv_prog_gcc_traditional,
 [  ac_pattern="Autoconf.*'x'"
@@ -76,12 +76,12 @@ Autoconf TIOCGETP'
   AC_PROGRAM_EGREP($ac_pattern, $ac_prog,
   ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no)
 
-  if test "$ac_cv_prog_gcc_traditional" = no; then
+  if test $ac_cv_prog_gcc_traditional = no; then
     ac_prog='#include <termio.h>
 Autoconf TCGETA'
     AC_PROGRAM_EGREP($ac_pattern, $ac_prog, ac_cv_prog_gcc_traditional=yes)
   fi])dnl
-  if test "$ac_cv_prog_gcc_traditional" = yes; then
+  if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
     AC_VERBOSE(setting CC to $CC)
   fi
@@ -94,6 +94,9 @@ define(AC_MINUS_C_MINUS_O,
 else
   AC_CHECKING(whether cc understands -c and -o together)
 fi
+set dummy $CC; ac_cc=[$]2
+AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
+[ac_cv_prog_cc_${ac_cc}_c_o=no
 echo 'foo(){}' > conftest.c
 # Make sure it works both with $CC and with simple cc.
 # We do the test twice because some compilers refuse to overwrite an
@@ -108,22 +111,24 @@ then
       if cc -c conftest.c -o conftest2.o 1>&6 2>&6 &&
         test -f conftest2.o && cc -c conftest.c -o conftest2.o 1>&6 2>&6
       then
-        :
-      else
-        AC_DEFINE(NO_MINUS_C_MINUS_O)
+        ac_cv_prog_cc_${ac_cc}_c_o=yes
       fi
     fi
   fi
-else
-  AC_DEFINE(NO_MINUS_C_MINUS_O)
 fi
 rm -f conftest*
 ])dnl
+if test $ac_cv_prog_cc_${ac_cc}_c_o = no; then
+  AC_DEFINE(NO_MINUS_C_MINUS_O)
+fi
+])dnl
 dnl
 dnl Define SET_MAKE to set ${MAKE} if make doesn't.
 define(AC_SET_MAKE,
 [AC_CHECKING(whether ${MAKE-make} sets \$MAKE)
-cat > conftestmake <<'EOF'
+set dummy ${MAKE-make}; ac_make=[$]2
+AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
+[cat > conftestmake <<'EOF'
 all:
        @echo 'ac_maketemp="${MAKE}"'
 EOF
@@ -132,12 +137,17 @@ changequote(,)dnl
 eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
 changequote([,])dnl
 if test -n "$ac_maketemp"; then
+  ac_cv_prog_make_${ac_make}_set=yes
+else
+  ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake])dnl
+if test $ac_cv_prog_make_${ac_make}_set = yes; then
   SET_MAKE=
 else
   SET_MAKE="MAKE=${MAKE-make}"
   AC_VERBOSE(setting MAKE to ${MAKE-make} in Makefiles)
 fi
-rm -f conftestmake
 AC_SUBST([SET_MAKE])dnl
 ])dnl
 dnl
@@ -151,18 +161,20 @@ define(AC_PROG_CPP,
 [AC_PROVIDE([$0])dnl
 AC_CHECKING(how to run the C preprocessor)
 if test -z "$CPP"; then
-  # This must be in double quotes, not single quotes, because CPP may get
-  # substituted into the Makefile and "${CC-cc}" will simply confuse
-  # make.  It must be expanded now.
+AC_CACHE_VAL(ac_cv_prog_CPP,
+[  # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
   CPP="${CC-cc} -E"
-dnl On the NeXT, cc -E runs the code through the compiler's parser,
-dnl not just through cpp.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
   AC_TEST_CPP([#include <stdio.h>
 Syntax Error], ,
   CPP="${CC-cc} -E -traditional-cpp"
   AC_TEST_CPP([#include <stdio.h>
 Syntax Error], ,CPP=/lib/cpp))
+  ac_cv_prog_CPP="$CPP"])dnl
 fi
+CPP="$ac_cv_prog_CPP"
 AC_VERBOSE(setting CPP to $CPP)
 AC_SUBST(CPP)dnl
 ])dnl
@@ -170,14 +182,17 @@ dnl
 define(AC_PROG_CXXCPP,
 [AC_PROVIDE([$0])dnl
 AC_CHECKING(how to run the C++ preprocessor)
-AC_LANG_SAVE[]dnl
-AC_LANG_CPLUSPLUS[]dnl
 if test -z "$CXXCPP"; then
+AC_CACHE_VAL(ac_cv_prog_CXXCPP,
+[AC_LANG_SAVE[]dnl
+AC_LANG_CPLUSPLUS[]dnl
   CXXCPP="${CXX-c++} -E"
   AC_TEST_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
-fi
-AC_VERBOSE(setting CXXCPP to $CXXCPP)
+  ac_cv_prog_CXXCPP="$CXXCPP"
 AC_LANG_RESTORE[]dnl
+fi])dnl
+CXXCPP="$ac_cv_prog_CXXCPP"
+AC_VERBOSE(setting CXXCPP to $CXXCPP)
 AC_SUBST(CXXCPP)dnl
 ])dnl
 dnl
@@ -199,16 +214,18 @@ fi
 AC_VERBOSE(setting LEXLIB to $LEXLIB)
 AC_SUBST(LEXLIB)])dnl
 dnl
-define(AC_YYTEXT_POINTER,[dnl
-AC_REQUIRE_CPP()dnl
+define(AC_YYTEXT_POINTER,
+[AC_REQUIRE_CPP()dnl
 AC_REQUIRE([AC_PROG_LEX])dnl
 AC_CHECKING(for yytext declaration)
-# POSIX says lex can declare yytext either as a pointer or an array; the
+AC_CACHE_VALUE(ac_cv_prog_lex_yytext_pointer,
+[# POSIX says lex can declare yytext either as a pointer or an array; the
 # default is implementation-dependent. Figure out which it is, since
 # not all implementations provide the %pointer and %array declarations.
 #
 # The minimal lex program is just a single line: %%.  But some broken lexes
 # (Solaris, I think it was) want two %% lines, so accommodate them.
+ac_cv_prog_lex_yytext_pointer=no
   echo '%%
 %%' | ${LEX}
 if test -f lex.yy.c; then
@@ -216,17 +233,16 @@ if test -f lex.yy.c; then
 elif test -f lexyy.c; then
   LEX_OUTPUT_ROOT=lexyy
 else
-  # Do not know what to do here.
-  AC_ERROR(cannot find output from $LEX, giving up on yytext declaration)
-  LEX_OUTPUT_ROOT=
-fi
-if test -n "$LEX_OUTPUT_ROOT"; then
-  echo 'extern char *yytext; main () { exit (0); }' >>$LEX_OUTPUT_ROOT.c
-  ac_save_LIBS="$LIBS"
-  LIBS="$LIBS $LEXLIB"
-  AC_TEST_LINK(`cat $LEX_OUTPUT_ROOT.c`, AC_DEFINE(YYTEXT_POINTER))
-  LIBS="$ac_save_LIBS"
-  rm -f "${LEX_OUTPUT_ROOT}.c"
+  AC_ERROR(cannot find output from $LEX, giving up)
+fi
+echo 'extern char *yytext; main () { exit (0); }' >>$LEX_OUTPUT_ROOT.c
+ac_save_LIBS="$LIBS"
+LIBS="$LIBS $LEXLIB"
+AC_TEST_LINK(`cat $LEX_OUTPUT_ROOT.c`, ac_cv_prog_lex_yytext_pointer=yes)
+LIBS="$ac_save_LIBS"
+rm -f "${LEX_OUTPUT_ROOT}.c"])dnl
+if test $ac_cv_prog_lex_yytext_pointer = yes; then
+  AC_DEFINE(YYTEXT_POINTER)
 fi
 AC_SUBST(LEX_OUTPUT_ROOT)dnl
 ])dnl
@@ -258,7 +274,7 @@ AC_CACHE_VAL(ac_cv_path_install,
     ''|.|/etc|/sbin|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
     *)
       # OSF1 and SCO ODT 3.0 have their own names for install.
-      for ac_prog in installbsd scoinst install; do
+      for ac_prog in ginstall installbsd scoinst install; do
         if test -f $ac_dir/$ac_prog; then
          if test $ac_prog = install &&
             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
@@ -294,35 +310,47 @@ AC_VERBOSE(setting INSTALL_DATA to $INSTALL_DATA)
 ])dnl
 dnl
 define(AC_LN_S,
-[AC_CHECKING(for ln -s)
-rm -f conftestdata
+[AC_CHECKING(whether ln -s works)
+AC_CACHE_VAL(ac_cv_prog_LN_S,
+[rm -f conftestdata
 if ln -s X conftestdata 2>/dev/null
 then
   rm -f conftestdata
-  LN_S="ln -s"
+  ac_cv_prog_LN_S="ln -s"
+else
+  ac_cv_prog_LN_S=ln
+fi])dnl
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
   AC_VERBOSE(ln -s is supported)
 else
-  LN_S=ln
   AC_VERBOSE(ln -s is not supported)
 fi
-AC_SUBST(LN_S)
+AC_SUBST(LN_S)dnl
 ])dnl
 dnl
 define(AC_RSH,
 [AC_CHECKING(for remote shell)
+AC_CACHE_VAL(ac_cv_path_RSH,
+[ac_cv_path_RSH=true
 for ac_file in \
   /usr/ucb/rsh /usr/bin/remsh /usr/bin/rsh /usr/bsd/rsh /usr/bin/nsh
 do
   if test -f $ac_file; then
-    AC_VERBOSE(found remote shell $ac_file)
-    RTAPELIB=rtapelib.o
+    ac_cv_path_RSH=$ac_file
     break
   fi
-done
-if test -z "$RTAPELIB"; then
-  AC_HEADER_CHECK(netdb.h, AC_DEFINE(HAVE_NETDB_H) RTAPELIB=rtapelib.o,
-    AC_DEFINE(NO_REMOTE))
+done])dnl
+RSH="$ac_cv_path_RSH"
+if test $RSH != true; then
+  AC_VERBOSE(found remote shell $RSH)
+  RTAPELIB=rtapelib.o
+else
+  AC_VERBOSE(found no remote shell)
+  AC_HEADER_CHECK(netdb.h, RTAPELIB=rtapelib.o AC_DEFINE(HAVE_NETDB_H),
+    RTAPELIB= AC_DEFINE(NO_REMOTE))
 fi
+AC_SUBST(RSH)dnl
 AC_SUBST(RTAPELIB)dnl
 ])dnl
 dnl
@@ -333,22 +361,23 @@ dnl
 define(AC_STDC_HEADERS,
 [AC_REQUIRE_CPP()dnl
 AC_CHECKING(for ANSI C header files)
-AC_TEST_CPP([#include <stdlib.h>
+AC_CACHE_VAL(ac_cv_header_stdc,
+[AC_TEST_CPP([#include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
-#include <float.h>], ac_stdc_hdrs=yes, ac_stdc_hdrs=no)
+#include <float.h>], ac_cv_header_stdc=yes, ac_cv_header_stdc=no)
 
-if test "$ac_stdc_hdrs" = yes; then
+if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-AC_HEADER_EGREP(memchr, string.h, , ac_stdc_hdrs=no)
+AC_HEADER_EGREP(memchr, string.h, , ac_cv_header_stdc=no)
 fi
 
-if test "$ac_stdc_hdrs" = yes; then
+if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-AC_HEADER_EGREP(free, stdlib.h, , ac_stdc_hdrs=no)
+AC_HEADER_EGREP(free, stdlib.h, , ac_cv_header_stdc=no)
 fi
 
-if test "$ac_stdc_hdrs" = yes; then
+if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
 AC_TEST_RUN([#include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -358,20 +387,21 @@ int main () { int i; for (i = 0; i < 256; i++)
 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 ], , ac_stdc_headers=no)
-fi
-
-if test "$ac_stdc_hdrs" = yes; then
+fi])dnl
+if test $ac_cv_header_stdc = yes; then
   AC_DEFINE(STDC_HEADERS)
 fi])dnl
 dnl
-define(AC_UNISTD_H, [AC_OBSOLETE([$0], [; instead use AC_HAVE_HEADERS(unistd.h)])AC_HEADER_CHECK(unistd.h,
-  AC_DEFINE(HAVE_UNISTD_H))])dnl
+define(AC_UNISTD_H,
+[AC_OBSOLETE([$0], [; instead use AC_HAVE_HEADERS(unistd.h)])dnl
+AC_HEADER_CHECK(unistd.h, AC_DEFINE(HAVE_UNISTD_H))])dnl
 dnl
 define(AC_USG,
 [AC_OBSOLETE([$0],
   [; instead use AC_HAVE_HEADERS(string.h) and HAVE_STRING_H])dnl
 AC_CHECKING([for BSD string and memory functions])
-AC_TEST_LINK([#include <strings.h>], [rindex(0, 0); bzero(0, 0);], , AC_DEFINE(USG))])dnl
+AC_TEST_LINK([#include <strings.h>], [rindex(0, 0); bzero(0, 0);], ,
+  AC_DEFINE(USG))])dnl
 dnl
 dnl
 dnl If memchr and the like aren't declared in <string.h>, include <memory.h>.
@@ -384,46 +414,53 @@ AC_HEADER_EGREP(memchr, string.h, ,
 dnl
 define(AC_MAJOR_HEADER,
 [AC_CHECKING([for major, minor and makedev header])
-AC_TEST_LINK([#include <sys/types.h>],
-[return makedev(0, 0);], ac_have_makedev=yes, ac_have_makedev=no)
-if test "$ac_have_makedev" = no; then
-AC_HEADER_CHECK(sys/mkdev.h, AC_DEFINE(MAJOR_IN_MKDEV) ac_have_makedev=yes)
-fi
-if test "$ac_have_makedev" = no; then
-AC_HEADER_CHECK(sys/sysmacros.h, AC_DEFINE(MAJOR_IN_SYSMACROS))
-fi]
-)dnl
+AC_CACHE_VAL(ac_cv_header_major,
+[AC_TEST_LINK([#include <sys/types.h>],
+[return makedev(0, 0);], ac_cv_header_major=sys/types.h, ac_cv_header_major=no)
+if test $ac_cv_header_major = no; then
+AC_HEADER_CHECK(sys/mkdev.h, ac_cv_header_major=sys/mkdev.h)
+fi
+if test $ac_cv_header_major = no; then
+AC_HEADER_CHECK(sys/sysmacros.h, ac_cv_header_major=sys/sysmacros.h)
+fi])dnl
+case "$ac_cv_header_major" in
+sys/mkdev.h) AC_DEFINE(MAJOR_IN_MKDEV) ;;
+sys/sysmacros.h) AC_DEFINE(MAJOR_IN_SYSMACROS) ;;
+esac
+])dnl
 dnl
 define(AC_DIR_HEADER,
 [AC_PROVIDE([$0])dnl
 AC_CHECKING(for directory library header)
-ac_dir_header=
-AC_DIR_HEADER_CHECK(dirent.h, DIRENT)
-AC_DIR_HEADER_CHECK(sys/ndir.h, SYSNDIR)
-AC_DIR_HEADER_CHECK(sys/dir.h, SYSDIR)
-AC_DIR_HEADER_CHECK(ndir.h, NDIR)
+AC_CACHE_VAL(ac_cv_header_dir,
+[ac_cv_header_dir=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+  AC_CHECKING([for $ac_hdr])
+AC_TEST_LINK([#include <sys/types.h>
+#include <$ac_hdr>], [DIR *dirp = 0;], ac_cv_header_dir=$ac_hdr; break)
+done])dnl
+case "$ac_cv_header_dir" in
+dirent.h) AC_DEFINE(DIRENT) ;;
+sys/ndir.h) AC_DEFINE(SYSNDIR) ;;
+sys/dir.h) AC_DEFINE(SYSDIR) ;;
+ndir.h) AC_DEFINE(NDIR) ;;
+esac
 
 AC_CHECKING(for closedir return value)
-AC_TEST_RUN([#include <sys/types.h>
-#include <$ac_dir_header>
-int closedir(); main() { exit(closedir(opendir(".")) != 0); }], ,
-AC_DEFINE(VOID_CLOSEDIR))
+AC_CACHE_VAL(ac_cv_func_closedir_void,
+[AC_TEST_RUN([#include <sys/types.h>
+#include <$ac_cv_header_dir>
+int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
+  ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes)])dnl
+if test $ac_cv_func_closedir_void = yes; then
+  AC_DEFINE(VOID_CLOSEDIR)
+fi
 ])dnl
-dnl Subroutine of AC_DIR_HEADER.
-dnl Check if $1 is the winning directory library header file.
-dnl It must not only exist, but also correctly define the `DIR' type.
-dnl If it is really winning, define $2 and set shell var `ac_dir_header' to $1.
-define(AC_DIR_HEADER_CHECK, [dnl
-if test -z "$ac_dir_header"; then
-  AC_CHECKING([for $1])
-  AC_TEST_LINK([#include <sys/types.h>
-#include <]$1[>],
-                  [DIR *dirp = 0;],
-                  AC_DEFINE($2) ac_dir_header=$1)dnl
-fi])dnl
 dnl
-define(AC_STAT_MACROS_BROKEN,[AC_CHECKING(for broken stat file mode macros)
-AC_PROGRAM_EGREP([You lose], [#include <sys/types.h>
+define(AC_STAT_MACROS_BROKEN,
+[AC_CHECKING(for broken stat file mode macros)
+AC_CACHE_VAL(ac_cv_header_stat_broken,
+[AC_PROGRAM_EGREP([You lose], [#include <sys/types.h>
 #include <sys/stat.h>
 #ifdef S_ISBLK
 #if S_ISBLK (S_IFDIR)
@@ -445,16 +482,26 @@ You lose.
 You lose.
 #endif
 #endif /* S_ISSOCK */
-], AC_DEFINE(STAT_MACROS_BROKEN))])dnl
+], ac_cv_header_stat_broken=yes, ac_cv_header_stat_broken=no)])dnl
+if test $ac_cv_header_stat_broken = yes; then
+  AC_DEFINE(STAT_MACROS_BROKEN)
+fi
+])dnl
 dnl
-define(AC_SYS_SIGLIST_DECLARED,[dnl
-AC_CHECKING([for sys_siglist declaration in signal.h or unistd.h])
-AC_TEST_LINK([#include <signal.h>
+define(AC_SYS_SIGLIST_DECLARED,
+[AC_CHECKING([for sys_siglist declaration in signal.h or unistd.h])
+AC_CACHE_VAL(ac_cv_decl_sys_siglist,
+[AC_TEST_LINK([#include <sys/types.h>
+#include <signal.h>
 /* NetBSD declares sys_siglist in unistd.h.  */
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif], [char *msg = *(sys_siglist + 1);],
-                AC_DEFINE(SYS_SIGLIST_DECLARED))])dnl
+  ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)])dnl
+if test $ac_cv_decl_sys_siglist = yes; then
+  AC_DEFINE(SYS_SIGLIST_DECLARED)
+fi
+])dnl
 dnl
 dnl
 dnl ### Checks for typedefs
@@ -463,8 +510,9 @@ dnl
 define(AC_GETGROUPS_T,
 [AC_REQUIRE([AC_UID_T])dnl
 AC_CHECKING(for type of array argument to getgroups)
-changequote(,)dnl
-dnl Do not put single quotes in the C program text!!
+AC_CACHE_VAL(ac_cv_type_getgroups,
+[changequote(,)dnl
+dnl Do not put single quotes in the C program text!
 ac_prog='/* Thanks to Mike Rendell for this test.  */
 #include <sys/types.h>
 #define NGID 256
@@ -487,55 +535,55 @@ main()
 }'
 changequote([,])dnl
 AC_TEST_RUN([$ac_prog],
-               AC_DEFINE(GETGROUPS_T, gid_t), AC_DEFINE(GETGROUPS_T, int))
+  ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int)])dnl
+AC_DEFINE(GETGROUPS_T, $ac_cv_type_getgroups)
 ])dnl
 dnl
 define(AC_UID_T,
 [AC_PROVIDE([$0])dnl
 AC_CHECKING(for uid_t in sys/types.h)
-AC_HEADER_EGREP(uid_t, sys/types.h, ,
-  AC_DEFINE(uid_t, int) AC_DEFINE(gid_t, int))])dnl
+AC_CACHE_VAL(ac_cv_type_uid_t,
+[AC_HEADER_EGREP(uid_t, sys/types.h,
+  ac_cv_type_uid_t=yes, ac_cv_type_uid_t=no)])dnl
+if test $ac_cv_type_uid_t = no; then
+  AC_DEFINE(uid_t, int)
+  AC_DEFINE(gid_t, int)
+fi
+])dnl
 dnl
-define(AC_SIZE_T,
-[AC_CHECKING(for size_t in sys/types.h)
-AC_HEADER_EGREP(size_t, sys/types.h, , AC_DEFINE(size_t, unsigned))])dnl
+define(AC_SIZE_T, [AC_CHECK_TYPE(size_t, unsigned)])dnl
 dnl
-define(AC_PID_T,
-[AC_PROVIDE([$0])dnl
-AC_CHECKING(for pid_t in sys/types.h)
-AC_HEADER_EGREP(pid_t, sys/types.h, , AC_DEFINE(pid_t, int))])dnl
+define(AC_PID_T, [AC_CHECK_TYPE(pid_t, int)])dnl
 dnl
 define(AC_OFF_T,
 [AC_PROVIDE([$0])dnl
-AC_CHECKING(for off_t in sys/types.h)
-AC_HEADER_EGREP(off_t, sys/types.h, , AC_DEFINE(off_t, long))])dnl
+AC_CHECK_TYPE(off_t, long)])dnl
 dnl
-define(AC_MODE_T,
-[AC_CHECKING(for mode_t in sys/types.h)
-AC_HEADER_EGREP(mode_t, sys/types.h, , AC_DEFINE(mode_t, int))])dnl
+define(AC_MODE_T, [AC_CHECK_TYPE(mode_t, int)])dnl
 dnl
 dnl Note that identifiers starting with SIG are reserved by ANSI C.
 define(AC_RETSIGTYPE,
 [AC_PROVIDE([$0])dnl
 AC_CHECKING([return type of signal handlers])
-AC_TEST_LINK([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_type_signal,
+[AC_TEST_LINK([#include <sys/types.h>
 #include <signal.h>
 #ifdef signal
 #undef signal
 #endif
 extern void (*signal ()) ();],
-[int i;],
-[AC_DEFINE(RETSIGTYPE, void)],
-[AC_DEFINE(RETSIGTYPE, int)])]
-)dnl
+[int i;], ac_cv_type_signal=void, ac_cv_type_signal=int)])dnl
+AC_DEFINE(RETSIGTYPE, $ac_cv_type_signal)
+])dnl
 dnl
 dnl
 dnl ### Checks for functions
 dnl
 dnl
-define(AC_MMAP, [
-AC_CHECKING(for working mmap)
-AC_TEST_RUN([/* Thanks to Mike Haertel and Jim Avera for this test. */
+define(AC_MMAP,
+[AC_CHECKING(for working mmap)
+AC_CACHE_VAL(ac_cv_func_mmap,
+[AC_TEST_RUN([/* Thanks to Mike Haertel and Jim Avera for this test. */
 #include <sys/types.h>
 #include <fcntl.h>
 #include <sys/mman.h>
@@ -601,7 +649,10 @@ main()
       exit(1);
   exit(0);
 }
-], AC_DEFINE(HAVE_MMAP))
+], ac_cv_func_mmap=yes, ac_cv_func_mmap=no)])dnl
+if test $ac_cv_func_mmap = yes; then
+  AC_DEFINE(HAVE_MMAP)
+fi
 ])dnl
 dnl
 define(AC_VPRINTF,
@@ -615,7 +666,8 @@ define(AC_VFORK,
 [AC_REQUIRE([AC_PID_T])dnl
 AC_HEADER_CHECK(vfork.h, AC_DEFINE(HAVE_VFORK_H))
 AC_CHECKING(for working vfork)
-AC_REQUIRE([AC_RETSIGTYPE])
+AC_CACHE_VAL(ac_cv_func_vfork,
+[AC_REQUIRE([AC_RETSIGTYPE])
 AC_TEST_RUN([/* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
 #include <sys/types.h>
@@ -627,22 +679,41 @@ AC_TEST_RUN([/* Thanks to Paul Eggert for this test.  */
 #ifdef HAVE_VFORK_H
 #include <vfork.h>
 #endif
+/* On sparc systems, changes by the child to local and incoming
+   argument registers are propagated back to the parent.
+   The compiler is told about this with #include <vfork.h>,
+   but some compilers (e.g. gcc -O) don't grok <vfork.h>.
+   Test for this by using a static variable whose address
+   is put into a register that is clobbered by the vfork.  */
+static
+sparc_address_test (arg) int arg; {
+  static pid_t child;
+  if (!child) {
+    child = vfork ();
+    if (child < 0)
+      perror ("vfork");
+    if (!child) {
+      arg = getpid();
+      write(-1, "", 0);
+      _exit (arg);
+    }
+  }
+}
 static int signalled;
 static RETSIGTYPE catch (s) int s; { signalled = 1; }
 main() {
   pid_t parent = getpid ();
   pid_t child;
 
+  sparc_address_test ();
+
   signal (SIGINT, catch);
 
   child = vfork ();
 
   if (child == 0) {
-    /* On sparc systems, changes by the child to local and incoming
-       argument registers are propagated back to the parent.
-       The compiler is told about this with #include <vfork.h>,
-       but some compilers (e.g. gcc -O) don't grok <vfork.h>.
-       Test for this by using lots of local variables, at least
+    /* Here is another test for sparc vfork register problems.
+       This test uses lots of local variables, at least
        as many local variables as main has allocated so far
        including compiler temporaries.  4 locals are enough for
        gcc 1.40.3 on a sparc, but we use 8 to be safe.
@@ -696,12 +767,16 @@ main() {
         || fstat(fileno(stdout), &st) != 0
         );
   }
-}], , AC_DEFINE(vfork, fork))
+}], ac_cv_func_vfork=yes, ac_cv_func_vfork=no)])dnl
+if test $ac_cv_func_vfork = no; then
+  AC_DEFINE(vfork, fork)
+fi
 ])dnl
 dnl
 define(AC_WAIT3,
 [AC_CHECKING(for wait3 that fills in rusage)
-AC_TEST_RUN([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_func_wait3,
+[AC_TEST_RUN([#include <sys/types.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <stdio.h>
@@ -727,17 +802,26 @@ main() {
     exit(r.ru_nvcsw == 0
         && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0);
   }
-}], AC_DEFINE(HAVE_WAIT3))
+}], ac_cv_func_wait3=yes, ac_cv_func_wait3=no)])dnl
+if test $ac_cv_func_wait3 = yes; then
+  AC_DEFINE(HAVE_WAIT3)
+fi
 ])dnl
 dnl
 define(AC_ALLOCA,
 [# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 AC_CHECKING([for working alloca.h])
-AC_TEST_LINK([#include <alloca.h>],
-  [char *p = alloca(2 * sizeof(int));], AC_DEFINE(HAVE_ALLOCA_H))
+AC_CACHE_VAL(ac_cv_header_alloca_h,
+[AC_TEST_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));],
+  ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)])dnl
+if test $ac_cv_header_alloca_h = yes; then
+  AC_DEFINE(HAVE_ALLOCA_H)
+fi
 
-ac_decl="#ifdef __GNUC__
+AC_CHECKING([for alloca])
+AC_CACHE_VAL(ac_cv_func_alloca,
+[AC_TEST_LINK([#ifdef __GNUC__
 #define alloca __builtin_alloca
 #else
 #if HAVE_ALLOCA_H
@@ -752,13 +836,13 @@ char *alloca ();
 #endif
 #endif
 #endif
-"
-AC_CHECKING([for alloca])
-AC_TEST_LINK($ac_decl,
-[char *p = (char *) alloca(1);],
-[ac_have_alloca=yes AC_DEFINE([HAVE_ALLOCA])], ac_have_alloca=no)
+], [char *p = (char *) alloca(1);],
+  ac_cv_func_alloca=yes, ac_cv_func_alloca=no)])dnl
+if test $ac_cv_func_alloca = yes; then
+  AC_DEFINE(HAVE_ALLOCA)
+fi
 
-if test "$ac_have_alloca" = no; then
+if test $ac_cv_func_alloca = no; then
   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
   # that cause trouble.  Some versions do not even contain alloca or
   # contain a buggy version.  If you still want to use their alloca,
@@ -774,12 +858,13 @@ webecray
 wenotbecray
 #endif
 ],
-AC_FUNC_CHECK([_getb67],AC_DEFINE([CRAY_STACKSEG_END],[_getb67]),
-AC_FUNC_CHECK([GETB67],AC_DEFINE([CRAY_STACKSEG_END],[GETB67]),
-AC_FUNC_CHECK([getb67],AC_DEFINE([CRAY_STACKSEG_END],[getb67])))))
+AC_FUNC_CHECK([_getb67],AC_DEFINE(CRAY_STACKSEG_END, _getb67),
+AC_FUNC_CHECK([GETB67],AC_DEFINE(CRAY_STACKSEG_END, GETB67),
+AC_FUNC_CHECK([getb67],AC_DEFINE(CRAY_STACKSEG_END, getb67)))))
 
 AC_CHECKING(stack direction for C alloca)
-AC_TEST_RUN([find_stack_direction ()
+AC_CACHE_VAL(ac_cv_c_stack_direction,
+[AC_TEST_RUN([find_stack_direction ()
 {
   static char *addr = 0;
   auto char dummy;
@@ -794,99 +879,112 @@ AC_TEST_RUN([find_stack_direction ()
 main ()
 {
   exit (find_stack_direction() < 0);
-}],
-AC_DEFINE(STACK_DIRECTION,1), AC_DEFINE(STACK_DIRECTION,-1),
-AC_DEFINE(STACK_DIRECTION,0))
+}], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
+  ac_cv_c_stack_direction=0)])dnl
+AC_DEFINE(STACK_DIRECTION, $ac_cv_c_stack_direction)
 fi
 AC_SUBST(ALLOCA)dnl
 ])dnl
 dnl
 define(AC_GETLOADAVG,
 [# Some definitions of getloadavg require that the program be installed setgid.
-AC_SUBST(NEED_SETGID)NEED_SETGID=false
-ac_need_func=yes
+NEED_SETGID=false
+AC_SUBST(NEED_SETGID)dnl
+ac_have_func=no
 
 # Check for the 4.4BSD definition of getloadavg.
-AC_HAVE_LIBRARY(util, LIBS="$LIBS -lutil" ac_need_func=no)
+AC_HAVE_LIBRARY(util, [LIBS="$LIBS -lutil" ac_have_func=yes
 # Some systems with -lutil have (and need) -lkvm as well, some do not.
-AC_HAVE_LIBRARY(kvm, LIBS="$LIBS -lkvm")
+AC_HAVE_LIBRARY(kvm, LIBS="$LIBS -lkvm")])
 
-if test "$ac_need_func" = yes; then
+if test $ac_have_func = no; then
 # There is a commonly available library for RS/6000 AIX.
 # Since it is not a standard part of AIX, it might be installed locally.
-ac_save_LIBS="$LIBS"
-LIBS="-L/usr/local/lib $LIBS"
-AC_HAVE_LIBRARY(getloadavg, LIBS="$LIBS -lgetloadavg" ac_need_func=no,
-       LIBS="$ac_save_LIBS")
+ac_save_LIBS="$LIBS" LIBS="-L/usr/local/lib $LIBS"
+AC_HAVE_LIBRARY(getloadavg, LIBS="$LIBS -lgetloadavg", LIBS="$ac_save_LIBS")
 fi
 
-# Make sure it is really in the library, if we think we found it at all.
+# Make sure it is really in the library, if we think we found it.
 AC_REPLACE_FUNCS(getloadavg)
 
-case "$LIBOBJS" in
-*getloadavg*)
-ac_need_func=yes
-AC_HEADER_CHECK(sys/dg_sys_info.h, [dnl
-AC_DEFINE(DGUX) ac_need_func=no
+if test $ac_cv_func_getloadavg = yes; then
+  AC_DEFINE(HAVE_GETLOADAVG)
+else
+ac_have_func=no
+AC_HEADER_CHECK(sys/dg_sys_info.h,
+[ac_have_func=yes AC_DEFINE(DGUX)
 # Some versions of DGUX need -ldgc for dg_sys_info.
 AC_HAVE_LIBRARY(dgc)])
-if test "$ac_need_func" = yes; then
+if test $ac_have_func = no; then
 # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
 # uses stabs), but it is still SVR4.  We cannot check for <elf.h> because
 # Irix 4.0.5F has the header but not the library.
-AC_HAVE_LIBRARY(elf, AC_DEFINE(SVR4) LIBS="$LIBS -lelf" ac_need_func=no
-  AC_HAVE_LIBRARY(kvm, LIBS="$LIBS -lkvm"))
+AC_HAVE_LIBRARY(elf,
+  [LIBS="$LIBS -lelf" ac_have_func=yes AC_DEFINE(SVR4)
+  AC_HAVE_LIBRARY(kvm, LIBS="$LIBS -lkvm")])
 fi
-if test "$ac_need_func" = yes; then
-AC_HEADER_CHECK(inq_stats/cpustats.h, AC_DEFINE(UMAX4_3) AC_DEFINE(UMAX)
-  ac_need_func=no)
+if test $ac_have_func = no; then
+AC_HEADER_CHECK(inq_stats/cpustats.h,
+  [ac_have_func=yes AC_DEFINE(UMAX4_3) AC_DEFINE(UMAX)])
 fi
-if test "$ac_need_func" = yes; then
-AC_HEADER_CHECK(sys/cpustats.h, AC_DEFINE(UMAX) ac_need_func=no)
+if test $ac_have_func = no; then
+AC_HEADER_CHECK(sys/cpustats.h,
+  [ac_have_func=yes AC_DEFINE(UMAX)])
 fi
-if test "$ac_need_func" = yes; then
+if test $ac_have_func = no; then
 AC_HAVE_HEADERS(mach/mach.h)
 fi
 
 AC_HEADER_CHECK(nlist.h,
 [AC_DEFINE(NLIST_STRUCT)
 AC_CHECKING([for n_un in struct nlist])
-AC_TEST_LINK([#include <nlist.h>],
+AC_CACHE_VAL(ac_cv_struct_nlist_n_un,
+[AC_TEST_LINK([#include <nlist.h>],
 [struct nlist n; n.n_un.n_name = 0;],
-AC_DEFINE(NLIST_NAME_UNION))])dnl
+ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])dnl
+if test $ac_cv_struct_nlist_n_un = yes; then
+  AC_DEFINE(NLIST_NAME_UNION)
+fi
+])dnl
 
-# Figure out whether we will need to install setgid.
-AC_PROGRAM_EGREP([Yowza Am I SETGID yet], [dnl
-#include "${srcdir}/getloadavg.c"
+AC_CHECKING(whether getloadavg requires setgid)
+AC_CACHE_VAL(ac_cv_func_getloadavg_setgid,
+[AC_PROGRAM_EGREP([Yowza Am I SETGID yet],
+[#include "${srcdir}/getloadavg.c"
 #ifdef LDAV_PRIVILEGED
 Yowza Am I SETGID yet
-#endif], [AC_DEFINE(GETLOADAVG_PRIVILEGED) NEED_SETGID=true])dnl
-;;
+#endif],
+  ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])dnl
+if test $ac_cv_func_getloadavg_setgid = yes; then
+  NEED_SETGID=true AC_DEFINE(GETLOADAVG_PRIVILEGED)
+fi
 
-*) AC_DEFINE(HAVE_GETLOADAVG) ;;
-esac
+fi # Do not have getloadavg in system libraries.
 
 if test "$NEED_SETGID" = true; then
-AC_SUBST(KMEM_GROUP)dnl
-  # Figure out what group owns /dev/kmem.
-  # The installed program will need to be setgid and owned by that group.
-changequote(,)dnl
+  AC_CHECKING(group of /dev/kmem)
+AC_CACHE_VAL(ac_cv_group_kmem,
+[changequote(,)dnl
   # On Solaris, /dev/kmem is a symlink.  Get info on the real file.
   ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
   # If we got an error (system does not support symlinks), try without -L.
   test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
-  KMEM_GROUP=`echo $ac_ls_output \
+  ac_cv_group_kmem=`echo $ac_ls_output \
     | sed -ne 's/[     ][      ]*/ /g;
               s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\)  *.*/\1/;
               / /s/.* //;p;'`
 changequote([,])dnl
+])dnl
+  KMEM_GROUP=$ac_cv_group_kmem
   AC_VERBOSE(/dev/kmem is owned by $KMEM_GROUP)
 fi
+AC_SUBST(KMEM_GROUP)dnl
 ])dnl
 dnl
 define(AC_UTIME_NULL,
 [AC_CHECKING(utime with null argument)
-rm -f conftestdata; > conftestdata
+AC_CACHE_VAL(ac_cv_func_utime_null,
+[rm -f conftestdata; > conftestdata
 # Sequent interprets utime(file, 0) to mean use start of epoch.  Wrong.
 AC_TEST_RUN([#include <sys/types.h>
 #include <sys/stat.h>
@@ -895,22 +993,32 @@ struct stat s, t;
 exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0
 && stat("conftestdata", &t) == 0 && t.st_mtime >= s.st_mtime
 && t.st_mtime - s.st_mtime < 120));
-}], AC_DEFINE(HAVE_UTIME_NULL))
-rm -f core
+}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no)
+rm -f core])dnl
+if test $ac_cv_func_utime_null = yes; then
+  AC_DEFINE(HAVE_UTIME_NULL)
+fi
 ])dnl
 dnl
-define(AC_STRCOLL, [AC_CHECKING(for strcoll)
-AC_TEST_RUN([#include <string.h>
+define(AC_STRCOLL,
+[AC_CHECKING(for strcoll)
+AC_CACHE_VAL(ac_cv_func_strcoll,
+[AC_TEST_RUN([#include <string.h>
 main ()
 {
   exit (strcoll ("abc", "def") >= 0 ||
        strcoll ("ABC", "DEF") >= 0 ||
        strcoll ("123", "456") >= 0);
-}], AC_DEFINE(HAVE_STRCOLL))])dnl
+}], ac_cv_func_strcoll=yes, ac_cv_func_strcoll=no)])dnl
+if test $ac_cv_func_strcoll = yes; then
+  AC_DEFINE(HAVE_STRCOLL)
+fi
+])dnl
 dnl
 define(AC_SETVBUF_REVERSED,
 [AC_CHECKING(whether setvbuf arguments are reversed)
-AC_TEST_RUN([#include <stdio.h>
+AC_CACHE_VAL(ac_cv_func_setvbuf_reversed,
+[AC_TEST_RUN([#include <stdio.h>
 /* If setvbuf has the reversed format, exit 0. */
 main () {
   /* This call has the arguments reversed.
@@ -920,8 +1028,11 @@ main () {
     exit(1);
   putc('\r', stdout);
   exit(0);                     /* Non-reversed systems segv here.  */
-}], AC_DEFINE(SETVBUF_REVERSED))
-rm -f core
+}], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no)
+rm -f core])dnl
+if test $ac_cv_func_setvbuf_reversed = yes; then
+  AC_DEFINE(SETVBUF_REVERSED)
+fi
 ])dnl
 dnl
 dnl
@@ -931,64 +1042,87 @@ dnl
 define(AC_STRUCT_TM,
 [AC_PROVIDE([$0])dnl
 AC_CHECKING([for struct tm in sys/time.h instead of time.h])
-AC_TEST_LINK([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_struct_tm,
+[AC_TEST_LINK([#include <sys/types.h>
 #include <time.h>],
-[struct tm *tp; tp->tm_sec;], , AC_DEFINE(TM_IN_SYS_TIME))])dnl
+[struct tm *tp; tp->tm_sec;],
+  ac_cv_struct_tm=time.h, ac_cv_struct_tm=sys/time.h)])dnl
+if test $ac_cv_struct_tm = sys/time.h; then
+  AC_DEFINE(TM_IN_SYS_TIME)
+fi
+])dnl
 dnl
 define(AC_TIME_WITH_SYS_TIME,
 [AC_CHECKING([whether time.h and sys/time.h may both be included])
-AC_TEST_LINK([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_header_time,
+[AC_TEST_LINK([#include <sys/types.h>
 #include <sys/time.h>
 #include <time.h>],
-[struct tm *tp;], AC_DEFINE(TIME_WITH_SYS_TIME))])dnl
+[struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)])dnl
+if test $ac_cv_header_time = yes; then
+  AC_DEFINE(TIME_WITH_SYS_TIME)
+fi
+])dnl
 dnl
 define(AC_TIMEZONE,
 [AC_REQUIRE([AC_STRUCT_TM])dnl
-ac_decl='#include <sys/types.h>
-'
-case "$DEFS" in
-  *TM_IN_SYS_TIME*) ac_decl="$ac_decl
-#include <sys/time.h>
-" ;;
-  *) ac_decl="$ac_decl
-#include <time.h>
-" ;;
-esac
 AC_CHECKING([for tm_zone in struct tm])
-AC_TEST_LINK($ac_decl,
-[struct tm tm; tm.tm_zone;],
-[ac_have_tm_zone=yes AC_DEFINE(HAVE_TM_ZONE)], ac_have_tm_zone=no)
-
-if test "$ac_have_tm_zone" = no; then
-AC_CHECKING([for tzname])
-AC_TEST_LINK(changequote(<<,>>)dnl
+AC_CACHE_VAL(ac_cv_struct_tm_zone,
+[AC_TEST_LINK([#include <sys/types.h>
+#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
+  ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])dnl
+if test "$ac_cv_struct_tm_zone" = yes; then
+  AC_DEFINE(HAVE_TM_ZONE)
+else
+  AC_CHECKING([for tzname])
+AC_CACHE_VAL(ac_cv_var_tzname,
+[AC_TEST_LINK(changequote(<<,>>)dnl
 <<#include <time.h>
 #ifndef tzname /* For SGI.  */
 extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
 #endif>>, changequote([,])dnl
-[atoi(*tzname);], AC_DEFINE(HAVE_TZNAME))
+[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])dnl
+  if test $ac_cv_var_tzname = yes; then
+    AC_DEFINE(HAVE_TZNAME)
+  fi
 fi
 ])dnl
 dnl
 define(AC_ST_BLOCKS,
 [AC_CHECKING([for st_blocks in struct stat])
-AC_TEST_LINK([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_struct_st_blocks,
+[AC_TEST_LINK([#include <sys/types.h>
 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
-AC_DEFINE(HAVE_ST_BLOCKS), LIBOBJS="$LIBOBJS fileblocks.o")dnl
+ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])dnl
+if test $ac_cv_struct_st_blocks = yes; then
+  AC_DEFINE(HAVE_ST_BLOCKS)
+else
+  LIBOBJS="$LIBOBJS fileblocks.o"
+fi
 AC_SUBST(LIBOBJS)dnl
 ])dnl
 dnl
 define(AC_ST_BLKSIZE,
 [AC_CHECKING([for st_blksize in struct stat])
-AC_TEST_LINK([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_struct_st_blksize,
+[AC_TEST_LINK([#include <sys/types.h>
 #include <sys/stat.h>], [struct stat s; s.st_blksize;],
-AC_DEFINE(HAVE_ST_BLKSIZE))])dnl
+ac_cv_struct_st_blksize=yes, ac_cv_struct_st_blksize=no)])dnl
+if test $ac_cv_struct_st_blksize = yes; then
+  AC_DEFINE(HAVE_ST_BLKSIZE)
+fi
+])dnl
 dnl
 define(AC_ST_RDEV,
 [AC_CHECKING([for st_rdev in struct stat])
-AC_TEST_LINK([#include <sys/types.h>
+AC_CACHE_VAL(ac_cv_struct_st_rdev,
+[AC_TEST_LINK([#include <sys/types.h>
 #include <sys/stat.h>], [struct stat s; s.st_rdev;],
-AC_DEFINE(HAVE_ST_RDEV))])dnl
+ac_cv_struct_st_rdev=yes, ac_cv_struct_st_rdev=no)])dnl
+if test $ac_cv_struct_st_rdev = yes; then
+  AC_DEFINE(HAVE_ST_RDEV)
+fi
+])dnl
 dnl
 dnl
 dnl ### Checks for compiler characteristics
@@ -996,16 +1130,21 @@ dnl
 dnl
 define(AC_CROSS_CHECK,
 [AC_PROVIDE([$0])dnl
-AC_CHECKING(whether cross-compiling)
 # If we cannot run a trivial program, we must be cross compiling.
-AC_TEST_RUN([main(){exit(0);}], cross_compiling=, cross_compiling=yes)
-if test "$cross_compiling" = yes; then
+AC_CHECKING(whether cross-compiling)
+AC_CACHE_VAL(ac_cv_c_cross,
+[AC_TEST_RUN([main(){exit(0);}], ac_cv_c_cross=no, ac_cv_c_cross=yes)])dnl
+cross_compiling=$ac_cv_c_cross
+if test $ac_cv_c_cross = yes; then
   AC_VERBOSE(we are cross-compiling)
+else
+  AC_VERBOSE(we are not cross-compiling)
 fi])dnl
 dnl
 define(AC_CHAR_UNSIGNED,
 [AC_CHECKING(for unsigned characters)
-AC_TEST_RUN(
+AC_CACHE_VAL(ac_cv_c_char_unsigned,
+[AC_TEST_RUN(
 [/* volatile prevents gcc2 from optimizing the test away on sparcs.  */
 #if !__STDC__
 #define volatile
@@ -1016,21 +1155,28 @@ main() {
 #else
   volatile char c = 255; exit(c < 0);
 #endif
-}], AC_DEFINE(__CHAR_UNSIGNED__))]
-)dnl
+}], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no)])dnl
+if test $ac_cv_c_char_unsigned = yes; then
+  AC_DEFINE(__CHAR_UNSIGNED__)
+fi
+])dnl
 dnl
 define(AC_LONG_DOUBLE,
 [AC_REQUIRE([AC_PROG_CC])dnl
 AC_CHECKING(for long double)
-if test "$GCC" = yes; then
-AC_DEFINE(HAVE_LONG_DOUBLE)
+AC_CACHE_VAL(ac_cv_c_long_double,
+[if test "$GCC" = yes; then
+  ac_cv_c_long_double=yes
 else
 AC_TEST_RUN([int main() {
 /* The Stardent Vistra knows sizeof(long double), but does not support it.  */
 long double foo = 0.0;
 /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
 exit(sizeof(long double) < sizeof(double)); }],
-AC_DEFINE(HAVE_LONG_DOUBLE))
+ac_cv_c_long_double=yes, ac_cv_c_long_double=no)
+fi])dnl
+if test $ac_cv_c_long_double = yes; then
+  AC_DEFINE(HAVE_LONG_DOUBLE)
 fi
 ])dnl
 dnl
@@ -1050,7 +1196,8 @@ AC_TEST_RUN([main() { exit(sizeof(long int) != 8); }],
 dnl
 define(AC_WORDS_BIGENDIAN,
 [AC_CHECKING(byte ordering)
-AC_TEST_RUN([main () {
+AC_CACHE_VAL(ac_cv_c_bigendian,
+[AC_TEST_RUN([main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
   union
   {
@@ -1059,12 +1206,16 @@ AC_TEST_RUN([main () {
   } u;
   u.l = 1;
   exit (u.c[sizeof (long) - 1] == 1);
-}], , AC_DEFINE(WORDS_BIGENDIAN))
+}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes)])dnl
+if test $ac_cv_c_bigendian = yes; then
+  AC_DEFINE(WORDS_BIGENDIAN)
+fi
 ])dnl
 dnl
 define(AC_ARG_ARRAY,
 [AC_CHECKING(whether the address of an argument can be used as an array)
-AC_TEST_RUN([main() {
+AC_CACHE_VAL(ac_cv_c_arg_array,
+[AC_TEST_RUN([main() {
 /* Return 0 iff arg arrays are ok.  */
 exit(!x(1, 2, 3, 4));
 }
@@ -1074,20 +1225,32 @@ x(a, b, c, d) {
 /* Return 1 iff arg arrays are ok.  */
 y(a, b) int *b; {
   return a == 1 && b[0] == 2 && b[1] == 3 && b[2] == 4;
-}], , AC_DEFINE(NO_ARG_ARRAY))
-rm -f core
+}], ac_cv_c_arg_array=no, ac_cv_c_arg_array=yes)
+rm -f core])dnl
+if test $ac_cv_c_arg_array = no; then
+  AC_DEFINE(NO_ARG_ARRAY)
+fi
 ])dnl
 dnl
 define(AC_INLINE,
 [AC_REQUIRE([AC_PROG_CC])dnl
-if test "$GCC" = yes; then
 AC_CHECKING([for inline])
-AC_TEST_LINK( , [} inline foo() {], , AC_DEFINE(inline, __inline))
+AC_CACHE_VAL(ac_cv_c_inline,
+[if test "$GCC" = yes; then
+AC_TEST_LINK( , [} inline foo() {], ac_cv_c_inline=yes, ac_cv_c_inline=no)
+else
+  ac_cv_c_inline=no
+fi])dnl
+if test $ac_cv_c_inline = no; then
+  AC_DEFINE(inline, __inline)
 fi
 ])dnl
 define(AC_CONST,
+[dnl Do not "break" this again.
+AC_CHECKING([for lack of working const])
+AC_CACHE_VAL(ac_cv_c_const,
 [changequote(,)dnl
-dnl Do not put single quotes in the C program text!!
+dnl Do not put single quotes in the C program text!
 ac_prog='/* Ultrix mips cc rejects this.  */
 typedef int charset[2]; const charset x;
 /* SunOS 4.1.1 cc rejects this.  */
@@ -1127,42 +1290,56 @@ ccp = (char const *const *) p;
   const int foo = 10;
 }'
 changequote([,])dnl
-dnl Do not "break" this again.
-AC_CHECKING([for lack of working const])
-AC_TEST_LINK( , [$ac_prog], , AC_DEFINE(const,))])dnl
+AC_TEST_LINK( , [$ac_prog], ac_cv_c_const=yes, ac_cv_c_const=no)])dnl
+if test $ac_cv_c_const = no; then
+  AC_DEFINE(const,)
+fi
+])dnl
 dnl
 dnl
 dnl ### Checks for operating system services
 dnl
 dnl
-define(AC_HAVE_POUNDBANG, [dnl
-AC_CHECKING(whether [#]! works in shell scripts)
-echo '#!/bin/cat
+define(AC_HAVE_POUNDBANG,
+[AC_CHECKING(whether [#]! works in shell scripts)
+AC_CACHE_VAL(ac_cv_sys_interpreter,
+[echo '#!/bin/cat
 exit 69
 ' > conftest
 chmod u+x conftest
 (SHELL=/bin/sh; export SHELL; ./conftest > /dev/null)
 if test $? -ne 69; then
-   :; $1
+   ac_cv_sys_interpreter=yes
 else
-   :; $2
+   ac_cv_sys_interpreter=no
+fi
+rm -f conftest])dnl
+if test $ac_cv_sys_interpreter = yes; then
+  ifelse([$1], , :, [$1])
+ifelse([$2], , , [else
+  $2
+])dnl
 fi
-rm -f conftest
 ])dnl
 define(AC_REMOTE_TAPE,
 [AC_CHECKING(for remote tape and socket header files)
-AC_HEADER_CHECK(sys/mtio.h,
-[ac_have_mtio_h=yes AC_DEFINE(HAVE_SYS_MTIO_H)], ac_have_mtio_h=no)
+AC_HEADER_CHECK(sys/mtio.h, AC_DEFINE(HAVE_SYS_MTIO_H))
 
-if test "$ac_have_mtio_h" = yes; then
-AC_TEST_CPP([#include <sgtty.h>
-#include <sys/socket.h>], PROGS="$PROGS rmt")
+if test "$ac_cv_header_mtio_h" = yes; then
+AC_CACHE_VAL(ac_cv_header_rmt,
+[AC_TEST_CPP([#include <sgtty.h>
+#include <sys/socket.h>], ac_cv_header_rmt=yes, ac_cv_header_rmt=no)])dnl
+ if test $ac_cv_header_rmt = yes; then
+    PROGS="$PROGS rmt"
+  fi
 fi
+AC_SUBST(PROGS)dnl
 ])dnl
 dnl
 define(AC_LONG_FILE_NAMES,
 [AC_CHECKING(for long file names)
-ac_some_dir_failed=no
+AC_CACHE_VAL(ac_cv_sys_long_file_names,
+[ac_cv_sys_long_file_names=yes
 # Test for long file names in all the places we know might matter:
 #      .               the current directory, where building will happen
 #      /tmp            where it might want to write temporary files
@@ -1177,15 +1354,22 @@ for ac_dir in `eval echo . /tmp /var/tmp /usr/tmp $prefix/lib $exec_prefix/lib`
   (echo 1 > $ac_dir/conftest9012345) 2>/dev/null
   (echo 2 > $ac_dir/conftest9012346) 2>/dev/null
   val=`cat $ac_dir/conftest9012345 2>/dev/null`
-  test -f $ac_dir/conftest9012345 && test "$val" = 1 || ac_some_dir_failed=yes
+  if test ! -f $ac_dir/conftest9012345 || test "$val" != 1; then
+    ac_cv_sys_long_file_names=no
+    rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2> /dev/null
+    break
+  fi
   rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2> /dev/null
-done
-test "$ac_some_dir_failed" = yes || AC_DEFINE(HAVE_LONG_FILE_NAMES)
+done])dnl
+if test $ac_cv_sys_long_file_names = yes; then
+  AC_DEFINE(HAVE_LONG_FILE_NAMES)
+fi
 ])dnl
 dnl
 define(AC_RESTARTABLE_SYSCALLS,
 [AC_CHECKING(for restartable system calls)
-AC_TEST_RUN(
+AC_CACHE_VAL(ac_cv_sys_restartable_syscalls,
+[AC_TEST_RUN(
 [/* Exit 0 (true) if wait returns something other than -1,
    i.e. the pid of the child, which means that wait was restarted
    after getting the signal.  */
@@ -1200,7 +1384,10 @@ main () {
   if (status == -1) wait(&i);
   exit (status == -1);
 }
-], AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS))
+], ac_cv_sys_restartable_syscalls=yes, ac_cv_sys_restartable_syscalls=no)])dnl
+if test $ac_cv_sys_restartable_syscalls = yes; then
+  AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS)
+fi
 ])dnl
 dnl
 define(AC_FIND_X,
@@ -1209,13 +1396,36 @@ AC_PROVIDE([$0])dnl
 # If we find X, set shell vars x_includes and x_libraries to the paths.
 no_x=yes
 if test "x$with_x" != xno; then
+
+# Command line options override cache.
+# FIXME We need to allow --x=includes= to work, I think.
+test -n "$x_includes" && ac_cv_x_includes="$x_includes"
+test -n "$x_libraries" && ac_cv_x_includes="$x_libraries"
+if test "${ac_cv_x_includes+set}" = set &&
+  test "${ac_cv_x_libraries+set}" = set; then
+  AC_VERBOSE(using cached values for ac_cv_x_includes and ac_cv_x_libraries)
+else
 AC_FIND_X_XMKMF
-if test -z "$ac_im_usrlibdir"; then
+fi
+if test "${ac_cv_x_includes+set}" != set ||
+  test "${ac_cv_x_libraries+set}" != set; then
 AC_FIND_X_DIRECT
 fi
+test -z "$ac_cv_x_includes" && ac_cv_x_includes=NONE
+test -z "$ac_cv_x_libraries" && ac_cv_x_libraries=NONE
+
+# FIXME can we reliably distinguish cache values that are set to empty
+# from those that aren't set?
+if test -z "$x_includes" && test "$ac_cv_x_includes" != NONE; then
+  x_includes="$ac_cv_x_includes"
+fi
+if test -z "$x_libraries" && test "$ac_cv_x_libraries" != NONE; then
+  x_libraries="$ac_cv_x_libraries"
+fi
+
 test -n "$x_includes" && AC_VERBOSE(X11 headers are in $x_includes)
 test -n "$x_libraries" && AC_VERBOSE(X11 libraries are in $x_libraries)
-fi
+fi # No --with-x=no.
 ])dnl
 dnl
 dnl Internal subroutine of AC_FIND_X.
@@ -1240,11 +1450,11 @@ EOF
     fi
     case "$ac_im_incroot" in
        /usr/include) ;;
-       *) test -z "$x_includes" && x_includes="$ac_im_incroot" ;;
+       *) test -z "$ac_cv_x_includes" && ac_cv_x_includes="$ac_im_incroot" ;;
     esac
     case "$ac_im_usrlibdir" in
        /usr/lib | /lib) ;;
-       *) test -z "$x_libraries" && x_libraries="$ac_im_usrlibdir" ;;
+       *) test -z "$ac_cv_x_libraries" && ac_cv_x_libraries="$ac_im_usrlibdir" ;;
     esac
   fi
   cd ..
@@ -1255,12 +1465,8 @@ dnl
 dnl Internal subroutine of AC_FIND_X.
 define(AC_FIND_X_DIRECT,
 [AC_CHECKING(for X include and library files directly)
-if test ".$x_direct_test_library" = . ; then
-   x_direct_test_library='Xt'
-fi
-if test ".$x_direct_test_include" = . ; then
-   x_direct_test_include='X11/Intrinsic.h'
-fi
+test -z "$x_direct_test_library" && x_direct_test_library=Xt
+test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
 AC_TEST_CPP([#include <$x_direct_test_include>], no_x=,
   for ac_dir in               \
     /usr/X11R6/include        \
@@ -1300,7 +1506,7 @@ AC_TEST_CPP([#include <$x_direct_test_include>], no_x=,
     ; \
   do
     if test -r "$ac_dir/$x_direct_test_include"; then
-      test -z "$x_includes" && x_includes=$ac_dir
+      test -z "$ac_cv_x_includes" && ac_cv_x_includes=$ac_dir
       no_x=
       break
     fi
@@ -1309,7 +1515,7 @@ AC_TEST_CPP([#include <$x_direct_test_include>], no_x=,
 # Check for the libraries.  First see if replacing the include by
 # lib works.
 AC_HAVE_LIBRARY("$x_direct_test_library", no_x=,
-for ac_dir in `echo "$x_includes" | sed s/include/lib/` \
+for ac_dir in `echo "$ac_cv_x_includes" | sed s/include/lib/` \
     /usr/X11R6/lib        \
     /usr/X11R5/lib        \
     /usr/X11R4/lib        \
@@ -1348,7 +1554,7 @@ for ac_dir in `echo "$x_includes" | sed s/include/lib/` \
 do
   for ac_extension in a so sl; do
     if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
-      test -z "$x_libraries" && x_libraries=$ac_dir
+      test -z "$ac_cv_x_libraries" && ac_cv_x_libraries=$ac_dir
       no_x=
       break 2
     fi