[Haskell-cafe] passing cpp options to c2hs from cabal

Duncan Coutts duncan.coutts at googlemail.com
Sun Apr 11 13:11:48 EDT 2010


On Mon, 2010-03-01 at 10:07 -0500, Chris Casinghino wrote:
> This works great, thanks!
> 
> As a footnote: I doubt I will be the only one is confused because
> "cc-options" get passed to c2hs but "cpp-options" don't.  Perhaps the
> cabal designers should revisit this choice.

I mostly agree.

What is a bit odd about c2hs is that it mixes cpp flags for the C
headers with cpp flags for the .chs file itself. So cc-options are
really for the C code, and those get passed to c2hs. The cpp-options are
for pre-processing Haskell code, and indeed arguably these should be
passed to c2hs too because recent c2hs versions also apply something
approximating cpp to the .chs file itself.

So depending on whether your -U__BLOCKS__ flag is to influence the C
headers or the contents of the .chs file, then use cc-options or
cpp-options.

I'll update this for some future release.

Duncan



More information about the Haskell-Cafe mailing list