caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Stefan Hellermann <stefan@the2masters.de>
To: caml-list@inria.fr
Subject: [Caml-list] [PATCH 0/2] use preprocessor to get infos about target arch
Date: Fri,  9 Oct 2015 14:03:12 +0200	[thread overview]
Message-ID: <1444392194-18276-1-git-send-email-stefan@the2masters.de> (raw)

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


             reply	other threads:[~2015-10-09 12:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 12:03 Stefan Hellermann [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444392194-18276-1-git-send-email-stefan@the2masters.de \
    --to=stefan@the2masters.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).