sysinfo() kernel variance
Henry Cejtin
henry@sourcelight.com
Mon, 25 Feb 2002 23:50:16 -0600
I guess that I would be happy just to be able to compile a MLton that
produced executables that could run on that machine, but it is an interesting
question.
When I was testing things out, if I run code compiled on a 2.4 kernel under a
2.2 kernel, mem_unit prints out as zero. Looking at the kernel sources, this
can be depended on. Thus you can test for this in code compiled under a 2.4
system at run time. This would still fail on a 2.2-kernel machine with more
than 4 gig of RAM or swap. I.e.: if you are compiling on a 2.2 kernel (no
mem_unit) then act as if mem_unit is always 1. If you are compiling on a 2.4
kernel, then at run-time check if mem_unit is 0. If so, pretend it is 1 (and
don't try to grab any fields that were added in 2.4 kernels).
I don't think I would bother with the automake configure if this is the only
thing that needs testing, but I would call what ever does it configure and I
would include no Makefile, but only a Makefile.in which the configure program
copied to Makefile. This way it feels like the standard configure.