From 2cc4932d59a77ed607b272f0620a29832193bf00 Mon Sep 17 00:00:00 2001 From: brarcher Date: Tue, 31 Dec 2013 20:39:31 +0000 Subject: [PATCH] autotools: include pthread.h when checking for clockid_t/timer_t Must include pthread.h to check for clockid_t and timer_t. This is because MinGW and MinGW-w64 both put the time related definitions in pthread headers and not in sys/types.h. Without optionally including pthread.h, the check for these types may mistakenly fail. git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@981 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- configure.ac | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6043ddb..46a72ec 100644 --- a/configure.ac +++ b/configure.ac @@ -239,8 +239,23 @@ AC_CHECK_SIZEOF(int, 4) AC_CHECK_SIZEOF(short, 2) AC_CHECK_SIZEOF(long, 4) -AC_CHECK_TYPE(clockid_t, int) -AC_CHECK_TYPE(timer_t, int) +# The following two checks will attempt to include pthread.h. The +# reason is MinGW and MinGW-w64 have been known to put the time +# related definitions in the pthread headers. Without include +# pthread.h, these checks may mistakenly fail to find the +# definitions. +AC_CHECK_TYPE(clockid_t, [], [AC_DEFINE([clockid_t], [int], [clockid_t])], [ +AC_INCLUDES_DEFAULT +#if defined(HAVE_PTHREAD) +#include +#endif /* HAVE_PTHREAD */ +]) +AC_CHECK_TYPE(timer_t, [], [AC_DEFINE([timer_t], [int], [timer_t])], [ +AC_INCLUDES_DEFAULT +#if defined(HAVE_PTHREAD) +#include +#endif /* HAVE_PTHREAD */ +]) # Checks for library functions. AC_FUNC_MALLOC -- 2.49.0