[PATCH] Make krb5-config suppress CFLAGS output and omit extra libraries when called with --libs

Stéphane Gaudreault stephane at archlinux.org
Mon Sep 26 09:33:52 EDT 2011

Please apply this minor patch (derived from Fedora) to fix two issues with 

1) Make krb5-config suppress CFLAGS output when called with --libs

In unpatched krb5, the output of "krb5-config --libs" contains the current
value of the CFLAGS. Example

# CFLAGS="SOME CRAP" krb5-config --libs

This cause CFLAGS to be copied into the LDFLAGS of other applications that 
call krb5-config in their building process.

2) Omit extra libraries because their interfaces are not exposed to
applications by libkrb5.

For example, if we build CUPS against unpatched krb5

# cups-config --libs
-lcups -march=x86-64 -mtune=generic -O2 -pipe -I/usr/include/dbus-1.0
-I/usr/lib/dbus-1.0/include -DDBUS_API_SUBJECT_TO_CHANGE
-Wl,--hash-style=gnu -Wl,--as-needed -lgssapi_krb5 -lkrb5 -lk5crypto
-lcom_err -lkeyutils -lresolv -ldl -lz -lm -lcrypt

This contain more dependencies than needed. These unneeded dependencies comes 
from krb5-config. With the patched krb5 we get :

# cups-config --libs
-lcups -Wl,--hash-style=gnu -Wl,--as-needed -lgssapi_krb5 -lkrb5
-lk5crypto -lcom_err -lz -lm -lcrypt

With patched krb5-config, setting do_deps to 1 indicates that the caller wants 
the whole list.

The patch is also available via


Stéphane Gaudreault

More information about the krbdev mailing list