=== modified file 'configure.in' --- configure.in 2009-08-12 09:38:36 +0000 +++ configure.in 2009-08-23 05:23:13 +0000 @@ -419,13 +419,37 @@ AC_MSG_NOTICE([With pthreads]) fi -AC_ARG_WITH(aio, - AS_HELP_STRING([--with-aio],[Use POSIX AIO])) -if test "$with_aio" = "yes"; then - AC_MSG_NOTICE([With aio]) +with_aio=yes +NEED_AIO= +LIBAIO= +AC_ARG_WITH(aio, AS_HELP_STRING([--without-aio],[Do not use POSIX AIO])) +dnl Check for POSIX AIO availability +if test "$with_aio" != "no"; then + AC_CHECK_HEADERS(aio.h) + dnl On some systems POSIX AIO functions are in librt + dnl On some systems POSIX AIO functions are in libaio + AC_CHECK_LIB(rt, aio_read, + [LIBAIO="-lrt"], + AC_CHECK_LIB(aio, aio_read,[LIBAIO="-laio"], + AC_MSG_ERROR(POSIX AIO is not available on this system)) + ) + + dnl Enable AIO if the library and headers are found + if test "$LIBAIO" != "" && test "$ac_have_aio_h" != ""; then + with_aio="yes" + else + dnl Windows does things differently. We provide wrappers. + case "$host_os" in + mingw|mingw32) + with_aio=yes + ;; + *) + with_aio=no + ;; + esac + fi fi - AC_ARG_WITH(dl, AS_HELP_STRING([--with-dl],[Use dynamic linking])) if test "$with_dl" = "yes"; then @@ -442,6 +466,10 @@ yes) for dir in $srcdir/src/fs/*; do module="`basename $dir`" + dnl COSS requires AIO to be auto-enabled. + if test -d "$dir" && test "$module" = "coss" && test "$with_aio" != "yes" ; then + continue + fi if test -d "$dir" && test "$module" != CVS && test "$module" != coss; then STORE_MODULES="$STORE_MODULES $module" fi @@ -481,7 +509,6 @@ NEED_BLOCKING= NEED_DISKDAEMON= NEED_DISKTHREADS= -NEED_AIO= STORE_TESTS= for fs in $STORE_MODULES none; do case "$fs" in @@ -496,6 +523,9 @@ NEED_DISKTHREADS="true" ;; coss) + if test "$with_aio" != "yes"; then + AC_MSG_ERROR([COSS requires POSIX AIO which is not available on this system.]) + fi NEED_AIO="true" dnl dnl Automake om MinGW needs explicit exe extension @@ -553,6 +583,11 @@ yes) for dir in $srcdir/src/DiskIO/*; do module="`basename $dir`" + dnl AIO modules require system support to be auto-enabled. + if test -d "$dir" && test "$module" = "AIO" && test "$with_aio" != "yes" ; then + AC_MSG_NOTICE([Autodetected $module DiskIO module but AIO support disabled. Skipping.]) + continue + fi if test -d "$dir" && test "$module" != CVS; then AC_MSG_NOTICE([Autodetected $module DiskIO module]) DISK_MODULES="$DISK_MODULES $module" @@ -578,7 +613,10 @@ if test -n "$DISK_MODULES"; then for module in $DISK_MODULES; do if test -d $srcdir/src/DiskIO/$module; then - : + dnl AIO module requires system POSIX AIO support + if test "$module" = "AIO" && test "$with_aio" != "yes"; then + AC_MSG_ERROR(AIO module requires POSIX AIO support which is not available or has been disabled) + fi else AC_MSG_ERROR(disk-io $module does not exist) fi @@ -599,11 +637,11 @@ DiskThreads) FOUND_DISKTHREADS="true" ;; - AIO) - FOUND_AIO="true" - ;; Blocking) FOUND_BLOCKING="true" + ;; + *) + ;; esac done @@ -629,15 +667,29 @@ DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskThreads/DiskThreadsDiskIOModule.o" fi -if test -z "$FOUND_AIO" && test -n "$NEED_AIO"; then - AC_MSG_NOTICE([adding AIO, as it is used by an active, legacy Store Module]) - DISK_LIBS="$DISK_LIBS libAIO.a" - DISK_MODULES="$DISK_MODULES AIO" - DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/AIO/AIODiskIOModule.o" +dnl Use the POSIX AIO pieces if we actually need them. +if test "$with_aio" = "yes" && test "$NEED_AIO" = "true" ; then + AC_MSG_NOTICE([adding AIO, as it is used by an active, legacy Store Module]) + DISK_LIBS="$DISK_LIBS $LIBAIO libAIO.a" + DISK_MODULES="$DISK_MODULES AIO" + DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/AIO/AIODiskIOModule.o" + case "$host_os" in + mingw|mingw32) + USE_AIO_WIN32=1 + AC_MSG_NOTICE([Aio IO Module used, Windows overlapped I/O support automatically enabled]) + ;; + *) + AC_MSG_NOTICE([Aio IO Module used, aio support automatically enabled]) + ;; + esac +else + if test "$NEED_AIO" = "true" ; then + AC_MSG_NOTICE([AIO support is not needed. Automatically disabled.]) + fi fi + AC_MSG_NOTICE([IO Modules built: $DISK_MODULES]) USE_AIOPS_WIN32=0 -USE_AIO_WIN32=0 dnl we know what is being built. now add dependencies. for fs in $DISK_MODULES none; do case "$fs" in @@ -655,32 +707,9 @@ esac fi ;; - AIO) - if test -z "$with_aio"; then - case "$host_os" in - mingw|mingw32) - USE_AIO_WIN32=1 - AC_MSG_NOTICE([Aio IO Module used, Windows overlapped I/O support automatically enabled]) - ;; - *) - AC_MSG_NOTICE([Aio IO Module used, aio support automatically enabled]) - with_aio=yes - ;; - esac - fi - ;; esac done -dnl Check for librt -dnl We use AIO in the coss store -if test "$with_aio" = "yes"; then - dnl On some systems POSIX AIO functions are in libaio - AC_CHECK_LIB(rt, aio_read, - [DISK_LIBS="$DISK_LIBS -lrt"], - AC_CHECK_LIB(aio, aio_read,[DISK_LIBS="$DISK_LIBS -laio"]) - ) -fi dnl Check for pthreads dnl We use pthreads when doing ASYNC I/O @@ -2080,7 +2109,6 @@ AC_HEADER_STDC AC_CHECK_HEADERS( \ - aio.h \ arpa/inet.h \ arpa/nameser.h \ assert.h \