element: Enforce that elements created by gst_element_factory_create/make() are floating
[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=10
10 CHECK_MICRO_VERSION=0
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 dnl Check for localtime_r()
22 AC_CHECK_FUNCS([localtime_r])
23 AM_CONDITIONAL(HAVE_LOCALTIME_R, test "x$ac_cv_func_localtime_r" = "xyes")
24
25 dnl Check for gettimeofday()
26 AC_CHECK_FUNCS([gettimeofday])
27 AM_CONDITIONAL(HAVE_GETTIMEOFDAY, test "x$ac_cv_func_gettimeofday" = "xyes")
28
29 dnl Check for getpid() and _getpid()
30 AC_CHECK_FUNCS([getpid _getpid])
31
32 dnl Check for strdup() and _strdup()
33 AC_CHECK_DECLS([strdup])
34 AC_CHECK_FUNCS([_strdup])
35 AM_CONDITIONAL(HAVE_STRDUP, test "x$ac_cv_have_decl_strdup" = "xyes" -o "x$ac_cv_func__strdup" = "xyes")
36
37 dnl Check for getline()
38 AC_CHECK_FUNCS([getline])
39 AM_CONDITIONAL(HAVE_GETLINE, test "x$ac_cv_func_getline" = "xyes")
40
41 dnl Check for mkstemp
42 AC_CHECK_FUNCS([mkstemp])
43
44 dnl Check for fork
45 AC_CHECK_FUNCS([fork], HAVE_FORK=1, HAVE_FORK=0)
46 AC_SUBST(HAVE_FORK)
47
48 dnl Check for alarm, localtime_r and strsignal
49 dnl First check for time.h as it might be used by localtime_r
50 AC_CHECK_HEADERS([time.h])
51 AC_CHECK_DECLS([alarm, localtime_r, strsignal], [], [], [
52     AC_INCLUDES_DEFAULT
53 #if HAVE_TIME_H
54 #include <time.h>
55 #endif /* HAVE_TIME_H */
56 ])
57 AC_CHECK_FUNCS([alarm setitimer strsignal])
58 AM_CONDITIONAL(HAVE_ALARM, test "x$ac_cv_func_alarm" = "xyes")
59 AM_CONDITIONAL(HAVE_LOCALTIME_R, test "x$ac_cv_func_localtime_r" = "xyes")
60 AM_CONDITIONAL(HAVE_STRSIGNAL, test "x$ac_cv_func_strsignal" = "xyes")
61
62 dnl Check if struct timespec/itimerspec are defined in time.h. If not, we need
63 dnl to define it in libs/gst/check/libcheck/libcompat.h. Note the optional
64 dnl inclusion of pthread.h. On MinGW(-w64), the pthread.h file contains the
65 dnl timespec/itimerspec definitions.
66 AC_CHECK_MEMBERS([struct timespec.tv_sec, struct timespec.tv_nsec], [],
67   [AC_DEFINE_UNQUOTED(STRUCT_TIMESPEC_DEFINITION_MISSING, 1,
68     [Need to define the timespec structure])], [
69 #include <time.h>
70 #if HAVE_PTHREAD
71 #include <pthread.h>
72 #endif /* HAVE_PTHREAD */
73 ])
74 AC_CHECK_MEMBERS([struct itimerspec.it_interval, struct itimerspec.it_value],
75   [], [AC_DEFINE_UNQUOTED(STRUCT_ITIMERSPEC_DEFINITION_MISSING, 1,
76     [Need to define the itimerspec structure])], [
77 #include <time.h>
78 #if HAVE_PTHREAD
79 #include <pthread.h>
80 #endif /* HAVE_PTHREAD */
81 ])
82
83 dnl Check if types timer_t/clockid_t are defined. If not, we need to define it
84 dnl in libs/gst/check/libcheck/libcompat/libcompat.h. Note the optional
85 dnl inclusion of pthread.h. On MinGW(-w64), the pthread.h file contains the
86 dnl timer_t/clockid_t definitions.
87 AC_CHECK_TYPE(timer_t, [], [
88     AC_DEFINE([timer_t], [int], [timer_t])
89   ], [
90     AC_INCLUDES_DEFAULT
91 #if HAVE_PTHREAD
92 #include <pthread.h>
93 #endif /* HAVE_PTHREAD */
94 ])
95 AC_CHECK_TYPE(clockid_t, [], [
96     AC_DEFINE([clockid_t], [int], [clockid_t])
97   ], [
98     AC_INCLUDES_DEFAULT
99 #if HAVE_PTHREAD
100 #include <pthread.h>
101 #endif /* HAVE_PTHREAD */
102 ])
103
104 dnl Check for POSIX timer functions in librt
105 AC_CHECK_LIB([rt], [timer_create, timer_settime, timer_delete])
106 AM_CONDITIONAL(HAVE_TIMER_CREATE_SETTIME_DELETE, test "x$ac_cv_lib_rt_timer_create__timer_settime__timer_delete" = "xyes")
107
108 dnl Allow for checking HAVE_CLOCK_GETTIME in automake files
109 AM_CONDITIONAL(HAVE_CLOCK_GETTIME, test "x$CLOCK_GETTIME_FOUND" = "xyes")
110
111 dnl Create _stdint.h in the top-level directory
112 AX_CREATE_STDINT_H
113
114 dnl Disable subunit support for the time being
115 enable_subunit=false
116
117 if test xfalse = x"$enable_subunit"; then
118 ENABLE_SUBUNIT="0"
119 else
120 ENABLE_SUBUNIT="1"
121 fi
122 AC_SUBST(ENABLE_SUBUNIT)
123 AC_DEFINE_UNQUOTED(ENABLE_SUBUNIT, $ENABLE_SUBUNIT, [Subunit protocol result output])
124
125 AM_CONDITIONAL(SUBUNIT, test x"$enable_subunit" != "xfalse")
126
127 ])