summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-08-18 00:31:05 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-08-18 00:40:14 +0300
commitab1bfc33c87726dc1fd85c351191380c6c463143 (patch)
tree731d03872f73628a9444c6007bf6dab0f742f7a7 /Makefile.am
parent454e8410e03b8a141296ec4c3c2bf876d78b4ea8 (diff)
downloadbdwgc-ab1bfc33c87726dc1fd85c351191380c6c463143.tar.gz
Link with rt library to get clock_gettime where necessary
Issue #450 (bdwgc). This patch adds the logic to CMake and configure scripts to pass -lrt option during linking to avoid unresolved clock_gettime on some hosts. * CMakeLists.txt [!NEED_LIB_RT] (HAVE_CLOCK_GETTIME_DIRECTLY): Set variable by check_function_exists(clock_gettime). * CMakeLists.txt [!NEED_LIB_RT && !HAVE_CLOCK_GETTIME_DIRECTLY] (NEED_LIB_RT): Set to ON. * CMakeLists.txt (LIBRT): Refine comment. * CMakeLists.txt (gc): Specify target_link_libraries regardless of enable_threads. * Makefile.am (libgc_la_LIBADD): Update comment. * configure.ac (need_lib_rt): Define variable (and set to false). * configure.ac [$THREADS==pthreads && ($host==*-*-hpux11* || $host==*-*-netbsd* || $host== *-*-solaris* || $host==*-*-osf*)] (THREADDLLIBS): Do not add "-lrt" directly. * configure.ac [$THREADS==pthreads && ($host==*-*-hpux11* || $host==*-*-netbsd* || $host== *-*-solaris* || $host==*-*-osf*)] (need_lib_rt): Set to true. * configure.ac [!need_lib_rt && !AC_LINK_IFELSE(clock_gettime) && AC_CHECK_LIB(rt,clock_gettime)] (need_lib_rt): Set to true. * configure.ac [need_lib_rt] (THREADDLLIBS): Append "-lrt".
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am2
1 files changed, 1 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 919710f0..c73126c0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -115,7 +115,7 @@ endif
endif
# Include THREADDLLIBS here to ensure that the correct versions of
-# linuxthread semaphore functions get linked:
+# linuxthread semaphore (and clock_gettime) functions get linked:
libgc_la_LIBADD = @addobjs@ $(THREADDLLIBS) $(UNWINDLIBS) $(ATOMIC_OPS_LIBS)
libgc_la_DEPENDENCIES = @addobjs@
libgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info $(LIBGC_VER_INFO) \