build: deal with recent glibc sunrpc header removal
authorGünther Deschner <gd@samba.org>
Tue, 16 Jan 2018 16:48:10 +0000 (17:48 +0100)
committerKarolin Seeger <kseeger@samba.org>
Thu, 25 Jan 2018 14:04:21 +0000 (15:04 +0100)
We need to rely on libtirpc or libntirpc to be around in that case.

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

Guenther

Pair-Programmed-With: Andreas Schneider <asn@samba.org>

Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit ee0be7eb723be1420fd601ea1abe0af748562953)

ctdb/wscript
lib/replace/wscript
lib/util/wscript_build
source3/auth/wscript_build
source3/wscript

index 8774b999ff2f8d428b76afe842fe4be2cd843c9a..715ecb175fa6cd622f347867125bc518b2defbfb 100644 (file)
@@ -559,7 +559,7 @@ def build(bld):
     bld.SAMBA_BINARY('smnotify',
                      source=bld.SUBDIR('utils/smnotify',
                                        'smnotify.c gen_smnotify.c gen_xdr.c'),
-                     deps='ctdb-smnotify-h ctdb-smnotify-c ctdb-smnotify-x popt',
+                     deps='ctdb-smnotify-h ctdb-smnotify-c ctdb-smnotify-x popt tirpc',
                      includes='utils utils/smnotify',
                      install_path='${CTDB_HELPER_BINDIR}')
 
index 2f94d4937d3b51b55e7148963c37954aa7ab319b..57b0a45faee8aa27ab54fcc538924132a2887cc2 100644 (file)
@@ -5,7 +5,7 @@ VERSION = '1.2.1'
 
 blddir = 'bin'
 
-import sys, os
+import Logs, sys, os
 
 # find the buildtools directory
 srcdir = '.'
@@ -65,14 +65,42 @@ def configure(conf):
                         headers='sys/inotify.h')
 
     conf.CHECK_HEADERS('security/pam_appl.h zlib.h asm/unistd.h')
-    conf.CHECK_HEADERS('aio.h sys/unistd.h rpc/rpc.h rpc/nettype.h alloca.h float.h')
+    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 not conf.CONFIG_SET('HAVE_RPC_RPC_H'):
+        if conf.CHECK_CFG(package='libtirpc', args='--cflags',
+                       msg='Checking for libtirpc headers',
+                       uselib_store='TIRPC'):
+            conf.CHECK_HEADERS('rpc/rpc.h rpc/nettype.h', lib='tirpc', together=True)
+            conf.SET_TARGET_TYPE('tirpc', 'SYSLIB')
+    if not conf.CONFIG_SET('HAVE_RPC_RPC_H'):
+        if conf.CHECK_CFG(package='libntirpc', args='--cflags',
+                       msg='Checking for libntirpc headers',
+                       uselib_store='TIRPC'):
+            conf.CHECK_HEADERS('rpc/rpc.h rpc/nettype.h', lib='tirpc', together=True)
+            conf.SET_TARGET_TYPE('tirpc', 'SYSLIB')
+    if not conf.CONFIG_SET('HAVE_RPC_RPC_H'):
+            Logs.error('ERROR: No rpc/rpc.h header found, tirpc or libntirpc missing?')
+            sys.exit(1)
+
+    conf.SET_TARGET_TYPE('nsl', 'EMPTY')
+    conf.CHECK_HEADERS('rpc/rpc.h rpcsvc/yp_prot.h', lib='tirpc')
+    if not conf.CONFIG_SET('HAVE_RPCSVC_YP_PROT_H'):
+        if conf.CHECK_CFG(package='libnsl', args='--cflags --libs',
+                          msg='Checking for libnsl',
+                          uselib_store='NSL'):
+            conf.SET_TARGET_TYPE('nsl', 'SYSLIB')
+            conf.CHECK_HEADERS('rpc/rpc.h rpcsvc/yp_prot.h', lib='tirpc nsl')
+        else:
+            conf.SET_TARGET_TYPE('nsl', 'SYSLIB')
+    conf.CHECK_HEADERS('rpcsvc/nis.h rpcsvc/ypclnt.h', lib='tirpc nsl')
 
-    conf.CHECK_HEADERS('rpcsvc/nis.h rpcsvc/ypclnt.h sys/sysctl.h')
+    conf.CHECK_HEADERS('sys/sysctl.h')
     conf.CHECK_HEADERS('sys/fileio.h sys/filesys.h sys/dustat.h sys/sysmacros.h')
     conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h')
 
-    conf.CHECK_CODE('', headers='rpc/rpc.h rpcsvc/yp_prot.h', define='HAVE_RPCSVC_YP_PROT_H')
-
     conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
     conf.CHECK_HEADERS('nss_common.h nsswitch.h ns_api.h')
     conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h')
index 0b16b6f821667700d241284f51d5c6ffbad515be..30face34381a5384b560a601dfcf2c426e6f57c3 100644 (file)
@@ -204,7 +204,7 @@ else:
 
     bld.SAMBA_SUBSYSTEM('access',
                         source='access.c',
-                        deps='interfaces samba-util',
+                        deps='interfaces samba-util tirpc nsl',
                         local_include=False)
 
     bld.SAMBA_SUBSYSTEM('util_str_escape',
index 83b5ad18f037f9307ad653bd5c01bf0b152f0f9e..8fd7dcded86de2f57ea003a50bba1f370edf59d8 100644 (file)
@@ -6,7 +6,7 @@ bld.SAMBA3_SUBSYSTEM('TOKEN_UTIL',
 
 bld.SAMBA3_SUBSYSTEM('USER_UTIL',
                      source='user_util.c',
-                     deps='TOKEN_UTIL')
+                     deps='TOKEN_UTIL tirpc nsl')
 
 bld.SAMBA3_SUBSYSTEM('AUTH_COMMON',
                     source='''auth_util.c
index d7a66122f9a419118901f3341bddc444b76b46d8..173b097ced6801fa59ca43dc0ea57bc68646e8f5 100644 (file)
@@ -119,7 +119,6 @@ def configure(conf):
     conf.CHECK_FUNCS('memalign posix_memalign hstrerror')
     conf.CHECK_FUNCS('shmget')
     conf.CHECK_FUNCS_IN('shm_open', 'rt', checklibc=True)
-    #FIXME: for some reason this one still fails
     conf.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
     conf.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
     conf.CHECK_FUNCS_IN('dn_expand', 'inet')
@@ -1446,7 +1445,7 @@ main() {
         #darwin style quota bytecount
         conf.CHECK_STRUCTURE_MEMBER('struct dqblk', 'dqb_curbytes', define='HAVE_STRUCT_DQBLK_DQB_CURBYTES',
                                 headers='sys/quota.h')
-        if conf.CHECK_HEADERS('rpcsvc/rquota.h'):
+        if conf.CHECK_HEADERS('rpcsvc/rquota.h', lib='tirpc'):
             conf.DEFINE('HAVE_NFS_QUOTAS', '1')
             conf.CHECK_STRUCTURE_MEMBER('struct getquota_rslt', 'getquota_rslt_u',
                                         define='HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U',
@@ -1484,7 +1483,8 @@ main() {
                         define='HAVE_NFS_QUOTAS',
                         msg='for NFS QUOTAS',
                         execute=True,
-                        local_include=False)
+                        local_include=False,
+                        lib='tirpc')
 
         if conf.CONFIG_SET('HAVE_QUOTACTL_LINUX') or \
            conf.CONFIG_SET('HAVE_QUOTACTL_4A') or \
@@ -1646,7 +1646,7 @@ main() {
         Logs.info("building with Spotlight support")
         default_static_modules.extend(TO_LIST('rpc_mdssvc_module'))
 
-    conf.CHECK_HEADERS('rpc/xdr.h')
+    conf.CHECK_HEADERS('rpc/xdr.h', lib='tirpc')
 
     forced_static_modules.extend(TO_LIST('auth_builtin auth_sam auth_winbind'))
     default_static_modules.extend(TO_LIST('''pdb_smbpasswd pdb_tdbsam