build: Rationalise AIO support in configure, ensure on by default
authorAndrew Bartlett <abartlet@samba.org>
Tue, 5 Jun 2012 23:23:22 +0000 (09:23 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 6 Jun 2012 06:23:10 +0000 (08:23 +0200)
With this change, the define to check for AIO is HAVE_AIO, consistant
with other subsystems.

It is now also on by default in the autoconf build, as it has been for waf.

Andrew Bartlett

source3/configure.in
source3/include/includes.h
source3/lib/system.c
source3/smbd/aio.c
source3/smbd/globals.c
source3/smbd/globals.h
source3/wscript

index 7a9f03a8c5dd3b880e990b58034ba5d8fdf4f0e3..a11e96b1075a75fb7b2e59d11acf2964874fc560 100644 (file)
@@ -5339,15 +5339,21 @@ esac
 #################################################
 # check for AIO support
 
+with_aio=auto
 AC_MSG_CHECKING(whether to support asynchronous io)
 AC_ARG_WITH(aio-support,
-[AS_HELP_STRING([--with-aio-support], [Include asynchronous io support (default=no)])],
-[ case "$withval" in
-  yes)
+[AS_HELP_STRING([--with-aio-support], [Include asynchronous io support (default=auto)])],
+[  case "$withval" in
+    yes|no)
+       with_aio=$withval
+       ;;
+   esac ])
 
-       AC_MSG_RESULT(yes)
-       case "$host_os" in
-       *)
+AC_MSG_RESULT($with_aio)
+
+if test x"$with_aio" = x"no"; then
+    AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support should be built in])
+else
                AIO_LIBS=$LIBS
                no_rt_LIBS=$LIBS
                AC_CHECK_LIB(rt,aio_read,[AIO_LIBS="$LIBS -lrt"])
@@ -5362,7 +5368,7 @@ AC_ARG_WITH(aio-support,
 samba_cv_HAVE_AIO=yes,samba_cv_HAVE_AIO=no)
                LIBS=$aio_LIBS])
                if test x"$samba_cv_HAVE_AIO" = x"yes"; then
-                       AC_DEFINE(WITH_AIO, 1, [Using asynchronous io])
+                       AC_DEFINE(HAVE_AIO, 1, [Using asynchronous io])
                        LIBS=$AIO_LIBS
                        AC_MSG_CHECKING(for aio_read)
                        AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
@@ -5405,19 +5411,11 @@ int main() { struct aiocb a; return aio_cancel(1, &a); }])],
 int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }])],
 [AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have aio_suspend]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
+               else
+                       AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support is available])
+                       AC_MSG_RESULT(no)
                fi
-
-            ;;
-        esac
-        ;;
-  *)
-    AC_MSG_RESULT(no)
-    AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support is available])
-    ;;
-  esac ],
-  AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support should be built in])
-  AC_MSG_RESULT(no)
-)
+fi
 
 if test x"$samba_cv_HAVE_AIO" = x"yes"; then
        if test x"$samba_cv_msghdr_msg_control" = x"yes" -o \
@@ -5455,7 +5453,7 @@ 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])
+               AC_DEFINE(HAVE_AIO, 1, [Using asynchronous io])
                default_shared_modules="$default_shared_modules vfs_aio_linux"
            fi
             ;;
index f25d1c2fcfe93c4e9537e2d314448a1f577e20f2..cb60dd2152d6792593d4261ff90735b858c18418 100644 (file)
 #include <netgroup.h>
 #endif
 
-#if defined(HAVE_AIO_H) && defined(WITH_AIO)
+#if defined(HAVE_AIO_H) && defined(HAVE_AIO)
 #include <aio.h>
 #endif
 
@@ -343,7 +343,7 @@ typedef struct stat_ex SMB_STRUCT_STAT;
  */
 
 #ifndef SMB_STRUCT_AIOCB
-#  if defined(WITH_AIO)
+#  if defined(HAVE_AIO)
 #      define SMB_STRUCT_AIOCB struct aiocb
 #  else
 #    define SMB_STRUCT_AIOCB int /* AIO not being used but we still need the define.... */
index 8c1ae94e19f587d53d6f715fc1f6db53b5bb44de..92596a8d72ec608b0a23453b9258eaba28faf2bd 100644 (file)
@@ -1365,7 +1365,7 @@ int sys_get_number_of_cores(void)
 }
 #endif
 
-#if defined(WITH_AIO)
+#if defined(HAVE_AIO)
 
 /*******************************************************************
  An aio_read wrapper.
@@ -1464,7 +1464,7 @@ int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct
        return -1;
 #endif
 }
-#else /* !WITH_AIO */
+#else /* !HAVE_AIO */
 
 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb)
 {
@@ -1507,4 +1507,4 @@ int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct
        errno = ENOSYS;
        return -1;
 }
-#endif /* WITH_AIO */
+#endif /* HAVE_AIO */
index aa8aee00fbec729b4d03a9dcbf94deba7275f9b6..131094de360e9b1a04fea053104995b7e4408c5b 100644 (file)
@@ -23,7 +23,7 @@
 #include "smbd/globals.h"
 #include "../lib/util/tevent_ntstatus.h"
 
-#if defined(WITH_AIO)
+#if defined(HAVE_AIO)
 
 /* The signal we'll use to signify aio done. */
 #ifndef RT_SIGNAL_AIO
index f107c0e66131941238bf0a1bbe182590b402137d..7c4ffec0990e7a38839cc74dc5721819d8f6ac54 100644 (file)
@@ -25,7 +25,7 @@
 #include "messages.h"
 #include "tdb_compat.h"
 
-#if defined(WITH_AIO)
+#if defined(HAVE_AIO)
 struct aio_extra *aio_list_head = NULL;
 struct tevent_signal *aio_signal_event = NULL;
 int aio_pending_size = 0;
index ccf79fe5ffd3ab13c915a1c8d080889d874f6de7..2c0056660f86c337696b365d8be96f8552ffae6e 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "system/select.h"
 
-#if defined(WITH_AIO)
+#if defined(HAVE_AIO)
 struct aio_extra;
 extern struct aio_extra *aio_list_head;
 extern struct tevent_signal *aio_signal_event;
index 9d8264ca87d94518e1c5a882e90da4efd2c245be..ccedb6947f88eb4a8b6b02e2038fdd4f01c4ed67 100755 (executable)
@@ -361,8 +361,6 @@ return acl_get_perm_np(permset_d, perm);
                         msg='Checking for asynchronous io support',
                         headers='sys/types.h aio.h',
                         lib='aio rt')
-        if conf.CONFIG_SET('HAVE_AIO'):
-            conf.DEFINE('WITH_AIO', '1')
         if conf.CONFIG_SET('HAVE_AIO'):
             conf.CHECK_CODE('struct aiocb a; return aio_read(&a);', 'HAVE_AIO_READ', msg='Checking for aio_read', headers='aio.h', lib='aio rt')
             conf.CHECK_CODE('struct aiocb a; return aio_write(&a);', 'HAVE_AIO_WRITE', msg='Checking for aio_write', headers='aio.h', lib='aio rt')