[prev in list] [next in list] [prev in thread] [next in thread]
List: strongswan-announce
Subject: [strongSwan-dev] [PATCH 1/2] Test if target system supports
From: J. Tang <tang () jtang ! org>
Date: 2011-11-07 3:42:13
Message-ID: AF30196E-4B5C-43A1-918A-DBCD4F70765B () jtang ! org
[Download RAW message or body]
Add a check to configure.in to detect if the target system has a
function clock_gettime(). On my OS X and Linux systems, the check
seems to work.
Signed-off-by: J. Tang <tang@jtang.org>
---
configure.in | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/configure.in b/configure.in
index a0b1f40..4973a04 100644
--- a/configure.in
+++ b/configure.in
@@ -329,11 +329,22 @@ AC_SEARCH_LIBS(socket, socket, [SOCKLIB=$LIBS],
)
AC_SUBST(SOCKLIB)
+try_link_clock="yes";
+AC_MSG_CHECKING([for POSIX real-time clock])
+AC_TRY_COMPILE(
+ [#include <time.h>],
+ [clock_gettime(CLOCK_THREAD_CPUTIME_ID, 0);],
+ [AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_CLOCK_GETTIME)],
+ [AC_MSG_RESULT([no]); try_link_clock="no";]
+)
+
dnl FreeBSD has clock_gettime in libc, Linux needs librt
-LIBS=""
-AC_SEARCH_LIBS(clock_gettime, rt, [RTLIB=$LIBS])
-AC_CHECK_FUNCS(clock_gettime)
-AC_SUBST(RTLIB)
+if test $try_link_clock = yes; then
+ LIBS=""
+ AC_SEARCH_LIBS(clock_gettime, rt, [RTLIB=$LIBS])
+ AC_CHECK_FUNCS(clock_gettime)
+ AC_SUBST(RTLIB)
+fi
dnl Android has pthread_* functions in bionic (libc), others need
libpthread
LIBS=""
--
1.7.3.2
_______________________________________________
Dev mailing list
Dev@lists.strongswan.org
https://lists.strongswan.org/mailman/listinfo/dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic