[CRIU] [PATCH] build: criu -- Make sure the required libs are installed

Cyrill Gorcunov gorcunov at openvz.org
Wed Feb 24 07:04:29 PST 2016


Otherwise our feature testing engine will simply fail
due to lack of libs we're binding with.

Reported-by: Laurent Dufour <ldufour at linux.vnet.ibm.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/Makefile | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/criu/Makefile b/criu/Makefile
index cc35f3771f88..1e1c73ce22d3 100644
--- a/criu/Makefile
+++ b/criu/Makefile
@@ -57,7 +57,19 @@ ccflags-y		+= -I/usr/include/libnl3
 export ccflags-y
 
 LIBS			:= -lrt -lpthread -lprotobuf-c -ldl -lnl-3
+REQ-LIBS-NAMES          := libpthread libprotobuf-c libnl-3
 
+#
+# Make sure all required libs are installed
+ifneq ($(MAKECMDGOALS),clean)
+        ifneq ($(shell sh -c                                                            \
+                        'TMP="$(OUTPUT)$(TMPOUT).$$$$";                                 \
+                        echo "int main(int argc, char *argv[]) { return 0; }" |         \
+                        "$(CC)" -x c - $(LIBS) -o "$$TMP" > /dev/null 2>&1 && echo y;   \
+                        rm -f "$$TMP"'),y)
+                $(error "Make sure '$(REQ-LIBS-NAMES)' libraries are installed")
+        endif
+endif
 ifeq ($(GMON),1)
 	CFLAGS		+= -pg
 	GMONLDOPT	:= -pg
-- 
2.5.0



More information about the CRIU mailing list