[cvs-nhc98] cvs commit: nhc98/src/hmake MkConfig.hs
Malcolm Wallace
Malcolm.Wallace at cs.york.ac.uk
Mon Aug 16 12:02:47 EDT 2004
"Simon Marlow" <simonmar at microsoft.com> writes:
> > Apparently ghc versions like 6.2 have -D__GLASGOW_HASKELL__=602, not =620.
>
> I think this makes complete sense, but it seems to catch everybody out.
> I don't know why. Perhaps because the version used to have the leading
> zero (eg. 5.04) and now it doesn't?
It is possibly because many people use a nasty shell-script hack to
convert the output of ghc --version into a -D__GLASGOW_HASKELL= option.
The simplest hack (provided originally by yourself I believe :-) is
GHCVERSION=`ghc --version 2>&1 | sed 's/^.*version[ ]*\([0-9.]*\).*/\1/'`
GHCNUM=`echo $GHCVERSION | tr "v." " " | ( read x y z; echo $x$y; )`
But when the middle zero disappeared, most of us probably assumed
that adding this:
if [ "$GHCNUM" -lt "100" ]
then GHCNUM=${GHCNUM}0
fi
was sufficient to patch things up again. Sadly not. It takes a
little bit more arithmetic. (in haskell:)
if v >= 100 then v else (v`div`10)*100 + (v`mod`10)
Maybe we should add a new option to the compiler, rather like cpp -dM,
to report any cpp symbols that are automatically defined.
Regards,
Malcolm
More information about the Cvs-nhc98
mailing list