At Cabal, this is done using the βflagsβ and its algorithm for resolving constraints. Example (from control-monad-exception in Hackage )
Flag extensibleExceptions description: Use extensible-exception package default: False (...) if flag(extensibleExceptions) build-depends: extensible-exceptions >= 0.1 && <0.2, base >= 3.0 && <4 else build-depends: base >= 4 && < 5
On a machine with an old base version, Cabal will try to resolve the dependency using extensibleExceptions False , crash, then try True with it again and use another build-depends , which will succeed. (You can also enable the flag from the command line.)
http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#configurations documents this mechanism, and the rest of the page describes other mechanisms, including direct conditions such as if impl(ghc >= 6.10.0) .
source share