mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-08-22 22:06:02 +00:00
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:
committed by
Will Deacon
parent
24ed52db06
commit
2c82d39a08
@@ -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
|
||||
|
||||
@@ -166,3 +166,12 @@ int main(void)
|
||||
return 0;
|
||||
}
|
||||
endef
|
||||
|
||||
define SOURCE_STATIC
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
endef
|
||||
|
||||
@@ -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"')
|
||||
|
||||
Reference in New Issue
Block a user