From 166d148355384c73d18c8465eb99dbc69e3eb400 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 6 Jul 2021 19:35:38 +0900 Subject: [PATCH] Fix check for malloc_conf when no library is required --- configure.ac | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d6f00aac6d..015237c43a 100644 --- a/configure.ac +++ b/configure.ac @@ -1303,8 +1303,11 @@ AS_IF([test "x$with_jemalloc" != xno],[ with_jemalloc=yes ], [test x$with_jemalloc = xyes && with_jemalloc=no]) - AC_CHECK_HEADER(jemalloc/jemalloc.h, [ - AC_DEFINE(RUBY_ALTERNATIVE_MALLOC_HEADER, []) + for malloc_header in jemalloc/jemalloc.h jemalloc.h; do + AC_CHECK_HEADER($malloc_header, [break], [malloc_header=]) + done + AS_IF([test "$malloc_header" != ""], [ + AC_DEFINE_UNQUOTED(RUBY_ALTERNATIVE_MALLOC_HEADER, [<$malloc_header>]) ], [test x$with_jemalloc = xyes && with_jemalloc=no]) AS_IF([test "x$with_jemalloc" != xyes], [ @@ -1313,7 +1316,7 @@ AS_IF([test "x$with_jemalloc" != xno],[ @%:@ifdef RUBY_ALTERNATIVE_MALLOC_HEADER @%:@include RUBY_ALTERNATIVE_MALLOC_HEADER @%:@else - @%:@include + extern const char *malloc_conf; @%:@endif], [return !&malloc_conf])], [rb_cv_jemalloc_demangle=yes], [rb_cv_jemalloc_demangle=no])