http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53238
--- Comment #16 from Daniel Richard G. <skunk at iskunk dot org> 2012-07-19 21:10:28 UTC --- Okay, spoke too soon; I encountered the same error later in the game, when building the "pthread" variant of libstdc++-v3. I'm going to try the build with a new patch, revisiting the code snippet in comment #2: --- libstdc++-v3/acinclude.m4 (revision 189681) +++ libstdc++-v3/acinclude.m4 (working copy) @@ -3282,13 +3282,18 @@ AC_MSG_CHECKING([whether it can be safely assumed that mutex_timedlock is available]) - AC_TRY_COMPILE([#include <unistd.h>], + AC_TRY_COMPILE( + [ + #include <stdlib.h> + #include <unistd.h> + ], [ // In case of POSIX threads check _POSIX_TIMEOUTS. #if (defined(_PTHREADS) \ && (!defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS <= 0)) #error #endif + return pthread_mutex_timedlock(NULL, NULL) ], [ac_gthread_use_mutex_timedlock=1], [ac_gthread_use_mutex_timedlock=0]) AC_DEFINE_UNQUOTED(_GTHREAD_USE_MUTEX_TIMEDLOCK, $ac_gthread_use_mutex_timedlock, Since the code is being compiled as C++, linking is not necessary to get an error in case the function is missing. Will this work any better as a solution than my suggestion in comment #4? (Might an "#ifndef WIN32" in there be helpful?)