Somehow the patch from [1] was not applied correctly, fixing that.
1. http://lists.cairographics.org/archives/cairo/2010-September/020826.html
AC_MSG_CHECKING(for __thread)
AC_LINK_IFELSE([
-#ifdef defined __MINGW32__ && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
+#if defined(__MINGW32__) && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
#error This MinGW version has broken __thread support
#endif
-#endif
#ifdef __OpenBSD__
#error OpenBSD has broken __thread support
#endif