]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
many bug fixes and a few additions, mostly derived from bug-gnu-utils
authorDavid MacKenzie <djm@djmnet.org>
Sat, 9 Nov 1996 22:19:24 +0000 (22:19 +0000)
committerDavid MacKenzie <djm@djmnet.org>
Sat, 9 Nov 1996 22:19:24 +0000 (22:19 +0000)
18 files changed:
ChangeLog
INSTALL
NEWS
TODO
acconfig.h
acgeneral.m4
acspecific.m4
autoconf.texi
autoheader.in
autoheader.sh
bin/autoheader.in
configure
doc/autoconf.texi
doc/install.texi
install.texi
lib/autoconf/general.m4
lib/autoconf/specific.m4
testsuite/autoconf.g/sizeof.exp [moved from testsuite/autoconf.g/sizeof_type.exp with 100% similarity]

index dc495d7de88c71d1ab4a5090890f34fd04d42175..669b7f3c3f046a25d8321112feadc88cd83c91db 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,58 @@
 Sat Nov  9 01:54:04 1996  David J MacKenzie  <djm@catapult.va.pubnix.com>
 
+       * Test release 2.10.1.
+
+       * acspecific.m4 (AC_PROG_CC_WORKS, AC_PROG_CXX_WORKS): New macros
+       adapted from Jim Meyering and automake.
+       (AC_PROG_CC, AC_PROG_CXX): Use them.
+       * acgeneral.m4 (AC_TRY_RUN_NATIVE): Split out of AC_TRY_RUN.
+       (AC_TRY_LINK): Check that the executable exists after linking.
+       (AC_EGREP_CPP): Disable m4 quote chars around egrep, so [] in regexps
+       isn't eaten.
+
+       * autoheader.sh: Add multiple-inclusion protection for config.h.
+       
+       * acgeneral.m4 (AC_PREFIX_PROGRAM): Pretty up the output.
+       (AC_CHECK_LIB): Include the function being tested in the message.
+       (AC_CHECK_PROG, AC_PATH_PROG): Add a dummy variable to force word
+       splitting on the path.
+
+       * acspecific.m4 (AC_FUNC_MMAP): Remove check and uses of valloc.
+       It turns out it's a separate issue, for GNU grep.
+       Replace the test program with a new version from Mike Haertel.
+
+       * acgeneral.m4 (AC_CACHE_SAVE): Accept the HP-UX sh 'set' output
+       format.  From Marcus Daniels <marcus@sysc.pdx.edu>.
+       
+       * acgeneral.m4 (AC_MSG_CHECKING, AC_CHECKING): Write a message to
+       config.log also.  From "T.E.Dickey" <dickey@clark.net>.
+       (AC_CHECK_LIB, AC_CHECK_HEADER, AC_CHECK_HEADERS): Replace use of
+       tr with sed, to avoid a bug in the AIX 4.1.3.0 tr reported by
+       Alain KNAFF <Alain.Knaff@imag.fr>.  He says that version of
+       tr interprets \055 magically like an unquoted -.
+       * acspecific.m4 (AC_PROG_MAKE_SET, AC_CHECK_HEADER_DIRENT,
+       AC_CHECK_HEADERS_DIRENT): Ditto.
+       
+       * acspecific.m4 (AC_FUNC_SETPGRP): New macro.
+        * acconfig.h (SETPGRP_VOID): New entry.
+       From "T.E.Dickey" <dickey@clark.net>.
+
         * acspecific.m4 (AC_PATH_X_DIRECT): Try /lib/usr/lib/X11 for A/UX.
         From Guillermo Gomez <gomez@mi.uni-erlangen.de>.
-       (AC_PATH_XTRA): Replace -R with LD_RUN_PATH in the
-       Solaris kludge.  From Paul Eggert <eggert@twinsun.com>.
-
+       (AC_PATH_XTRA): Replace -R with adding LD_RUN_PATH to CC in the
+       Solaris kludge.  Suggested by Paul Eggert <eggert@twinsun.com>.
+       Define X_DISPLAY_MISSING with AC_DEFINE, and
+       if not using X, clear out the X variables.
+       Check system-dependent libs before system-independent ones.
+       Check for more system-dependent libs.
+       From Karl Berry.
+       Use AC_CHECK_FUNC in the system-dependent libs tests.
+       From Larry Schwimmer <rosebud@cyclone.stanford.edu>.
+       Wart removal: Don't require AC_ISC_POSIX.
+       (AC_ISC_POSIX): Don't blather about being called before AC_TRY_LINK,
+       which is now called in AC_PROG_CC.  Don't encourage using this macro.
+        * acconfig.h (X_DISPLAY_MISSING): Add entry.
+       
 Fri Nov  8 16:02:08 1996  David J MacKenzie  <djm@catapult.va.pubnix.com>
 
        * acspecific.m4 (AC_PATH_X_DIRECT): Search for /usr/X11 before
@@ -12,6 +60,7 @@ Fri Nov  8 16:02:08 1996  David J MacKenzie  <djm@catapult.va.pubnix.com>
 
        * acgeneral.m4 (AC_CHECK_TYPE) [STDC_HEADERS]: Check in stddef.h, too.
        From "Glenn P. Davis" <davis@unidata.ucar.edu>.
+       Don't require the second char after the type name to be a space.
        (AC_TRY_RUN): Remove the test files before executing the "failure"
        case code.
 
@@ -22,9 +71,15 @@ Fri Nov  8 16:02:08 1996  David J MacKenzie  <djm@catapult.va.pubnix.com>
        (AC_PROG_CC, AC_PROG_CXX): Check whether -g works even if
        C[XX]FLAGS is set.  From T.E.Dickey <dickey@clark.net>
        (AC_FUNC_FNMATCH): New macro.
+       * acconfig.h (HAVE_FNMATCH): New entry.
        
        * acgeneral.m4 (AC_REPLACE_FUNCS): Call AC_CHECK_FUNCS to do the work.
        
+Tue Oct 29 13:03:44 1996  Doug Evans  <dje@canuck.cygnus.com>
+
+       * acgeneral.m4 (AC_OUTPUT_SUBDIRS): Fix thinko in computation of
+       ac_sub_srcdir in relative but not "." case.
+
 Thu Oct 10 22:29:37 1996  David J MacKenzie  <djm@catapult.va.pubnix.com>
 
        * acgeneral.m4 (AC_CANONICAL_HOST, AC_CANONICAL_TARGET,
diff --git a/INSTALL b/INSTALL
index a2c8722ccaff676071265013de37bdfb59f13704..50dbe439d099a31d9e7e2b2dec33ce7d71635263 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -167,7 +167,9 @@ operates.
 `--quiet'
 `--silent'
 `-q'
-     Do not print messages saying which checks are being made.
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
 
 `--srcdir=DIR'
      Look for the package's source code in directory DIR.  Usually
diff --git a/NEWS b/NEWS
index dd082e4695e1a72c4ec6eaf065060ee9f2ebaace..0e8a6293b32d086127fd6d7b0c90c7edd2ad3079 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,11 @@
 Major changes in release 2.11:
 
-* AC_CHECK_LIB can handle any funny characters in library names.
-* AC_REPLACE_FUNCS defines HAVE_FUNCTION if the system has the function.
-* New macro: AC_FUNC_FNMATCH.
+* AC_PROG_CC and AC_PROG_CXX check whether the compiler works.
+* AC_REPLACE_FUNCS defines HAVE_@var{function} if the system has the function.
+* New macros: AC_FUNC_FNMATCH, AC_FUNC_SETPGRP.
 * config.sub and config.guess recognize more system types.
-* Other bug fixes.
+* autoheader.sh adds multiple-inclusion protection for config.h.
+* Bug fixes.
 \f
 Major changes in release 2.10:
 
diff --git a/TODO b/TODO
index e600ffd8cff66588aa0daefc54281c4239c132e6..69a2d9a7ac16a4f179d33cb3121ee9bcbe03cd35 100644 (file)
--- a/TODO
+++ b/TODO
@@ -374,3 +374,41 @@ From:    Julian Onions <j.onions@nexor.co.uk>
 
 ------------------------------------------------------------------------------
 
+It would be nice if the configure script would handle an option such as
+--x-libraries="/usr/openwin/lib /usr/dt/lib".
+
+Rick Boykin <rboykin@cscsun3.larc.nasa.gov>
+
+------------------------------------------------------------------------------
+
+Look into quoting of cache variable values reported by Paul Eggert.
+
+------------------------------------------------------------------------------
+
+Timezone calculations checks.
+
+------------------------------------------------------------------------------
+
+Support different default filesystem layouts, e.g. SVR4, Linux.
+Of course, this can be done locally with config.site.
+
+------------------------------------------------------------------------------
+
+Mention automake, libtool, etc. in the autoconf manual.
+
+------------------------------------------------------------------------------
+
+configure-time pasting together of output files from multiple pieces.
+
+------------------------------------------------------------------------------
+
+I wonder if it is possible to get the path for X11's app-defaults
+directory by autoconf. Moreover, I'd like to have a general way of
+accessing imake variables by autoconf, something like
+
+AC_DEFINE(WINE_APP_DEFAULTS, AC_IMAKE_VAR(XAPPLOADDIR))
+
+Slaven Rezic <eserte@cabulja.herceg.de>
+
+------------------------------------------------------------------------------
+
index abbb64245f014aaef80f855023eb387102beaf8c..5bf096c52105354fe7d44299990cf431e4d939b1 100644 (file)
@@ -67,6 +67,9 @@
 /* Define if you don't have vprintf but do have _doprnt.  */
 #undef HAVE_DOPRNT
 
+/* Define if your system has a working fnmatch function.  */
+#undef HAVE_FNMATCH
+
 /* Define if your system has its own `getloadavg' function.  */
 #undef HAVE_GETLOADAVG
 
 /* Define as the return type of signal handlers (int or void).  */
 #undef RETSIGTYPE
 
+/* Define if the `setpgrp' function takes no argument.  */
+#undef SETPGRP_VOID
+
 /* Define if the setvbuf function takes the buffering type as its second
    argument and the buffer pointer as the third, as on System V
    before release 3.  */
    byte first (like Motorola and SPARC, unlike Intel and VAX).  */
 #undef WORDS_BIGENDIAN
 
+/* Define if the X Window System is missing or not being used.  */
+#undef X_DISPLAY_MISSING
+
 /* Define if lex declares yytext as a char * by default, not a char[].  */
 #undef YYTEXT_POINTER
 
index 10e04b71414f237137379aa777c7ee395cec0f68..cc78cf1c8bbbc3e462cf6794cd383ded4cdc442b 100644 (file)
@@ -188,6 +188,7 @@ dnl Installation directory options.
 dnl These are left unexpanded so users can "make install exec_prefix=/foo"
 dnl and all the variables that are supposed to be based on exec_prefix
 dnl by default will actually change.
+dnl Use braces instead of parens because sh, perl, etc. also accept them.
 bindir='${exec_prefix}/bin'
 sbindir='${exec_prefix}/sbin'
 libexecdir='${exec_prefix}/libexec'
@@ -1050,8 +1051,9 @@ changequote(, )dnl
 dnl Allow a site initialization script to override cache values.
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
+# HP-UX 10.01 sh prints single quotes around any value that contains spaces.
 (set) 2>&1 |
-  sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \
+sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)='*\([^']*\)'*/\1=\${\1='\2'}/p"\
   >> confcache
 changequote([, ])dnl
 if cmp -s $cache_file confcache; then
@@ -1137,11 +1139,13 @@ dnl ### Printing messages
 
 dnl AC_MSG_CHECKING(FEATURE-DESCRIPTION)
 define(AC_MSG_CHECKING,
-[echo $ac_n "checking $1""... $ac_c" 1>&AC_FD_MSG])
+[echo $ac_n "checking $1""... $ac_c" 1>&AC_FD_MSG
+echo "configure:__oline__: checking $1" >&AC_FD_CC])
 
 dnl AC_CHECKING(FEATURE-DESCRIPTION)
 define(AC_CHECKING,
-[echo "checking $1" 1>&AC_FD_MSG])
+[echo "checking $1" 1>&AC_FD_MSG
+echo "configure:__oline__: checking $1" >&AC_FD_CC])
 
 dnl AC_MSG_RESULT(RESULT-DESCRIPTION)
 define(AC_MSG_RESULT,
@@ -1252,7 +1256,10 @@ else
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
 ifelse([$6], , , [  ac_prog_rejected=no
 ])dnl
-  for ac_dir in ifelse([$5], , $PATH, [$5]); do
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl bash word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  for ac_dir in ifelse([$5], , $PATH, [$5$ac_dummy]); do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
 ifelse([$6], , , dnl
@@ -1313,7 +1320,10 @@ AC_CACHE_VAL(ac_cv_path_$1,
   ;;
   *)
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in ifelse([$4], , $PATH, [$4]); do
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl bash word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  for ac_dir in ifelse([$4], , $PATH, [$4$ac_dummy]); do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
       ac_cv_path_$1="$ac_dir/$ac_word"
@@ -1396,7 +1406,8 @@ AC_DEFUN(AC_PREFIX_PROGRAM,
 changequote(<<, >>)dnl
 define(<<AC_VAR_NAME>>, translit($1, [a-z], [A-Z]))dnl
 changequote([, ])dnl
-AC_MSG_CHECKING([for prefix by ])
+dnl We reimplement AC_MSG_CHECKING (mostly) to avoid the ... in the middle.
+echo $ac_n "checking for prefix by $ac_c" 1>&AC_FD_MSG
 AC_PATH_PROG(AC_VAR_NAME, $1)
 changequote(<<, >>)dnl
   if test -n "$ac_cv_path_<<>>AC_VAR_NAME"; then
@@ -1414,12 +1425,12 @@ dnl ### Checking for libraries
 dnl AC_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
 dnl              [, OTHER-LIBRARIES]]])
 AC_DEFUN(AC_CHECK_LIB,
-[AC_MSG_CHECKING([for -l$1])
+[AC_MSG_CHECKING([for $2 in -l$1])
 dnl Use a cache variable name containing both the library and function name,
 dnl because the test really is for library $1 defining function $2, not
 dnl just for library $1.  Separate tests with the same $1 and different $2s
 dnl may have different results.
-ac_lib_var=`echo $1['_']$2 | tr './+\055' '__p_'`
+ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
 AC_CACHE_VAL(ac_cv_lib_$ac_lib_var,
 [ac_save_LIBS="$LIBS"
 LIBS="-l$1 $5 $LIBS"
@@ -1535,7 +1546,10 @@ EOF
 dnl eval is necessary to expand ac_cpp.
 dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
+dnl Prevent m4 from eating character classes:
+changequote(, )dnl
   egrep "$1" >/dev/null 2>&1; then
+changequote([, ])dnl
   ifelse([$3], , :, [rm -rf conftest*
   $3])
 ifelse([$4], , , [else
@@ -1602,7 +1616,7 @@ int t() {
 [$2]
 ; return 0; }
 EOF
-if AC_TRY_EVAL(ac_link); then
+if AC_TRY_EVAL(ac_link) && test -s conftest; then
   ifelse([$3], , :, [rm -rf conftest*
   $3])
 ifelse([$4], , , [else
@@ -1628,7 +1642,14 @@ if test "$cross_compiling" = yes; then
   AC_MSG_ERROR(can not run test program while cross compiling)],
   [$4])
 else
-cat > conftest.$ac_ext <<EOF
+  AC_TRY_RUN_NATIVE([$1], [$2], [$3])
+fi
+])
+
+dnl Like AC_TRY_RUN but assumes a native-environment (non-cross) compiler.
+dnl AC_TRY_RUN_NATIVE(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE]])
+AC_DEFUN(AC_TRY_RUN_NATIVE,
+[cat > conftest.$ac_ext <<EOF
 [#]line __oline__ "configure"
 #include "confdefs.h"
 ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
@@ -1645,7 +1666,6 @@ ifelse([$3], , , [else
   $3
 ])dnl
 fi
-fi
 rm -fr conftest*])
 
 
@@ -1655,7 +1675,7 @@ dnl ### Checking for header files
 dnl AC_CHECK_HEADER(HEADER-FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
 AC_DEFUN(AC_CHECK_HEADER,
 [dnl Do the transliteration at runtime so arg 1 can be a shell variable.
-ac_safe=`echo "$1" | tr './\055' '___'`
+ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
 AC_MSG_CHECKING([for $1])
 AC_CACHE_VAL(ac_cv_header_$ac_safe,
 [AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_safe=yes",
@@ -1676,7 +1696,7 @@ AC_DEFUN(AC_CHECK_HEADERS,
 do
 AC_CHECK_HEADER($ac_hdr,
 [changequote(, )dnl
-  ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'`
+  ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
 changequote([, ])dnl
   AC_DEFINE_UNQUOTED($ac_tr_hdr) $2], $3)dnl
 done
@@ -1781,8 +1801,8 @@ AC_DEFUN(AC_CHECK_TYPE,
 AC_MSG_CHECKING(for $1)
 AC_CACHE_VAL(ac_cv_type_$1,
 [AC_EGREP_CPP(dnl
-changequote(,)dnl
-$1[^a-zA-Z_0-9] dnl
+changequote(<<<,>>>)dnl
+<<<$1[^a-zA-Z_0-9]>>>dnl
 changequote([,]), [#include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
@@ -2255,13 +2275,18 @@ if test "$no_recursion" != yes; then
     ac_popdir=`pwd`
     cd $ac_config_dir
 
+changequote(, )dnl
+      # A "../" for each directory in /$ac_config_dir.
+      ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
+changequote([, ])dnl
+
     case "$srcdir" in
     .) # No --srcdir option.  We are building in place.
       ac_sub_srcdir=$srcdir ;;
     /*) # Absolute path.
       ac_sub_srcdir=$srcdir/$ac_config_dir ;;
     *) # Relative path.
-      ac_sub_srcdir=../$srcdir/$ac_config_dir ;;
+      ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
     esac
 
     # Check for guested configure; otherwise get Cygnus style configure.
@@ -2278,10 +2303,6 @@ if test "$no_recursion" != yes; then
     if test -n "$ac_sub_configure"; then
 
       # Make the cache file name correct relative to the subdirectory.
-changequote(, )dnl
-      # A "../" for each directory in /$ac_config_dir.
-      ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
-changequote([, ])dnl
       case "$cache_file" in
       /*) ac_sub_cache_file=$cache_file ;;
       *) # Relative path.
index 17104c229d3be43f770a7a4f4d812d4094aa01d4..432f5f0758cf1c7b2cbbe545056305e78f688916 100644 (file)
@@ -119,6 +119,8 @@ else
   GCC=
   test "${CFLAGS+set}" = set || CFLAGS="-g"
 fi
+
+AC_PROG_CC_WORKS
 ])
 
 AC_DEFUN(AC_PROG_CXX,
@@ -166,6 +168,37 @@ else
   GXX=
   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
 fi
+
+AC_PROG_CXX_WORKS
+])
+
+dnl This check is derived from macros from Bruno Haible and Cygnus.
+AC_DEFUN(AC_PROG_CC_WORKS,
+[AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works])
+AC_LANG_SAVE
+AC_LANG_C
+AC_TRY_RUN_NATIVE([main() { exit(0); }],
+           ac_cv_prog_cc_works=yes, ac_cv_prog_cc_works=no,
+           AC_TRY_LINK(, , ac_cv_prog_cc_works=yes, ac_cv_prog_cc_works=no))
+AC_LANG_RESTORE
+AC_MSG_RESULT($ac_cv_prog_cc_works)
+if test $ac_cv_prog_cc_works = no; then
+  AC_MSG_ERROR([Installation or configuration problem: C compiler cannot create executables.])
+fi
+])
+
+AC_DEFUN(AC_PROG_CXX_WORKS,
+[AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+AC_TRY_RUN_NATIVE([main() { exit(0); }],
+           ac_cv_prog_cxx_works=yes, ac_cv_prog_cxx_works=no,
+           AC_TRY_LINK(, , ac_cv_prog_cxx_works=yes, ac_cv_prog_cxx_works=no))
+AC_LANG_RESTORE
+AC_MSG_RESULT($ac_cv_prog_cxx_works)
+if test $ac_cv_prog_cxx_works = no; then
+  AC_MSG_ERROR([Installation or configuration problem: C++ compiler cannot create executables.])
+fi
 ])
 
 AC_DEFUN(AC_PROG_GCC_TRADITIONAL,
@@ -241,7 +274,7 @@ fi
 dnl Define SET_MAKE to set ${MAKE} if make doesn't.
 AC_DEFUN(AC_PROG_MAKE_SET,
 [AC_MSG_CHECKING(whether ${MAKE-make} sets \${MAKE})
-set dummy ${MAKE-make}; ac_make=`echo "[$]2" | tr './\055' '___'`
+set dummy ${MAKE-make}; ac_make=`echo "[$]2" | sed 'y%./+-%__p_%'`
 AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
 [cat > conftestmake <<\EOF
 all:
@@ -369,7 +402,8 @@ ac_save_LIBS="$LIBS"
 LIBS="$LIBS $LEXLIB"
 AC_TRY_LINK(`cat $LEX_OUTPUT_ROOT.c`, , ac_cv_prog_lex_yytext_pointer=yes)
 LIBS="$ac_save_LIBS"
-rm -f "${LEX_OUTPUT_ROOT}.c"])
+rm -f "${LEX_OUTPUT_ROOT}.c"
+])
 dnl
 if test $ac_cv_prog_lex_yytext_pointer = yes; then
   AC_DEFINE(YYTEXT_POINTER)
@@ -557,7 +591,7 @@ dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILE
 dnl defines the type `DIR'.  dirent.h on NextStep 3.2 doesn't.
 dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)
 AC_DEFUN(AC_CHECK_HEADER_DIRENT,
-[ac_safe=`echo "$1" | tr './\055' '___'`
+[ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
 AC_MSG_CHECKING([for $1 that defines DIR])
 AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe,
 [AC_TRY_COMPILE([#include <sys/types.h>
@@ -580,7 +614,7 @@ define(AC_CHECK_HEADERS_DIRENT,
 do
 AC_CHECK_HEADER_DIRENT($ac_hdr,
 [changequote(, )dnl
-  ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdedfghijklmnopqrstuvwxyz./\055' 'ABCDEDFGHIJKLMNOPQRSTUVWXYZ___'`
+  ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
 changequote([, ])dnl
   AC_DEFINE_UNQUOTED($ac_tr_hdr) $2])dnl
 done])
@@ -791,10 +825,30 @@ fi
 ])
 
 AC_DEFUN(AC_FUNC_MMAP,
-[AC_CHECK_FUNCS(valloc getpagesize)
+[AC_CHECK_FUNCS(getpagesize)
 AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap,
 [AC_TRY_RUN([
-/* Thanks to Mike Haertel and Jim Avera for this test. */
+/* Thanks to Mike Haertel and Jim Avera for this test.
+   Here is a matrix of mmap possibilities:
+       mmap private not fixed
+       mmap private fixed at somewhere currently unmapped
+       mmap private fixed at somewhere already mapped
+       mmap shared not fixed
+       mmap shared fixed at somewhere currently unmapped
+       mmap shared fixed at somewhere already mapped
+   For private mappings, we should verify that changes cannot be read()
+   back from the file, nor mmap's back from the file at a different
+   address.  (There have been systems where private was not correctly
+   implemented like the infamous i386 svr4.0, and systems where the
+   VM page cache was not coherent with the filesystem buffer cache
+   like early versions of FreeBSD and possibly contemporary NetBSD.)
+   For shared mappings, we should conversely verify that changes get
+   propogated back to all the places they're supposed to be.
+
+   Grep wants private fixed already mapped.
+   The main things grep needs to know about mmap are:
+   * does it exist and is it safe to write into the mmap'd area
+   * how to use it (BSD variants)  */
 #include <sys/types.h>
 #include <fcntl.h>
 #include <sys/mman.h>
@@ -819,44 +873,74 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap,
 # endif
 #endif
 
-#ifndef HAVE_VALLOC
-# define valloc malloc
-#endif
-
 #ifdef __cplusplus
-extern "C" { void *valloc(unsigned), *malloc(unsigned); }
+extern "C" { void *malloc(unsigned); }
 #else
-char *valloc(), *malloc();
+char *malloc();
 #endif
 
 int
 main()
 {
-  char *buf1, *buf2, *buf3;
-  int i = getpagesize(), j;
-  int i2 = i * 2;
-  int fd;
-
-  buf1 = (char *)valloc(i2);
-  buf2 = (char *)valloc(i);
-  buf3 = (char *)malloc(i2);
-  for (j = 0; j < i2; ++j)
-    *(buf1 + j) = rand();
-  fd = open("conftestmmap", O_CREAT | O_RDWR, 0666);
-  write(fd, buf1, i2);
-  mmap(buf2, i, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, fd, 0);
-  for (j = 0; j < i; ++j)
-    if (*(buf1 + j) != *(buf2 + j))
-      exit(1);
-  lseek(fd, (long)i, 0);
-  read(fd, buf2, i); /* read into mapped memory -- file should not change */
-  /* (it does in i386 SVR4.0 - Jim Avera, jima@netcom.com) */
-  lseek(fd, (long)0, 0);
-  read(fd, buf3, i2);
-  for (j = 0; j < i2; ++j)
-    if (*(buf1 + j) != *(buf3 + j))
-      exit(1);
-  exit(0);
+       char *data, *data2, *data3;
+       int i, pagesize;
+       int fd;
+
+       pagesize = getpagesize();
+
+       /*
+        * First, make a file with some known garbage in it.
+        */
+       data = malloc(pagesize);
+       if (!data)
+               exit(1);
+       for (i = 0; i < pagesize; ++i)
+               *(data + i) = rand();
+       umask(0);
+       fd = creat("conftestmmap", 0600);
+       if (fd < 0)
+               exit(1);
+       if (write(fd, data, pagesize) != pagesize)
+               exit(1);
+       close(fd);
+
+       /*
+        * Next, try to mmap the file at a fixed address which
+        * already has something else allocated at it.  If we can,
+        * also make sure that we see the same garbage.
+        */
+       fd = open("conftestmmap", O_RDWR);
+       if (fd < 0)
+               exit(1);
+       data2 = malloc(2 * pagesize);
+       if (!data2)
+               exit(1);
+       data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+       if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
+           MAP_PRIVATE | MAP_FIXED, fd, 0L))
+               exit(1);
+       for (i = 0; i < pagesize; ++i)
+               if (*(data + i) != *(data2 + i))
+                       exit(1);
+
+       /*
+        * Finally, make sure that changes to the mapped area
+        * do not percolate back to the file as seen by read().
+        * (This is a bug on some variants of i386 svr4.0.)
+        */
+       for (i = 0; i < pagesize; ++i)
+               *(data2 + i) = *(data2 + i) + 1;
+       data3 = malloc(pagesize);
+       if (!data3)
+               exit(1);
+       if (read(fd, data3, pagesize) != pagesize)
+               exit(1);
+       for (i = 0; i < pagesize; ++i)
+               if (*(data + i) != *(data3 + i))
+                       exit(1);
+       close(fd);
+       unlink("conftestmmap");
+       exit(0);
 }
 ], ac_cv_func_mmap=yes, ac_cv_func_mmap=no, ac_cv_func_mmap=no)])
 if test $ac_cv_func_mmap = yes; then
@@ -925,6 +1009,28 @@ if test $ac_cv_func_getpgrp_void = yes; then
 fi
 ])
 
+AC_DEFUN(AC_FUNC_SETPGRP,
+[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
+AC_TRY_RUN([
+/*
+ * If this system has a BSD-style setpgrp, which takes arguments, exit
+ * successfully.
+ */
+main()
+{
+    if (setpgrp(1,1) == -1)
+       exit(0);
+    else
+       exit(1);
+}
+], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes,
+   AC_MSG_ERROR(cannot check setpgrp if cross compiling))
+)
+if test $ac_cv_func_setpgrp_void = yes; then
+  AC_DEFINE(SETPGRP_VOID)
+fi
+])
+
 AC_DEFUN(AC_FUNC_VPRINTF,
 [AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))
 if test "$ac_cv_func_vprintf" != yes; then
@@ -1883,11 +1989,11 @@ fi # $ac_x_libraries = NO
 
 dnl Find additional X libraries, magic flags, etc.
 AC_DEFUN(AC_PATH_XTRA,
-[AC_REQUIRE([AC_ISC_POSIX])dnl
-AC_REQUIRE([AC_PATH_X])dnl
+[AC_REQUIRE([AC_PATH_X])dnl
 if test "$no_x" = yes; then
   # Not all programs may use this symbol, but it does not hurt to define it.
-  X_CFLAGS="$X_CFLAGS -DX_DISPLAY_MISSING"
+  AC_DEFINE(X_DISPLAY_MISSING)
+  X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
 else
   if test -n "$x_includes"; then
     X_CFLAGS="$X_CFLAGS -I$x_includes"
@@ -1896,26 +2002,18 @@ else
   # It would also be nice to do this for all -L options, not just this one.
   if test -n "$x_libraries"; then
     X_LIBS="$X_LIBS -L$x_libraries"
+dnl FIXME banish uname from this macro!
     # For Solaris; some versions of Sun CC require a space after -R and
     # others require no space, so we take a different approach.
-    LD_RUN_PATH="$x_libraries"; export LD_RUN_PATH
+    if test "`(uname) 2>/dev/null`" = SunOS &&
+      uname -r | grep '^5' >/dev/null; then
+      CC="LD_RUN_PATH=$x_libraries $CC"
+    fi
   fi
 
-  # Check for libraries that X11R6 Xt/Xaw programs need.
-
-  ac_save_LDFLAGS="$LDFLAGS"
-  LDFLAGS="$LDFLAGS -L$x_libraries"
-  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
-  # check for ICE first), but we must link in the order -lSM -lICE or
-  # we get undefined symbols.  So assume we have SM if we have ICE.
-  # These have to be linked with before -lX11, unlike the other
-  # libraries we check for below, so use a different variable.
-  #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
-  AC_CHECK_LIB(ICE, IceConnectionNumber,
-    [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"])
-  LDFLAGS="$ac_save_LDFLAGS"
-
   # Check for system-dependent libraries X programs must link with.
+  # Do this before checking for the system-independent R6 libraries
+  # (-lICE), since we may need -lsocket or whatever for X linking.
 
   if test "$ISC" = yes; then
     X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
@@ -1931,17 +2029,54 @@ else
 
     # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
     # to get the SysV transport functions.
-    # Not sure which flavor of 386 UNIX this is, but it seems harmless to
-    # check for it.
-    AC_CHECK_LIB(nsl, t_accept, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"])
+    # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4)
+    # needs -lnsl.
+    # The nsl library prevents programs from opening the X display
+    # on Irix 5.2, according to dickey@clark.net.
+    AC_CHECK_FUNC(gethostbyname)
+    if test $ac_cv_func_gethostbyname = no; then
+      AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
+    fi
 
     # lieder@skyler.mavd.honeywell.com says without -lsocket,
-    # socket/setsockopt and other routines are undefined under SCO ODT 2.0.
-    # But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch.
-    if test "`(uname) 2>/dev/null`" != IRIX; then
-      AC_CHECK_LIB(socket, socket, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"])
+    # socket/setsockopt and other routines are undefined under SCO ODT
+    # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary
+    # on later versions), says simon@lia.di.epfl.ch: it contains
+    # gethostby* variants that don't use the nameserver (or something).
+    # -lsocket must be given before -lnsl if both are needed.
+    # We assume that if connect needs -lnsl, so does gethostbyname.
+    AC_CHECK_FUNC(connect)
+    if test $ac_cv_func_connect = no; then
+      AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
+       $X_EXTRA_LIBS)
+    fi
+
+    # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
+    AC_CHECK_FUNC(remove)
+    if test $ac_cv_func_remove = no; then
+      AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
+    fi
+
+    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
+    AC_CHECK_FUNC(shmat)
+    if test $ac_cv_func_shmat = no; then
+      AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")
     fi
   fi
+
+  # Check for libraries that X11R6 Xt/Xaw programs need.
+  ac_save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS -L$x_libraries"
+  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
+  # check for ICE first), but we must link in the order -lSM -lICE or
+  # we get undefined symbols.  So assume we have SM if we have ICE.
+  # These have to be linked with before -lX11, unlike the other
+  # libraries we check for below, so use a different variable.
+  #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
+  AC_CHECK_LIB(ICE, IceConnectionNumber,
+    [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"])
+  LDFLAGS="$ac_save_LDFLAGS"
+
 fi
 AC_SUBST(X_CFLAGS)dnl
 AC_SUBST(X_PRE_LIBS)dnl
@@ -1982,7 +2117,6 @@ fi
 AC_DEFUN(AC_ISC_POSIX,
 [AC_REQUIRE([AC_PROG_CC])dnl
 AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
-AC_BEFORE([$0], [AC_TRY_LINK])dnl
 AC_BEFORE([$0], [AC_TRY_RUN])dnl
 AC_MSG_CHECKING(for POSIXized ISC)
 if test -d /etc/conf/kconfig.d &&
index 7e7ba68020b013e038f49264fe724163e2828a27..ea1cd1018e8459ebfdc01565876118c81fc7db5c 100644 (file)
@@ -1910,8 +1910,19 @@ variable @code{LIBOBJS}.
 @defmac AC_FUNC_MMAP
 @maindex FUNC_MMAP
 @cvindex HAVE_MMAP
-If the @code{mmap} function exists and works correctly on memory mapped
-files, define @code{HAVE_MMAP}.
+If the @code{mmap} function exists and works correctly, define
+@code{HAVE_MMAP}.  Only checks private fixed mapping of already-mapped
+memory.
+@end defmac
+
+@defmac AC_FUNC_SETPGRP
+@maindex FUNC_SETPGRP
+@cvindex SETPGRP_VOID
+If @code{setpgrp} takes no argument (the POSIX.1 version), define
+@code{SETPGRP_VOID}.  Otherwise, it is the BSD version, which takes two
+process ID as arguments.  This macro does not check whether
+@code{setpgrp} exists at all; if you need to work in that situation,
+first call @code{AC_CHECK_FUNC} for @code{setpgrp}.
 @end defmac
 
 @defmac AC_FUNC_SETVBUF_REVERSED
@@ -4030,6 +4041,15 @@ with.  If no argument is given, it defaults to @samp{yes}.
 @samp{--without-@var{package}} is equivalent to
 @samp{--with-@var{package}=no}.
 
+@code{configure} scripts do not complain about
+@samp{--with-@var{package}} options that they do not support.
+This behavior permits configuring a source tree containing multiple
+packages with a top-level @code{configure} script when the packages
+support different options, without spurious error messages about options
+that some of the packages support.
+An unfortunate side effect is that option spelling errors are not diagnosed.
+No better approach to this problem has been suggested so far.
+
 For each external software package that may be used, @file{configure.in}
 should call @code{AC_ARG_WITH} to detect whether the @code{configure}
 user asked to use it.  Whether each package is used or not by
@@ -4093,6 +4113,15 @@ argument looks like @samp{--enable-debug=stabs}.  If no argument is
 given, it defaults to @samp{yes}.  @samp{--disable-@var{feature}} is
 equivalent to @samp{--enable-@var{feature}=no}.
 
+@code{configure} scripts do not complain about
+@samp{--enable-@var{feature}} options that they do not support.
+This behavior permits configuring a source tree containing multiple
+packages with a top-level @code{configure} script when the packages
+support different options, without spurious error messages about options
+that some of the packages support.
+An unfortunate side effect is that option spelling errors are not diagnosed.
+No better approach to this problem has been suggested so far.
+
 For each optional feature, @file{configure.in} should call
 @code{AC_ARG_ENABLE} to detect whether the @code{configure} user asked
 to include it.  Whether each feature is included or not by default, and
@@ -4110,7 +4139,7 @@ alphanumeric characters and dashes.
 The option's argument is available to the shell commands
 @var{action-if-given} in the shell variable @code{enableval}, which is
 actually just the value of the shell variable
-@code{enable_@var{package}}, with any @samp{-} characters changed into
+@code{enable_@var{feature}}, with any @samp{-} characters changed into
 @samp{_}.  You may use that variable instead, if you wish.  The
 @var{help-string} argument is like that of @code{AC_ARG_WITH}
 (@pxref{External Software}).
@@ -4327,9 +4356,11 @@ file (if @code{CONFIG_SITE} is not set to a different file).
 @example
 # config.site for configure
 #
-# Default --prefix and --exec-prefix.
+# Change some defaults.
 test "$prefix" = NONE && prefix=/usr/share/local/gnu
 test "$exec_prefix" = NONE && exec_prefix=/usr/local/gnu
+test "$sharedstatedir" = '$@{prefix@}/com' && sharedstatedir=/var
+test "$localstatedir" = '$@{prefix@}/var' && localstatedir=/var
 #
 # Give Autoconf 2.x generated configure scripts a shared default
 # cache file for feature test results, architecture-specific.
index 61d23843bfdb6e49d63d62deb1ecc7a1086091c1..e5c69dac8d0ccbdc9a1cd3408b617f3b86509842 100644 (file)
@@ -86,6 +86,12 @@ if test $show_version = yes; then
 fi
 
 TEMPLATES="${AC_MACRODIR}/acconfig.h"
+# Disabled until I figure out whether it's really right.
+#if test "$localdir" != .; then
+  # When running autoheader from autoreconf, this is how we get
+  # subdirectories' acconfig.h files.
+  test -r ./acconfig.h && TEMPLATES="${TEMPLATES} ./acconfig.h"
+#fi
 test -r $localdir/acconfig.h && TEMPLATES="${TEMPLATES} $localdir/acconfig.h"
 
 case $# in
@@ -151,7 +157,12 @@ esac
 
 # Don't write "do not edit" -- it will get copied into the
 # config.h, which it's ok to edit.
-echo "/* ${config_h_in}.  Generated automatically from $infile by autoheader.  */"
+cat <<EOF
+/* ${config_h_in}.  Generated automatically from $infile by autoheader.  */
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+EOF
 
 test -r ${config_h}.top && cat ${config_h}.top
 test -r $localdir/acconfig.h &&
@@ -233,6 +244,8 @@ test -r $localdir/acconfig.h &&
   sed -n '/@BOTTOM@/,${/@BOTTOM@/!p;}' $localdir/acconfig.h
 test -f ${config_h}.bot && cat ${config_h}.bot
 
+echo '#endif /* _CONFIG_H */'
+
 status=0
 
 if test -n "$syms"; then
index 61d23843bfdb6e49d63d62deb1ecc7a1086091c1..e5c69dac8d0ccbdc9a1cd3408b617f3b86509842 100644 (file)
@@ -86,6 +86,12 @@ if test $show_version = yes; then
 fi
 
 TEMPLATES="${AC_MACRODIR}/acconfig.h"
+# Disabled until I figure out whether it's really right.
+#if test "$localdir" != .; then
+  # When running autoheader from autoreconf, this is how we get
+  # subdirectories' acconfig.h files.
+  test -r ./acconfig.h && TEMPLATES="${TEMPLATES} ./acconfig.h"
+#fi
 test -r $localdir/acconfig.h && TEMPLATES="${TEMPLATES} $localdir/acconfig.h"
 
 case $# in
@@ -151,7 +157,12 @@ esac
 
 # Don't write "do not edit" -- it will get copied into the
 # config.h, which it's ok to edit.
-echo "/* ${config_h_in}.  Generated automatically from $infile by autoheader.  */"
+cat <<EOF
+/* ${config_h_in}.  Generated automatically from $infile by autoheader.  */
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+EOF
 
 test -r ${config_h}.top && cat ${config_h}.top
 test -r $localdir/acconfig.h &&
@@ -233,6 +244,8 @@ test -r $localdir/acconfig.h &&
   sed -n '/@BOTTOM@/,${/@BOTTOM@/!p;}' $localdir/acconfig.h
 test -f ${config_h}.bot && cat ${config_h}.bot
 
+echo '#endif /* _CONFIG_H */'
+
 status=0
 
 if test -n "$syms"; then
index 61d23843bfdb6e49d63d62deb1ecc7a1086091c1..e5c69dac8d0ccbdc9a1cd3408b617f3b86509842 100644 (file)
@@ -86,6 +86,12 @@ if test $show_version = yes; then
 fi
 
 TEMPLATES="${AC_MACRODIR}/acconfig.h"
+# Disabled until I figure out whether it's really right.
+#if test "$localdir" != .; then
+  # When running autoheader from autoreconf, this is how we get
+  # subdirectories' acconfig.h files.
+  test -r ./acconfig.h && TEMPLATES="${TEMPLATES} ./acconfig.h"
+#fi
 test -r $localdir/acconfig.h && TEMPLATES="${TEMPLATES} $localdir/acconfig.h"
 
 case $# in
@@ -151,7 +157,12 @@ esac
 
 # Don't write "do not edit" -- it will get copied into the
 # config.h, which it's ok to edit.
-echo "/* ${config_h_in}.  Generated automatically from $infile by autoheader.  */"
+cat <<EOF
+/* ${config_h_in}.  Generated automatically from $infile by autoheader.  */
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+EOF
 
 test -r ${config_h}.top && cat ${config_h}.top
 test -r $localdir/acconfig.h &&
@@ -233,6 +244,8 @@ test -r $localdir/acconfig.h &&
   sed -n '/@BOTTOM@/,${/@BOTTOM@/!p;}' $localdir/acconfig.h
 test -f ${config_h}.bot && cat ${config_h}.bot
 
+echo '#endif /* _CONFIG_H */'
+
 status=0
 
 if test -n "$syms"; then
index 65ce229d57cd2571d8cc9eebb48ed31505d282b8..e2ef59893572aeffd6a6984212efc7e082c1ad8f 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.10 
+# Generated automatically using autoconf version 2.10.1 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
@@ -330,7 +330,7 @@ EOF
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.10"
+    echo "configure generated by autoconf version 2.10.1"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -538,6 +538,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:__oline__: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_M4'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -574,6 +575,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:__oline__: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -605,6 +607,7 @@ done
 # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:__oline__: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -669,6 +672,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:__oline__: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -742,8 +746,9 @@ cat > confcache <<\EOF
 EOF
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
+# HP-UX 10.01 sh prints single quotes around any value that contains spaces.
 (set) 2>&1 |
-  sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \
+sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)='*\([^']*\)'*/\1=\${\1='\2'}/p"\
   >> confcache
 if cmp -s $cache_file confcache; then
   :
@@ -811,7 +816,7 @@ do
     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.10"
+    echo "$CONFIG_STATUS generated by autoconf version 2.10.1"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
index 7e7ba68020b013e038f49264fe724163e2828a27..ea1cd1018e8459ebfdc01565876118c81fc7db5c 100644 (file)
@@ -1910,8 +1910,19 @@ variable @code{LIBOBJS}.
 @defmac AC_FUNC_MMAP
 @maindex FUNC_MMAP
 @cvindex HAVE_MMAP
-If the @code{mmap} function exists and works correctly on memory mapped
-files, define @code{HAVE_MMAP}.
+If the @code{mmap} function exists and works correctly, define
+@code{HAVE_MMAP}.  Only checks private fixed mapping of already-mapped
+memory.
+@end defmac
+
+@defmac AC_FUNC_SETPGRP
+@maindex FUNC_SETPGRP
+@cvindex SETPGRP_VOID
+If @code{setpgrp} takes no argument (the POSIX.1 version), define
+@code{SETPGRP_VOID}.  Otherwise, it is the BSD version, which takes two
+process ID as arguments.  This macro does not check whether
+@code{setpgrp} exists at all; if you need to work in that situation,
+first call @code{AC_CHECK_FUNC} for @code{setpgrp}.
 @end defmac
 
 @defmac AC_FUNC_SETVBUF_REVERSED
@@ -4030,6 +4041,15 @@ with.  If no argument is given, it defaults to @samp{yes}.
 @samp{--without-@var{package}} is equivalent to
 @samp{--with-@var{package}=no}.
 
+@code{configure} scripts do not complain about
+@samp{--with-@var{package}} options that they do not support.
+This behavior permits configuring a source tree containing multiple
+packages with a top-level @code{configure} script when the packages
+support different options, without spurious error messages about options
+that some of the packages support.
+An unfortunate side effect is that option spelling errors are not diagnosed.
+No better approach to this problem has been suggested so far.
+
 For each external software package that may be used, @file{configure.in}
 should call @code{AC_ARG_WITH} to detect whether the @code{configure}
 user asked to use it.  Whether each package is used or not by
@@ -4093,6 +4113,15 @@ argument looks like @samp{--enable-debug=stabs}.  If no argument is
 given, it defaults to @samp{yes}.  @samp{--disable-@var{feature}} is
 equivalent to @samp{--enable-@var{feature}=no}.
 
+@code{configure} scripts do not complain about
+@samp{--enable-@var{feature}} options that they do not support.
+This behavior permits configuring a source tree containing multiple
+packages with a top-level @code{configure} script when the packages
+support different options, without spurious error messages about options
+that some of the packages support.
+An unfortunate side effect is that option spelling errors are not diagnosed.
+No better approach to this problem has been suggested so far.
+
 For each optional feature, @file{configure.in} should call
 @code{AC_ARG_ENABLE} to detect whether the @code{configure} user asked
 to include it.  Whether each feature is included or not by default, and
@@ -4110,7 +4139,7 @@ alphanumeric characters and dashes.
 The option's argument is available to the shell commands
 @var{action-if-given} in the shell variable @code{enableval}, which is
 actually just the value of the shell variable
-@code{enable_@var{package}}, with any @samp{-} characters changed into
+@code{enable_@var{feature}}, with any @samp{-} characters changed into
 @samp{_}.  You may use that variable instead, if you wish.  The
 @var{help-string} argument is like that of @code{AC_ARG_WITH}
 (@pxref{External Software}).
@@ -4327,9 +4356,11 @@ file (if @code{CONFIG_SITE} is not set to a different file).
 @example
 # config.site for configure
 #
-# Default --prefix and --exec-prefix.
+# Change some defaults.
 test "$prefix" = NONE && prefix=/usr/share/local/gnu
 test "$exec_prefix" = NONE && exec_prefix=/usr/local/gnu
+test "$sharedstatedir" = '$@{prefix@}/com' && sharedstatedir=/var
+test "$localstatedir" = '$@{prefix@}/var' && localstatedir=/var
 #
 # Give Autoconf 2.x generated configure scripts a shared default
 # cache file for feature test results, architecture-specific.
index 67c284b06f7d1e637ca690d4f0d5adcab490ec1f..f26dfcd41e3a195e4e46e29e980deaa286198951 100644 (file)
@@ -193,6 +193,8 @@ Print a summary of the options to @code{configure}, and exit.
 @itemx --silent
 @itemx -q
 Do not print messages saying which checks are being made.
+To suppress all normal output, redirect it to @file{/dev/null}
+(any error messages will still be shown).
 
 @item --srcdir=@var{dir}
 Look for the package's source code in directory @var{dir}.  Usually
index 67c284b06f7d1e637ca690d4f0d5adcab490ec1f..f26dfcd41e3a195e4e46e29e980deaa286198951 100644 (file)
@@ -193,6 +193,8 @@ Print a summary of the options to @code{configure}, and exit.
 @itemx --silent
 @itemx -q
 Do not print messages saying which checks are being made.
+To suppress all normal output, redirect it to @file{/dev/null}
+(any error messages will still be shown).
 
 @item --srcdir=@var{dir}
 Look for the package's source code in directory @var{dir}.  Usually
index 10e04b71414f237137379aa777c7ee395cec0f68..cc78cf1c8bbbc3e462cf6794cd383ded4cdc442b 100644 (file)
@@ -188,6 +188,7 @@ dnl Installation directory options.
 dnl These are left unexpanded so users can "make install exec_prefix=/foo"
 dnl and all the variables that are supposed to be based on exec_prefix
 dnl by default will actually change.
+dnl Use braces instead of parens because sh, perl, etc. also accept them.
 bindir='${exec_prefix}/bin'
 sbindir='${exec_prefix}/sbin'
 libexecdir='${exec_prefix}/libexec'
@@ -1050,8 +1051,9 @@ changequote(, )dnl
 dnl Allow a site initialization script to override cache values.
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
+# HP-UX 10.01 sh prints single quotes around any value that contains spaces.
 (set) 2>&1 |
-  sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \
+sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)='*\([^']*\)'*/\1=\${\1='\2'}/p"\
   >> confcache
 changequote([, ])dnl
 if cmp -s $cache_file confcache; then
@@ -1137,11 +1139,13 @@ dnl ### Printing messages
 
 dnl AC_MSG_CHECKING(FEATURE-DESCRIPTION)
 define(AC_MSG_CHECKING,
-[echo $ac_n "checking $1""... $ac_c" 1>&AC_FD_MSG])
+[echo $ac_n "checking $1""... $ac_c" 1>&AC_FD_MSG
+echo "configure:__oline__: checking $1" >&AC_FD_CC])
 
 dnl AC_CHECKING(FEATURE-DESCRIPTION)
 define(AC_CHECKING,
-[echo "checking $1" 1>&AC_FD_MSG])
+[echo "checking $1" 1>&AC_FD_MSG
+echo "configure:__oline__: checking $1" >&AC_FD_CC])
 
 dnl AC_MSG_RESULT(RESULT-DESCRIPTION)
 define(AC_MSG_RESULT,
@@ -1252,7 +1256,10 @@ else
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
 ifelse([$6], , , [  ac_prog_rejected=no
 ])dnl
-  for ac_dir in ifelse([$5], , $PATH, [$5]); do
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl bash word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  for ac_dir in ifelse([$5], , $PATH, [$5$ac_dummy]); do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
 ifelse([$6], , , dnl
@@ -1313,7 +1320,10 @@ AC_CACHE_VAL(ac_cv_path_$1,
   ;;
   *)
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in ifelse([$4], , $PATH, [$4]); do
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl bash word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  for ac_dir in ifelse([$4], , $PATH, [$4$ac_dummy]); do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
       ac_cv_path_$1="$ac_dir/$ac_word"
@@ -1396,7 +1406,8 @@ AC_DEFUN(AC_PREFIX_PROGRAM,
 changequote(<<, >>)dnl
 define(<<AC_VAR_NAME>>, translit($1, [a-z], [A-Z]))dnl
 changequote([, ])dnl
-AC_MSG_CHECKING([for prefix by ])
+dnl We reimplement AC_MSG_CHECKING (mostly) to avoid the ... in the middle.
+echo $ac_n "checking for prefix by $ac_c" 1>&AC_FD_MSG
 AC_PATH_PROG(AC_VAR_NAME, $1)
 changequote(<<, >>)dnl
   if test -n "$ac_cv_path_<<>>AC_VAR_NAME"; then
@@ -1414,12 +1425,12 @@ dnl ### Checking for libraries
 dnl AC_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
 dnl              [, OTHER-LIBRARIES]]])
 AC_DEFUN(AC_CHECK_LIB,
-[AC_MSG_CHECKING([for -l$1])
+[AC_MSG_CHECKING([for $2 in -l$1])
 dnl Use a cache variable name containing both the library and function name,
 dnl because the test really is for library $1 defining function $2, not
 dnl just for library $1.  Separate tests with the same $1 and different $2s
 dnl may have different results.
-ac_lib_var=`echo $1['_']$2 | tr './+\055' '__p_'`
+ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
 AC_CACHE_VAL(ac_cv_lib_$ac_lib_var,
 [ac_save_LIBS="$LIBS"
 LIBS="-l$1 $5 $LIBS"
@@ -1535,7 +1546,10 @@ EOF
 dnl eval is necessary to expand ac_cpp.
 dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
+dnl Prevent m4 from eating character classes:
+changequote(, )dnl
   egrep "$1" >/dev/null 2>&1; then
+changequote([, ])dnl
   ifelse([$3], , :, [rm -rf conftest*
   $3])
 ifelse([$4], , , [else
@@ -1602,7 +1616,7 @@ int t() {
 [$2]
 ; return 0; }
 EOF
-if AC_TRY_EVAL(ac_link); then
+if AC_TRY_EVAL(ac_link) && test -s conftest; then
   ifelse([$3], , :, [rm -rf conftest*
   $3])
 ifelse([$4], , , [else
@@ -1628,7 +1642,14 @@ if test "$cross_compiling" = yes; then
   AC_MSG_ERROR(can not run test program while cross compiling)],
   [$4])
 else
-cat > conftest.$ac_ext <<EOF
+  AC_TRY_RUN_NATIVE([$1], [$2], [$3])
+fi
+])
+
+dnl Like AC_TRY_RUN but assumes a native-environment (non-cross) compiler.
+dnl AC_TRY_RUN_NATIVE(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE]])
+AC_DEFUN(AC_TRY_RUN_NATIVE,
+[cat > conftest.$ac_ext <<EOF
 [#]line __oline__ "configure"
 #include "confdefs.h"
 ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
@@ -1645,7 +1666,6 @@ ifelse([$3], , , [else
   $3
 ])dnl
 fi
-fi
 rm -fr conftest*])
 
 
@@ -1655,7 +1675,7 @@ dnl ### Checking for header files
 dnl AC_CHECK_HEADER(HEADER-FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
 AC_DEFUN(AC_CHECK_HEADER,
 [dnl Do the transliteration at runtime so arg 1 can be a shell variable.
-ac_safe=`echo "$1" | tr './\055' '___'`
+ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
 AC_MSG_CHECKING([for $1])
 AC_CACHE_VAL(ac_cv_header_$ac_safe,
 [AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_safe=yes",
@@ -1676,7 +1696,7 @@ AC_DEFUN(AC_CHECK_HEADERS,
 do
 AC_CHECK_HEADER($ac_hdr,
 [changequote(, )dnl
-  ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'`
+  ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
 changequote([, ])dnl
   AC_DEFINE_UNQUOTED($ac_tr_hdr) $2], $3)dnl
 done
@@ -1781,8 +1801,8 @@ AC_DEFUN(AC_CHECK_TYPE,
 AC_MSG_CHECKING(for $1)
 AC_CACHE_VAL(ac_cv_type_$1,
 [AC_EGREP_CPP(dnl
-changequote(,)dnl
-$1[^a-zA-Z_0-9] dnl
+changequote(<<<,>>>)dnl
+<<<$1[^a-zA-Z_0-9]>>>dnl
 changequote([,]), [#include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
@@ -2255,13 +2275,18 @@ if test "$no_recursion" != yes; then
     ac_popdir=`pwd`
     cd $ac_config_dir
 
+changequote(, )dnl
+      # A "../" for each directory in /$ac_config_dir.
+      ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
+changequote([, ])dnl
+
     case "$srcdir" in
     .) # No --srcdir option.  We are building in place.
       ac_sub_srcdir=$srcdir ;;
     /*) # Absolute path.
       ac_sub_srcdir=$srcdir/$ac_config_dir ;;
     *) # Relative path.
-      ac_sub_srcdir=../$srcdir/$ac_config_dir ;;
+      ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
     esac
 
     # Check for guested configure; otherwise get Cygnus style configure.
@@ -2278,10 +2303,6 @@ if test "$no_recursion" != yes; then
     if test -n "$ac_sub_configure"; then
 
       # Make the cache file name correct relative to the subdirectory.
-changequote(, )dnl
-      # A "../" for each directory in /$ac_config_dir.
-      ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
-changequote([, ])dnl
       case "$cache_file" in
       /*) ac_sub_cache_file=$cache_file ;;
       *) # Relative path.
index 17104c229d3be43f770a7a4f4d812d4094aa01d4..432f5f0758cf1c7b2cbbe545056305e78f688916 100644 (file)
@@ -119,6 +119,8 @@ else
   GCC=
   test "${CFLAGS+set}" = set || CFLAGS="-g"
 fi
+
+AC_PROG_CC_WORKS
 ])
 
 AC_DEFUN(AC_PROG_CXX,
@@ -166,6 +168,37 @@ else
   GXX=
   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
 fi
+
+AC_PROG_CXX_WORKS
+])
+
+dnl This check is derived from macros from Bruno Haible and Cygnus.
+AC_DEFUN(AC_PROG_CC_WORKS,
+[AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works])
+AC_LANG_SAVE
+AC_LANG_C
+AC_TRY_RUN_NATIVE([main() { exit(0); }],
+           ac_cv_prog_cc_works=yes, ac_cv_prog_cc_works=no,
+           AC_TRY_LINK(, , ac_cv_prog_cc_works=yes, ac_cv_prog_cc_works=no))
+AC_LANG_RESTORE
+AC_MSG_RESULT($ac_cv_prog_cc_works)
+if test $ac_cv_prog_cc_works = no; then
+  AC_MSG_ERROR([Installation or configuration problem: C compiler cannot create executables.])
+fi
+])
+
+AC_DEFUN(AC_PROG_CXX_WORKS,
+[AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+AC_TRY_RUN_NATIVE([main() { exit(0); }],
+           ac_cv_prog_cxx_works=yes, ac_cv_prog_cxx_works=no,
+           AC_TRY_LINK(, , ac_cv_prog_cxx_works=yes, ac_cv_prog_cxx_works=no))
+AC_LANG_RESTORE
+AC_MSG_RESULT($ac_cv_prog_cxx_works)
+if test $ac_cv_prog_cxx_works = no; then
+  AC_MSG_ERROR([Installation or configuration problem: C++ compiler cannot create executables.])
+fi
 ])
 
 AC_DEFUN(AC_PROG_GCC_TRADITIONAL,
@@ -241,7 +274,7 @@ fi
 dnl Define SET_MAKE to set ${MAKE} if make doesn't.
 AC_DEFUN(AC_PROG_MAKE_SET,
 [AC_MSG_CHECKING(whether ${MAKE-make} sets \${MAKE})
-set dummy ${MAKE-make}; ac_make=`echo "[$]2" | tr './\055' '___'`
+set dummy ${MAKE-make}; ac_make=`echo "[$]2" | sed 'y%./+-%__p_%'`
 AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
 [cat > conftestmake <<\EOF
 all:
@@ -369,7 +402,8 @@ ac_save_LIBS="$LIBS"
 LIBS="$LIBS $LEXLIB"
 AC_TRY_LINK(`cat $LEX_OUTPUT_ROOT.c`, , ac_cv_prog_lex_yytext_pointer=yes)
 LIBS="$ac_save_LIBS"
-rm -f "${LEX_OUTPUT_ROOT}.c"])
+rm -f "${LEX_OUTPUT_ROOT}.c"
+])
 dnl
 if test $ac_cv_prog_lex_yytext_pointer = yes; then
   AC_DEFINE(YYTEXT_POINTER)
@@ -557,7 +591,7 @@ dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILE
 dnl defines the type `DIR'.  dirent.h on NextStep 3.2 doesn't.
 dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)
 AC_DEFUN(AC_CHECK_HEADER_DIRENT,
-[ac_safe=`echo "$1" | tr './\055' '___'`
+[ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
 AC_MSG_CHECKING([for $1 that defines DIR])
 AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe,
 [AC_TRY_COMPILE([#include <sys/types.h>
@@ -580,7 +614,7 @@ define(AC_CHECK_HEADERS_DIRENT,
 do
 AC_CHECK_HEADER_DIRENT($ac_hdr,
 [changequote(, )dnl
-  ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdedfghijklmnopqrstuvwxyz./\055' 'ABCDEDFGHIJKLMNOPQRSTUVWXYZ___'`
+  ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
 changequote([, ])dnl
   AC_DEFINE_UNQUOTED($ac_tr_hdr) $2])dnl
 done])
@@ -791,10 +825,30 @@ fi
 ])
 
 AC_DEFUN(AC_FUNC_MMAP,
-[AC_CHECK_FUNCS(valloc getpagesize)
+[AC_CHECK_FUNCS(getpagesize)
 AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap,
 [AC_TRY_RUN([
-/* Thanks to Mike Haertel and Jim Avera for this test. */
+/* Thanks to Mike Haertel and Jim Avera for this test.
+   Here is a matrix of mmap possibilities:
+       mmap private not fixed
+       mmap private fixed at somewhere currently unmapped
+       mmap private fixed at somewhere already mapped
+       mmap shared not fixed
+       mmap shared fixed at somewhere currently unmapped
+       mmap shared fixed at somewhere already mapped
+   For private mappings, we should verify that changes cannot be read()
+   back from the file, nor mmap's back from the file at a different
+   address.  (There have been systems where private was not correctly
+   implemented like the infamous i386 svr4.0, and systems where the
+   VM page cache was not coherent with the filesystem buffer cache
+   like early versions of FreeBSD and possibly contemporary NetBSD.)
+   For shared mappings, we should conversely verify that changes get
+   propogated back to all the places they're supposed to be.
+
+   Grep wants private fixed already mapped.
+   The main things grep needs to know about mmap are:
+   * does it exist and is it safe to write into the mmap'd area
+   * how to use it (BSD variants)  */
 #include <sys/types.h>
 #include <fcntl.h>
 #include <sys/mman.h>
@@ -819,44 +873,74 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap,
 # endif
 #endif
 
-#ifndef HAVE_VALLOC
-# define valloc malloc
-#endif
-
 #ifdef __cplusplus
-extern "C" { void *valloc(unsigned), *malloc(unsigned); }
+extern "C" { void *malloc(unsigned); }
 #else
-char *valloc(), *malloc();
+char *malloc();
 #endif
 
 int
 main()
 {
-  char *buf1, *buf2, *buf3;
-  int i = getpagesize(), j;
-  int i2 = i * 2;
-  int fd;
-
-  buf1 = (char *)valloc(i2);
-  buf2 = (char *)valloc(i);
-  buf3 = (char *)malloc(i2);
-  for (j = 0; j < i2; ++j)
-    *(buf1 + j) = rand();
-  fd = open("conftestmmap", O_CREAT | O_RDWR, 0666);
-  write(fd, buf1, i2);
-  mmap(buf2, i, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, fd, 0);
-  for (j = 0; j < i; ++j)
-    if (*(buf1 + j) != *(buf2 + j))
-      exit(1);
-  lseek(fd, (long)i, 0);
-  read(fd, buf2, i); /* read into mapped memory -- file should not change */
-  /* (it does in i386 SVR4.0 - Jim Avera, jima@netcom.com) */
-  lseek(fd, (long)0, 0);
-  read(fd, buf3, i2);
-  for (j = 0; j < i2; ++j)
-    if (*(buf1 + j) != *(buf3 + j))
-      exit(1);
-  exit(0);
+       char *data, *data2, *data3;
+       int i, pagesize;
+       int fd;
+
+       pagesize = getpagesize();
+
+       /*
+        * First, make a file with some known garbage in it.
+        */
+       data = malloc(pagesize);
+       if (!data)
+               exit(1);
+       for (i = 0; i < pagesize; ++i)
+               *(data + i) = rand();
+       umask(0);
+       fd = creat("conftestmmap", 0600);
+       if (fd < 0)
+               exit(1);
+       if (write(fd, data, pagesize) != pagesize)
+               exit(1);
+       close(fd);
+
+       /*
+        * Next, try to mmap the file at a fixed address which
+        * already has something else allocated at it.  If we can,
+        * also make sure that we see the same garbage.
+        */
+       fd = open("conftestmmap", O_RDWR);
+       if (fd < 0)
+               exit(1);
+       data2 = malloc(2 * pagesize);
+       if (!data2)
+               exit(1);
+       data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+       if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
+           MAP_PRIVATE | MAP_FIXED, fd, 0L))
+               exit(1);
+       for (i = 0; i < pagesize; ++i)
+               if (*(data + i) != *(data2 + i))
+                       exit(1);
+
+       /*
+        * Finally, make sure that changes to the mapped area
+        * do not percolate back to the file as seen by read().
+        * (This is a bug on some variants of i386 svr4.0.)
+        */
+       for (i = 0; i < pagesize; ++i)
+               *(data2 + i) = *(data2 + i) + 1;
+       data3 = malloc(pagesize);
+       if (!data3)
+               exit(1);
+       if (read(fd, data3, pagesize) != pagesize)
+               exit(1);
+       for (i = 0; i < pagesize; ++i)
+               if (*(data + i) != *(data3 + i))
+                       exit(1);
+       close(fd);
+       unlink("conftestmmap");
+       exit(0);
 }
 ], ac_cv_func_mmap=yes, ac_cv_func_mmap=no, ac_cv_func_mmap=no)])
 if test $ac_cv_func_mmap = yes; then
@@ -925,6 +1009,28 @@ if test $ac_cv_func_getpgrp_void = yes; then
 fi
 ])
 
+AC_DEFUN(AC_FUNC_SETPGRP,
+[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
+AC_TRY_RUN([
+/*
+ * If this system has a BSD-style setpgrp, which takes arguments, exit
+ * successfully.
+ */
+main()
+{
+    if (setpgrp(1,1) == -1)
+       exit(0);
+    else
+       exit(1);
+}
+], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes,
+   AC_MSG_ERROR(cannot check setpgrp if cross compiling))
+)
+if test $ac_cv_func_setpgrp_void = yes; then
+  AC_DEFINE(SETPGRP_VOID)
+fi
+])
+
 AC_DEFUN(AC_FUNC_VPRINTF,
 [AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))
 if test "$ac_cv_func_vprintf" != yes; then
@@ -1883,11 +1989,11 @@ fi # $ac_x_libraries = NO
 
 dnl Find additional X libraries, magic flags, etc.
 AC_DEFUN(AC_PATH_XTRA,
-[AC_REQUIRE([AC_ISC_POSIX])dnl
-AC_REQUIRE([AC_PATH_X])dnl
+[AC_REQUIRE([AC_PATH_X])dnl
 if test "$no_x" = yes; then
   # Not all programs may use this symbol, but it does not hurt to define it.
-  X_CFLAGS="$X_CFLAGS -DX_DISPLAY_MISSING"
+  AC_DEFINE(X_DISPLAY_MISSING)
+  X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
 else
   if test -n "$x_includes"; then
     X_CFLAGS="$X_CFLAGS -I$x_includes"
@@ -1896,26 +2002,18 @@ else
   # It would also be nice to do this for all -L options, not just this one.
   if test -n "$x_libraries"; then
     X_LIBS="$X_LIBS -L$x_libraries"
+dnl FIXME banish uname from this macro!
     # For Solaris; some versions of Sun CC require a space after -R and
     # others require no space, so we take a different approach.
-    LD_RUN_PATH="$x_libraries"; export LD_RUN_PATH
+    if test "`(uname) 2>/dev/null`" = SunOS &&
+      uname -r | grep '^5' >/dev/null; then
+      CC="LD_RUN_PATH=$x_libraries $CC"
+    fi
   fi
 
-  # Check for libraries that X11R6 Xt/Xaw programs need.
-
-  ac_save_LDFLAGS="$LDFLAGS"
-  LDFLAGS="$LDFLAGS -L$x_libraries"
-  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
-  # check for ICE first), but we must link in the order -lSM -lICE or
-  # we get undefined symbols.  So assume we have SM if we have ICE.
-  # These have to be linked with before -lX11, unlike the other
-  # libraries we check for below, so use a different variable.
-  #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
-  AC_CHECK_LIB(ICE, IceConnectionNumber,
-    [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"])
-  LDFLAGS="$ac_save_LDFLAGS"
-
   # Check for system-dependent libraries X programs must link with.
+  # Do this before checking for the system-independent R6 libraries
+  # (-lICE), since we may need -lsocket or whatever for X linking.
 
   if test "$ISC" = yes; then
     X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
@@ -1931,17 +2029,54 @@ else
 
     # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
     # to get the SysV transport functions.
-    # Not sure which flavor of 386 UNIX this is, but it seems harmless to
-    # check for it.
-    AC_CHECK_LIB(nsl, t_accept, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"])
+    # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4)
+    # needs -lnsl.
+    # The nsl library prevents programs from opening the X display
+    # on Irix 5.2, according to dickey@clark.net.
+    AC_CHECK_FUNC(gethostbyname)
+    if test $ac_cv_func_gethostbyname = no; then
+      AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
+    fi
 
     # lieder@skyler.mavd.honeywell.com says without -lsocket,
-    # socket/setsockopt and other routines are undefined under SCO ODT 2.0.
-    # But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch.
-    if test "`(uname) 2>/dev/null`" != IRIX; then
-      AC_CHECK_LIB(socket, socket, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"])
+    # socket/setsockopt and other routines are undefined under SCO ODT
+    # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary
+    # on later versions), says simon@lia.di.epfl.ch: it contains
+    # gethostby* variants that don't use the nameserver (or something).
+    # -lsocket must be given before -lnsl if both are needed.
+    # We assume that if connect needs -lnsl, so does gethostbyname.
+    AC_CHECK_FUNC(connect)
+    if test $ac_cv_func_connect = no; then
+      AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
+       $X_EXTRA_LIBS)
+    fi
+
+    # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
+    AC_CHECK_FUNC(remove)
+    if test $ac_cv_func_remove = no; then
+      AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
+    fi
+
+    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
+    AC_CHECK_FUNC(shmat)
+    if test $ac_cv_func_shmat = no; then
+      AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")
     fi
   fi
+
+  # Check for libraries that X11R6 Xt/Xaw programs need.
+  ac_save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS -L$x_libraries"
+  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
+  # check for ICE first), but we must link in the order -lSM -lICE or
+  # we get undefined symbols.  So assume we have SM if we have ICE.
+  # These have to be linked with before -lX11, unlike the other
+  # libraries we check for below, so use a different variable.
+  #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
+  AC_CHECK_LIB(ICE, IceConnectionNumber,
+    [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"])
+  LDFLAGS="$ac_save_LDFLAGS"
+
 fi
 AC_SUBST(X_CFLAGS)dnl
 AC_SUBST(X_PRE_LIBS)dnl
@@ -1982,7 +2117,6 @@ fi
 AC_DEFUN(AC_ISC_POSIX,
 [AC_REQUIRE([AC_PROG_CC])dnl
 AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
-AC_BEFORE([$0], [AC_TRY_LINK])dnl
 AC_BEFORE([$0], [AC_TRY_RUN])dnl
 AC_MSG_CHECKING(for POSIXized ISC)
 if test -d /etc/conf/kconfig.d &&