]> git.puffer.fish Git - mirror/frr.git/commitdiff
[configure] Refine CLOCK_MONOTONIC test
authorPaul Jakma <paul@quagga.net>
Thu, 18 Jun 2009 16:38:01 +0000 (17:38 +0100)
committerPaul Jakma <paul@quagga.net>
Thu, 18 Jun 2009 19:18:31 +0000 (20:18 +0100)
* 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
lib/zebra.h

index c1f618248b5c0e15a19c83c7cac34db580512073..3ac8384f555f92397279e826ca820674a22266ee 100755 (executable)
@@ -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 <netinet/in.h>
 #endif
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# 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 <sys/resource.h>
 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
index 2716460f52f20024ba24ce6a92fe5878a4f57492..2dc84514295046e8fdf7b3558b5b11a7e5eb5a13 100644 (file)
@@ -55,7 +55,6 @@ typedef int socklen_t;
 #include <sys/select.h>
 #endif /* HAVE_SYS_SELECT_H */
 #include <sys/stat.h>
-#include <sys/time.h>
 #include <sys/types.h>
 #include <sys/param.h>
 #ifdef HAVE_SYS_SYSCTL_H
@@ -72,7 +71,16 @@ typedef int socklen_t;
 #include <sys/ksym.h>
 #endif /* HAVE_SYS_KSYM_H */
 #include <syslog.h>
-#include <time.h>
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif /* TIME_WITH_SYS_TIME */
 #include <sys/uio.h>
 #include <sys/utsname.h>
 #ifdef HAVE_RUSAGE