From: Jeremy Allison Date: Fri, 20 Apr 2012 22:53:55 +0000 (-0700) Subject: Add complete test program for Linux kernel aio inside configure.in (I discovered... X-Git-Tag: samba-4.0.0alpha20~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbaaf4b21fd7253d333261ba925e8f40122335e8;p=thirdparty%2Fsamba.git Add complete test program for Linux kernel aio inside configure.in (I discovered yesterday there are systems with only half the glibc changes needed to implement userspace kaio. --- diff --git a/source3/configure.in b/source3/configure.in index 35bbe2873cc..56112e9ca56 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -5545,12 +5545,34 @@ if test x"$samba_cv_HAVE_AIO" = x"yes"; then # Check for Linux kernel aio support. case "$host_os" in *linux*) - AC_MSG_CHECKING(for Linux kernel asynchronous io support) - AC_CHECK_LIB(aio,io_submit, - [AIO_LIBS="$LIBS -laio"; - AC_DEFINE(HAVE_LINUX_KERNEL_AIO, 1, Define to 1 if there is support for Linux kernel asynchronous io)], - []) - if test x"$ac_cv_lib_aio_io_submit" = x"yes"; then + AC_CHECK_LIB(aio,io_submit,[AIO_LIBS="$LIBS -laio"]) + AC_CACHE_CHECK([for Linux kernel asynchronous io support],samba_cv_HAVE_LINUX_KERNEL_AIO,[ + aio_LIBS=$LIBS + LIBS=$AIO_LIBS + AC_TRY_LINK([#include +#include +#include +#include +#include +#include ], +[ struct io_event ioev; +struct iocb *ioc; +io_context_t ctx; +struct timespec ts; +int fd; +char *buf; +fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); +io_queue_init(128,&ctx); +io_prep_pwrite(ioc, 1, buf, 1, 0); +io_prep_pread(ioc, 1, buf, 1, 0); +io_set_eventfd(ioc, fd); +io_set_callback(ioc, (io_callback_t)(0)); +io_submit(ctx, 1, &ioc); +io_getevents(ctx, 1, 1, &ioev, &ts);], +samba_cv_HAVE_LINUX_KERNEL_AIO=yes,samba_cv_HAVE_LINUX_KERNEL_AIO=no) + LIBS=$aio_LIBS]) + if test x"$samba_cv_HAVE_LINUX_KERNEL_AIO" = x"yes"; then + AC_DEFINE(WITH_AIO, 1, [Using asynchronous io]) default_shared_modules="$default_shared_modules vfs_aio_linux" fi ;;