AC_CHECK_FUNCS([localtime_r])
+dnl Check for getpid() and _getpid()
+AC_CHECK_FUNCS([getpid _getpid])
+
+dnl Check for strdup() and _strdup()
+AC_CHECK_DECLS([strdup])
+AC_CHECK_FUNCS([_strdup])
+
+dnl Check for fork
+AC_CHECK_FUNCS([fork], HAVE_FORK=1, HAVE_FORK=0)
+AC_SUBST(HAVE_FORK)
+
+dnl Check for alarm, localtime_r and strsignal
+dnl First check for time.h as it might be used by localtime_r
+AC_CHECK_HEADERS([time.h])
+AC_CHECK_DECLS([alarm, localtime_r, strsignal], [], [], [
+ AC_INCLUDES_DEFAULT
+#if HAVE_TIME_H
+#include <time.h>
+#endif /* HAVE_TIME_H */
+])
+AC_CHECK_FUNCS([alarm setitimer strsignal])
+AM_CONDITIONAL(HAVE_ALARM, test "x$ac_cv_func_alarm" = "xyes")
+AM_CONDITIONAL(HAVE_LOCALTIME_R, test "x$ac_cv_func_localtime_r" = "xyes")
+AM_CONDITIONAL(HAVE_STRSIGNAL, test "x$ac_cv_func_strsignal" = "xyes")
+
+dnl Check if struct timespec/itimerspec are defined in time.h. If not, we need
+dnl to define it in libs/gst/check/libcheck/libcompat.h. Note the optional
+dnl inclusion of pthread.h. On MinGW(-w64), the pthread.h file contains the
+dnl timespec/itimerspec definitions.
+AC_CHECK_MEMBERS([struct timespec.tv_sec, struct timespec.tv_nsec], [],
+ [AC_DEFINE_UNQUOTED(STRUCT_TIMESPEC_DEFINITION_MISSING, 1,
+ [Need to define the timespec structure])], [
+#include <time.h>
+#if HAVE_PTHREAD
+#include <pthread.h>
+#endif /* HAVE_PTHREAD */
+])
+AC_CHECK_MEMBERS([struct itimerspec.it_interval, struct itimerspec.it_value],
+ [], [AC_DEFINE_UNQUOTED(STRUCT_ITIMERSPEC_DEFINITION_MISSING, 1,
+ [Need to define the itimerspec structure])], [
+#include <time.h>
+#if HAVE_PTHREAD
+#include <pthread.h>
+#endif /* HAVE_PTHREAD */
+])
+
+dnl Check if types timer_t/clockid_t are defined. If not, we need to define
+dnl it in libs/gst/check/libcheck/ibcompat.h. Note the optional inclusion of
+dnl pthread.h. On MinGW(-w64), the pthread.h file contains the
+dnl timer_t/clockid_t definitions.
+AC_CHECK_TYPE(timer_t, [], [
+ AC_DEFINE([timer_t], [int], [timer_t])
+ ], [
+ AC_INCLUDES_DEFAULT
+#if HAVE_PTHREAD
+#include <pthread.h>
+#endif /* HAVE_PTHREAD */
+])
+AC_CHECK_TYPE(clockid_t, [], [
+ AC_DEFINE([clockid_t], [int], [clockid_t])
+ ], [
+ AC_INCLUDES_DEFAULT
+#if HAVE_PTHREAD
+#include <pthread.h>
+#endif /* HAVE_PTHREAD */
+])
+
+dnl Check for POSIX timer functions in librt
+AC_CHECK_LIB([rt], [timer_create, timer_settime, timer_delete])
+AM_CONDITIONAL(HAVE_TIMER_CREATE_SETTIME_DELETE, test "x$ac_cv_lib_rt_timer_create__timer_settime__timer_delete" = "xyes")
+
+dnl Allow for checking HAVE_CLOCK_GETTIME in automake files
+AM_CONDITIONAL(HAVE_CLOCK_GETTIME, test "x$ac_cv_func_clock_gettime" = "xyes")
dnl Create _stdint.h in the top-level directory
AX_CREATE_STDINT_H