about XSync extension problem.

lantian ai ailantian at googlemail.com
Wed Nov 18 20:09:50 PST 2009


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 <ajax at redhat.com>:
> 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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xorg-clock_gettimecheck3.patch
Type: text/x-patch
Size: 1428 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20091119/412aa19a/attachment.bin>


More information about the xorg mailing list