s3-waf: more fallocate checks stolen from autoconf.
authorGünther Deschner <gd@samba.org>
Tue, 11 Jan 2011 23:43:26 +0000 (00:43 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 12 Jan 2011 00:44:22 +0000 (01:44 +0100)
Guenther

source3/wscript

index 3e83c12f28dbf67e4dd752ab87e821e53ebbf23c..561f65dd7035599da5fb21719371ccb9c3aea860 100644 (file)
@@ -88,6 +88,7 @@ def configure(conf):
     conf.ADD_LDFLAGS("-Wl,--export-dynamic", testflags=True)
 
     conf.CHECK_HEADERS('execinfo.h libexc.h libunwind.h netdb.h')
+    conf.CHECK_HEADERS('linux/falloc.h')
 
     conf.CHECK_FUNCS('getcwd fchown chmod fchmod mknod mknod64')
     conf.CHECK_FUNCS('strtol strchr strupr chflags')
@@ -335,6 +336,35 @@ return acl_get_perm_np(permset_d, perm);
                     headers='sys/types.h sys/statfs.h',
                     execute=True)
 
+    if conf.CONFIG_SET('HAVE_FALLOCATE'):
+        conf.CHECK_CODE('''
+               #if defined(HAVE_UNISTD_H)
+               #include <unistd.h>
+               #endif
+               #include <sys/types.h>
+               #define _GNU_SOURCE
+               #include <fcntl.h>
+               #if defined(HAVE_LINUX_FALLOC_H)
+               #include <linux/falloc.h>
+               #endif
+               int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
+               'HAVE_LINUX_FALLOCATE',
+               msg="Checking whether the Linux 'fallocate' function is available")
+    if conf.CONFIG_SET('HAVE_FALLOCATE64'):
+        conf.CHECK_CODE('''
+               #if defined(HAVE_UNISTD_H)
+               #include <unistd.h>
+               #endif
+               #include <sys/types.h>
+               #define _GNU_SOURCE
+               #include <fcntl.h>
+               #if defined(HAVE_LINUX_FALLOC_H)
+               #include <linux/falloc.h>
+               #endif
+               int ret = fallocate64(0, FALLOC_FL_KEEP_SIZE, 0, 10);''',
+               'HAVE_LINUX_FALLOCATE64',
+               msg="Checking whether the Linux 'fallocate64' function is available")
+
     default_static_modules=TO_LIST('''pdb_smbpasswd pdb_tdbsam pdb_wbc_sam pdb_ldap
                                       auth_sam auth_unix auth_winbind auth_wbc auth_server
                                       auth_domain auth_builtin auth_netlogond vfs_default