Fix compilation with ghc < 4.6.0 by conditionally defining our own lookupEnv