heimdal: Fix build with system provided heimdal library
authorChristof Schmitt <cs@samba.org>
Tue, 26 Jun 2018 20:32:28 +0000 (13:32 -0700)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 10 Jul 2018 05:30:26 +0000 (07:30 +0200)
Trying to compile with a system provided heimdal library
results in this compile error:

[ 876/3043] Compiling source4/auth/kerberos/srv_keytab.c
In file included from /usr/include/heimdal/krb5.h:949:0,
                 from ../lib/replace/system/kerberos.h:33,
                 from ../source4/auth/kerberos/srv_keytab.c:31:
/usr/include/heimdal/krb5-protos.h:3894:1: error: unknown type name ‘HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE’; did you mean ‘_WARN_UNUSED_RESULT_’?
 HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 _WARN_UNUSED_RESULT_
/usr/include/heimdal/krb5-protos.h:3895:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘krb5_generate_random’
 krb5_generate_random (

The problem is that Samba provides a minimal krb5-types.h file
for the internal build that gets used during the build with
the system provided heimdal library. As the minimal file
does not provide all definitions, the build fails.

Fix this by having the krb-types.h file simply include the
include file from the system library, if the build is done
using the system provided heimdal library.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jul 10 07:30:26 CEST 2018 on sn-devel-144

source4/heimdal_build/krb5-types.h
source4/heimdal_build/wscript_configure

index 4f55a80a585264de1fc2344c9b8018710b3e0454..b88194cadf970ff534fa8697293de34f015f3260 100644 (file)
@@ -1,14 +1,18 @@
 /* krb5-types.h -- this file was generated for i686-pc-linux-gnu by
                    $Id: bits.c,v 1.23 2005/01/05 15:22:02 lha Exp $ */
 
-#ifndef __krb5_types_h__
-#define __krb5_types_h__
+#ifndef __samba_krb5_types_h__
+#define __samba_krb5_types_h__
 
 #include "replace.h"
 #include "system/network.h"
 
+#if defined USING_SYSTEM_KRB5 && defined HEIMDAL_KRB5_TYPES_PATH
+#include HEIMDAL_KRB5_TYPES_PATH
+#else
 typedef socklen_t krb5_socklen_t;
 typedef int krb5_socket_t;
 typedef ssize_t krb5_ssize_t;
+#endif
 
-#endif /* __krb5_types_h__ */
+#endif /* __samb_krb5_types_h__ */
index 7bd499fa9799dd54aa2c6dbf02e20af554f55a67..19f0bf218ec4c4c3e68fd336b36eb36a636a10bb 100644 (file)
@@ -176,7 +176,10 @@ if krb5_config:
             if l.startswith("libdir="):
                 heimdal_libdirs.append(l.strip()[len("libdir="):])
             elif l.startswith("includedir="):
-                heimdal_includedirs.append(l.strip()[len("includedir="):])
+                include_path = l.strip()[len("includedir="):]
+                heimdal_includedirs.append(include_path)
+                conf.define('HEIMDAL_KRB5_TYPES_PATH',
+                            include_path + "/krb5-types.h")
     finally:
         f.close()