caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] [PATCH 0/2] use preprocessor to get infos about target arch
@ 2015-10-09 12:03 Stefan Hellermann
  2015-10-09 12:03 ` [Caml-list] [PATCH 1/2] configure: Check sizes of integers and pointers by using the preprocessor Stefan Hellermann
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stefan Hellermann @ 2015-10-09 12:03 UTC (permalink / raw)
  To: caml-list

I'm trying to port OCaml to the openwrt router distribution [1]. Openwrt
makes heavy use of cross-compiling, and supports about 40 different
target archs.
When cross-compiling OCaml the configure script fails on 2 tests, it
cannot detect integer and pointer sizes and it cannot detect endianess.
I could now add rules and manually set the values for all 40 openwrt
targets into the configure script, but I think this doesn't scale well
and is only useful for openwrt.

So I sat down and wrote an alternative way to detect pointer sizes and
endianess by using the preprocessor and parsing it's output. This is
currently lightly tested on a few archs, so please comment and test.

There is also a test in configure script which checks if negative
division rounds to zero. This check currently fails in case of
cross-compile, but is only a warning. I see no way to do this check
in the preprocessor.
Is this test really needed? Which compiler do misbehave? Sind C99 round
to zero is mandated by the C Standard.

[1] https://openwrt.org/

Stefan Hellermann (2):
  configure: Check sizes of integers and pointers by using the
    preprocessor
  configure: Check endianess by using the preprocessor

 config/auto-aux/endian.c       | 60 ++++++++++++-----------------
 config/auto-aux/preprocesstest | 22 +++++++++++
 config/auto-aux/sizes.c        | 85 ++++++++++++++++++++++++++++++------------
 configure                      | 28 ++++++++------
 4 files changed, 123 insertions(+), 72 deletions(-)
 create mode 100755 config/auto-aux/preprocesstest

-- 
2.1.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-09 12:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-09 12:03 [Caml-list] [PATCH 0/2] use preprocessor to get infos about target arch Stefan Hellermann
2015-10-09 12:03 ` [Caml-list] [PATCH 1/2] configure: Check sizes of integers and pointers by using the preprocessor Stefan Hellermann
2015-10-09 12:03 ` [Caml-list] [PATCH 2/2] configure: Check endianess " Stefan Hellermann
2015-10-09 12:24 ` [Caml-list] [PATCH 0/2] use preprocessor to get infos about target arch Daniel Bünzli
2015-10-09 12:31   ` Stefan Hellermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).