From 6511cab26728453d1b5e572bbbc3775f70c10c0e Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Thu, 18 Jun 2009 17:38:01 +0100 Subject: [configure] Refine CLOCK_MONOTONIC test * configure.ac: Check for the actual CLOCK_MONOTONIC symbol, as clock_gettime need not imply that clock type is supported * lib/zebra.h: use the method given in autoconf docs for sys/time.h inclusion --- configure.ac | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index c1f61824..3ac8384f 100755 --- a/configure.ac +++ b/configure.ac @@ -391,7 +391,7 @@ dnl ------------------------- AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \ sys/types.h linux/version.h netdb.h asm/types.h \ sys/param.h limits.h signal.h libutil.h \ - sys/socket.h netinet/in.h]) + sys/socket.h netinet/in.h time.h sys/time.h]) dnl Utility macro to avoid retyping includes all the time m4_define([QUAGGA_INCLUDES], @@ -425,6 +425,16 @@ m4_define([QUAGGA_INCLUDES], #if HAVE_NETINET_IN_H # include #endif +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif /* TIME_WITH_SYS_TIME */ ])dnl AC_CHECK_HEADERS([sys/un.h net/if.h netinet/in_systm.h netinet/in_var.h \ @@ -1324,12 +1334,10 @@ AC_TRY_COMPILE([#include dnl -------------------------------------- dnl checking for clock_time monotonic struct and call dnl -------------------------------------- -AC_CHECK_LIB(rt, clock_gettime, -[AC_DEFINE(HAVE_MONOTONIC_CLOCK,, Have monotonic clock) - LIBS="$LIBS -lrt"] -) - - +AC_CHECK_DECL(CLOCK_MONOTONIC, + [AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"]) + AC_DEFINE(HAVE_MONOTONIC_CLOCK,, Have monotonic clock) +], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES]) dnl ------------------- dnl capabilities checks -- cgit v1.2.1