gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 01/02: Further improved PAGESIZE macro detection


From: gnunet
Subject: [libmicrohttpd] 01/02: Further improved PAGESIZE macro detection
Date: Wed, 27 Oct 2021 20:33:49 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit af75c70b42fb851ee605c40e1cd950f8c5bcf90d
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Oct 27 21:24:33 2021 +0300

    Further improved PAGESIZE macro detection
---
 configure.ac                | 74 +++++++++++++++++++++++++++++++++++++++++++--
 src/microhttpd/memorypool.c |  9 +++++-
 2 files changed, 80 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index b922e2c3..169a4019 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1393,7 +1393,42 @@ choke me now
   ]
 )
 AS_VAR_IF([[mhd_cv_macro_pagesize_usable]], [["yes"]],
-  [AC_DEFINE([[MHD_USE_PAGESIZE_MACRO]],[[1]],[Define if you have usable 
PAGESIZE macro])],
+  [
+    AC_DEFINE([[MHD_USE_PAGESIZE_MACRO]],[[1]],[Define if you have usable 
PAGESIZE macro])
+    AC_CACHE_CHECK([whether PAGESIZE macro could be used for static init], 
[mhd_cv_macro_pagesize_usable_static],
+      [
+        AC_LINK_IFELSE(
+          [
+            AC_LANG_PROGRAM(
+              [[
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifndef PAGESIZE
+#error No PAGESIZE macro defined
+choke me now
+#endif
+static long ac_pgsz = PAGESIZE + 0;
+              ]],
+              [[
+                if (1 > ac_pgsz) return 1;
+              ]]
+            )
+          ],
+          [[mhd_cv_macro_pagesize_usable_static="yes"]], 
[[mhd_cv_macro_pagesize_usable_static="no"]]
+        )
+      ]
+    )
+    AS_VAR_IF([[mhd_cv_macro_pagesize_usable_static]], [["yes"]],
+      [AC_DEFINE([[MHD_USE_PAGESIZE_MACRO_STATIC]],[[1]],[Define if you have 
PAGESIZE macro usable for static init])]
+    )
+  ],
   [
     AC_CACHE_CHECK([for usable PAGE_SIZE macro], 
[mhd_cv_macro_page_size_usable],
       [
@@ -1426,7 +1461,42 @@ choke me now
       ]
     )
     AS_VAR_IF([[mhd_cv_macro_page_size_usable]], [["yes"]],
-      [AC_DEFINE([[MHD_USE_PAGE_SIZE_MACRO]],[[1]],[Define if you have usable 
PAGE_SIZE macro])]
+      [
+        AC_DEFINE([[MHD_USE_PAGE_SIZE_MACRO]],[[1]],[Define if you have usable 
PAGE_SIZE macro])
+        AC_CACHE_CHECK([whether PAGE_SIZE macro could be used for static 
init], [mhd_cv_macro_page_size_usable_static],
+          [
+            AC_LINK_IFELSE(
+              [
+                AC_LANG_PROGRAM(
+                  [[
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifndef PAGE_SIZE
+#error No PAGE_SIZE macro defined
+choke me now
+#endif
+static long ac_pgsz = PAGE_SIZE + 0;
+                  ]],
+                  [[
+                    if (1 > ac_pgsz) return 1;
+                  ]]
+                )
+              ],
+              [[mhd_cv_macro_page_size_usable_static="yes"]], 
[[mhd_cv_macro_page_size_usable_static="no"]]
+            )
+          ]
+        )
+        AS_VAR_IF([[mhd_cv_macro_page_size_usable_static]], [["yes"]],
+          [AC_DEFINE([[MHD_USE_PAGE_SIZE_MACRO_STATIC]],[[1]],[Define if you 
have PAGE_SIZE macro usable for static init])]
+        )
+      ]
     )
   ]
 )
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index cf0b897e..f963031e 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -120,7 +120,14 @@
 /**
  * Size of memory page
  */
-static size_t MHD_sys_page_size_ = _MHD_FALLBACK_PAGE_SIZE; /* Default 
fallback value */
+static size_t MHD_sys_page_size_ =
+#if defined(MHD_USE_PAGESIZE_MACRO_STATIC)
+  PAGESIZE;
+#elif defined(MHD_USE_PAGE_SIZE_MACRO_STATIC)
+  PAGE_SIZE;
+#else  /* ! MHD_USE_PAGE_SIZE_MACRO_STATIC */
+  _MHD_FALLBACK_PAGE_SIZE;   /* Default fallback value */
+#endif /* ! MHD_USE_PAGE_SIZE_MACRO_STATIC */
 
 /**
  * Initialise values for memory pools

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