From 79baeabd91fc5e369d109c8350b7369283b0c607 Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Mon, 14 Apr 2014 13:49:59 -0700 Subject: Link against librt if necessary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For a while, we were very confused why ppamltracer would work happily on some Debian systems but produce dynamic linker errors on other, similar ones. It turns out the difference was glibc versions – if you have glibc <2.17, you need to specify '-lrt' for one of the functions ppamltracer uses. This commit adds an Autoconf macro that adds that flag if necessary; it should improve portability in general as well. --- configure.ac | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 38c5ec8..7e1c7a5 100644 --- a/configure.ac +++ b/configure.ac @@ -49,6 +49,12 @@ LT_INIT # Dependencies AC_CHECK_HEADERS([unistd.h]) AC_CHECK_TYPE([clockid_t]) +# glibc 2.17 moved 'clock_gettime' (and the other 'clock_' functions) into the +# main C library, but pre-2.17, you needed to link with '-lrt'. (See +# https://blog.flameeyes.eu/2012/12/glibc-2-17-what-s-going-to-be-a-trouble.) +# Search for 'clock_gettime', and if it doesn't exist, add 'rt' to the link +# list. +AC_SEARCH_LIBS([clock_gettime], [rt]) GALOIS_PPAML_LIB_OPENTRACE( [], [AC_MSG_ERROR([both OTF development libraries and the 'otfconfig' program are required. You can install them from .])]) -- cgit v1.2.3