]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/x11r7/xserver_xorg-server/1.19.4/0002-configure.ac-Fix-check-for-CLOCK_MONOTONIC.patch
docs/manual: fix BR2_EXTERNAL path typo
[coffee/buildroot.git] / package / x11r7 / xserver_xorg-server / 1.19.4 / 0002-configure.ac-Fix-check-for-CLOCK_MONOTONIC.patch
1 Discover monotonic clock using compile-time check
2
3 monotonic clock check does not work when cross-compiling.
4
5 Upstream-Status: Denied [Does not work on OpenBSD]
6 Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
7
8
9
10 Original patch follows:
11
12 When xorg-xserver is being cross-compiled, there is currently no way
13 for us to detect whether the monotonic clock is available on the
14 target system, because we aren't able to run a test program on the host
15 system. Currently, in this situation, we default to not use the
16 monotonic clock. One problem with this situation is that the user will
17 be treated as idle when the date is updated.
18
19 To fix this situation, we now use a compile-time check to detect whether the
20 monotonic clock is available. This check can run just fine when we are
21 cross-compiling.
22
23 Signed-off-by: David James <davidjames at google.com>
24
25 Downloaded from
26 https://github.com/openembedded/openembedded-core/blob/master/meta/recipes-graphics/xorg-xserver/xserver-xorg/0001-configure.ac-Fix-check-for-CLOCK_MONOTONIC.patch
27
28 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
29 ---
30  configure.ac | 17 +++++++----------
31  1 file changed, 7 insertions(+), 10 deletions(-)
32
33 diff --git a/configure.ac b/configure.ac
34 index f7ab48c..26e85cd 100644
35 --- a/configure.ac
36 +++ b/configure.ac
37 @@ -1048,19 +1048,16 @@ if ! test "x$have_clock_gettime" = xno; then
38          CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
39      fi
40  
41 -    AC_RUN_IFELSE([AC_LANG_SOURCE([
42 +    AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
43  #include <time.h>
44 -
45 -int main(int argc, char *argv[[]]) {
46 -    struct timespec tp;
47 -
48 -    if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
49 +#include <unistd.h>
50 +int main() {
51 +#if !(defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0 && defined(CLOCK_MONOTONIC))
52 +        #error No monotonic clock
53 +#endif
54          return 0;
55 -    else
56 -        return 1;
57  }
58 -    ])], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
59 -       [MONOTONIC_CLOCK="cross compiling"])
60 +]])],[MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no])
61  
62      LIBS="$LIBS_SAVE"
63      CPPFLAGS="$CPPFLAGS_SAVE"
64 -- 
65 2.1.4
66