For the case where there is no pkg-config, source4/heimdal_build/wscript_configure only seems to check for the com_err library at the moment; it doesn't check if the header can actually be used. This breaks on some systems, especially those that have com_err.h in /usr/include/krb5 and -lcom_err in /usr/lib.
Isn't this fixed by 46b4fe0c48cb045db0a372cf89d2b0da79e44bac ?
No, I'm pretty sure the underlying issue is that we don't actually check for the header file in the relevant waf function. This commit also predates this bugreport.