Add waf/configure tests for openat.
authorJeremy Allison <jra@samba.org>
Tue, 3 Jul 2012 20:34:21 +0000 (13:34 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 4 Jul 2012 00:37:59 +0000 (02:37 +0200)
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jul  4 02:37:59 CEST 2012 on sn-devel-104

source3/configure.in
source3/wscript

index abb4de667374b3daa8cc7666680ccdf1d0796a75..150f1896dac4b24ba541c6c9bf7e89fa3a36833e 100644 (file)
@@ -5791,6 +5791,24 @@ if test x"$samba_cv_HAVE_POSIX_FADVISE" = x"yes"; then
              [Whether posix_fadvise is available])
 fi
 
+############################################
+# See if we have the openat syscall.
+
+AC_CACHE_CHECK([for openat],
+               samba_cv_HAVE_OPENAT,[
+    AC_TRY_LINK([
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+#include <fcntl.h>],
+    [int fd = openat(AT_FDCWD, ".", O_RDONLY);],
+    samba_cv_HAVE_OPENAT=yes,
+    samba_cv_HAVE_OPENAT=no)])
+
+if test x"$samba_cv_HAVE_OPENAT" = x"yes"; then
+    AC_DEFINE(HAVE_OPENAT,1, [Whether openat is available])
+fi
+
 ############################################
 # See if we have the Linux splice syscall.
 
index 5fcf86ea187b7f598ea15ed71e37cae211dab029..12529e5e69a76f8435a4774646e428f559c7a12c 100755 (executable)
@@ -353,6 +353,11 @@ return acl_get_perm_np(permset_d, perm);
                 headers='unistd.h fcntl.h')
     conf.CHECK_DECLS('readahead', headers='fcntl.h', always=True)
 
+    conf.CHECK_CODE('int fd = openat(AT_FDCWD, ".", O_RDONLY);',
+               'HAVE_OPENAT',
+               msg='Checking for openat',
+               headers='fcntl.h')
+
     if Options.options.with_aio_support:
         conf.CHECK_FUNCS_IN('aio_read', 'aio')
         conf.CHECK_FUNCS_IN('aio_read', 'rt')