diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-05-05 23:54:36 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-05-05 23:54:36 +0900 |
commit | 3d5b6ddff8def49e59fb9a9ddd28a653498ae861 (patch) | |
tree | e6f80634342c425ad27b9afa921534388bd59e1d /configure.ac | |
parent | e71c9ca529f1dce2c3816653cd974ce786eea7d8 (diff) |
Fix compilation on M1 Mac
As PAGE_SIZE may not be a preprocessor constant, dispatch at
runtime in that case.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index d2ea9ea66f..1eb4be412c 100644 --- a/configure.ac +++ b/configure.ac @@ -2726,6 +2726,24 @@ main(int argc, char *argv[]) rb_cv_fork_with_pthread=yes)]) test x$rb_cv_fork_with_pthread = xyes || AC_DEFINE(CANNOT_FORK_WITH_PTHREAD) ]) + +AS_IF([test "x$ac_cv_func_mmap" = xyes], [ + malloc_headers=`sed -n '/MALLOC_HEADERS_BEGIN/,/MALLOC_HEADERS_END/p' ${srcdir}/gc.c` + AC_CACHE_CHECK([PAGE_SIZE is defined], rb_cv_page_size, + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[${malloc_headers} + typedef char conftest_page[PAGE_SIZE]; + ]], [[]])], + [rb_cv_page_size=const], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[${malloc_headers}]], [[ + int page_size = (int)PAGE_SIZE; + (void)page_size; + ]])], + [rb_cv_page_size=variable], [rb_cv_page_size=no])])]) + AS_CASE([$rb_cv_page_size], + [const], [AC_DEFINE(USE_MMAP_ALIGNED_ALLOC, [(PAGE_SIZE <= HEAP_PAGE_SIZE)])], + [no], [AC_DEFINE(USE_MMAP_ALIGNED_ALLOC, 1)], + ) +], [AC_DEFINE(USE_MMAP_ALIGNED_ALLOC, 0)]) } : "runtime section" && { |