Cross-compiling and macros

Andreas Vinsander andreas+jemalloc at
Fri Apr 15 06:48:55 PDT 2011

2011/4/15 Jason Evans <jasone at>:
> On 04/14/2011 05:16 AM, Andreas Vinsander wrote:
>> I am trying to cross-compile jemalloc for evaluation on an embedded
>> device running a Linux home brew distro.
>> I have some problems with the way jemalloc tests for various support
>> of the host (target) system.
> For a first pass, can you run configure without the cross compiler
> specified, then hack up Makefile and include/jemalloc/jemalloc_defs.h to do
> the right thing for your platform?

Yes, I could do that but I would rather fix the autoconf issues.

>> So far I have modified jemalloc-2.2.1 as seen in the
>> attached patch, but there still exists a call to AC_RUN_IFELSE.
> The one remaining AC_RUN_IFELSE is for page size detection, right?  I think
> it's reasonable to just specify a default of 12 (and maybe even allow an
> environment variable to override that default) if the test fails.

Yes, the STATIC_PAGE_SHIFT test.
Shouldn't that be possible to find out in runtime. Or is that what
--enable-dynamic-page-shift is doing? In that case shouldn't the script ignore the STATIC_PAGE_SHIFT if
--enable-dynamic-page-shift was specified?

>> What is the best way to handle it? To use autoconf cache and supply a
>> default value when cross-compiling?
> How would the autoconf cache help here?  Isn't it still necessary for the
> test to have successfully run at some point for the cache to have a valid
> result?

See for example:

It is possible to provide a pre-defined cache with values that suites
the target system.
I thought that could be useful here as well. I have poked around a bit
with it here and it seems to work.


More information about the jemalloc-discuss mailing list