From: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
To: Malcolm Matalka <mmatalka@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Suggested way to determine platform specific capabilities in build system?
Date: Tue, 14 Apr 2015 13:23:50 +0200 [thread overview]
Message-ID: <A3109D1A77E44BD781BACFE3CD56F703@erratique.ch> (raw)
In-Reply-To: <877ftfoudd.fsf@gmail.com>
Le mardi, 14 avril 2015 à 12:51, Malcolm Matalka a écrit :
> What is the current suggested way to determine what, roughly, autoconf
> would do for you? I have some platform specific functionality to be
> included (or excluded) depending on the OS.
I don't know if there's a suggested way but here are various ways to proceed.
If you are using ocamlbuild, you can use `Sys.win32` since 4.01.0 or `Sys.os_type = "Win32"` to determine if you are on windows and otherwise get the (stripped and lowercased) result of `uname -s`, see e.g (but it's missing the win bit):
https://github.com/dbuenzli/tsdl/blob/master/myocamlbuild.ml#L6
If you are using Makefiles you may want include `$(ocamlc -where)/lib/ocaml/Makefile.config` and use the `$SYSTEM` variable.
If this is only needed for C stubs you can also try solve this at the CPP level — but I guess this can be quite brittle — see e.g (here again missing the win bit as it's undefined for now):
https://github.com/dbuenzli/mtime/blob/master/src-os/mtime_stubs.c#L11-L21
In any case make sure the value can be overridden from the command line for cross compilation scenarios.
Best,
Daniel
next prev parent reply other threads:[~2015-04-14 11:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-14 10:51 Malcolm Matalka
2015-04-14 11:23 ` Daniel Bünzli [this message]
2015-04-14 13:17 ` Thomas Gazagnaire
2015-04-19 6:47 ` Adrien Nader
2015-04-19 8:38 ` Daniel Bünzli
2015-04-19 10:13 ` David Allsopp
2015-04-19 12:11 ` Daniel Bünzli
2015-04-19 19:14 ` Emmanuel Surleau
2015-04-20 9:55 ` Ben Millwood
2015-04-17 10:38 ` Ivan Gotovchits
2015-04-21 21:36 ` Richard W.M. Jones
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=A3109D1A77E44BD781BACFE3CD56F703@erratique.ch \
--to=daniel.buenzli@erratique.ch \
--cc=caml-list@inria.fr \
--cc=mmatalka@gmail.com \
/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