rx: Add atomic operations code
[openafs.git] / acinclude.m4
index ba8f7b6..276cace 100644 (file)
@@ -981,6 +981,16 @@ dnl Linux-only, but just enable always.
                AC_DEFINE(AFS_CACHE_BYPASS, 1, [define to activate cache bypassing Unix client])
 esac
 
+AC_CACHE_CHECK([if compiler has __sync_add_and_fetch],
+    [ac_cv_sync_fetch_and_add],
+    [AC_TRY_LINK(, [int var; return __sync_add_and_fetch(&var, 1);],
+                   [ac_cv_sync_fetch_and_add=yes],
+                   [ac_cv_sync_fetch_and_add=no])
+])
+AS_IF([test "$ac_cv_sync_fetch_and_add" = "yes"],
+      [AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD, 1,
+               [define if your C compiler has __sync_add_and_fetch])])
+
 AC_CACHE_CHECK([if struct sockaddr has sa_len field],
     [ac_cv_sockaddr_len],
     [AC_TRY_COMPILE( [#include <sys/types.h>
@@ -1258,6 +1268,10 @@ AC_CHECK_FUNCS([ \
        getrlimit \
        issetugid \
        mkstemp \
+       pread \
+       preadv \
+       pwrite \
+       pwritev \
        regcomp \
        regerror \
        regexec \
@@ -1275,6 +1289,23 @@ AC_CHECK_FUNCS([ \
        vsyslog \
 ])
 
+AC_MSG_CHECKING([for positional I/O])
+if test "$ac_cv_func_pread" = "yes" && \
+        test "$ac_cv_func_pwrite" = "yes"; then
+   AC_DEFINE(HAVE_PIO, 1, [define if you have pread() and pwrite()])
+   AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+fi
+AC_MSG_CHECKING([for vectored positional I/O])
+if test "$ac_cv_func_preadv" = "yes" && \
+        test "$ac_cv_func_pwritev" = "yes"; then
+   AC_DEFINE(HAVE_PIOV, 1, [define if you have preadv() and pwritev()])
+   AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+fi
+
 AC_MSG_CHECKING([for POSIX regex library])
 if test "$ac_cv_header_regex_h" = "yes" && \
        test "$ac_cv_func_regcomp" = "yes" && \
@@ -1433,6 +1464,24 @@ struct labeltest struct_labeltest = {
 [AC_MSG_RESULT(no)
 ])
 
+AC_MSG_CHECKING([checking for dirfd])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+]],
+        [[DIR *d = 0; dirfd(d);]])],
+        [ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
+if test "$ac_rk_have_dirfd" = "yes" ; then
+        AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
+fi
+AC_MSG_RESULT($ac_rk_have_dirfd)
+
+OPENAFS_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#endif])
+
 dnl Eventually, this will look for the system one, or for OpenSSL
 LIB_hcrypto="-lafshcrypto"
 AC_SUBST(LIB_hcrypto)