summaryrefslogtreecommitdiffstats
path: root/build/linux/configure.ac
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-02-20 18:00:03 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-02-20 18:02:23 +0100
commit6096eb2db483cddd2211b9d8bc96298a38ac3169 (patch)
tree29c2122fcf375a5eb16ebd9c903b8e06ab68f3a2 /build/linux/configure.ac
parent4126f910ae9fd2d4fc756e7f07c03049fe26daad (diff)
downloadastra-6096eb2db483cddd2211b9d8bc96298a38ac3169.tar.gz
astra-6096eb2db483cddd2211b9d8bc96298a38ac3169.tar.bz2
astra-6096eb2db483cddd2211b9d8bc96298a38ac3169.tar.xz
astra-6096eb2db483cddd2211b9d8bc96298a38ac3169.zip
Check if we need librt for clock_gettime in configure script
Diffstat (limited to 'build/linux/configure.ac')
-rw-r--r--build/linux/configure.ac28
1 files changed, 28 insertions, 0 deletions
diff --git a/build/linux/configure.ac b/build/linux/configure.ac
index f99c4d3..cbf6016 100644
--- a/build/linux/configure.ac
+++ b/build/linux/configure.ac
@@ -31,6 +31,7 @@ LT_INIT([disable-static])
SAVED_CPPFLAGS="$CPPFLAGS"
SAVED_CXXFLAGS="$CXXFLAGS"
SAVED_LDFLAGS="$LDFLAGS"
+SAVED_LIBS="$LIBS"
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
@@ -47,6 +48,32 @@ dnl Use iostream to check if the C++ compiler works
AC_CHECK_HEADER(iostream, , AC_MSG_ERROR([No working c++ compiler found]))
+# clock_gettime
+
+AC_MSG_CHECKING([for clock_gettime])
+AC_TRY_LINK([
+#include <ctime>
+],[
+struct timespec t; clock_gettime(CLOCK_REALTIME, &t);
+],astra_clock_gettime_ok=yes,astra_clock_gettime_ok=no)
+AC_MSG_RESULT($astra_clock_gettime_ok)
+if test x$astra_clock_gettime_ok = xno; then
+ AC_MSG_CHECKING([for clock_gettime in librt])
+ LIBS="$LIBS -lrt"
+ AC_TRY_LINK([
+ #include <ctime>
+ ],[
+ struct timespec t; clock_gettime(CLOCK_REALTIME, &t);
+ ],astra_clock_gettime_ok=yes,astra_clock_gettime_ok=no)
+ AC_MSG_RESULT($astra_clock_gettime_ok)
+ if test x$astra_clock_gettime_ok = xno; then
+ AC_MSG_ERROR([No clock_gettime found])
+ else
+ SAVED_LIBS="$SAVED_LIBS -lrt"
+ fi
+fi
+
+
# boost-unit-test-framework
AC_MSG_CHECKING([for boost-unit-test-framework])
@@ -179,6 +206,7 @@ AC_SUBST(HAVEMATLAB)
AC_SUBST(SAVED_CPPFLAGS)
AC_SUBST(SAVED_CXXFLAGS)
AC_SUBST(SAVED_LDFLAGS)
+AC_SUBST(SAVED_LIBS)
AC_CONFIG_FILES([Makefile])