From d708e3ecd157fe7e990725d8377b5613c0ce5bdb Mon Sep 17 00:00:00 2001
From: Jacob Champion <jacob.champion@enterprisedb.com>
Date: Wed, 28 May 2025 10:18:50 -0700
Subject: [PATCH 1/2] WIP: move GSSAPI checks into their own macro

---
 config/programs.m4 | 15 +++++++++++++++
 configure          |  2 ++
 configure.ac       |  7 +------
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/config/programs.m4 b/config/programs.m4
index 0ad1e58b48d..f2a950750bd 100644
--- a/config/programs.m4
+++ b/config/programs.m4
@@ -354,3 +354,18 @@ AC_DEFUN([PGAC_CHECK_LIBCURL],
   LDFLAGS=$pgac_save_LDFLAGS
   LIBS=$pgac_save_LIBS
 ])# PGAC_CHECK_LIBCURL
+
+
+# PGAC_CHECK_GSSAPI
+# ------------------
+# Check for a GSSAPI implementation.
+
+AC_DEFUN([PGAC_CHECK_GSSAPI],
+[
+  if test "$PORTNAME" != "win32"; then
+    AC_SEARCH_LIBS(gss_store_cred_into, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
+                   [AC_MSG_ERROR([could not find function 'gss_store_cred_into' required for GSSAPI])])
+  else
+    LIBS="$LIBS -lgssapi32"
+  fi
+])# PGAC_CHECK_GSSAPI
diff --git a/configure b/configure
index 4f15347cc95..327b2de8184 100755
--- a/configure
+++ b/configure
@@ -12892,6 +12892,7 @@ $as_echo "$pgac_cv__libcurl_async_dns" >&6; }
 fi
 
 if test "$with_gssapi" = yes ; then
+
   if test "$PORTNAME" != "win32"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gss_store_cred_into" >&5
 $as_echo_n "checking for library containing gss_store_cred_into... " >&6; }
@@ -12954,6 +12955,7 @@ fi
   else
     LIBS="$LIBS -lgssapi32"
   fi
+
 fi
 
 #
diff --git a/configure.ac b/configure.ac
index 4b8335dc613..97d9375703f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1367,12 +1367,7 @@ if test "$with_libcurl" = yes ; then
 fi
 
 if test "$with_gssapi" = yes ; then
-  if test "$PORTNAME" != "win32"; then
-    AC_SEARCH_LIBS(gss_store_cred_into, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
-                   [AC_MSG_ERROR([could not find function 'gss_store_cred_into' required for GSSAPI])])
-  else
-    LIBS="$LIBS -lgssapi32"
-  fi
+  PGAC_CHECK_GSSAPI
 fi
 
 #
-- 
2.34.1

