forked from old/legacy-imlib2
imlib2_load: Use clock_gettime() when available
This commit is contained in:
parent
e3a2bd5fa6
commit
5a2490eb7f
10
configure.ac
10
configure.ac
|
@ -129,6 +129,16 @@ AM_CONDITIONAL(BUILD_X11, test "x$have_x" = "xyes")
|
|||
AC_CHECK_LIB(dl, dlopen, DLOPEN_LIBS=-ldl)
|
||||
AC_SUBST(DLOPEN_LIBS)
|
||||
|
||||
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
|
||||
[AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
|
||||
[have_clock_gettime=no])])
|
||||
if test "x$have_clock_gettime" != xno; then
|
||||
AC_DEFINE(USE_MONOTONIC_CLOCK, 1, [Use monotonic clock from clock_gettime()])
|
||||
if test "x$have_clock_gettime" != xyes; then
|
||||
AC_SUBST(CLOCK_LIBS, [$have_clock_gettime])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to enable jpeg support)
|
||||
AC_ARG_WITH([jpeg],
|
||||
|
|
|
@ -19,7 +19,7 @@ imlib2_conv_SOURCES = imlib2_conv.c
|
|||
imlib2_conv_LDADD = $(top_builddir)/src/lib/libImlib2.la
|
||||
|
||||
imlib2_load_SOURCES = imlib2_load.c
|
||||
imlib2_load_LDADD = $(top_builddir)/src/lib/libImlib2.la
|
||||
imlib2_load_LDADD = $(top_builddir)/src/lib/libImlib2.la $(CLOCK_LIBS)
|
||||
|
||||
imlib2_show_SOURCES = imlib2_show.c
|
||||
imlib2_show_LDADD = $(top_builddir)/src/lib/libImlib2.la -lX11 -lm
|
||||
|
|
|
@ -4,7 +4,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#if USE_MONOTONIC_CLOCK
|
||||
#include <time.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifndef X_DISPLAY_MISSING
|
||||
#define X_DISPLAY_MISSING
|
||||
|
|
Loading…
Reference in New Issue