richard@x3200:~/src/pkgsrc/security/mit-krb5$ git diff .
diff --git a/security/mit-krb5/builtin.mk b/security/mit-krb5/builtin.mk
index c31837d..aa4f6b2 100644
--- a/security/mit-krb5/builtin.mk
+++ b/security/mit-krb5/builtin.mk
@@ -72,3 +72,22 @@ USE_BUILTIN.mit-krb5!=
\
. endif
.endif
MAKEVARS+= USE_BUILTIN.mit-krb5
+
+###
+### The section below only applies if we are not including this file
+### solely to determine whether a built-in implementation exists.
+###
+CHECK_BUILTIN.mit-krb5?= no
+.if !empty(CHECK_BUILTIN.mit-krb5:M[nN][oO])
+. if !empty(USE_BUILTIN.mit-krb5:M[yY][eE][sS])
+KRB5_CONFIG?= ${SH_KRB5_CONFIG}
+ALL_ENV+= KRB5_CONFIG=${KRB5_CONFIG:Q}
+
+BUILDLINK_CPPFLAGS.mit-krb5!= ${SH_KRB5_CONFIG} --cflags
+BUILDLINK_LDFLAGS.mit-krb5!= ${SH_KRB5_CONFIG} --libs
+. if ${OPSYS} == "SunOS"
+BUILDLINK_LDFLAGS.mit-krb5+= -lgss
+. endif
+. endif
+
+.endif # CHECK_BUILTIN.mit-krb5