From dbb68df8d02eff87f10df331e17bd0940e158f56 Mon Sep 17 00:00:00 2001
From: "Robin H. Johnson" <robbat2@gentoo.org>
Date: Wed, 24 Jul 2019 11:15:59 +0200
Subject: [PATCH] Add pthread to libdevmapper pkgconfig file

Forward-ported from 2.02.176 to 2.03.05
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
---
 libdm/libdevmapper.pc.in | 2 +-
 tools/Makefile.in        | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libdm/libdevmapper.pc.in b/libdm/libdevmapper.pc.in
index a325aeb9e0..aa0980378f 100644
--- a/libdm/libdevmapper.pc.in
+++ b/libdm/libdevmapper.pc.in
@@ -9,4 +9,4 @@ Version: @DM_LIB_PATCHLEVEL@
 Cflags: -I${includedir} 
 Libs: -L${libdir} -ldevmapper
 Requires.private: @SELINUX_PC@ @UDEV_PC@
-Libs.private: -lm @RT_LIBS@
+Libs.private: -lm @RT_LIBS@ @PTHREAD_LIBS@
diff --git a/tools/Makefile.in b/tools/Makefile.in
index e5fc9c4ae4..12e4de2c63 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -87,6 +87,7 @@ ifeq ("@STATIC_LINK@", "yes")
   TARGETS += lvm.static
   INSTALL_LVM_TARGETS += install_tools_static
   INSTALL_CMDLIB_TARGETS += install_cmdlib_static
+  STATIC_LIBS += @PTHREAD_LIBS@
 endif
 
 LVMLIBS = $(SYSTEMD_LIBS) -L$(top_builddir)/libdm -ldevmapper $(LIBS) -laio
@@ -113,6 +114,10 @@ CFLOW_TARGET = lvm
 
 include $(top_builddir)/make.tmpl
 
+ifeq ("@STATIC_LINK@", "yes")
+    STATIC_LIBS += @PTHREAD_LIBS@
+endif
+
 device-mapper:
 
 all: device-mapper
-- 
2.22.0

