Blame SOURCES/kexec-tools-2.0.17-makedumpfile-Check-if-clock_gettime-requires-lrt.patch

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