lib/replace: check for __thread support