--- libeio/libeio.m4 2010/12/01 07:30:39 1.11 +++ libeio/libeio.m4 2012/06/02 20:13:26 1.20 @@ -1,3 +1,7 @@ +dnl openbsd in it's neverending brokenness requires stdint.h for intptr_t, +dnl but that header isn't very portable... +AC_CHECK_HEADERS([stdint.h sys/syscall.h sys/prctl.h]) + AC_SEARCH_LIBS( pthread_create, [pthread pthreads pthreadVC2], @@ -58,22 +62,6 @@ ],ac_cv_fdatasync=yes,ac_cv_fdatasync=no)]) test $ac_cv_fdatasync = yes && AC_DEFINE(HAVE_FDATASYNC, 1, fdatasync(2) is available) -AC_CACHE_CHECK(for pread and pwrite, ac_cv_preadwrite, [AC_LINK_IFELSE([ -#include -int main (void) -{ - int fd = 0; - size_t count = 1; - char buf; - off_t offset = 1; - ssize_t res; - res = pread (fd, &buf, count, offset); - res = pwrite (fd, &buf, count, offset); - return 0; -} -],ac_cv_preadwrite=yes,ac_cv_preadwrite=no)]) -test $ac_cv_preadwrite = yes && AC_DEFINE(HAVE_PREADWRITE, 1, pread(2) and pwrite(2) are available) - AC_CACHE_CHECK(for sendfile, ac_cv_sendfile, [AC_LINK_IFELSE([ # include #if __linux @@ -119,3 +107,89 @@ ],ac_cv_sync_file_range=yes,ac_cv_sync_file_range=no)]) test $ac_cv_sync_file_range = yes && AC_DEFINE(HAVE_SYNC_FILE_RANGE, 1, sync_file_range(2) is available) +AC_CACHE_CHECK(for fallocate, ac_cv_linux_fallocate, [AC_LINK_IFELSE([ +#include +int main (void) +{ + int fd = 0; + int mode = 0; + off_t offset = 1; + off_t len = 1; + int res; + res = fallocate (fd, mode, offset, len); + return 0; +} +],ac_cv_linux_fallocate=yes,ac_cv_linux_fallocate=no)]) +test $ac_cv_linux_fallocate = yes && AC_DEFINE(HAVE_LINUX_FALLOCATE, 1, fallocate(2) is available) + +AC_CACHE_CHECK(for sys_syncfs, ac_cv_sys_syncfs, [AC_LINK_IFELSE([ +#include +#include +int main (void) +{ + int res = syscall (__NR_syncfs, (int)0); +} +],ac_cv_sys_syncfs=yes,ac_cv_sys_syncfs=no)]) +test $ac_cv_sys_syncfs = yes && AC_DEFINE(HAVE_SYS_SYNCFS, 1, syscall(__NR_syncfs) is available) + +AC_CACHE_CHECK(for prctl_set_name, ac_cv_prctl_set_name, [AC_LINK_IFELSE([ +#include +int main (void) +{ + char name[] = "test123"; + int res = prctl (PR_SET_NAME, (unsigned long)name, 0, 0, 0); +} +],ac_cv_prctl_set_name=yes,ac_cv_prctl_set_name=no)]) +test $ac_cv_prctl_set_name = yes && AC_DEFINE(HAVE_PRCTL_SET_NAME, 1, prctl(PR_SET_NAME) is available) + +dnl ############################################################################# +dnl # these checks exist for the benefit of IO::AIO + +dnl at least uclibc defines _POSIX_ADVISORY_INFO without *any* of the required +dnl functionality actually being present. ugh. +AC_CACHE_CHECK(for posix_madvise, ac_cv_posix_madvise, [AC_LINK_IFELSE([ +#include +int main (void) +{ + int res = posix_madvise ((void *)0, (size_t)0, POSIX_MADV_NORMAL); + int a = POSIX_MADV_SEQUENTIAL; + int b = POSIX_MADV_RANDOM; + int c = POSIX_MADV_WILLNEED; + int d = POSIX_MADV_DONTNEED; + return 0; +} +],ac_cv_posix_madvise=yes,ac_cv_posix_madvise=no)]) +test $ac_cv_posix_madvise = yes && AC_DEFINE(HAVE_POSIX_MADVISE, 1, posix_madvise(2) is available) + +AC_CACHE_CHECK(for posix_fadvise, ac_cv_posix_fadvise, [AC_LINK_IFELSE([ +#define _XOPEN_SOURCE 600 +#include +int main (void) +{ + int res = posix_fadvise ((int)0, (off_t)0, (off_t)0, POSIX_FADV_NORMAL); + int a = POSIX_FADV_SEQUENTIAL; + int b = POSIX_FADV_NOREUSE; + int c = POSIX_FADV_RANDOM; + int d = POSIX_FADV_WILLNEED; + int e = POSIX_FADV_DONTNEED; + return 0; +} +],ac_cv_posix_fadvise=yes,ac_cv_posix_fadvise=no)]) +test $ac_cv_posix_fadvise = yes && AC_DEFINE(HAVE_POSIX_FADVISE, 1, posix_fadvise(2) is available) + +dnl lots of linux specifics +AC_CHECK_HEADERS([linux/fs.h linux/fiemap.h]) + +AC_CACHE_CHECK([for splice, vmsplice and tee], ac_cv_linux_splice, [AC_LINK_IFELSE([ +#include +int main (void) +{ + ssize_t res; + res = splice ((int)0, (loff_t)0, (int)0, (loff_t *)0, (size_t)0, SPLICE_F_MOVE | SPLICE_F_NONBLOCK | SPLICE_F_MORE); + res = tee ((int)0, (int)0, (size_t)0, SPLICE_F_NONBLOCK); + res = vmsplice ((int)0, (struct iovec *)0, 0, SPLICE_F_NONBLOCK | SPLICE_F_GIFT); + return 0; +} +],ac_cv_linux_splice=yes,ac_cv_linux_splice=no)]) +test $ac_cv_linux_splice = yes && AC_DEFINE(HAVE_LINUX_SPLICE, 1, splice/vmsplice/tee(2) are available) +