kvm tools: Add test for -static libc present

Make sure the static binaries can be built.

Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
[ penberg@kernel.org: improve error message ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Cyrill Gorcunov
2012-06-11 15:31:40 +04:00
committed by Will Deacon
parent 24ed52db06
commit 2c82d39a08
3 changed files with 20 additions and 0 deletions
+3
View File
@@ -219,6 +219,9 @@ ifeq ($(call try-cc,$(SOURCE_AIO),$(FLAGS_AIO) -static),y)
LIBS_STATOPT += -laio
endif
ifneq ($(call try-build,$(SOURCE_STATIC),-static,),y)
$(error No static libc found. Please install glibc-static package.)
endif
###
LIBS += -lrt
+9
View File
@@ -166,3 +166,12 @@ int main(void)
return 0;
}
endef
define SOURCE_STATIC
#include <stdlib.h>
int main(void)
{
return 0;
}
endef
+8
View File
@@ -186,3 +186,11 @@ try-cc = $(shell sh -c \
echo "$(1)" | \
$(CC) -x c - $(2) -o "$$TMP" > /dev/null 2>&1 && echo y; \
rm -f "$$TMP"')
# try-build
# Usage: option = $(call try-build, source-to-build, cc-options, link-options)
try-build = $(shell sh -c \
'TMP="$(OUTPUT)$(TMPOUT).$$$$"; \
echo "$(1)" | \
$(CC) -x c - $(2) $(3) -o "$$TMP" > /dev/null 2>&1 && echo y; \
rm -f "$$TMP"')