waf: Fix NFS quota support with libtirpc
authorAndreas Schneider <asn@samba.org>
Fri, 19 Jan 2018 13:30:20 +0000 (14:30 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 22 Jan 2018 16:26:52 +0000 (17:26 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13238

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jan 22 17:26:52 CET 2018 on sn-devel-144

lib/replace/wscript
source3/lib/sysquotas_nfs.c
source3/modules/nfs4acl_xattr_xdr.c
source3/wscript
source3/wscript_build

index 57b0a45faee8aa27ab54fcc538924132a2887cc2..2c638b772124f720fa6a6ecce053296a8efdc56a 100644 (file)
@@ -70,7 +70,7 @@ def configure(conf):
     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',
+        if conf.CHECK_CFG(package='libtirpc', args='--cflags --libs',
                        msg='Checking for libtirpc headers',
                        uselib_store='TIRPC'):
             conf.CHECK_HEADERS('rpc/rpc.h rpc/nettype.h', lib='tirpc', together=True)
index fe46d3fa36a3f12fd4465fe626877aa30533ab9a..dd2b12d0ffdaa7ecb31b9c089f47e2225fb45882 100644 (file)
  * This is based on the FreeBSD / SUNOS5 section of quotas.c
  */
 
+/* <rpc/xdr.h> uses TRUE and FALSE */
+#ifdef TRUE
+#undef TRUE
+#endif
+
+#ifdef FALSE
+#undef FALSE
+#endif
+
 #include <rpc/rpc.h>
 #include <rpc/types.h>
+#include <rpc/xdr.h>
 #include <rpcsvc/rquota.h>
 #ifdef HAVE_RPC_NETTYPE_H
 #include <rpc/nettype.h>
 #endif
-#include <rpc/xdr.h>
 
 #ifndef RQ_PATHLEN
 #define RQ_PATHLEN 1024
index 524e69c0e1f5a70d712267f86fb4f35cb1e2a6e5..399c104faa4c33aa1f58a1833f82fd24b8c636f8 100644 (file)
 #define DBGC_CLASS DBGC_VFS
 
 #ifdef HAVE_RPC_XDR_H
+/* <rpc/xdr.h> uses TRUE and FALSE */
+#ifdef TRUE
+#undef TRUE
+#endif
+
+#ifdef FALSE
+#undef FALSE
+#endif
+
 #include <rpc/xdr.h>
 #include "nfs41acl.h"
 #include "nfs4acl_xattr_xdr.h"
index 1c711aa570b833e53174e3959da93e278d5b2d71..8751833b221495b047c935c017fb33b8551ec25e 100644 (file)
@@ -1446,10 +1446,22 @@ main() {
         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', lib='tirpc'):
-            conf.DEFINE('HAVE_NFS_QUOTAS', '1')
+            # Optional structure member
             conf.CHECK_STRUCTURE_MEMBER('struct getquota_rslt', 'getquota_rslt_u',
                                         define='HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U',
-                                        headers='rpcsvc/rquota.h')
+                                        headers='rpcsvc/rquota.h',
+                                        lib='tirpc')
+
+            # Required fucntion for NFS quote support
+            conf.CHECK_CODE('''
+                            clnt_create("", RQUOTAPROG, RQUOTAVERS, "udp");
+                            ''',
+                            headers="rpc/rpc.h rpc/types.h rpcsvc/rquota.h rpc/nettype.h rpc/xdr.h",
+                            define='HAVE_NFS_QUOTAS',
+                            msg='checking for clnt_create()',
+                            execute=True,
+                            local_include=False,
+                            lib='tirpc')
 
         if (host_os.rfind('linux') > -1):
             conf.DEFINE('HAVE_QUOTACTL_LINUX', '1')
@@ -1476,16 +1488,6 @@ main() {
                                 execute=True,
                                 addmain=False)
 
-        conf.CHECK_CODE('''
-                     clnt_create("", RQUOTAPROG, RQUOTAVERS, "udp");
-''',
-                        headers="rpc/rpc.h rpc/types.h rpcsvc/rquota.h rpc/nettype.h rpc/xdr.h", 
-                        define='HAVE_NFS_QUOTAS',
-                        msg='for NFS QUOTAS',
-                        execute=True,
-                        local_include=False,
-                        lib='tirpc')
-
         if conf.CONFIG_SET('HAVE_QUOTACTL_LINUX') or \
            conf.CONFIG_SET('HAVE_QUOTACTL_4A') or \
            conf.CONFIG_SET('HAVE_QUOTACTL_4B') or \
index d4bc3cb17002ed9a2c024041f1bcb05f4ab00889..76c5d6e203bd27a930e318c02e1a87eabf1a79e3 100644 (file)
@@ -594,7 +594,7 @@ bld.SAMBA3_SUBSYSTEM('sysquotas',
                         lib/sysquotas_nfs.c
                      ''',
                      allow_warnings=True,
-                     deps='samba3-util samba-util')
+                     deps='samba3-util samba-util tirpc')
 
 NOTIFY_SOURCES=''
 NOTIFY_DEPS=''