Hello Ajax:
I am not very familar with autoconf.
I updated this patch.
If it is cross compile ,I check with AC_TRY_LINK again,
I tried on arm machine , is it ok ?
AM_CONDITIONAL(CLOCK_MONOTONIC, [test "x$CLOCK_MONOTONIC" = xyes])
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
CLOCK_LIBS="$have_clock_gettime"
else
CLOCK_LIBS=""
fi
LIBS_SAVE="$LIBS"
LIBS="$CLOCK_LIBS"
CPPFLAGS_SAVE="$CPPFLAGS"
if test x"$glibc" = xyes; then
CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
fi
AC_RUN_IFELSE([
#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"])
LIBS="$LIBS_SAVE $CLOCK_LIBS"
CPPFLAGS="$CPPFLAGS_SAVE"
else
MONOTONIC_CLOCK=no
fi
if test "x$MONOTONIC_CLOCK" = "xcross compiling"; then
AC_MSG_NOTICE(["cross compiling Xserver ,check MONOTONIC_CLOCK link" ])
AC_TRY_LINK([
#include <time.h>
],
[
struct timespec tp;
clock_gettime(CLOCK_MONOTONIC, &tp);
], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no])
LIBS="$LIBS_SAVE $CLOCK_LIBS"
CPPFLAGS="$CPPFLAGS_SAVE"
else
MONOTONIC_CLOCK=no
fi
if test "x$MONOTONIC_CLOCK" = xyes; then
AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
LIBS="$LIBS $CLOCK_LIBS"
fi
Thanks
Best regards
ailantian
2009/11/19 Adam Jackson <[email protected]>:
> On Wed, 2009-11-18 at 10:41 +0800, lantian ai wrote:
>> Thanks Ajax:
>>
>> patch is coming
>
> The patch is wrong. It assumes that any cross-compiled target has
> CLOCK_MONOTONIC.
>
> - ajax
>
--- xorg-server-1.6.2/configure.ac.orrginal 2009-11-19 12:00:48.000000000 +0800
+++ xorg-server-1.6.2/configure.ac 2009-11-19 12:07:30.000000000 +0800
@@ -723,6 +723,7 @@
#endif
], glibc=yes, glibc=no)
AC_MSG_RESULT([$glibc])
+AM_CONDITIONAL(CLOCK_MONOTONIC, [test "x$CLOCK_MONOTONIC" = xyes])
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
[AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
@@ -759,19 +760,36 @@
], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
[MONOTONIC_CLOCK="cross compiling"])
- LIBS="$LIBS_SAVE"
+ LIBS="$LIBS_SAVE $CLOCK_LIBS"
CPPFLAGS="$CPPFLAGS_SAVE"
else
MONOTONIC_CLOCK=no
fi
-AC_MSG_RESULT([$MONOTONIC_CLOCK])
+
+if test "x$MONOTONIC_CLOCK" = "xcross compiling"; then
+AC_MSG_NOTICE(["cross compiling Xserver ,check MONOTONIC_CLOCK link" ])
+ AC_TRY_LINK([
+#include <time.h>
+],
+[
+ struct timespec tp;
+ clock_gettime(CLOCK_MONOTONIC, &tp);
+ ], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no])
+
+ LIBS="$LIBS_SAVE $CLOCK_LIBS"
+ CPPFLAGS="$CPPFLAGS_SAVE"
+else
+ MONOTONIC_CLOCK=no
+fi
if test "x$MONOTONIC_CLOCK" = xyes; then
AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
LIBS="$LIBS $CLOCK_LIBS"
fi
+
+AC_MSG_RESULT([$MONOTONIC_CLOCK])
AM_CONDITIONAL(XV, [test "x$XV" = xyes])
if test "x$XV" = xyes; then
AC_DEFINE(XV, 1, [Support Xv extension])
_______________________________________________
xorg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xorg