From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 500627FCCB for ; Tue, 14 Apr 2015 15:17:09 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of thomas.gazagnaire@gmail.com) identity=pra; client-ip=74.125.82.47; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="thomas.gazagnaire@gmail.com"; x-sender="thomas.gazagnaire@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of thomas.gazagnaire@gmail.com designates 74.125.82.47 as permitted sender) identity=mailfrom; client-ip=74.125.82.47; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="thomas.gazagnaire@gmail.com"; x-sender="thomas.gazagnaire@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wg0-f47.google.com) identity=helo; client-ip=74.125.82.47; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="thomas.gazagnaire@gmail.com"; x-sender="postmaster@mail-wg0-f47.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AyAQClEi1Vmy9SfUpcg15cgxXEJ4V/gUQ7EQEBAQEBAQERAQEBAQEGCwsJFC6EIAEBAwESER0BOAEDDAEFBRoCJgICNAEFARwGMQSHdAMJCAUIqQE+MYs4hGGLOycNhT8BCgEBAQEXAQEEDoETigqCZoFjgyIvgRYFlQeZOjWBFVuBeoE9boJDAQEB X-IPAS-Result: A0AyAQClEi1Vmy9SfUpcg15cgxXEJ4V/gUQ7EQEBAQEBAQERAQEBAQEGCwsJFC6EIAEBAwESER0BOAEDDAEFBRoCJgICNAEFARwGMQSHdAMJCAUIqQE+MYs4hGGLOycNhT8BCgEBAQEXAQEEDoETigqCZoFjgyIvgRYFlQeZOjWBFVuBeoE9boJDAQEB X-IronPort-AV: E=Sophos;i="5.11,576,1422918000"; d="scan'208";a="111033187" Received: from mail-wg0-f47.google.com ([74.125.82.47]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 14 Apr 2015 15:17:08 +0200 Received: by wgin8 with SMTP id n8so11605805wgi.0 for ; Tue, 14 Apr 2015 06:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Ef1PtQEuFq9usSWjk7xJEzwbD4cNwRvuavAoWCChKcg=; b=eVb+ymm/7Il/PsIFxMXga368At7dh1DgDVbof+gX9jvyZyewR7hBkFgaVn5ZOPBFSW p5iRdBR6p6tvYA/c+61JnXXcE/JhgS7pies2SBawwwUdQ15I696T706Pn/Jp6lN8nJgW vzhA18x3Iwrt3qhbcnqFhatjQAtFgAA/vpk78f1Jq0lCBu583zeRKfAiDbz9NeDmsuVG r+oAvKGwWYxh5oecyuiKgRU/E+94n+oIlkWhEIvetvoMnBh+BfZ9Xpj8wvyOc60C2hXJ tRvJ3uSBUKaJZXcD+9eqHPe3axVHcwKZzpNgTGzL2feXAofnzr1yFqF2+SuYe5kjdAVI yrYw== X-Received: by 10.194.47.231 with SMTP id g7mr38520039wjn.140.1429017428146; Tue, 14 Apr 2015 06:17:08 -0700 (PDT) Received: from piana.mac.cl.cam.ac.uk (piana.mac.cl.cam.ac.uk. [128.232.56.38]) by mx.google.com with ESMTPSA id js3sm1573273wjc.5.2015.04.14.06.17.06 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Apr 2015 06:17:07 -0700 (PDT) Sender: Thomas Gazagnaire Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) From: Thomas Gazagnaire In-Reply-To: Date: Tue, 14 Apr 2015 14:17:06 +0100 Cc: Malcolm Matalka , caml-list@inria.fr Content-Transfer-Encoding: quoted-printable Message-Id: <515F7A4D-8FED-473D-AA53-F01E4885A92A@gazagnaire.org> References: <877ftfoudd.fsf@gmail.com> To: =?utf-8?Q?Daniel_B=C3=BCnzli?= X-Mailer: Apple Mail (2.2098) Subject: Re: [Caml-list] Suggested way to determine platform specific capabilities in build system? >> 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. >=20 > I don't know if there's a suggested way but here are various ways to proc= eed. >=20 > If you are using ocamlbuild, you can use `Sys.win32` since 4.01.0 or `Sys= .os_type =3D "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 missi= ng the win bit):=20=20 >=20 > https://github.com/dbuenzli/tsdl/blob/master/myocamlbuild.ml#L6 >=20 > If you are using Makefiles you may want include `$(ocamlc -where)/lib/oca= ml/Makefile.config` and use the `$SYSTEM` variable. >=20 > If this is only needed for C stubs you can also try solve this at the CPP= level =E2=80=94 but I guess this can be quite brittle =E2=80=94 see e.g (h= ere again missing the win bit as it's undefined for now):=20=20 >=20 > https://github.com/dbuenzli/mtime/blob/master/src-os/mtime_stubs.c#L11-L21 >=20 > In any case make sure the value can be overridden from the command line f= or cross compilation scenarios.=20=20 See also the system detection functions in opam-depext: https://github.com/ocaml/opam-depext/blob/master/depext.ml#L76 Thomas