Source: Home brewed
Fixes issues with differences of Solaris krb5 and MIT krb5

--- a/wscript_configure_system_mitkrb5	2013-06-13 09:21:03.000000000 +0000
+++ samba-4.1.12/wscript_configure_system_mitkrb5	2015-01-09 00:06:46.004441833 +0000
@@ -30,6 +30,8 @@
     krb5_define_syslib(conf, "gssapi", conf.env['LIB_GSSAPI'])
     if 'gssapi_krb5' in conf.env['LIB_GSSAPI']:
         krb5_define_syslib(conf, "gssapi_krb5", conf.env['LIB_GSSAPI'])
+    if 'gss' in conf.env['LIB_GSSAPI']:
+        krb5_define_syslib(conf, "gss", conf.env['LIB_GSSAPI'])
 
     vendor = conf.cmd_and_log("%(path)s --vendor" % dict(path=conf.env.KRB5_CONFIG), dict())
     conf.env.KRB5_VENDOR = vendor.strip().lower()
@@ -52,10 +53,10 @@
 
 conf.check_cfg(args="--cflags --libs", package="com_err", uselib_store="com_err")
 conf.CHECK_FUNCS_IN('_et_list', 'com_err')
-conf.CHECK_HEADERS('com_err.h', lib='com_err')
+conf.CHECK_HEADERS('com_err.h', lib='com_err krb5')
 
 conf.CHECK_HEADERS('krb5.h krb5/locate_plugin.h', lib='krb5')
-conf.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h gssapi/gssapi_ext.h gssapi/gssapi_krb5.h', lib='gssapi')
+conf.CHECK_HEADERS('gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h gssapi/gssapi_ext.h gssapi/gssapi_krb5.h', lib='gssapi krb5')
 
 conf.CHECK_FUNCS_IN('krb5_encrypt_data', 'k5crypto')
 conf.CHECK_FUNCS_IN('des_set_key','crypto')
@@ -80,7 +81,7 @@
        gsskrb5_extract_authz_data_from_sec_context
        gss_krb5_export_lucid_sec_context
        gss_import_cred gss_export_cred
-       ''', 'gssapi gssapi_krb5')
+       ''', 'gssapi gssapi_krb5 krb5')
 conf.CHECK_FUNCS_IN('krb5_mk_req_extended krb5_kt_compare', 'krb5')
 conf.CHECK_FUNCS('''
        krb5_set_default_in_tkt_etypes krb5_set_default_tgs_enctypes
@@ -108,25 +109,25 @@
 conf.CHECK_DECLS('''krb5_get_credentials_for_user
                     krb5_auth_con_set_req_cksumtype''',
                     headers='krb5.h', always=True)
-conf.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers='krb5.h')
-conf.CHECK_VARIABLE('KV5M_KEYTAB', headers='krb5.h')
-conf.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers='krb5.h')
-conf.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers='krb5.h')
-conf.CHECK_VARIABLE('ENCTYPE_AES128_CTS_HMAC_SHA1_96', headers='krb5.h')
-conf.CHECK_VARIABLE('ENCTYPE_AES256_CTS_HMAC_SHA1_96', headers='krb5.h')
+conf.CHECK_VARIABLE('AP_OPTS_USE_SUBKEY', headers='krb5.h', lib='krb5')
+conf.CHECK_VARIABLE('KV5M_KEYTAB', headers='krb5.h', lib='krb5')
+conf.CHECK_VARIABLE('KRB5_KU_OTHER_CKSUM', headers='krb5.h', lib='krb5')
+conf.CHECK_VARIABLE('KRB5_KEYUSAGE_APP_DATA_CKSUM', headers='krb5.h', lib='krb5')
+conf.CHECK_VARIABLE('ENCTYPE_AES128_CTS_HMAC_SHA1_96', headers='krb5.h', lib='krb5')
+conf.CHECK_VARIABLE('ENCTYPE_AES256_CTS_HMAC_SHA1_96', headers='krb5.h', lib='krb5')
 conf.CHECK_DECLS('KRB5_PDU_NONE', reverse=True, headers='krb5.h')
-conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers='krb5.h',
+conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'key', headers='krb5.h', lib='krb5',
                             define='HAVE_KRB5_KEYTAB_ENTRY_KEY')
-conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers='krb5.h',
+conf.CHECK_STRUCTURE_MEMBER('krb5_keytab_entry', 'keyblock', headers='krb5.h', lib='krb5',
                             define='HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK')
-conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers='krb5.h',
+conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'magic', headers='krb5.h', lib='krb5',
                             define='HAVE_MAGIC_IN_KRB5_ADDRESS')
-conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers='krb5.h',
+conf.CHECK_STRUCTURE_MEMBER('krb5_address', 'addrtype', headers='krb5.h', lib='krb5',
                             define='HAVE_ADDRTYPE_IN_KRB5_ADDRESS')
-conf.CHECK_STRUCTURE_MEMBER('krb5_ap_req', 'ticket', headers='krb5.h',
+conf.CHECK_STRUCTURE_MEMBER('krb5_ap_req', 'ticket', headers='krb5.h', lib='krb5',
                             define='HAVE_TICKET_POINTER_IN_KRB5_AP_REQ')
 
-conf.CHECK_TYPE('krb5_encrypt_block', headers='krb5.h')
+conf.CHECK_TYPE('krb5_encrypt_block', headers='krb5.h', lib='krb5')
 
 conf.CHECK_CODE('''
        krb5_context ctx;
@@ -134,7 +135,7 @@
        krb5_get_init_creds_opt_free(ctx, opt);
        ''',
     'KRB5_CREDS_OPT_FREE_REQUIRES_CONTEXT',
-    headers='krb5.h', link=False,
+    headers='krb5.h', lib='krb5', link=False,
     msg="Checking whether krb5_get_init_creds_opt_free takes a context argument")
 conf.CHECK_CODE('''
        const krb5_data *pkdata;
@@ -245,7 +246,7 @@
 conf.CHECK_CODE('''#define KRB5_DEPRECATED 1
        #include <krb5.h>''',
    'HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER', addmain=False,
-    link=False,
+    link=False, lib='krb5',
     msg="Checking for KRB5_DEPRECATED define taking an identifier")
 
 conf.CHECK_CODE('''
