check: Update version number of included libcheck
[platform/upstream/gstreamer.git] / m4 / check-checks.m4
1 dnl Check for things that check needs/wants and that we don't check for already
2 dnl AM_GST_CHECK_CHECKS()
3
4 AC_DEFUN([AG_GST_CHECK_CHECKS],
5 [
6 AC_MSG_NOTICE([Running check unit test framework checks now...])
7
8 CHECK_MAJOR_VERSION=0
9 CHECK_MINOR_VERSION=9
10 CHECK_MICRO_VERSION=14
11 CHECK_VERSION=$CHECK_MAJOR_VERSION.$CHECK_MINOR_VERSION.$CHECK_MICRO_VERSION
12
13 AC_SUBST(CHECK_MAJOR_VERSION)
14 AC_SUBST(CHECK_MINOR_VERSION)
15 AC_SUBST(CHECK_MICRO_VERSION)
16 AC_SUBST(CHECK_VERSION)
17
18 dnl Checks for header files and declarations
19 AC_CHECK_HEADERS([unistd.h sys/wait.h sys/time.h], [], [], [AC_INCLUDES_DEFAULT])
20
21 AC_CHECK_FUNCS([localtime_r])
22
23 dnl Check for getpid() and _getpid()
24 AC_CHECK_FUNCS([getpid _getpid])
25
26 dnl Check for strdup() and _strdup()
27 AC_CHECK_DECLS([strdup])
28 AC_CHECK_FUNCS([_strdup])
29
30 dnl Check for fork
31 AC_CHECK_FUNCS([fork], HAVE_FORK=1, HAVE_FORK=0)
32 AC_SUBST(HAVE_FORK)
33
34 dnl Check for alarm, localtime_r and strsignal
35 dnl First check for time.h as it might be used by localtime_r
36 AC_CHECK_HEADERS([time.h])
37 AC_CHECK_DECLS([alarm, localtime_r, strsignal], [], [], [
38     AC_INCLUDES_DEFAULT
39 #if HAVE_TIME_H
40 #include <time.h>
41 #endif /* HAVE_TIME_H */
42 ])
43 AC_CHECK_FUNCS([alarm setitimer strsignal])
44 AM_CONDITIONAL(HAVE_ALARM, test "x$ac_cv_func_alarm" = "xyes")
45 AM_CONDITIONAL(HAVE_LOCALTIME_R, test "x$ac_cv_func_localtime_r" = "xyes")
46 AM_CONDITIONAL(HAVE_STRSIGNAL, test "x$ac_cv_func_strsignal" = "xyes")
47
48 dnl Check if struct timespec/itimerspec are defined in time.h. If not, we need
49 dnl to define it in libs/gst/check/libcheck/libcompat.h. Note the optional
50 dnl inclusion of pthread.h. On MinGW(-w64), the pthread.h file contains the
51 dnl timespec/itimerspec definitions.
52 AC_CHECK_MEMBERS([struct timespec.tv_sec, struct timespec.tv_nsec], [],
53   [AC_DEFINE_UNQUOTED(STRUCT_TIMESPEC_DEFINITION_MISSING, 1,
54     [Need to define the timespec structure])], [
55 #include <time.h>
56 #if HAVE_PTHREAD
57 #include <pthread.h>
58 #endif /* HAVE_PTHREAD */
59 ])
60 AC_CHECK_MEMBERS([struct itimerspec.it_interval, struct itimerspec.it_value],
61   [], [AC_DEFINE_UNQUOTED(STRUCT_ITIMERSPEC_DEFINITION_MISSING, 1,
62     [Need to define the itimerspec structure])], [
63 #include <time.h>
64 #if HAVE_PTHREAD
65 #include <pthread.h>
66 #endif /* HAVE_PTHREAD */
67 ])
68
69 dnl Check if types timer_t/clockid_t are defined. If not, we need to define
70 dnl it in libs/gst/check/libcheck/ibcompat.h. Note the optional inclusion of
71 dnl pthread.h. On MinGW(-w64), the pthread.h file contains the
72 dnl timer_t/clockid_t definitions.
73 AC_CHECK_TYPE(timer_t, [], [
74     AC_DEFINE([timer_t], [int], [timer_t])
75   ], [
76     AC_INCLUDES_DEFAULT
77 #if HAVE_PTHREAD
78 #include <pthread.h>
79 #endif /* HAVE_PTHREAD */
80 ])
81 AC_CHECK_TYPE(clockid_t, [], [
82     AC_DEFINE([clockid_t], [int], [clockid_t])
83   ], [
84     AC_INCLUDES_DEFAULT
85 #if HAVE_PTHREAD
86 #include <pthread.h>
87 #endif /* HAVE_PTHREAD */
88 ])
89
90 dnl Check for POSIX timer functions in librt
91 AC_CHECK_LIB([rt], [timer_create, timer_settime, timer_delete])
92 AM_CONDITIONAL(HAVE_TIMER_CREATE_SETTIME_DELETE, test "x$ac_cv_lib_rt_timer_create__timer_settime__timer_delete" = "xyes")
93
94 dnl Allow for checking HAVE_CLOCK_GETTIME in automake files
95 AM_CONDITIONAL(HAVE_CLOCK_GETTIME, test "x$ac_cv_func_clock_gettime" = "xyes")
96
97 dnl Create _stdint.h in the top-level directory
98 AX_CREATE_STDINT_H
99
100 dnl Disable subunit support for the time being
101 enable_subunit=false
102
103 if test xfalse = x"$enable_subunit"; then
104 ENABLE_SUBUNIT="0"
105 else
106 ENABLE_SUBUNIT="1"
107 fi
108 AC_SUBST(ENABLE_SUBUNIT)
109 AC_DEFINE_UNQUOTED(ENABLE_SUBUNIT, $ENABLE_SUBUNIT, [Subunit protocol result output])
110
111 AM_CONDITIONAL(SUBUNIT, test x"$enable_subunit" != "xfalse")
112
113 ])