]> granicus.if.org Git - postgresql/blobdiff - configure
Add statement_timestamp(), clock_timestamp(), and
[postgresql] / configure
index aa79db47a4269dd7bef64f1ea6c9925d5f0d265a..24c0ef9532c8aefd0a54102dca508d69d40bbd35 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for PostgreSQL 8.1beta1.
+# Generated by GNU Autoconf 2.59 for PostgreSQL 8.2devel.
 #
 # Report bugs to <pgsql-bugs@postgresql.org>.
 #
@@ -8,7 +8,7 @@
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 #
-# Copyright (c) 1996-2005, PostgreSQL Global Development Group
+# Copyright (c) 1996-2006, PostgreSQL Global Development Group
 ## --------------------- ##
 ## M4sh Initialization.  ##
 ## --------------------- ##
@@ -271,8 +271,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='PostgreSQL'
 PACKAGE_TARNAME='postgresql'
-PACKAGE_VERSION='8.1beta1'
-PACKAGE_STRING='PostgreSQL 8.1beta1'
+PACKAGE_VERSION='8.2devel'
+PACKAGE_STRING='PostgreSQL 8.2devel'
 PACKAGE_BUGREPORT='pgsql-bugs@postgresql.org'
 
 ac_unique_file="src/backend/access/common/heaptuple.c"
@@ -314,7 +314,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS configure_args build build_cpu build_vendor build_os host host_cpu host_vendor host_os PORTNAME docdir enable_nls WANTED_LANGUAGES default_port enable_shared enable_rpath enable_debug CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP GCC TAS autodepend INCLUDES enable_thread_safety with_tcl with_perl with_python with_krb5 krb_srvtab with_pam with_bonjour with_openssl with_zlib EGREP ELF_SYS LDFLAGS_SL AWK FLEX FLEXFLAGS LN_S LD with_gnu_ld ld_R_works RANLIB ac_ct_RANLIB LORDER TAR STRIP ac_ct_STRIP STRIP_STATIC_LIB STRIP_SHARED_LIB YACC YFLAGS PERL perl_archlibexp perl_privlibexp perl_useshrplib perl_embed_ldflags PYTHON python_version python_configdir python_includespec python_libdir python_libspec python_additional_libs HAVE_IPV6 LIBOBJS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS HAVE_POSIX_SIGNALS MSGFMT MSGMERGE XGETTEXT localedir TCLSH TCL_CONFIG_SH TCL_INCLUDE_SPEC TCL_LIB_FILE TCL_LIBS TCL_LIB_SPEC TCL_SHARED_BUILD TCL_SHLIB_LD_LIBS NSGMLS JADE have_docbook DOCBOOKSTYLE COLLATEINDEX SGMLSPL vpath_build LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS configure_args build build_cpu build_vendor build_os host host_cpu host_vendor host_os PORTNAME docdir enable_nls WANTED_LANGUAGES default_port enable_shared enable_rpath enable_debug CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP GCC TAS autodepend INCLUDES enable_thread_safety with_tcl with_perl with_python with_krb5 krb_srvtab with_pam with_ldap with_bonjour with_openssl with_zlib EGREP ELF_SYS LDFLAGS_SL AWK FLEX FLEXFLAGS LN_S LD with_gnu_ld ld_R_works RANLIB ac_ct_RANLIB TAR STRIP ac_ct_STRIP STRIP_STATIC_LIB STRIP_SHARED_LIB YACC YFLAGS PERL perl_archlibexp perl_privlibexp perl_useshrplib perl_embed_ldflags PYTHON python_version python_configdir python_includespec python_libdir python_libspec python_additional_libs HAVE_IPV6 LIBOBJS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS HAVE_POSIX_SIGNALS MSGFMT MSGMERGE XGETTEXT localedir TCLSH TCL_CONFIG_SH TCL_INCLUDE_SPEC TCL_LIB_FILE TCL_LIBS TCL_LIB_SPEC TCL_SHARED_BUILD TCL_SHLIB_LD_LIBS NSGMLS JADE have_docbook DOCBOOKSTYLE COLLATEINDEX SGMLSPL vpath_build LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -791,7 +791,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures PostgreSQL 8.1beta1 to adapt to many kinds of systems.
+\`configure' configures PostgreSQL 8.2devel to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -852,7 +852,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of PostgreSQL 8.1beta1:";;
+     short | recursive ) echo "Configuration of PostgreSQL 8.2devel:";;
    esac
   cat <<\_ACEOF
 
@@ -880,7 +880,7 @@ Optional Packages:
   --with-includes=DIRS    look for additional header files in DIRS
   --with-libraries=DIRS   look for additional libraries in DIRS
   --with-libs=DIRS        alternative spelling of --with-libraries
-  --with-pgport=PORTNUM   change default port number 5432
+  --with-pgport=PORTNUM   change default port number [5432]
   --with-tcl              build Tcl modules (PL/Tcl)
   --with-tclconfig=DIR    tclConfig.sh is in DIR
   --with-perl             build Perl modules (PL/Perl)
@@ -888,9 +888,11 @@ Optional Packages:
   --with-krb5             build with Kerberos 5 support
   --with-krb-srvnam=NAME  name of the default service principal in Kerberos [postgres]
   --with-pam              build with PAM support
+  --with-ldap             build with LDAP support
   --with-bonjour          build with Bonjour support
   --with-openssl          build with OpenSSL support
-  --without-readline      do not use Readline
+  --with-libedit-preferred  prefer BSD Libedit over GNU Readline
+  --without-readline      do not use GNU Readline / BSD Libedit line editing
   --without-zlib          do not use Zlib
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
 
@@ -1005,14 +1007,14 @@ fi
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-PostgreSQL configure 8.1beta1
+PostgreSQL configure 8.2devel
 generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 
-Copyright (c) 1996-2005, PostgreSQL Global Development Group
+Copyright (c) 1996-2006, PostgreSQL Global Development Group
 _ACEOF
   exit 0
 fi
@@ -1021,7 +1023,7 @@ cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by PostgreSQL $as_me 8.1beta1, which was
+It was created by PostgreSQL $as_me 8.2devel, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -1495,7 +1497,6 @@ else
 
 case $host_os in
      aix*) template=aix ;;
-    beos*) template=beos ;;
     bsdi*) template=bsdi ;;
   cygwin*) template=cygwin ;;
   darwin*) template=darwin ;;
@@ -1510,7 +1511,6 @@ case $host_os in
 nextstep*) template=nextstep ;;
  openbsd*) template=openbsd ;;
      osf*) template=osf ;;
-     qnx*) template=qnx4 ;;
      sco*) template=sco ;;
  solaris*) template=solaris ;;
    sunos*) template=sunos4 ;;
@@ -2713,15 +2713,13 @@ else
   fi
 fi
 
+# The Intel compiler on Linux supports most gcc options, but not
+# all of them, so only add these options if we are really using
+# gcc.  Intel compiler has a bug in checking for division by NAN
+# (NaN == 0), -mp1 fixes it, so someday we might way to add it.
+
 if test "$GCC" = yes; then
-  CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith"
 
-  # Some versions of GCC support some additional useful warning flags.
-  # Check whether they are supported, and add them to CFLAGS if so.
-  echo "$as_me:$LINENO: checking if $CC supports -Wdeclaration-after-statement" >&5
-echo $ECHO_N "checking if $CC supports -Wdeclaration-after-statement... $ECHO_C" >&6
-pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -Wdeclaration-after-statement"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -2732,7 +2730,9 @@ cat >>conftest.$ac_ext <<_ACEOF
 int
 main ()
 {
-
+#ifndef __INTEL_COMPILER
+choke me
+#endif
   ;
   return 0;
 }
@@ -2759,22 +2759,23 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+  ICC=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-CFLAGS="$pgac_save_CFLAGS"
-                    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ICC=no
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  if test "$ICC" = no; then
+    CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith -Winline"
 
-  echo "$as_me:$LINENO: checking if $CC supports -Wold-style-definition" >&5
-echo $ECHO_N "checking if $CC supports -Wold-style-definition... $ECHO_C" >&6
+    # Some versions of GCC support some additional useful warning flags.
+    # Check whether they are supported, and add them to CFLAGS if so.
+    echo "$as_me:$LINENO: checking if $CC supports -Wdeclaration-after-statement" >&5
+echo $ECHO_N "checking if $CC supports -Wdeclaration-after-statement... $ECHO_C" >&6
 pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -Wold-style-definition"
+CFLAGS="$pgac_save_CFLAGS -Wdeclaration-after-statement"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -2824,7 +2825,7 @@ echo "${ECHO_T}no" >&6
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 
-  echo "$as_me:$LINENO: checking if $CC supports -Wendif-labels" >&5
+    echo "$as_me:$LINENO: checking if $CC supports -Wendif-labels" >&5
 echo $ECHO_N "checking if $CC supports -Wendif-labels... $ECHO_C" >&6
 pgac_save_CFLAGS=$CFLAGS
 CFLAGS="$pgac_save_CFLAGS -Wendif-labels"
@@ -2877,6 +2878,7 @@ echo "${ECHO_T}no" >&6
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 
+  fi
 
   # Disable strict-aliasing rules; needed for gcc 3.3+
   echo "$as_me:$LINENO: checking if $CC supports -fno-strict-aliasing" >&5
@@ -2950,7 +2952,6 @@ fi
 # Check if the compiler still works with the template settings
 echo "$as_me:$LINENO: checking whether the C compiler still works" >&5
 echo $ECHO_N "checking whether the C compiler still works... $ECHO_C" >&6
-
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -3744,6 +3745,46 @@ echo "${ECHO_T}$with_pam" >&6
 
 
 
+#
+# LDAP
+#
+echo "$as_me:$LINENO: checking whether to build with LDAP support" >&5
+echo $ECHO_N "checking whether to build with LDAP support... $ECHO_C" >&6
+
+
+
+# Check whether --with-ldap or --without-ldap was given.
+if test "${with_ldap+set}" = set; then
+  withval="$with_ldap"
+
+  case $withval in
+    yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_LDAP 1
+_ACEOF
+
+      ;;
+    no)
+      :
+      ;;
+    *)
+      { { echo "$as_me:$LINENO: error: no argument expected for --with-ldap option" >&5
+echo "$as_me: error: no argument expected for --with-ldap option" >&2;}
+   { (exit 1); exit 1; }; }
+      ;;
+  esac
+
+else
+  with_ldap=no
+
+fi;
+
+echo "$as_me:$LINENO: result: $with_ldap" >&5
+echo "${ECHO_T}$with_ldap" >&6
+
+
+
 #
 # Bonjour
 #
@@ -3824,6 +3865,37 @@ echo "${ECHO_T}$with_openssl" >&6
 
 
 
+#
+# Prefer libedit
+#
+
+
+
+# Check whether --with-libedit-preferred or --without-libedit-preferred was given.
+if test "${with_libedit_preferred+set}" = set; then
+  withval="$with_libedit_preferred"
+
+  case $withval in
+    yes)
+      :
+      ;;
+    no)
+      :
+      ;;
+    *)
+      { { echo "$as_me:$LINENO: error: no argument expected for --with-libedit-preferred option" >&5
+echo "$as_me: error: no argument expected for --with-libedit-preferred option" >&2;}
+   { (exit 1); exit 1; }; }
+      ;;
+  esac
+
+else
+  with_libedit_preferred=no
+
+fi;
+
+
+
 #
 # Readline
 #
@@ -4331,46 +4403,6 @@ else
   RANLIB="$ac_cv_prog_RANLIB"
 fi
 
-for ac_prog in lorder
-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 "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_LORDER+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$LORDER"; then
-  ac_cv_prog_LORDER="$LORDER" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_LORDER="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-fi
-fi
-LORDER=$ac_cv_prog_LORDER
-if test -n "$LORDER"; then
-  echo "$as_me:$LINENO: result: $LORDER" >&5
-echo "${ECHO_T}$LORDER" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  test -n "$LORDER" && break
-done
-
 # Extract the first word of "tar", so it can be a program name with args.
 set dummy tar; ac_word=$2
 echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -4743,23 +4775,50 @@ echo "$as_me:$LINENO: result: ${python_libspec} ${python_additional_libs}" >&5
 echo "${ECHO_T}${python_libspec} ${python_additional_libs}" >&6
 
 
+# threaded python is not supported on bsd's
+echo "$as_me:$LINENO: checking whether Python is compiled with thread support" >&5
+echo $ECHO_N "checking whether Python is compiled with thread support... $ECHO_C" >&6
+pythreads=`${PYTHON} -c "import sys; print int('thread' in sys.builtin_module_names)"`
+if test "$pythreads" = "1"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  case $host_os in
+  openbsd*|freebsd4*)
+    { { echo "$as_me:$LINENO: error: *** Threaded Python not supported on this platform ***" >&5
+echo "$as_me: error: *** Threaded Python not supported on this platform ***" >&2;}
+   { (exit 1); exit 1; }; }
+    ;;
+  esac
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
 fi
 
+# Supply a numeric version string for use by 3rd party add-ons
+# awk -F is a regex on some platforms, and not on others, so make "." a tab
+PG_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/A-Za-z.*$//' |
+tr '.' '       ' |
+$AWK '{printf \"%d%02d%02d\", $1, $2, (NF >= 3) ? $3 : 0}'`"
+
+cat >>confdefs.h <<_ACEOF
+#define PG_VERSION_NUM $PG_VERSION_NUM
+_ACEOF
+
 
 ##
 ## Libraries
 ##
 
-if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
-then
-
-echo "$as_me:$LINENO: checking for main in -lbsd" >&5
-echo $ECHO_N "checking for main in -lbsd... $ECHO_C" >&6
-if test "${ac_cv_lib_bsd_main+set}" = set; then
+echo "$as_me:$LINENO: checking for library containing setproctitle" >&5
+echo $ECHO_N "checking for library containing setproctitle... $ECHO_C" >&6
+if test "${ac_cv_search_setproctitle+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lbsd  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_setproctitle=no
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -4767,11 +4826,17 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char setproctitle ();
 int
 main ()
 {
-main ();
+setproctitle ();
   ;
   return 0;
 }
@@ -4798,38 +4863,18 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_bsd_main=yes
+  ac_cv_search_setproctitle="none required"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_bsd_main=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_main" >&5
-echo "${ECHO_T}$ac_cv_lib_bsd_main" >&6
-if test $ac_cv_lib_bsd_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBBSD 1
-_ACEOF
-
-  LIBS="-lbsd $LIBS"
-
-fi
-
-fi
-
-echo "$as_me:$LINENO: checking for setproctitle in -lutil" >&5
-echo $ECHO_N "checking for setproctitle in -lutil... $ECHO_C" >&6
-if test "${ac_cv_lib_util_setproctitle+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lutil  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+if test "$ac_cv_search_setproctitle" = no; then
+  for ac_lib in util; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4873,36 +4918,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_util_setproctitle=yes
+  ac_cv_search_setproctitle="-l$ac_lib"
+break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_util_setproctitle=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  done
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_util_setproctitle" >&5
-echo "${ECHO_T}$ac_cv_lib_util_setproctitle" >&6
-if test $ac_cv_lib_util_setproctitle = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBUTIL 1
-_ACEOF
-
-  LIBS="-lutil $LIBS"
-
+LIBS=$ac_func_search_save_LIBS
 fi
+echo "$as_me:$LINENO: result: $ac_cv_search_setproctitle" >&5
+echo "${ECHO_T}$ac_cv_search_setproctitle" >&6
+if test "$ac_cv_search_setproctitle" != no; then
+  test "$ac_cv_search_setproctitle" = "none required" || LIBS="$ac_cv_search_setproctitle $LIBS"
 
+fi
 
-echo "$as_me:$LINENO: checking for main in -lm" >&5
-echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6
-if test "${ac_cv_lib_m_main+set}" = set; then
+echo "$as_me:$LINENO: checking for library containing pow" >&5
+echo $ECHO_N "checking for library containing pow... $ECHO_C" >&6
+if test "${ac_cv_search_pow+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_pow=no
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -4910,11 +4952,17 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char pow ();
 int
 main ()
 {
-main ();
+pow ();
   ;
   return 0;
 }
@@ -4941,48 +4989,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_m_main=yes
+  ac_cv_search_pow="none required"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_m_main=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5
-echo "${ECHO_T}$ac_cv_lib_m_main" >&6
-if test $ac_cv_lib_m_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBM 1
-_ACEOF
-
-  LIBS="-lm $LIBS"
-
-fi
-
-
-echo "$as_me:$LINENO: checking for main in -ldl" >&5
-echo $ECHO_N "checking for main in -ldl... $ECHO_C" >&6
-if test "${ac_cv_lib_dl_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+if test "$ac_cv_search_pow" = no; then
+  for ac_lib in m; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char pow ();
 int
 main ()
 {
-main ();
+pow ();
   ;
   return 0;
 }
@@ -5009,36 +5044,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_dl_main=yes
+  ac_cv_search_pow="-l$ac_lib"
+break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_dl_main=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  done
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dl_main" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_main" >&6
-if test $ac_cv_lib_dl_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDL 1
-_ACEOF
-
-  LIBS="-ldl $LIBS"
-
+LIBS=$ac_func_search_save_LIBS
 fi
+echo "$as_me:$LINENO: result: $ac_cv_search_pow" >&5
+echo "${ECHO_T}$ac_cv_search_pow" >&6
+if test "$ac_cv_search_pow" != no; then
+  test "$ac_cv_search_pow" = "none required" || LIBS="$ac_cv_search_pow $LIBS"
 
+fi
 
-echo "$as_me:$LINENO: checking for main in -lnsl" >&5
-echo $ECHO_N "checking for main in -lnsl... $ECHO_C" >&6
-if test "${ac_cv_lib_nsl_main+set}" = set; then
+echo "$as_me:$LINENO: checking for library containing dlopen" >&5
+echo $ECHO_N "checking for library containing dlopen... $ECHO_C" >&6
+if test "${ac_cv_search_dlopen+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnsl  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_dlopen=no
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5046,11 +5078,17 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
 int
 main ()
 {
-main ();
+dlopen ();
   ;
   return 0;
 }
@@ -5077,48 +5115,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_nsl_main=yes
+  ac_cv_search_dlopen="none required"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_nsl_main=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_main" >&5
-echo "${ECHO_T}$ac_cv_lib_nsl_main" >&6
-if test $ac_cv_lib_nsl_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBNSL 1
-_ACEOF
-
-  LIBS="-lnsl $LIBS"
-
-fi
-
-
-echo "$as_me:$LINENO: checking for main in -lsocket" >&5
-echo $ECHO_N "checking for main in -lsocket... $ECHO_C" >&6
-if test "${ac_cv_lib_socket_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+if test "$ac_cv_search_dlopen" = no; then
+  for ac_lib in dl; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
 int
 main ()
 {
-main ();
+dlopen ();
   ;
   return 0;
 }
@@ -5145,36 +5170,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_socket_main=yes
+  ac_cv_search_dlopen="-l$ac_lib"
+break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_socket_main=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  done
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_socket_main" >&5
-echo "${ECHO_T}$ac_cv_lib_socket_main" >&6
-if test $ac_cv_lib_socket_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBSOCKET 1
-_ACEOF
-
-  LIBS="-lsocket $LIBS"
-
+LIBS=$ac_func_search_save_LIBS
 fi
+echo "$as_me:$LINENO: result: $ac_cv_search_dlopen" >&5
+echo "${ECHO_T}$ac_cv_search_dlopen" >&6
+if test "$ac_cv_search_dlopen" != no; then
+  test "$ac_cv_search_dlopen" = "none required" || LIBS="$ac_cv_search_dlopen $LIBS"
 
+fi
 
-echo "$as_me:$LINENO: checking for main in -lipc" >&5
-echo $ECHO_N "checking for main in -lipc... $ECHO_C" >&6
-if test "${ac_cv_lib_ipc_main+set}" = set; then
+echo "$as_me:$LINENO: checking for library containing socket" >&5
+echo $ECHO_N "checking for library containing socket... $ECHO_C" >&6
+if test "${ac_cv_search_socket+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lipc  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_socket=no
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5182,11 +5204,17 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char socket ();
 int
 main ()
 {
-main ();
+socket ();
   ;
   return 0;
 }
@@ -5213,116 +5241,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_ipc_main=yes
+  ac_cv_search_socket="none required"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_ipc_main=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_main" >&5
-echo "${ECHO_T}$ac_cv_lib_ipc_main" >&6
-if test $ac_cv_lib_ipc_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBIPC 1
-_ACEOF
-
-  LIBS="-lipc $LIBS"
-
-fi
-
-
-echo "$as_me:$LINENO: checking for main in -lIPC" >&5
-echo $ECHO_N "checking for main in -lIPC... $ECHO_C" >&6
-if test "${ac_cv_lib_IPC_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lIPC  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+if test "$ac_cv_search_socket" = no; then
+  for ac_lib in socket wsock32; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
-int
-main ()
-{
-main ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_IPC_main=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_IPC_main=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_IPC_main" >&5
-echo "${ECHO_T}$ac_cv_lib_IPC_main" >&6
-if test $ac_cv_lib_IPC_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBIPC 1
-_ACEOF
-
-  LIBS="-lIPC $LIBS"
-
-fi
-
-
-echo "$as_me:$LINENO: checking for main in -llc" >&5
-echo $ECHO_N "checking for main in -llc... $ECHO_C" >&6
-if test "${ac_cv_lib_lc_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-llc  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char socket ();
 int
 main ()
 {
-main ();
+socket ();
   ;
   return 0;
 }
@@ -5349,104 +5296,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_lc_main=yes
+  ac_cv_search_socket="-l$ac_lib"
+break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_lc_main=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_lc_main" >&5
-echo "${ECHO_T}$ac_cv_lib_lc_main" >&6
-if test $ac_cv_lib_lc_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBLC 1
-_ACEOF
-
-  LIBS="-llc $LIBS"
-
-fi
-
-
-echo "$as_me:$LINENO: checking for main in -ldld" >&5
-echo $ECHO_N "checking for main in -ldld... $ECHO_C" >&6
-if test "${ac_cv_lib_dld_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-main ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_dld_main=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_dld_main=no
+  done
 fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+LIBS=$ac_func_search_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dld_main" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_main" >&6
-if test $ac_cv_lib_dld_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDLD 1
-_ACEOF
-
-  LIBS="-ldld $LIBS"
+echo "$as_me:$LINENO: result: $ac_cv_search_socket" >&5
+echo "${ECHO_T}$ac_cv_search_socket" >&6
+if test "$ac_cv_search_socket" != no; then
+  test "$ac_cv_search_socket" = "none required" || LIBS="$ac_cv_search_socket $LIBS"
 
 fi
 
-
-echo "$as_me:$LINENO: checking for main in -lld" >&5
-echo $ECHO_N "checking for main in -lld... $ECHO_C" >&6
-if test "${ac_cv_lib_ld_main+set}" = set; then
+echo "$as_me:$LINENO: checking for library containing shl_load" >&5
+echo $ECHO_N "checking for library containing shl_load... $ECHO_C" >&6
+if test "${ac_cv_search_shl_load+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lld  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_shl_load=no
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5454,11 +5330,17 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shl_load ();
 int
 main ()
 {
-main ();
+shl_load ();
   ;
   return 0;
 }
@@ -5485,48 +5367,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_ld_main=yes
+  ac_cv_search_shl_load="none required"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_ld_main=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_ld_main" >&5
-echo "${ECHO_T}$ac_cv_lib_ld_main" >&6
-if test $ac_cv_lib_ld_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBLD 1
-_ACEOF
-
-  LIBS="-lld $LIBS"
-
-fi
-
-
-echo "$as_me:$LINENO: checking for main in -lcompat" >&5
-echo $ECHO_N "checking for main in -lcompat... $ECHO_C" >&6
-if test "${ac_cv_lib_compat_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcompat  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+if test "$ac_cv_search_shl_load" = no; then
+  for ac_lib in dld; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shl_load ();
 int
 main ()
 {
-main ();
+shl_load ();
   ;
   return 0;
 }
@@ -5553,104 +5422,36 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_compat_main=yes
+  ac_cv_search_shl_load="-l$ac_lib"
+break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_compat_main=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  done
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_compat_main" >&5
-echo "${ECHO_T}$ac_cv_lib_compat_main" >&6
-if test $ac_cv_lib_compat_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBCOMPAT 1
-_ACEOF
-
-  LIBS="-lcompat $LIBS"
-
+LIBS=$ac_func_search_save_LIBS
 fi
+echo "$as_me:$LINENO: result: $ac_cv_search_shl_load" >&5
+echo "${ECHO_T}$ac_cv_search_shl_load" >&6
+if test "$ac_cv_search_shl_load" != no; then
+  test "$ac_cv_search_shl_load" = "none required" || LIBS="$ac_cv_search_shl_load $LIBS"
 
-
-echo "$as_me:$LINENO: checking for main in -lBSD" >&5
-echo $ECHO_N "checking for main in -lBSD... $ECHO_C" >&6
-if test "${ac_cv_lib_BSD_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lBSD  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-main ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_BSD_main=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_BSD_main=no
 fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_BSD_main" >&5
-echo "${ECHO_T}$ac_cv_lib_BSD_main" >&6
-if test $ac_cv_lib_BSD_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBBSD 1
-_ACEOF
-
-  LIBS="-lBSD $LIBS"
 
-fi
-
-
-echo "$as_me:$LINENO: checking for main in -lgen" >&5
-echo $ECHO_N "checking for main in -lgen... $ECHO_C" >&6
-if test "${ac_cv_lib_gen_main+set}" = set; then
+# We only use libld in port/dynloader/aix.c
+case $host_os in
+     aix*)
+       echo "$as_me:$LINENO: checking for library containing ldopen" >&5
+echo $ECHO_N "checking for library containing ldopen... $ECHO_C" >&6
+if test "${ac_cv_search_ldopen+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgen  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_ldopen=no
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5658,11 +5459,17 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char ldopen ();
 int
 main ()
 {
-main ();
+ldopen ();
   ;
   return 0;
 }
@@ -5689,48 +5496,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_gen_main=yes
+  ac_cv_search_ldopen="none required"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_gen_main=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_gen_main" >&5
-echo "${ECHO_T}$ac_cv_lib_gen_main" >&6
-if test $ac_cv_lib_gen_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBGEN 1
-_ACEOF
-
-  LIBS="-lgen $LIBS"
-
-fi
-
-
-echo "$as_me:$LINENO: checking for main in -lPW" >&5
-echo $ECHO_N "checking for main in -lPW... $ECHO_C" >&6
-if test "${ac_cv_lib_PW_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lPW  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+if test "$ac_cv_search_ldopen" = no; then
+  for ac_lib in ld; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char ldopen ();
 int
 main ()
 {
-main ();
+ldopen ();
   ;
   return 0;
 }
@@ -5757,96 +5551,28 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_PW_main=yes
+  ac_cv_search_ldopen="-l$ac_lib"
+break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_PW_main=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_PW_main" >&5
-echo "${ECHO_T}$ac_cv_lib_PW_main" >&6
-if test $ac_cv_lib_PW_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPW 1
-_ACEOF
-
-  LIBS="-lPW $LIBS"
-
-fi
-
-
-echo "$as_me:$LINENO: checking for main in -lresolv" >&5
-echo $ECHO_N "checking for main in -lresolv... $ECHO_C" >&6
-if test "${ac_cv_lib_resolv_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lresolv  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-main ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_resolv_main=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_resolv_main=no
+  done
 fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+LIBS=$ac_func_search_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_main" >&5
-echo "${ECHO_T}$ac_cv_lib_resolv_main" >&6
-if test $ac_cv_lib_resolv_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBRESOLV 1
-_ACEOF
-
-  LIBS="-lresolv $LIBS"
+echo "$as_me:$LINENO: result: $ac_cv_search_ldopen" >&5
+echo "${ECHO_T}$ac_cv_search_ldopen" >&6
+if test "$ac_cv_search_ldopen" != no; then
+  test "$ac_cv_search_ldopen" = "none required" || LIBS="$ac_cv_search_ldopen $LIBS"
 
 fi
 
+       ;;
+esac
 echo "$as_me:$LINENO: checking for library containing getopt_long" >&5
 echo $ECHO_N "checking for library containing getopt_long... $ECHO_C" >&6
 if test "${ac_cv_search_getopt_long+set}" = set; then
@@ -5973,138 +5699,14 @@ if test "$ac_cv_search_getopt_long" != no; then
 
 fi
 
-# QNX:
-
-echo "$as_me:$LINENO: checking for main in -lunix" >&5
-echo $ECHO_N "checking for main in -lunix... $ECHO_C" >&6
-if test "${ac_cv_lib_unix_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lunix  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-main ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_unix_main=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_unix_main=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_unix_main" >&5
-echo "${ECHO_T}$ac_cv_lib_unix_main" >&6
-if test $ac_cv_lib_unix_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBUNIX 1
-_ACEOF
-
-  LIBS="-lunix $LIBS"
-
-fi
-
 echo "$as_me:$LINENO: checking for library containing crypt" >&5
-echo $ECHO_N "checking for library containing crypt... $ECHO_C" >&6
-if test "${ac_cv_search_crypt+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-ac_cv_search_crypt=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char crypt ();
-int
-main ()
-{
-crypt ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_crypt="none required"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_crypt" = no; then
-  for ac_lib in crypt; do
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-    cat >conftest.$ac_ext <<_ACEOF
+echo $ECHO_N "checking for library containing crypt... $ECHO_C" >&6
+if test "${ac_cv_search_crypt+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_crypt=no
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -6148,8 +5750,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_search_crypt="-l$ac_lib"
-break
+  ac_cv_search_crypt="none required"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
@@ -6157,29 +5758,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-  done
-fi
-LIBS=$ac_func_search_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_search_crypt" >&5
-echo "${ECHO_T}$ac_cv_search_crypt" >&6
-if test "$ac_cv_search_crypt" != no; then
-  test "$ac_cv_search_crypt" = "none required" || LIBS="$ac_cv_search_crypt $LIBS"
-
-fi
-
-# BeOS:
-if test "$PORTNAME" = "beos"
-then
-
-echo "$as_me:$LINENO: checking for __inet_ntoa in -lbind" >&5
-echo $ECHO_N "checking for __inet_ntoa in -lbind... $ECHO_C" >&6
-if test "${ac_cv_lib_bind___inet_ntoa+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lbind  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+if test "$ac_cv_search_crypt" = no; then
+  for ac_lib in crypt; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -6192,11 +5774,11 @@ extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char __inet_ntoa ();
+char crypt ();
 int
 main ()
 {
-__inet_ntoa ();
+crypt ();
   ;
   return 0;
 }
@@ -6223,29 +5805,26 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_bind___inet_ntoa=yes
+  ac_cv_search_crypt="-l$ac_lib"
+break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_bind___inet_ntoa=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  done
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_bind___inet_ntoa" >&5
-echo "${ECHO_T}$ac_cv_lib_bind___inet_ntoa" >&6
-if test $ac_cv_lib_bind___inet_ntoa = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBBIND 1
-_ACEOF
-
-  LIBS="-lbind $LIBS"
-
+LIBS=$ac_func_search_save_LIBS
 fi
+echo "$as_me:$LINENO: result: $ac_cv_search_crypt" >&5
+echo "${ECHO_T}$ac_cv_search_crypt" >&6
+if test "$ac_cv_search_crypt" != no; then
+  test "$ac_cv_search_crypt" = "none required" || LIBS="$ac_cv_search_crypt $LIBS"
 
 fi
+
 # Solaris:
 echo "$as_me:$LINENO: checking for library containing fdatasync" >&5
 echo $ECHO_N "checking for library containing fdatasync... $ECHO_C" >&6
@@ -6374,14 +5953,13 @@ if test "$ac_cv_search_fdatasync" != no; then
 fi
 
 # Cygwin:
-
-echo "$as_me:$LINENO: checking for shmget in -lcygipc" >&5
-echo $ECHO_N "checking for shmget in -lcygipc... $ECHO_C" >&6
-if test "${ac_cv_lib_cygipc_shmget+set}" = set; then
+echo "$as_me:$LINENO: checking for library containing shmget" >&5
+echo $ECHO_N "checking for library containing shmget... $ECHO_C" >&6
+if test "${ac_cv_search_shmget+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcygipc  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_shmget=no
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -6426,51 +6004,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_cygipc_shmget=yes
+  ac_cv_search_shmget="none required"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_cygipc_shmget=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_cygipc_shmget" >&5
-echo "${ECHO_T}$ac_cv_lib_cygipc_shmget" >&6
-if test $ac_cv_lib_cygipc_shmget = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBCYGIPC 1
-_ACEOF
-
-  LIBS="-lcygipc $LIBS"
-
-fi
-
-# WIN32:
-if test "$PORTNAME" = "win32"
-then
-
-echo "$as_me:$LINENO: checking for main in -lwsock32" >&5
-echo $ECHO_N "checking for main in -lwsock32... $ECHO_C" >&6
-if test "${ac_cv_lib_wsock32_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lwsock32  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+if test "$ac_cv_search_shmget" = no; then
+  for ac_lib in cygipc; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shmget ();
 int
 main ()
 {
-main ();
+shmget ();
   ;
   return 0;
 }
@@ -6497,41 +6059,42 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_wsock32_main=yes
+  ac_cv_search_shmget="-l$ac_lib"
+break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_wsock32_main=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  done
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_wsock32_main" >&5
-echo "${ECHO_T}$ac_cv_lib_wsock32_main" >&6
-if test $ac_cv_lib_wsock32_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBWSOCK32 1
-_ACEOF
-
-  LIBS="-lwsock32 $LIBS"
-
+LIBS=$ac_func_search_save_LIBS
 fi
+echo "$as_me:$LINENO: result: $ac_cv_search_shmget" >&5
+echo "${ECHO_T}$ac_cv_search_shmget" >&6
+if test "$ac_cv_search_shmget" != no; then
+  test "$ac_cv_search_shmget" = "none required" || LIBS="$ac_cv_search_shmget $LIBS"
 
 fi
 
+
 if test "$with_readline" = yes; then
 
-echo "$as_me:$LINENO: checking for readline" >&5
-echo $ECHO_N "checking for readline... $ECHO_C" >&6
 
 if test "${pgac_cv_check_readline+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   pgac_cv_check_readline=no
 pgac_save_LIBS=$LIBS
-for pgac_rllib in -lreadline -ledit ; do
+if test x"$with_libedit_preferred" != x"yes"
+then   READLINE_ORDER="-lreadline -ledit"
+else   READLINE_ORDER="-ledit -lreadline"
+fi
+for pgac_rllib in $READLINE_ORDER ; do
+  echo "$as_me:$LINENO: checking for ${pgac_rllib}" >&5
+echo $ECHO_N "checking for ${pgac_rllib}... $ECHO_C" >&6
   for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
     LIBS="${pgac_rllib}${pgac_lib} $pgac_save_LIBS"
     cat >conftest.$ac_ext <<_ACEOF
@@ -6590,7 +6153,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
       esac
 
       pgac_cv_check_readline="${pgac_rllib}${pgac_lib}"
-      break 2
+      break
 
 else
   echo "$as_me: failed program was:" >&5
@@ -6600,24 +6163,29 @@ fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
   done
+  if test "$pgac_cv_check_readline" != no ; then
+    echo "$as_me:$LINENO: result: yes ($pgac_cv_check_readline)" >&5
+echo "${ECHO_T}yes ($pgac_cv_check_readline)" >&6
+    break
+  else
+    echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  fi
 done
 LIBS=$pgac_save_LIBS
 
 fi
 
 if test "$pgac_cv_check_readline" != no ; then
+  LIBS="$pgac_cv_check_readline $LIBS"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_LIBREADLINE 1
 _ACEOF
 
-  LIBS="$pgac_cv_check_readline $LIBS"
-  echo "$as_me:$LINENO: result: yes ($pgac_cv_check_readline)" >&5
-echo "${ECHO_T}yes ($pgac_cv_check_readline)" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
 fi
+
+
   if test x"$pgac_cv_check_readline" = x"no"; then
     { { echo "$as_me:$LINENO: error: readline library not found
 If you have readline already installed, see config.log for details on the
@@ -7326,25 +6894,182 @@ echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_CRYPTO_new_ex_data" >&5
 echo "${ECHO_T}$ac_cv_lib_crypto_CRYPTO_new_ex_data" >&6
 if test $ac_cv_lib_crypto_CRYPTO_new_ex_data = yes; then
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBCRYPTO 1
+#define HAVE_LIBCRYPTO 1
+_ACEOF
+
+  LIBS="-lcrypto $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error: library 'crypto' is required for OpenSSL" >&5
+echo "$as_me: error: library 'crypto' is required for OpenSSL" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+echo "$as_me:$LINENO: checking for SSL_library_init in -lssl" >&5
+echo $ECHO_N "checking for SSL_library_init in -lssl... $ECHO_C" >&6
+if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lssl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char SSL_library_init ();
+int
+main ()
+{
+SSL_library_init ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_ssl_SSL_library_init=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_ssl_SSL_library_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_library_init" >&5
+echo "${ECHO_T}$ac_cv_lib_ssl_SSL_library_init" >&6
+if test $ac_cv_lib_ssl_SSL_library_init = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSSL 1
+_ACEOF
+
+  LIBS="-lssl $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error: library 'ssl' is required for OpenSSL" >&5
+echo "$as_me: error: library 'ssl' is required for OpenSSL" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+  else
+
+echo "$as_me:$LINENO: checking for CRYPTO_new_ex_data in -leay32" >&5
+echo $ECHO_N "checking for CRYPTO_new_ex_data in -leay32... $ECHO_C" >&6
+if test "${ac_cv_lib_eay32_CRYPTO_new_ex_data+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-leay32  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char CRYPTO_new_ex_data ();
+int
+main ()
+{
+CRYPTO_new_ex_data ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_eay32_CRYPTO_new_ex_data=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_eay32_CRYPTO_new_ex_data=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_eay32_CRYPTO_new_ex_data" >&5
+echo "${ECHO_T}$ac_cv_lib_eay32_CRYPTO_new_ex_data" >&6
+if test $ac_cv_lib_eay32_CRYPTO_new_ex_data = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBEAY32 1
 _ACEOF
 
-  LIBS="-lcrypto $LIBS"
+  LIBS="-leay32 $LIBS"
 
 else
-  { { echo "$as_me:$LINENO: error: library 'crypto' is required for OpenSSL" >&5
-echo "$as_me: error: library 'crypto' is required for OpenSSL" >&2;}
+  { { echo "$as_me:$LINENO: error: library 'eay32' is required for OpenSSL" >&5
+echo "$as_me: error: library 'eay32' is required for OpenSSL" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
 
-echo "$as_me:$LINENO: checking for SSL_library_init in -lssl" >&5
-echo $ECHO_N "checking for SSL_library_init in -lssl... $ECHO_C" >&6
-if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then
+echo "$as_me:$LINENO: checking for SSL_library_init in -lssleay32" >&5
+echo $ECHO_N "checking for SSL_library_init in -lssleay32... $ECHO_C" >&6
+if test "${ac_cv_lib_ssleay32_SSL_library_init+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lssl  $LIBS"
+LIBS="-lssleay32  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7389,41 +7114,44 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_ssl_SSL_library_init=yes
+  ac_cv_lib_ssleay32_SSL_library_init=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_ssl_SSL_library_init=no
+ac_cv_lib_ssleay32_SSL_library_init=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_library_init" >&5
-echo "${ECHO_T}$ac_cv_lib_ssl_SSL_library_init" >&6
-if test $ac_cv_lib_ssl_SSL_library_init = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_ssleay32_SSL_library_init" >&5
+echo "${ECHO_T}$ac_cv_lib_ssleay32_SSL_library_init" >&6
+if test $ac_cv_lib_ssleay32_SSL_library_init = yes; then
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBSSL 1
+#define HAVE_LIBSSLEAY32 1
 _ACEOF
 
-  LIBS="-lssl $LIBS"
+  LIBS="-lssleay32 $LIBS"
 
 else
-  { { echo "$as_me:$LINENO: error: library 'ssl' is required for OpenSSL" >&5
-echo "$as_me: error: library 'ssl' is required for OpenSSL" >&2;}
+  { { echo "$as_me:$LINENO: error: library 'ssleay32' is required for OpenSSL" >&5
+echo "$as_me: error: library 'ssleay32' is required for OpenSSL" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
-  else
+  fi
+fi
 
-echo "$as_me:$LINENO: checking for CRYPTO_new_ex_data in -leay32" >&5
-echo $ECHO_N "checking for CRYPTO_new_ex_data in -leay32... $ECHO_C" >&6
-if test "${ac_cv_lib_eay32_CRYPTO_new_ex_data+set}" = set; then
+if test "$with_pam" = yes ; then
+
+echo "$as_me:$LINENO: checking for pam_start in -lpam" >&5
+echo $ECHO_N "checking for pam_start in -lpam... $ECHO_C" >&6
+if test "${ac_cv_lib_pam_pam_start+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-leay32  $LIBS"
+LIBS="-lpam  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7437,11 +7165,11 @@ extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char CRYPTO_new_ex_data ();
+char pam_start ();
 int
 main ()
 {
-CRYPTO_new_ex_data ();
+pam_start ();
   ;
   return 0;
 }
@@ -7468,40 +7196,45 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_eay32_CRYPTO_new_ex_data=yes
+  ac_cv_lib_pam_pam_start=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_eay32_CRYPTO_new_ex_data=no
+ac_cv_lib_pam_pam_start=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_eay32_CRYPTO_new_ex_data" >&5
-echo "${ECHO_T}$ac_cv_lib_eay32_CRYPTO_new_ex_data" >&6
-if test $ac_cv_lib_eay32_CRYPTO_new_ex_data = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_pam_pam_start" >&5
+echo "${ECHO_T}$ac_cv_lib_pam_pam_start" >&6
+if test $ac_cv_lib_pam_pam_start = yes; then
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBEAY32 1
+#define HAVE_LIBPAM 1
 _ACEOF
 
-  LIBS="-leay32 $LIBS"
+  LIBS="-lpam $LIBS"
 
 else
-  { { echo "$as_me:$LINENO: error: library 'eay32' is required for OpenSSL" >&5
-echo "$as_me: error: library 'eay32' is required for OpenSSL" >&2;}
+  { { echo "$as_me:$LINENO: error: library 'pam' is required for PAM" >&5
+echo "$as_me: error: library 'pam' is required for PAM" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
+fi
 
-echo "$as_me:$LINENO: checking for SSL_library_init in -lssleay32" >&5
-echo $ECHO_N "checking for SSL_library_init in -lssleay32... $ECHO_C" >&6
-if test "${ac_cv_lib_ssleay32_SSL_library_init+set}" = set; then
+
+if test "$with_ldap" = yes ; then
+  if test "$PORTNAME" != "win32"; then
+
+echo "$as_me:$LINENO: checking for ldap_bind in -lldap" >&5
+echo $ECHO_N "checking for ldap_bind in -lldap... $ECHO_C" >&6
+if test "${ac_cv_lib_ldap_ldap_bind+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lssleay32  $LIBS"
+LIBS="-lldap  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7515,11 +7248,11 @@ extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char SSL_library_init ();
+char ldap_bind ();
 int
 main ()
 {
-SSL_library_init ();
+ldap_bind ();
   ;
   return 0;
 }
@@ -7546,44 +7279,41 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_ssleay32_SSL_library_init=yes
+  ac_cv_lib_ldap_ldap_bind=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_ssleay32_SSL_library_init=no
+ac_cv_lib_ldap_ldap_bind=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_ssleay32_SSL_library_init" >&5
-echo "${ECHO_T}$ac_cv_lib_ssleay32_SSL_library_init" >&6
-if test $ac_cv_lib_ssleay32_SSL_library_init = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_ldap_ldap_bind" >&5
+echo "${ECHO_T}$ac_cv_lib_ldap_ldap_bind" >&6
+if test $ac_cv_lib_ldap_ldap_bind = yes; then
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBSSLEAY32 1
+#define HAVE_LIBLDAP 1
 _ACEOF
 
-  LIBS="-lssleay32 $LIBS"
+  LIBS="-lldap $LIBS"
 
 else
-  { { echo "$as_me:$LINENO: error: library 'ssleay32' is required for OpenSSL" >&5
-echo "$as_me: error: library 'ssleay32' is required for OpenSSL" >&2;}
+  { { echo "$as_me:$LINENO: error: library 'ldap' is required for LDAP" >&5
+echo "$as_me: error: library 'ldap' is required for LDAP" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
-  fi
-fi
-
-if test "$with_pam" = yes ; then
+  else
 
-echo "$as_me:$LINENO: checking for pam_start in -lpam" >&5
-echo $ECHO_N "checking for pam_start in -lpam... $ECHO_C" >&6
-if test "${ac_cv_lib_pam_pam_start+set}" = set; then
+echo "$as_me:$LINENO: checking for ldap_bind in -lwldap32" >&5
+echo $ECHO_N "checking for ldap_bind in -lwldap32... $ECHO_C" >&6
+if test "${ac_cv_lib_wldap32_ldap_bind+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpam  $LIBS"
+LIBS="-lwldap32  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7597,11 +7327,11 @@ extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char pam_start ();
+char ldap_bind ();
 int
 main ()
 {
-pam_start ();
+ldap_bind ();
   ;
   return 0;
 }
@@ -7628,35 +7358,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_pam_pam_start=yes
+  ac_cv_lib_wldap32_ldap_bind=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_pam_pam_start=no
+ac_cv_lib_wldap32_ldap_bind=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_pam_pam_start" >&5
-echo "${ECHO_T}$ac_cv_lib_pam_pam_start" >&6
-if test $ac_cv_lib_pam_pam_start = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_wldap32_ldap_bind" >&5
+echo "${ECHO_T}$ac_cv_lib_wldap32_ldap_bind" >&6
+if test $ac_cv_lib_wldap32_ldap_bind = yes; then
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPAM 1
+#define HAVE_LIBWLDAP32 1
 _ACEOF
 
-  LIBS="-lpam $LIBS"
+  LIBS="-lwldap32 $LIBS"
 
 else
-  { { echo "$as_me:$LINENO: error: library 'pam' is required for PAM" >&5
-echo "$as_me: error: library 'pam' is required for PAM" >&2;}
+  { { echo "$as_me:$LINENO: error: library 'wldap32' is required for LDAP" >&5
+echo "$as_me: error: library 'wldap32' is required for LDAP" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
+  fi
 fi
 
-
 ##
 ## Header files
 ##
@@ -10286,31 +10016,184 @@ if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
 else
   ac_cv_header_openssl_ssl_h=$ac_header_preproc
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_openssl_ssl_h" >&5
-echo "${ECHO_T}$ac_cv_header_openssl_ssl_h" >&6
+echo "$as_me:$LINENO: result: $ac_cv_header_openssl_ssl_h" >&5
+echo "${ECHO_T}$ac_cv_header_openssl_ssl_h" >&6
+
+fi
+if test $ac_cv_header_openssl_ssl_h = yes; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: header file <openssl/ssl.h> is required for OpenSSL" >&5
+echo "$as_me: error: header file <openssl/ssl.h> is required for OpenSSL" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+  if test "${ac_cv_header_openssl_err_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for openssl/err.h" >&5
+echo $ECHO_N "checking for openssl/err.h... $ECHO_C" >&6
+if test "${ac_cv_header_openssl_err_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_openssl_err_h" >&5
+echo "${ECHO_T}$ac_cv_header_openssl_err_h" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking openssl/err.h usability" >&5
+echo $ECHO_N "checking openssl/err.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <openssl/err.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking openssl/err.h presence" >&5
+echo $ECHO_N "checking openssl/err.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <openssl/err.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: openssl/err.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: openssl/err.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/err.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: openssl/err.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: openssl/err.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: openssl/err.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/err.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: openssl/err.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/err.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: openssl/err.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/err.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: openssl/err.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/err.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: openssl/err.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/err.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: openssl/err.h: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ---------------------------------------- ##
+## Report this to pgsql-bugs@postgresql.org ##
+## ---------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for openssl/err.h" >&5
+echo $ECHO_N "checking for openssl/err.h... $ECHO_C" >&6
+if test "${ac_cv_header_openssl_err_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_openssl_err_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_openssl_err_h" >&5
+echo "${ECHO_T}$ac_cv_header_openssl_err_h" >&6
 
 fi
-if test $ac_cv_header_openssl_ssl_h = yes; then
+if test $ac_cv_header_openssl_err_h = yes; then
   :
 else
-  { { echo "$as_me:$LINENO: error: header file <openssl/ssl.h> is required for OpenSSL" >&5
-echo "$as_me: error: header file <openssl/ssl.h> is required for OpenSSL" >&2;}
+  { { echo "$as_me:$LINENO: error: header file <openssl/err.h> is required for OpenSSL" >&5
+echo "$as_me: error: header file <openssl/err.h> is required for OpenSSL" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
 
-  if test "${ac_cv_header_openssl_err_h+set}" = set; then
-  echo "$as_me:$LINENO: checking for openssl/err.h" >&5
-echo $ECHO_N "checking for openssl/err.h... $ECHO_C" >&6
-if test "${ac_cv_header_openssl_err_h+set}" = set; then
+fi
+
+if test "$with_pam" = yes ; then
+
+for ac_header in security/pam_appl.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_openssl_err_h" >&5
-echo "${ECHO_T}$ac_cv_header_openssl_err_h" >&6
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking openssl/err.h usability" >&5
-echo $ECHO_N "checking openssl/err.h usability... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -10318,7 +10201,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <openssl/err.h>
+#include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -10354,15 +10237,15 @@ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
 # Is the header present?
-echo "$as_me:$LINENO: checking openssl/err.h presence" >&5
-echo $ECHO_N "checking openssl/err.h presence... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <openssl/err.h>
+#include <$ac_header>
 _ACEOF
 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -10396,25 +10279,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: openssl/err.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: openssl/err.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openssl/err.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: openssl/err.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: openssl/err.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: openssl/err.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openssl/err.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: openssl/err.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openssl/err.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: openssl/err.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openssl/err.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: openssl/err.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openssl/err.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: openssl/err.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openssl/err.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: openssl/err.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
 ## ---------------------------------------- ##
@@ -10425,31 +10308,25 @@ _ASBOX
       sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
-echo "$as_me:$LINENO: checking for openssl/err.h" >&5
-echo $ECHO_N "checking for openssl/err.h... $ECHO_C" >&6
-if test "${ac_cv_header_openssl_err_h+set}" = set; then
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_openssl_err_h=$ac_header_preproc
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_openssl_err_h" >&5
-echo "${ECHO_T}$ac_cv_header_openssl_err_h" >&6
-
-fi
-if test $ac_cv_header_openssl_err_h = yes; then
-  :
-else
-  { { echo "$as_me:$LINENO: error: header file <openssl/err.h> is required for OpenSSL" >&5
-echo "$as_me: error: header file <openssl/err.h> is required for OpenSSL" >&2;}
-   { (exit 1); exit 1; }; }
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 
 fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
 
-if test "$with_pam" = yes ; then
+else
 
-for ac_header in security/pam_appl.h
+for ac_header in pam/pam_appl.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -10595,8 +10472,23 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then
 _ACEOF
 
 else
+  { { echo "$as_me:$LINENO: error: header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM." >&5
+echo "$as_me: error: header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 
-for ac_header in pam/pam_appl.h
+done
+
+fi
+
+done
+
+fi
+
+if test "$with_ldap" = yes ; then
+  if test "$PORTNAME" != "win32"; then
+
+for ac_header in ldap.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -10742,17 +10634,82 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then
 _ACEOF
 
 else
-  { { echo "$as_me:$LINENO: error: header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM." >&5
-echo "$as_me: error: header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM." >&2;}
+  { { echo "$as_me:$LINENO: error: header file <ldap.h> is required for LDAP" >&5
+echo "$as_me: error: header file <ldap.h> is required for LDAP" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
 done
 
+  else
+
+for ac_header in winldap.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <windows.h>
+
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  { { echo "$as_me:$LINENO: error: header file <winldap.h> is required for LDAP" >&5
+echo "$as_me: error: header file <winldap.h> is required for LDAP" >&2;}
+   { (exit 1); exit 1; }; }
 fi
 
 done
 
+  fi
 fi
 
 if test "$with_bonjour" = yes ; then
 
 fi
 
+# This is probably only present on Darwin, but may as well check always
+echo "$as_me:$LINENO: checking whether F_FULLFSYNC is declared" >&5
+echo $ECHO_N "checking whether F_FULLFSYNC is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_F_FULLFSYNC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <fcntl.h>
+
+int
+main ()
+{
+#ifndef F_FULLFSYNC
+  char *p = (char *) F_FULLFSYNC;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_have_decl_F_FULLFSYNC=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_F_FULLFSYNC=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_F_FULLFSYNC" >&5
+echo "${ECHO_T}$ac_cv_have_decl_F_FULLFSYNC" >&6
+if test $ac_cv_have_decl_F_FULLFSYNC = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_F_FULLFSYNC 1
+_ACEOF
+
+
+else
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_F_FULLFSYNC 0
+_ACEOF
+
+
+fi
+
+
+
 ##
 ## Functions, global variables
 ##
 # also decide to use snprintf.c if snprintf() is present but does not
 # have all the features we need --- see below.
 
-pgac_need_repl_snprintf=no
+if test "$PORTNAME" = "win32"; then
+  # Win32 gets snprintf.c built unconditionally.
+  #
+  # To properly translate all NLS languages strings, we must support the
+  # *printf() %$ format, which allows *printf() arguments to be selected
+  # by position in the translated string.
+  #
+  # libintl versions < 0.13 use the native *printf() functions, and Win32
+  # *printf() doesn't understand %$, so we must use our /port versions,
+  # which do understand %$. libintl versions >= 0.13 include their own
+  # *printf versions on Win32.  The libintl 0.13 release note text is:
+  #
+  #   C format strings with positions, as they arise when a translator
+  #   needs to reorder a sentence, are now supported on all platforms.
+  #   On those few platforms (NetBSD and Woe32) for which the native
+  #   printf()/fprintf()/... functions don't support such format
+  #   strings, replacements are provided through <libintl.h>.
+  #
+  # We could use libintl >= 0.13's *printf() if we were sure that we had
+  # a litint >= 0.13 at runtime, but seeing that there is no clean way
+  # to guarantee that, it is best to just use our own, so we are sure to
+  # get %$ support. In include/port.h we disable the *printf() macros
+  # that might have been defined by libintl.
+  #
+  # We do this unconditionally whether NLS is used or not so we are sure
+  # that all Win32 libraries and binaries behave the same.
+  pgac_need_repl_snprintf=yes
+else
+  pgac_need_repl_snprintf=no
 
 for ac_func in snprintf
 do
@@ -14094,6 +14154,7 @@ else
 fi
 done
 
+fi
 
 
 # Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
@@ -14245,7 +14306,6 @@ fi
 
 
 
-# do this one the hard way in case isinf() is a macro
 echo "$as_me:$LINENO: checking for isinf" >&5
 echo $ECHO_N "checking for isinf... $ECHO_C" >&6
 if test "${ac_cv_func_isinf+set}" = set; then
@@ -14257,12 +14317,14 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+
 #include <math.h>
+double glob_double;
 
 int
 main ()
 {
-double x = 0.0; int res = isinf(x);
+return isinf(glob_double) ? 0 : 1;
   ;
   return 0;
 }
@@ -14550,8 +14612,11 @@ done
 
 
 
-# system's version of getaddrinfo(), if any, may be used only if we found
-# a definition for struct addrinfo; see notes in src/include/getaddrinfo.h
+# System's version of getaddrinfo(), if any, may be used only if we found
+# a definition for struct addrinfo; see notes in src/include/getaddrinfo.h.
+# (Note: the AC_REPLACE_FUNCS probe fails on Windows, where the available
+# versions of getaddrinfo don't follow normal C call protocol.  This is OK
+# because we want to use our own getaddrinfo.c on Windows anyway.)
 if test x"$ac_cv_type_struct_addrinfo" = xyes ; then
 
 for ac_func in getaddrinfo
@@ -14808,7 +14873,10 @@ case $host_os in bsdi*|netbsd*)
 ac_cv_func_fseeko=yes
 esac
 
-# Solaris has a very slow qsort in certain cases, so we replace it.
+# Solaris has a very slow qsort in certain cases, so we replace it:
+#   http://forum.sun.com/thread.jspa?forumID=4&threadID=7231
+# Supposedly it is fixed in Solaris, but not sure which version, and
+# no confirmed testing.  2005-12-16
 if test "$PORTNAME" = "solaris"; then
 case $LIBOBJS in
     "qsort.$ac_objext"   | \
@@ -15139,11 +15207,14 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+
 #include <math.h>
+double glob_double;
+
 int
 main ()
 {
-int dummy=finite(1.0);
+return finite(glob_double) ? 0 : 1;
   ;
   return 0;
 }
@@ -16245,7 +16316,7 @@ fi
 # which indicates that we try without any flags at all, and "pthread-config"
 # which is a program returning the flags for the Pth emulation library.
 
-acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config pthreadGC2"
 
 # The ordering *is* (sometimes) important.  Some notes on the
 # individual items follow:
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
+# --------------------
+# Run tests below here
+# --------------------
 
 # Force use of our snprintf if system's doesn't do arg control
-# This feature is used by NLS
-if test "$enable_nls" = yes &&
-   test $pgac_need_repl_snprintf = no &&
-# On Win32, libintl replaces snprintf() with its own version that
-# understands arg control, so we don't need our own.  In fact, it
-# also uses macros that conflict with ours, so we _can't_ use
-# our own.
-   test "$PORTNAME" != "win32"; then
+# See comment above at snprintf test for details.
+if test "$enable_nls" = yes -a "$pgac_need_repl_snprintf" = no; then
   echo "$as_me:$LINENO: checking whether printf supports argument control" >&5
 echo $ECHO_N "checking whether printf supports argument control... $ECHO_C" >&6
 if test "${pgac_cv_printf_arg_control+set}" = set; then
@@ -17634,7 +17702,7 @@ _ACEOF
 if test $pgac_need_repl_snprintf = yes; then
 
 cat >>confdefs.h <<\_ACEOF
-#define USE_SNPRINTF 1
+#define USE_REPL_SNPRINTF 1
 _ACEOF
 
   case $LIBOBJS in
@@ -21477,6 +21545,17 @@ _ACEOF
 SHMEM_IMPLEMENTATION="src/backend/port/sysv_shmem.c"
 
 
+# If not set in template file, set bytes to use libc memset()
+if test x"$MEMSET_LOOP_LIMIT" = x"" ; then
+  MEMSET_LOOP_LIMIT=1024
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define MEMSET_LOOP_LIMIT ${MEMSET_LOOP_LIMIT}
+_ACEOF
+
+
+
 if test "$enable_nls" = yes ; then
 
   echo "$as_me:$LINENO: checking for library containing gettext" >&5
@@ -22439,13 +22518,13 @@ if test x"$template" != x"win32"
 then
   { echo "$as_me:$LINENO: WARNING:
 *** Skipping thread test program.  --enable-thread-safety-force was used.
-*** Run the program in src/tools/thread on the your machine and add
+*** Run the program in src/test/thread on the your machine and add
 proper locking function calls to your applications to guarantee thread
 safety.
 " >&5
 echo "$as_me: WARNING:
 *** Skipping thread test program.  --enable-thread-safety-force was used.
-*** Run the program in src/tools/thread on the your machine and add
+*** Run the program in src/test/thread on the your machine and add
 proper locking function calls to your applications to guarantee thread
 safety.
 " >&2;}
@@ -22468,11 +22547,11 @@ if test "$cross_compiling" = yes; then
 echo "${ECHO_T}maybe" >&6
   { echo "$as_me:$LINENO: WARNING:
 *** Skipping thread test program because of cross-compile build.
-*** Run the program in src/tools/thread on the target machine.
+*** Run the program in src/test/thread on the target machine.
 " >&5
 echo "$as_me: WARNING:
 *** Skipping thread test program because of cross-compile build.
-*** Run the program in src/tools/thread on the target machine.
+*** Run the program in src/test/thread on the target machine.
 " >&2;}
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -22481,7 +22560,7 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include "$srcdir/src/tools/thread/thread_test.c"
+#include "$srcdir/src/test/thread/thread_test.c"
 _ACEOF
 rm -f conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
@@ -22510,7 +22589,7 @@ echo "${ECHO_T}no" >&6
 ***
 *** You can use the configure option --enable-thread-safety-force
 *** to force threads to be enabled.  However, you must then run
-*** the program in src/tools/thread and add locking function calls
+*** the program in src/test/thread and add locking function calls
 *** to your applications to guarantee thread safety.
 " >&5
 echo "$as_me: error:
@@ -22519,7 +22598,7 @@ echo "$as_me: error:
 ***
 *** You can use the configure option --enable-thread-safety-force
 *** to force threads to be enabled.  However, you must then run
-*** the program in src/tools/thread and add locking function calls
+*** the program in src/test/thread and add locking function calls
 *** to your applications to guarantee thread safety.
 " >&2;}
    { (exit 1); exit 1; }; }
@@ -22932,7 +23011,7 @@ _ASBOX
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by PostgreSQL $as_me 8.1beta1, which was
+This file was extended by PostgreSQL $as_me 8.2devel, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -22998,7 +23077,7 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-PostgreSQL config.status 8.1beta1
+PostgreSQL config.status 8.2devel
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
@@ -23233,6 +23312,7 @@ s,@with_python@,$with_python,;t t
 s,@with_krb5@,$with_krb5,;t t
 s,@krb_srvtab@,$krb_srvtab,;t t
 s,@with_pam@,$with_pam,;t t
+s,@with_ldap@,$with_ldap,;t t
 s,@with_bonjour@,$with_bonjour,;t t
 s,@with_openssl@,$with_openssl,;t t
 s,@with_zlib@,$with_zlib,;t t
@@ -23248,7 +23328,6 @@ s,@with_gnu_ld@,$with_gnu_ld,;t t
 s,@ld_R_works@,$ld_R_works,;t t
 s,@RANLIB@,$RANLIB,;t t
 s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@LORDER@,$LORDER,;t t
 s,@TAR@,$TAR,;t t
 s,@STRIP@,$STRIP,;t t
 s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t