Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Thomas Gazagnaire <thomas@gazagnaire.org>
To: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
Cc: Malcolm Matalka <mmatalka@gmail.com>, caml-list@inria.fr
Subject: Re: [Caml-list] Suggested way to determine platform specific capabilities in build system?
Date: Tue, 14 Apr 2015 14:17:06 +0100	[thread overview]
Message-ID: <515F7A4D-8FED-473D-AA53-F01E4885A92A@gazagnaire.org> (raw)
In-Reply-To: <A3109D1A77E44BD781BACFE3CD56F703@erratique.ch>

>> 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.  

See also the system detection functions in opam-depext:

https://github.com/ocaml/opam-depext/blob/master/depext.ml#L76

Thomas

  reply	other threads:[~2015-04-14 13:17 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
2015-04-14 13:17   ` Thomas Gazagnaire [this message]
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=515F7A4D-8FED-473D-AA53-F01E4885A92A@gazagnaire.org \
    --to=thomas@gazagnaire.org \
    --cc=caml-list@inria.fr \
    --cc=daniel.buenzli@erratique.ch \
    --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