From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=5.0 tests=DNS_FROM_RFC_POST,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id F3A61BC37 for ; Tue, 18 Aug 2009 04:37:58 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoABAF6xiUrRVdK2kGdsb2JhbACaQz8BAQEBCQkMBxMDqieBI49cAQMCBIQVBQ X-IronPort-AV: E=Sophos;i="4.43,399,1246831200"; d="scan'208";a="44778086" Received: from mail-yx0-f182.google.com ([209.85.210.182]) by mail4-smtp-sop.national.inria.fr with ESMTP; 18 Aug 2009 04:37:38 +0200 Received: by yxe12 with SMTP id 12so4110559yxe.1 for ; Mon, 17 Aug 2009 19:37:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=TCX3I8zosYRarHfqPXV+QE1Lto2O+Zmls7YA5eS86bM=; b=seiAtXx+4LtL5m+sCRpKOeic7uaIEgR+1ZjYHbD9ED/rTC9a4boisWuz89Smdyf2CS HFvMMB2G2etfrogcXzkXHUcrvPqUFvjAJdQFnMu3AwLAzDLlgWBvcT1kt63AJo7DyBnM CmzsmStSvvdoeSZxylvRT0Uk8g6Ku8cRaueD8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=OHn0fTGtciGzb8x0w7EmyUZMQkpIYk/0umJGZaKgBsZWmkuXSjXS6tocrMP37hJQF9 a1qt4ANNiSGFIhhot50DqOgmAeng4xH11tW7YVNSzY3th2dXO+KNqTtGAq4H7yD2pgV8 axA7mq0UNVAN8ToMmJInZLxmC9zx728PWKulQ= Received: by 10.90.210.20 with SMTP id i20mr3333992agg.32.1250563057564; Mon, 17 Aug 2009 19:37:37 -0700 (PDT) Received: from ?192.168.1.100? ([72.44.99.175]) by mx.google.com with ESMTPS id 21sm1848841agd.11.2009.08.17.19.37.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 17 Aug 2009 19:37:36 -0700 (PDT) Message-ID: <4A8A13EE.3080805@gmail.com> Date: Mon, 17 Aug 2009 22:37:34 -0400 From: Edgar Friendly User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: Andre Nathan Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Conditional compilation References: <4A8A0B3C.10504@gmail.com> <1250562412.6289.8.camel@homesick> In-Reply-To: <1250562412.6289.8.camel@homesick> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; compilation:01 ifdef:01 foo:01 -pp:01 camlp:01 camlp:01 cmo:01 foo:01 ifdef:01 compilation:01 mismatch:01 ocaml:01 autoconf:01 makefile:01 -pp:01 Andre Nathan wrote: > On Mon, 2009-08-17 at 22:00 -0400, Edgar Friendly wrote: >> Is there a better way to do this? The path I'm following is looking >> very byzantine compared to C's [-DFOO] + [#ifdef FOO]. > > In ospec I use > > -pp "camlp4o Camlp4MacroParser.cmo -D FOO" > > which can then be tested in the code with > > IFDEF FOO THEN > ... > END > > > HTH, > Andre > It does help - I'd not considered Camlp4MacroParser for the job, thinking that optcomp would have a good way to do exactly what its name says - optional compilation. I'm starting to think that optcomp is just a mismatch for what I'm trying to do, and I'm trying to use the wrong tool for the job. That said, I don't think it's the best solution (especially with already long compile times for the project) to use both optcomp and Camlp4MacroParser, so I guess I should figure out how to do #if ocaml_version < (3, 11) in Camlp4MacroParser. I guess autoconf might be of some help here, although I don't see an easy way to to pass text from an autoconf-created Makefile through ocamlbuild into only some files' [-pp] commands. I think myocamlbuild.ml might be the key, maybe autoconf can produce it as well as Makefile. E.