From 49111a63e6d9bb963e6d628f7813c007c54263a0 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Wed, 10 Nov 2004 21:43:41 +0000
Subject: [PATCH] configure --with-gssapi fix

---
 CHANGES      |  4 ++++
 configure.ac | 30 ++++++++++++++++++------------
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/CHANGES b/CHANGES
index b548bd40e2..d66143eb79 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@
 
                                   Changelog
 
+Daniel (10 November 2004)
+- I installed Heimdal on my Debian box (using the debian package) and noticed
+  that configure --with-gssapi failed to create a nice build. Fixed now.
+
 Daniel (9 November 2004)
 - Gisle Vanem marked all external function calls with CURL_EXTERN so that now
   the Windows, Netware and other builds no longer need libcurl.def or similar
diff --git a/configure.ac b/configure.ac
index 6215495826..d8aaf02385 100644
--- a/configure.ac
+++ b/configure.ac
@@ -647,7 +647,7 @@ if test x"$want_gss" = xyes; then
   if test -z "$GSSAPI_INCS"; then
      if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
         GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
-     else
+     elif test "$GSSAPI_ROOT" != "yes"; then
         GSSAPI_INCS="-I$GSSAPI_ROOT/include"
      fi
   fi
@@ -657,8 +657,10 @@ if test x"$want_gss" = xyes; then
      if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
         gss_ldflags=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
 	LDFLAGS="$LDFLAGS $gss_ldflags"
-     else
+     elif test "$GSSAPI_ROOT" != "yes"; then
         LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff -lgssapi"
+     else
+        LDFLAGS="$LDFLAGS -lgssapi"
      fi
   else
      LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
@@ -669,17 +671,21 @@ if test x"$want_gss" = xyes; then
 
   curl_gss_msg="enabled"
 
-  if test -n "$GSSAPI_INCS"; then
-    # cut off the preceding -I from the include path
-    GSSAPI_INCS=`echo $GSSAPI_INCS | sed -e s/^-I//g`
-  fi
-
-  if test -f "$GSSAPI_INCS/gssapi.h"; then
+  AC_CHECK_HEADER(gssapi.h,
+    [
+       dnl found in the given dirs
       AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
-  else
-      AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
-  fi
-  
+    ],
+    [
+      dnl not found, check in gssapi/ subdir 
+      AC_CHECK_HEADER(gssapi/gssapi.h,
+        dnl found 
+        AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
+      )
+      
+    ]
+  )
+
 else
   AC_MSG_RESULT(no)
 fi
-- 
GitLab