diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2012-08-28 08:51:55 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2012-08-28 08:51:55 (GMT) |
commit | 541c8c407b7ba8dd10f85bb48bcb5900270b3f84 (patch) | |
tree | 71a6abc0f2a43bcfd33f80b3b30b878f234cbf05 /configure.in | |
parent | 60a53113e05db443af4d520883ec3145680642a8 (diff) | |
download | fluxbox_pavel-541c8c407b7ba8dd10f85bb48bcb5900270b3f84.zip fluxbox_pavel-541c8c407b7ba8dd10f85bb48bcb5900270b3f84.tar.bz2 |
changed timing functions to use a monotonic increasing clock
gettimeofday() is subject to be changed on daylight-saving or to ntp-related
(think leap-seconds). even worse, it is subject to be changed BACK in time. this
is hard to fix correctly (see commit 45726d3016e and bug #3560509). it is
irrelevant for timers to know the nano-seconds since the epoch anyways.
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 68 |
1 files changed, 49 insertions, 19 deletions
diff --git a/configure.in b/configure.in index 14f1993..8ec02d5 100644 --- a/configure.in +++ b/configure.in | |||
@@ -35,7 +35,7 @@ AC_HEADER_STDC | |||
35 | AC_HEADER_STDBOOL | 35 | AC_HEADER_STDBOOL |
36 | AC_CHECK_HEADERS(errno.h ctype.h dirent.h fcntl.h libgen.h \ | 36 | AC_CHECK_HEADERS(errno.h ctype.h dirent.h fcntl.h libgen.h \ |
37 | locale.h math.h nl_types.h process.h signal.h stdarg.h \ | 37 | locale.h math.h nl_types.h process.h signal.h stdarg.h \ |
38 | stdio.h time.h unistd.h \ | 38 | stdint.h stdio.h time.h unistd.h \ |
39 | sys/param.h sys/select.h sys/signal.h sys/stat.h \ | 39 | sys/param.h sys/select.h sys/signal.h sys/stat.h \ |
40 | sys/time.h sys/types.h sys/wait.h \ | 40 | sys/time.h sys/types.h sys/wait.h \ |
41 | langinfo.h iconv.h) | 41 | langinfo.h iconv.h) |
@@ -48,7 +48,7 @@ AC_CHECK_HEADERS(sstream, , | |||
48 | )] | 48 | )] |
49 | ) | 49 | ) |
50 | 50 | ||
51 | AC_CHECK_HEADERS(cassert cctype cerrno cmath cstdarg cstdio cstdlib cstring ctime) | 51 | AC_CHECK_HEADERS(cassert cctype cerrno cmath cstdarg cstdint cstdio cstdlib cstring ctime) |
52 | 52 | ||
53 | 53 | ||
54 | dnl Check for existance of basename(), setlocale() and strftime() | 54 | dnl Check for existance of basename(), setlocale() and strftime() |
@@ -61,10 +61,11 @@ AC_FUNC_SELECT_ARGTYPES | |||
61 | AC_FUNC_STAT | 61 | AC_FUNC_STAT |
62 | 62 | ||
63 | AC_CHECK_FUNCS(basename, , AC_CHECK_LIB(gen, basename, LIBS="-lgen $LIBS")) | 63 | AC_CHECK_FUNCS(basename, , AC_CHECK_LIB(gen, basename, LIBS="-lgen $LIBS")) |
64 | AC_CHECK_FUNCS(catclose catgets catopen getpid gettimeofday memset mkdir \ | 64 | AC_CHECK_FUNCS(catclose catgets catopen getpid memset mkdir \ |
65 | nl_langinfo putenv regcomp select setenv setlocale sigaction snprintf \ | 65 | nl_langinfo putenv regcomp select setenv setlocale sigaction snprintf \ |
66 | sqrt strcasecmp strcasestr strchr strstr strtol strtoul sync vsnprintf) | 66 | sqrt strcasecmp strcasestr strchr strstr strtol strtoul sync vsnprintf) |
67 | 67 | ||
68 | |||
68 | dnl Windows requires the mingw-catgets library for the catgets function. | 69 | dnl Windows requires the mingw-catgets library for the catgets function. |
69 | AC_SEARCH_LIBS([catgets], [catgets], [], []) | 70 | AC_SEARCH_LIBS([catgets], [catgets], [], []) |
70 | 71 | ||
@@ -92,6 +93,48 @@ size_t x = strftime(s, 5, "%a", localtime(&t)); | |||
92 | [AC_MSG_RESULT(no)]) | 93 | [AC_MSG_RESULT(no)]) |
93 | 94 | ||
94 | 95 | ||
96 | AC_MSG_CHECKING(for clock_gettime) | ||
97 | AC_COMPILE_IFELSE( | ||
98 | [AC_LANG_PROGRAM( | ||
99 | [#include <time.h>], | ||
100 | [[ | ||
101 | clock_gettime(CLOCK_MONOTONIC, 0); | ||
102 | return 0; | ||
103 | ]] | ||
104 | )], | ||
105 | [ | ||
106 | AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define to 1 if you have the 'clock_gettime' function.]) | ||
107 | AC_MSG_RESULT(yes) | ||
108 | # *bsd has clock_gettime() in libc | ||
109 | AC_CHECK_LIB(rt, clock_gettime, LIBS="-lrt $LIBS") | ||
110 | ], | ||
111 | [ | ||
112 | AC_MSG_RESULT(no) | ||
113 | ] | ||
114 | ) | ||
115 | |||
116 | AC_MSG_CHECKING(for mach_absolute_time) | ||
117 | AC_COMPILE_IFELSE( | ||
118 | [AC_LANG_PROGRAM( | ||
119 | [#include <mach/mach_time.h>], | ||
120 | [[ | ||
121 | mach_absolute_time(); | ||
122 | return 0; | ||
123 | ]] | ||
124 | )], | ||
125 | [ | ||
126 | AC_DEFINE(HAVE_MACH_ABSOLUTE_TIME, 1, [Define to 1 if you have the 'mach_absolute_time' function.]) | ||
127 | AC_MSG_RESULT(yes) | ||
128 | #AC_CHECK_LIB(, clock_gettime, LIBS="-lrt $LIBS") | ||
129 | ], | ||
130 | [ | ||
131 | AC_MSG_RESULT(no) | ||
132 | ] | ||
133 | ) | ||
134 | |||
135 | |||
136 | |||
137 | |||
95 | AC_STRUCT_TM | 138 | AC_STRUCT_TM |
96 | 139 | ||
97 | dnl --------------- | 140 | dnl --------------- |
@@ -130,18 +173,8 @@ if test "x$ac_cv_header_iconv_h" = "xyes"; then | |||
130 | 173 | ||
131 | if test "x$ac_found_iconv" = xyes; then | 174 | if test "x$ac_found_iconv" = xyes; then |
132 | AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) | 175 | AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) |
133 | AC_CHECK_LIB([iconv], | 176 | AC_CHECK_LIB(iconv, iconv_open, LIBS="-liconv $LIBS") |
134 | [iconv_open], | 177 | AC_CHECK_LIB(iconv, libiconv_open, LIBS="-liconv $LIBS") |
135 | [ | ||
136 | LIBS="-liconv $LIBS" | ||
137 | ], | ||
138 | []) | ||
139 | AC_CHECK_LIB([iconv], | ||
140 | [libiconv_open], | ||
141 | [ | ||
142 | LIBS="-liconv $LIBS" | ||
143 | ], | ||
144 | []) | ||
145 | 178 | ||
146 | dnl Check if iconv uses const in prototype declaration | 179 | dnl Check if iconv uses const in prototype declaration |
147 | AC_CACHE_CHECK(for iconv declaration, | 180 | AC_CACHE_CHECK(for iconv declaration, |
@@ -185,10 +218,7 @@ LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS" | |||
185 | 218 | ||
186 | 219 | ||
187 | dnl Check for required functions in -lX11 | 220 | dnl Check for required functions in -lX11 |
188 | AC_CHECK_LIB(X11, XOpenDisplay, | 221 | AC_CHECK_LIB(X11, XOpenDisplay, LIBS="-lX11 $LIBS", AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.])) |
189 | LIBS="-lX11 $LIBS", | ||
190 | AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.]) | ||
191 | ) | ||
192 | LIBS="$X_EXTRA_LIBS $LIBS" | 222 | LIBS="$X_EXTRA_LIBS $LIBS" |
193 | 223 | ||
194 | AC_CHECK_LIB(xpg4, setlocale, LIBS="-lxpg4 $LIBS") | 224 | AC_CHECK_LIB(xpg4, setlocale, LIBS="-lxpg4 $LIBS") |