$NetBSD: patch-configure,v 1.3 2017/11/03 09:40:37 jperkin Exp $

builtin krb5-config in platforms such as solaris do not support
the gssapi option, and need an explicit -lgss

On Darwin, do not append custom CFLAGS.

Do not strip debug flags.

--- configure.orig	2017-10-17 14:31:48.000000000 +0000
+++ configure
@@ -4272,6 +4272,7 @@ $as_echo "$as_me: $xc_bad_var_msg librar
         ;;
     esac
   done
+  xc_bad_var_cflags=no
   if test $xc_bad_var_cflags = yes; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: using CFLAGS: $CFLAGS" >&5
 $as_echo "$as_me: using CFLAGS: $CFLAGS" >&6;}
@@ -17159,7 +17160,7 @@ squeeze() {
 
 
       #
-  if test "$compiler_id" != "unknown"; then
+  if false; then
     #
     if test "$compiler_id" = "GNU_C" ||
       test "$compiler_id" = "CLANG"; then
@@ -17482,13 +17483,6 @@ $as_echo_n "checking if compiler accepts
       tmp_options="$flags_dbg_off"
     fi
     #
-    if test "$flags_prefer_cppflags" = "yes"; then
-      CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
-      CFLAGS="$tmp_CFLAGS"
-    else
-      CPPFLAGS="$tmp_CPPFLAGS"
-      CFLAGS="$tmp_CFLAGS $tmp_options"
-    fi
     squeeze CPPFLAGS
     squeeze CFLAGS
 
@@ -19122,7 +19116,7 @@ $as_echo "no" >&6; }
   tst_cflags="no"
   case $host_os in
     darwin*)
-      tst_cflags="yes"
+      tst_cflags="no"
       ;;
   esac
 
@@ -21788,7 +21782,11 @@ $as_echo "yes" >&6; }
      if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
         GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi`
      elif test -f "$KRB5CONFIG"; then
-        GSSAPI_INCS=`$KRB5CONFIG --cflags gssapi`
+        if `$KRB5CONFIG --cflags gssapi` 2>&1 | grep "Unknown option" >/dev/null; then
+           GSSAPI_INCS=`$KRB5CONFIG --cflags`
+        else
+           GSSAPI_INCS=`$KRB5CONFIG --cflags gssapi`
+        fi
      elif test "$GSSAPI_ROOT" != "yes"; then
         GSSAPI_INCS="-I$GSSAPI_ROOT/include"
      fi
@@ -21961,7 +21959,7 @@ $as_echo "#define HAVE_GSSAPI 1" >>confd
         LIBS="-lgss $LIBS"
         ;;
      *)
-        LIBS="-lgssapi $LIBS"
+        LIBS="-lgssapi -lkrb5 $LIBS"
         ;;
      esac
   fi
