krb5 commit: Add MACOS_FRAMEWORK to static link flags

[email protected] Wed, 15 Jul 2026 18:24:21 -0400 (EDT)
Newsgroups gmane.comp.encryption.kerberos.cvs
Message-ID <[email protected]>
https://github.com/krb5/krb5/commit/9a27137bfa04f9ae79b19cce7cdb05680dfe844e
commit 9a27137bfa04f9ae79b19cce7cdb05680dfe844e
Author: George Chow <[email protected]>
Date:   Thu Jun 18 11:40:36 2026 -0700

    Add MACOS_FRAMEWORK to static link flags
    
    When building statically on macOS, the CoreFoundation and Security
    frameworks required by krb5 are not propagated to consumers via
    pkg-config or the Makefile link variables.  This causes linker failures
    when an application links against the static krb5 libraries without
    separately specifying the framework flags.
    
    Add @MACOS_FRAMEWORK@ to Libs.private in mit-krb5.pc.in, so pkg-config
    --static exposes it, and to KRB5_BASE_LIBS in config/pre.in, so the
    build system includes it when linking executables against the static
    libraries.

 src/build-tools/mit-krb5.pc.in | 2 +-
 src/config/pre.in              | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/build-tools/mit-krb5.pc.in b/src/build-tools/mit-krb5.pc.in
index fdc557785..e5fde402c 100644
--- a/src/build-tools/mit-krb5.pc.in
+++ b/src/build-tools/mit-krb5.pc.in
@@ -12,4 +12,4 @@ Description: An implementation of Kerberos network authentication
 Version: @KRB5_VERSION@
 Cflags: -I${includedir}
 Libs: -L${libdir} -lkrb5 -lk5crypto @COM_ERR_LIB@
-Libs.private: -lkrb5support
+Libs.private: -lkrb5support @MACOS_FRAMEWORK@ @LIBS@ @DL_LIB@
diff --git a/src/config/pre.in b/src/config/pre.in
index d165ba9cc..a59f6ca90 100644
--- a/src/config/pre.in
+++ b/src/config/pre.in
@@ -370,6 +370,8 @@ CMOCKA_LIBS	= @CMOCKA_LIBS@
 LDAP_LIBS	= @LDAP_LIBS@
 LMDB_LIBS	= @LMDB_LIBS@
 
+MACOS_FRAMEWORK = @MACOS_FRAMEWORK@
+
 KRB5_LIB			= -lkrb5
 K5CRYPTO_LIB			= -lk5crypto
 GSS_KRB5_LIB			= -lgssapi_krb5
@@ -378,7 +380,7 @@ SUPPORT_LIB			= -l$(SUPPORT_LIBNAME)
 # HESIOD_LIBS is -lhesiod...
 HESIOD_LIBS	= @HESIOD_LIBS@
 
-KRB5_BASE_LIBS	= $(KRB5_LIB) $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB) $(LIBS) $(DL_LIB)
+KRB5_BASE_LIBS	= $(KRB5_LIB) $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB) $(MACOS_FRAMEWORK) $(LIBS) $(DL_LIB)
 KDB5_LIBS	= $(KDB5_LIB) $(GSSRPC_LIBS)
 GSS_LIBS	= $(GSS_KRB5_LIB)
 GSSRPC_LIBS	= -lgssrpc $(GSS_LIBS)