summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-10-25 23:57:00 +0300
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-10-26 00:25:34 +0300
commitd04e2545a7238133692aa4501d24e5fdae30df08 (patch)
tree918b12e594454b5787925dbe7fb5c35cb2351d36 /configure.ac
parentd12d0839fdede9ddad219815ced89664a2c44458 (diff)
GetTimeInMillis: spuport monotonic clock
Add support for CLOCK_MONOTONIC from clock_gettime, and use that in GetTimeInMillis() if available, falling back to the old gettimeofday() implementation. This is _slightly_ faster on some 64-bit architectures, and _slightly_ slower on others (though barely measurable). (cherry picked from d285833290316cb5dd1e7f1e52c96be3e9cf21cd commit)
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac43
1 files changed, 41 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 7945a272d..25570f2c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -515,7 +515,7 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la'
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
dnl Core modules for most extensions, et al.
-REQUIRED_MODULES="randrproto renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto xproto xtrans xf86miscproto xf86vidmodeproto xf86bigfontproto [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto inputproto xf86dgaproto [kbproto >= 1.0.3]"
+REQUIRED_MODULES="randrproto renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto [xproto >= 7.0.9] xtrans xf86miscproto xf86vidmodeproto xf86bigfontproto [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto inputproto xf86dgaproto [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont xau fontenc"
AM_CONDITIONAL(XV, [test "x$XV" = xyes])
@@ -873,9 +873,46 @@ PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS}"
XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} -lm"
-AC_SUBST([XSERVER_LIBS])
AC_SUBST([SYS_LIBS])
+AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
+ [AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
+ [have_clock_gettime=no])])
+
+AC_MSG_CHECKING([for a useful monotonic clock ...])
+
+if ! test "x$have_clock_gettime" = xno; then
+ if ! test "x$have_clock_gettime" = xyes; then
+ LIBS="$have_clock_gettime"
+ else
+ LIBS=""
+ fi
+
+ AC_RUN_IFELSE([
+#define _POSIX_C_SOURCE 199309L
+#include <time.h>
+
+int main(int argc, char *argv[]) {
+ struct timespec tp;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
+ return 0;
+ else
+ return 1;
+}
+ ], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
+ [MONOTONIC_CLOCK="cross compiling"])
+else
+ MONOTONIC_CLOCK=no
+fi
+
+AC_MSG_RESULT([$MONOTONIC_CLOCK])
+
+if test "x$MONOTONIC_CLOCK" = xyes; then
+ AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
+ XSERVER_LIBS="$XSERVER_LIBS $LIBS"
+fi
+
dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
dnl we need to replicate that here until those can all be fixed
AC_MSG_CHECKING([if SVR4 needs to be defined])
@@ -890,6 +927,8 @@ AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
AC_DEFINE_UNQUOTED(X_BYTE_ORDER,[$ENDIAN],[Endian order])
+AC_SUBST([XSERVER_LIBS])
+
dnl ---------------------------------------------------------------------------
dnl DDX section.
dnl ---------------------------------------------------------------------------