Allow disabling thread support (and test compilation)