Fix test suite compilation with network 2.6

(cherry picked from commit 5ff933435b16c4224f1ede35fd452cc3933d0408)
Make test suite network dependencies more robust

(cherry picked from commit 5b367e51e8178dd3f208b0dbe6b998b42f61dfc0)
Only test for same cabal-version (but not ghc-ver)

The overly strict test was introduced in
4806aba73d57bcbac08d697046e387af77bd2506
but this breaks GHC bindists. Cabal 1.20 and older
also only checked the cabal version to match but
ignored the compiler versions.

Differing compiler versions per se are considered harmless.

Approved by @dcoutts
Move parts of Distribution.Simple.GHC that can be shared with other
GHC-derived compiler flavors to Distribution.Simple.GHC.Internal
Add GHCJS support to the Simple build infrastructure