Recommended way to conditionally compile modules?
bos at serpentine.com
Fri Jan 15 17:36:16 EST 2010
I have a source base that contains a number of source files that use APIs
that vary by platform: every platform provides select, most provide poll,
BSDs provide kqueue, and Linux provides epoll. I already have autoconf tests
for these functions, and I'd like to use the results of those autoconf
checks to determine which modules to compile, but I am unable to figure out
how to do this in my .cabal or .buildinfo file. (I *could* have explicit os
conditionals in there, but that's ugly.)
Right now, I'm just building all of the modules, and conditionally giving
them bodies as follows:
module System.Event.EPoll where
The trouble with this is twofold. I have to export everything in the module
(because its contents vary depending on where I compile it), and the CPP
macros there are ugly. Is there a better solution?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries