summaryrefslogtreecommitdiffstats
path: root/build
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
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')
-rw-r--r--build/linux/Makefile.in3
-rw-r--r--build/linux/configure.ac28
2 files changed, 30 insertions, 1 deletions
diff --git a/build/linux/Makefile.in b/build/linux/Makefile.in
index 685e1e5..5b4c9fa 100644
--- a/build/linux/Makefile.in
+++ b/build/linux/Makefile.in
@@ -19,10 +19,11 @@ VPATH=../..
CPPFLAGS=@SAVED_CPPFLAGS@
CXXFLAGS=@SAVED_CXXFLAGS@
LDFLAGS=@SAVED_LDFLAGS@
+LIBS=@SAVED_LIBS@
CPPFLAGS+=-I../.. -I../../include -I../../lib/include/rapidxml
CXXFLAGS+=-g -O3 -Wall -Wshadow
-LIBS=-lpthread -lrt
+LIBS+=-lpthread
LDFLAGS+=-g
ifeq ($(cuda),yes)
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])