gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 03/03: configure: try to detect whether eventfd is enabl


From: gnunet
Subject: [libmicrohttpd] 03/03: configure: try to detect whether eventfd is enabled
Date: Fri, 23 Dec 2022 15:49:41 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 4a169d0cffaa69ed22ddd6cca721b43c7599df6c
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Dec 23 17:20:54 2022 +0300

    configure: try to detect whether eventfd is enabled
    
    eventfd is optional kernel feature, MHD can work just fine without
    eventfd enabled.
---
 configure.ac | 66 ++++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 42 insertions(+), 24 deletions(-)

diff --git a/configure.ac b/configure.ac
index eb323051..e224cd88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1998,32 +1998,50 @@ AS_CASE([[$enable_itc]],
 )
 AS_UNSET([[use_itc]])
 
-AS_IF([[test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"]], [
-  AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [
-    AC_CHECK_HEADERS([sys/eventfd.h], [], [], [AC_INCLUDES_DEFAULT])
-    AS_VAR_IF([[ac_cv_header_sys_eventfd_h]], [["yes"]], [
-      AC_CACHE_CHECK([whether eventfd(2) is usable], 
[[mhd_cv_eventfd_usable]], [
-        AC_LINK_IFELSE([
-          AC_LANG_PROGRAM([[
+AS_IF([[test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"]],
+  [
+    MHD_CHECK_LINK_RUN([[for working 
eventfd(2)]],[[mhd_cv_eventfd_usable]],[[mhd_cv_eventfd_usable='assuming no']],
+      [
+        AC_LANG_SOURCE([[
 #include <sys/eventfd.h>
 #include <unistd.h>
-          ]], [[
-          int ef = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
-          if (ef < 0) return 1;
-          close (ef);
-          ]])
-        ], [[mhd_cv_eventfd_usable='yes']], [[mhd_cv_eventfd_usable='no']])
-      ])
-    ])
-  ])
-  AS_VAR_IF([[mhd_cv_eventfd_usable]], [["yes"]], [
-    use_itc='eventfd'
-    enable_itc="$use_itc"
-    AC_DEFINE([[_MHD_ITC_EVENTFD]], [[1]], [Define to use eventFD for 
inter-thread communication])
-  ], [
-    AS_VAR_IF([[enable_itc]], [["eventfd"]], [AC_MSG_ERROR([[eventfd(2) is not 
usable, consider using other type of inter-thread communication]])])
-  ])
-])
+
+int main(void)
+{
+  unsigned char buf[8];
+  int ret;
+  int efd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
+  if (0 > efd)
+    return 2;
+  ret = 0;
+  buf[3] = 1;
+  if (8 != write(efd, buf, 8))
+    ret = 3;
+  else
+  {
+    if (8 != read(efd, buf, 8))
+      ret = 4;
+  }
+  close(efd);
+  return ret;
+}
+          ]]
+        )
+      ],
+      [
+        use_itc='eventfd'
+        enable_itc="$use_itc"
+        AC_DEFINE([[_MHD_ITC_EVENTFD]], [[1]], [Define to use eventFD for 
inter-thread communication])
+      ],
+      [
+        AS_VAR_IF([[enable_itc]], [["eventfd"]], [AC_MSG_ERROR([[eventfd(2) is 
not usable, consider using other type of inter-thread communication]])])
+      ]
+    )
+    AS_VAR_IF([mhd_cv_eventfd_usable],["assuming no"],
+      [AC_MSG_WARN([if you have 'eventfd' support enabled on your target 
system consider overriding test result by "mhd_cv_eventfd_usable=yes" configure 
parameter])]
+    )
+  ]
+)
 
 AS_IF([[test "x$enable_itc" = "xpipe" || test "x$enable_itc" = "xauto"]], [
   AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]