Skip to content

Commit

Permalink
configure: cache mmap MAP_SIZE detection
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterDA committed Jun 21, 2024
1 parent b7e65da commit ea3c85a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 37 deletions.
13 changes: 6 additions & 7 deletions aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ camlPervasives__loop_1128:
])])

AC_DEFUN([OCAML_MMAP_SUPPORTS_MAP_STACK], [
AC_MSG_CHECKING([whether mmap supports MAP_STACK])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
AC_CACHE_CHECK([whether mmap supports MAP_STACK],
[ocaml_cv_func_mmap_MAP_STACK],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <sys/mman.h>
#include <stdio.h>
#include <stdlib.h>
Expand All @@ -239,10 +239,9 @@ AC_DEFUN([OCAML_MMAP_SUPPORTS_MAP_STACK], [
if (block == MAP_FAILED)
return 1;
]])],
[has_mmap_map_stack=true
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([no assumed])])
[ocaml_cv_func_mmap_MAP_STACK=yes],
[ocaml_cv_func_mmap_MAP_STACK=no],
[ocaml_cv_func_mmap_MAP_STACK='no assumed'])])
])

AC_DEFUN([OCAML_MMAP_SUPPORTS_HUGE_PAGES], [
Expand Down
42 changes: 23 additions & 19 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 9 additions & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2386,21 +2386,19 @@ AS_IF([test x"$enable_flat_float_array" = "xno"],

OCAML_MMAP_SUPPORTS_MAP_STACK
AS_IF([test x"$enable_mmap_map_stack" = "xyes"],
[AS_IF([test x"$has_mmap_map_stack" = "xtrue"],
[AS_IF([test x"$ocaml_cv_func_mmap_MAP_STACK" = "xyes"],
[AS_CASE([$target],
[*-freebsd*],
[AC_MSG_ERROR([mmap MAP_STACK not supported on FreeBSD])],
[with_mmap_map_stack=true;
AC_DEFINE([USE_MMAP_MAP_STACK], [1])])],
[AC_MSG_ERROR([mmap MAP_STACK requested but not found on $target])])
],
[AC_MSG_ERROR([mmap MAP_STACK is not supported on FreeBSD])],
[use_mmap_map_stack=true])],
[AC_MSG_ERROR([mmap MAP_STACK requested but not found on $target])])],
[AS_CASE([$target],
[*-openbsd*],
[with_mmap_map_stack=true;
AC_DEFINE([USE_MMAP_MAP_STACK], [1])
AC_MSG_NOTICE([using MAP_STACK on OpenBSD due to stack checking])],
[with_mmap_map_stack=false])
])
[use_mmap_map_stack=true
AC_MSG_NOTICE([Using MAP_STACK on OpenBSD due to stack checking])])])

AS_IF([$use_mmap_map_stack],
[AC_DEFINE([USE_MMAP_MAP_STACK], [1], [Define to use mmap MAP_STACK.])])

oc_native_compflags=''

Expand Down

0 comments on commit ea3c85a

Please sign in to comment.