From 6096eb2db483cddd2211b9d8bc96298a38ac3169 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 20 Feb 2015 18:00:03 +0100 Subject: Check if we need librt for clock_gettime in configure script --- build/linux/Makefile.in | 3 ++- build/linux/configure.ac | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'build') 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 +],[ +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 + ],[ + 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]) -- cgit v1.2.3