waf:replace: Do not link against libpthread if not necessary