diff --git a/Makefile b/Makefile index 376990b..7a9d3b6 100644 --- a/Makefile +++ b/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/config/feature-tests.mak b/config/feature-tests.mak index be9ebc0..4a81f56 100644 --- a/config/feature-tests.mak +++ b/config/feature-tests.mak @@ -166,3 +166,12 @@ int main(void) return 0; } endef + +define SOURCE_STATIC +#include + +int main(void) +{ + return 0; +} +endef diff --git a/config/utilities.mak b/config/utilities.mak index 8046182..a70963b 100644 --- a/config/utilities.mak +++ b/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"')