Cross-compiling and configure.ac macros

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


2011/4/15 Jason Evans <jasone at canonware.com>:
> 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 configure.ac 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
configure.ac 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:
http://developer.gnome.org/glib/2.28/glib-cross-compiling.html

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.

/Andreas



More information about the jemalloc-discuss mailing list