From 143dbb2e49476a6155e754908e20b9f5769585ea Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Mon, 26 Jan 2009 22:24:50 +0000
Subject: [PATCH] ITS#5846 and autoconf2.61 bits

---
 CHANGES      |  1 +
 build/top.mk |  1 +
 configure    | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 configure.in |  5 ++++
 4 files changed, 82 insertions(+), 2 deletions(-)

diff --git a/CHANGES b/CHANGES
index 1b294e87c8..4ecf01f7ca 100644
--- a/CHANGES
+++ b/CHANGES
@@ -41,6 +41,7 @@ OpenLDAP 2.4.14 Engineering
 		Updated test017,test018,test019 to cover more cases (ITS#5883)
 		Removed patch for BerkeleyDB 4.7.25 (Official patch available)
 		Fixed MSVC 9.0 build issues (ITS#5888)
+		Fixed gss detection on Solaris (ITS#5846)
 	Documentation
 		admin24 added limits chapter (ITS#5818)
 		slapo-constraint(5) example fix (ITS#5895)
diff --git a/build/top.mk b/build/top.mk
index ce398f9e19..86a5ec2bc4 100644
--- a/build/top.mk
+++ b/build/top.mk
@@ -32,6 +32,7 @@ exec_prefix = @exec_prefix@
 ldap_subdir = @ldap_subdir@
 
 bindir = @bindir@
+datarootdir = @datarootdir@
 datadir = @datadir@$(ldap_subdir)
 includedir = @includedir@
 infodir = @infodir@
diff --git a/configure b/configure
index 5555798fcb..4262d95f98 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in OpenLDAP: pkg/ldap/configure.in,v 1.631.2.18 2009/01/21 01:26:41 quanah Exp .
+# From configure.in OpenLDAP: pkg/ldap/configure.in,v 1.631.2.20 2009/01/26 21:16:37 quanah Exp .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61.
 #
@@ -12729,6 +12729,7 @@ echo "${ECHO_T}$ol_cv_msvc" >&6; }
 case $host_os in
   *mingw32* ) ac_cv_mingw32=yes ;;
   *cygwin* ) ac_cv_cygwin=yes ;;
+  *interix* ) ac_cv_interix=yes ;;
 esac
 
 
@@ -14829,7 +14830,10 @@ fi
 done
 
 
-if test "$ac_cv_mingw32" = yes -o "$ol_cv_msvc" = yes ; then
+if test "$ac_cv_mingw32" = yes \
+	-o "$ac_cv_interix" = yes \
+	-o "$ol_cv_msvc" = yes
+then
 
 
 for ac_header in winsock.h winsock2.h
@@ -19534,6 +19538,75 @@ else
   ol_link_gssapi=no
 fi
 
+		fi
+		if test $ol_link_gssapi != yes ; then
+			{ echo "$as_me:$LINENO: checking for gss_wrap in -lgss" >&5
+echo $ECHO_N "checking for gss_wrap in -lgss... $ECHO_C" >&6; }
+if test "${ac_cv_lib_gss_gss_wrap+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lgss  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gss_wrap ();
+int
+main ()
+{
+return gss_wrap ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_gss_gss_wrap=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_gss_gss_wrap=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_gss_gss_wrap" >&5
+echo "${ECHO_T}$ac_cv_lib_gss_gss_wrap" >&6; }
+if test $ac_cv_lib_gss_gss_wrap = yes; then
+  ol_link_gssapi=yes;GSSAPI_LIBS="-lgss"
+else
+  ol_link_gssapi=no
+fi
+
 		fi
 	fi
 
diff --git a/configure.in b/configure.in
index 48edacf25c..fb0cd72a96 100644
--- a/configure.in
+++ b/configure.in
@@ -1177,6 +1177,11 @@ case $ol_with_gssapi in yes | auto)
 			             [ol_link_gssapi=yes;GSSAPI_LIBS="-lgssapi_krb5"],
 			             [ol_link_gssapi=no])
 		fi
+		if test $ol_link_gssapi != yes ; then
+			AC_CHECK_LIB(gss, gss_wrap,
+			             [ol_link_gssapi=yes;GSSAPI_LIBS="-lgss"],
+			             [ol_link_gssapi=no])
+		fi
 	fi
 
 	;;
-- 
GitLab