lib:replace: Fix linking when libtirpc-devel overwrites system headers
authorNoel Power <noel.power@suse.com>
Thu, 15 Mar 2018 16:46:39 +0000 (16:46 +0000)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 20 Mar 2018 15:07:05 +0000 (16:07 +0100)
Some systems (like SUSE currently) install the new tirpc headers by
overwritting the existing system location used by gcc. This patch will
detect if the headers in the system location belong to tirpc or not.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13341

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Mar 20 16:07:05 CET 2018 on sn-devel-144

lib/replace/wscript

index 534062ec717243b480d6785cf34efffc4e467507..66398970da317fbe73df54346899940afe43cbc3 100644 (file)
@@ -68,7 +68,15 @@ def configure(conf):
     conf.CHECK_HEADERS('aio.h sys/unistd.h alloca.h float.h')
 
     conf.SET_TARGET_TYPE('tirpc', 'EMPTY')
-    conf.CHECK_HEADERS('rpc/rpc.h rpc/nettype.h')
+
+    if conf.CHECK_CODE(
+            '\n#ifndef _TIRPC_RPC_H\n#error "no tirpc headers in system path"\n#endif\n',
+            'HAVE_RPC_RPC_HEADERS',
+            headers=['rpc/rpc.h', 'rpc/nettype.h'],
+            msg='Checking for tirpc rpc headers in default system path'):
+        if conf.CONFIG_SET('HAVE_RPC_RPC_H'):
+            conf.undefine('HAVE_RPC_RPC_H')
+
     if not conf.CONFIG_SET('HAVE_RPC_RPC_H'):
         if conf.CHECK_CFG(package='libtirpc', args='--cflags --libs',
                        msg='Checking for libtirpc headers',