cf4a81
From aec51ef7aee483cc5bf16844bdbacb1c70619f15 Mon Sep 17 00:00:00 2001
cf4a81
From: Petr Tesarik <ptesarik@suse.com>
cf4a81
Date: Wed, 20 Jun 2018 11:50:19 +0200
cf4a81
Subject: [PATCH 2/2] [PATCH 2/2] Check if clock_gettime() requires -lrt
cf4a81
cf4a81
For glibc versions before 2.17, clock_gettime() was contained in a
cf4a81
separate library and required linking with -lrt.
cf4a81
cf4a81
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
cf4a81
---
cf4a81
 Makefile | 12 ++++++++++++
cf4a81
 1 file changed, 12 insertions(+)
cf4a81
cf4a81
diff --git a/makedumpfile-1.6.2/Makefile b/makedumpfile-1.6.2/Makefile
cf4a81
index 612b9d0..142a387 100644
cf4a81
--- a/makedumpfile-1.6.2/Makefile
cf4a81
+++ b/makedumpfile-1.6.2/Makefile
cf4a81
@@ -68,6 +68,18 @@ endif
cf4a81
 
cf4a81
 LIBS := -lpthread $(LIBS)
cf4a81
 
cf4a81
+try-run = $(shell set -e;		\
cf4a81
+	TMP=".$$$$.tmp";		\
cf4a81
+	if ($(1)) >/dev/null 2>&1;	\
cf4a81
+	then echo "$(2)";		\
cf4a81
+	else echo "$(3)";		\
cf4a81
+	fi;				\
cf4a81
+	rm -f "$$TMP")
cf4a81
+
cf4a81
+LINK_TEST_PROG="int clock_gettime(); int main(){ return clock_gettime(); }"
cf4a81
+LIBS := $(LIBS) $(call try-run,\
cf4a81
+	echo $(LINK_TEST_PROG) | $(CC) $(CFLAGS) -o "$$TMP" -x c -,,-lrt)
cf4a81
+
cf4a81
 all: makedumpfile
cf4a81
 
cf4a81
 $(OBJ_PART): $(SRC_PART)
cf4a81
-- 
cf4a81
2.9.5
cf4a81