Commit-ID: 7d93accb8310f43952675505acf0191b22736e81 Gitweb: http://git.kernel.org/tip/7d93accb8310f43952675505acf0191b22736e81 Author: Cyrill Gorcunov <gorcunov@xxxxxxxxxx> AuthorDate: Mon, 11 Jun 2012 15:31:40 +0400 Committer: Pekka Enberg <penberg@xxxxxxxxxx> CommitDate: Tue, 12 Jun 2012 11:25:22 +0300 kvm tools: Add test for -static libc present Make sure the static binaries can be built. Reported-by: Ingo Molnar <mingo@xxxxxxxxxx> Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx> [ penberg@xxxxxxxxxx: improve error message ] Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx> --- tools/kvm/Makefile | 3 +++ tools/kvm/config/feature-tests.mak | 9 +++++++++ tools/kvm/config/utilities.mak | 8 ++++++++ 3 files changed, 20 insertions(+), 0 deletions(-) diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile index 376990b..7a9d3b6 100644 --- a/tools/kvm/Makefile +++ b/tools/kvm/Makefile @@ -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 diff --git a/tools/kvm/config/feature-tests.mak b/tools/kvm/config/feature-tests.mak index be9ebc0..4a81f56 100644 --- a/tools/kvm/config/feature-tests.mak +++ b/tools/kvm/config/feature-tests.mak @@ -166,3 +166,12 @@ int main(void) return 0; } endef + +define SOURCE_STATIC +#include <stdlib.h> + +int main(void) +{ + return 0; +} +endef diff --git a/tools/kvm/config/utilities.mak b/tools/kvm/config/utilities.mak index 8046182..a70963b 100644 --- a/tools/kvm/config/utilities.mak +++ b/tools/kvm/config/utilities.mak @@ -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"') -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html