add GHCJS fields and generalise flag handling

This adds the `GHCJS` compiler flavor and the new fields and `impl` flag behaviour as discussed on the `cabal-devel` list. It also generalizes some of the underlying flag handling code to make it easier to extend to other compilers.

While this PR adds the `GHCJS` flavour, it does not yet expose it through the setup flags or have any implementation for it, since the GHCJS backend requires a bit of restructuring of the GHC, ghc-pkg and haddock handling code, to avoid too much code duplication. I intend to submit that in the next pull req, since I prefer to break it down into more manageable pieces.