gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (4dadf8ec -> 4a169d0c)


From: gnunet
Subject: [libmicrohttpd] branch master updated (4dadf8ec -> 4a169d0c)
Date: Fri, 23 Dec 2022 15:49:38 +0100

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 4dadf8ec Updated parsing of cookies, reject cookie completely if 
discipline is very strict
     new 84dfd52f Added new M4 helper macro
     new 2efc0139 configure: used better detection of some functions when 
cross-compiling
     new 4a169d0c configure: try to detect whether eventfd is enabled

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 configure.ac             | 145 ++++++++++++++++++++++-------------------------
 m4/mhd_check_link_run.m4 |  67 ++++++++++++++++++++++
 2 files changed, 136 insertions(+), 76 deletions(-)
 create mode 100644 m4/mhd_check_link_run.m4

diff --git a/configure.ac b/configure.ac
index b032badc..e224cd88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1750,29 +1750,11 @@ AC_CHECK_MEMBERS([struct sockaddr_in.sin_len, struct 
sockaddr_in6.sin6_len,
 #endif
    ])
 
-MHD_CHECK_FUNC([getsockname],
-  [[
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
-  ]],
+MHD_CHECK_LINK_RUN([[for working getsockname()]],[[mhd_cv_getsockname_usable]],
+  [[mhd_cv_getsockname_usable='assuming yes']],
   [
-    struct sockaddr_storage ss;
-    (void)getsockname(socket(0,0,0),(struct sockaddr *)&ss,(void*)0);
-  ],
-  [
-    AC_CACHE_CHECK([[whether getsockname() is usable]], 
[[mhd_cv_getsockname_usable]],
-      [
-         AC_RUN_IFELSE(
-           [
-            AC_LANG_SOURCE(
-             [[
+    AC_LANG_SOURCE(
+      [[
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
@@ -1853,18 +1835,10 @@ int main(void)
 #endif
   return ret;
 }
-             ]]
-            )
-           ],
-           [[mhd_cv_getsockname_usable='yes']],
-           [[mhd_cv_getsockname_usable='no']],
-           [[mhd_cv_getsockname_usable='assuming yes']]
-         )
-        ]
-      )
-    AS_VAR_IF([[mhd_cv_getsockname_usable]], [["no"]], [:],
-        [AC_DEFINE([[MHD_USE_GETSOCKNAME]], [[1]], [Define if you have usable 
`getsockname' function.])])
-  ]
+      ]]
+    )
+  ],
+  [AC_DEFINE([[MHD_USE_GETSOCKNAME]], [[1]], [Define if you have usable 
`getsockname' function.])]
 )
 
 AC_CACHE_CHECK([for usable PAGESIZE macro], [mhd_cv_macro_pagesize_usable],
@@ -2024,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"]], [], [
@@ -2074,8 +2066,13 @@ AC_INCLUDES_DEFAULT
       use_itc='pipe'
       enable_itc="$use_itc"
       AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread 
communication])
-      AC_CACHE_CHECK([[whether pipe2(2) is usable]], [[mhd_cv_pipe2_usable]], [
-        AC_RUN_IFELSE([
+      MHD_CHECK_LINK_RUN([[whether pipe2(2) is 
usable]],[[mhd_cv_pipe2_usable]],
+        [
+          # Cross-compiling
+          AS_CASE([${host_os}], [kfreebsd*-gnu], 
[[mhd_cv_pipe2_usable='assuming no']],
+            [[mhd_cv_pipe2_usable='assuming yes']])
+        ],
+        [
           AC_LANG_PROGRAM([
 AC_INCLUDES_DEFAULT
 #ifdef HAVE_FCNTL_H
@@ -2084,22 +2081,18 @@ AC_INCLUDES_DEFAULT
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-          ], [[
-            int arr[2];
-            int res;
-            res = pipe2(arr, O_CLOEXEC | O_NONBLOCK);
-            if (res != 0) return 33;
-            close (arr[0]);
-            close (arr[1]);
-          ]])
-        ], [[mhd_cv_pipe2_usable='yes']], [[mhd_cv_pipe2_usable='no']], [
-          # Cross-compiling
-          AS_CASE([${host_os}], [kfreebsd*-gnu], 
[[mhd_cv_pipe2_usable='assuming no']],
-            [[mhd_cv_pipe2_usable='assuming yes']])
-        ])
-      ])
-      AS_CASE([["X-${mhd_cv_pipe2_usable}"]], [[X*yes]],
-        [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable 
pipe2(2) function])])
+            ], [[
+              int arr[2];
+              int res;
+              res = pipe2(arr, O_CLOEXEC | O_NONBLOCK);
+              if (res != 0) return 33;
+              close (arr[0]);
+              close (arr[1]);
+            ]]
+          )
+        ],
+        [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable 
pipe2(2) function])]
+      )
     ], [
       AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not 
usable, consider using other type of inter-thread communication]])])
     ])
diff --git a/m4/mhd_check_link_run.m4 b/m4/mhd_check_link_run.m4
new file mode 100644
index 00000000..731ab81e
--- /dev/null
+++ b/m4/mhd_check_link_run.m4
@@ -0,0 +1,67 @@
+# SYNOPSIS
+#
+#   MHD_CHECK_LINK_RUN(MESSAGE, CACHE_ID, COMMAND_IF_CROSS_COMPILING, INPUT,
+#                      [ACTION_IF_SUCCEED], [ACTION_IF_FAILED])
+#
+# DESCRIPTION
+#
+#   Improved version of AC_RUN_IFELSE macro.
+#   Unlike AC_RUN_IFELSE, this macro tries to link the code if cross-compiling.
+#   Action COMMAND_IF_CROSS_COMPILING is executed only if link is succeed,
+#   otherwise CACHE_ID variable set to "no". 
+#   COMMAND_IF_CROSS_COMPILING action must set CACHE_ID variable to "yes", 
"no",
+#   "assuming yes" or "assuming no".
+#   ACTION_IF_SUCCEED is executed if result is "yes" or "assuming yes".
+#   ACTION_IF_FAILED is execuded if result is "no" or "assuming no".
+#
+#   Example usage:
+#
+#     MHD_CHECK_LINK_RUN([for valid snprintf()], [mhd_cv_snprintf_valid],
+#                        AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+#                                        [if (4 != snprintf(NULL, 0, "test"))
+#                                           return 2;])],
+#                        [mhd_cv_snprintf_valid='assuming no'])
+#
+#
+# LICENSE
+#
+#   Copyright (c) 2022 Karlson2k (Evgeny Grin) <k2k@narod.ru>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 1
+
+AC_DEFUN([MHD_CHECK_LINK_RUN],[dnl
+m4_ifblank([$1],[m4_fatal([$0: The first macro argument ("MESSAGE") must not 
be empty])])dnl
+m4_ifblank([$2],[m4_fatal([$0: The second macro argument ("CACHE_ID") must not 
be empty])])dnl
+m4_ifblank([$3],[m4_fatal([$0: The third macro argument 
("COMMAND_IF_CROSS_COMPILING") ]dnl
+[must not be empty])])dnl
+m4_ifblank([$4],[m4_fatal([$0: The fourth macro argument ("INPUT") must not be 
empty])])dnl
+m4_bmatch(_mhd_norm_expd([$2]),[\s],dnl
+[m4_fatal([$0: The second macro argument ("CACHE_ID") must not contain 
whitespaces])])dnl
+m4_bmatch(_mhd_norm_expd([$3]),[\<]m4_re_escape(_mhd_norm_expd([$2]))[\>],[],dnl
+[m4_fatal([$0: The third macro argument ("COMMAND_IF_CROSS_COMPILING") must 
assign ]dnl
+[a value to the cache variable ']_mhd_norm_expd([$2])['])])dnl
+m4_pushdef([cacheVar],_mhd_norm_expd([$2]))dnl
+AC_CACHE_CHECK([$1],[$2],
+[
+AC_LANG_CONFTEST([$4])
+AS_VAR_IF([cross_compiling],["yes"],
+[AC_LINK_IFELSE([],[
+$3
+],[cacheVar='no'])dnl AC_LINK_IFELSE
+],dnl
+[AC_RUN_IFELSE([],[cacheVar='yes'],[cacheVar='no'],[[# Dummy placeholder]])
+])
+rm -f conftest.$ac_ext
+])
+m4_ifnblank([$5],[
+AS_IF([test "x$cacheVar" = "xyes" || test "x$cacheVar" = "xassuming 
yes"],[$5])dnl AS_IF
+])dnl m4_ifnblank
+m4_ifnblank([$6],[
+AS_IF([test "x$cacheVar" = "xno" || test "x$cacheVar" = "xassuming 
no"],[$6])dnl AS_IF
+])dnl m4_ifnblank
+])dnl AC_DEFUN

-- 
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]