dev-lang/ghc: backport __threaded detection to 7.8.1-rc1

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>