2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/verbose.mk
16 @if [ -f $(TMP_DIR)/.prereq-error ]; then \
17 cat $(TMP_DIR)/.prereq-error; \
26 ifeq ($$(CHECK_$(1)),)
29 prereq-$(1): $(TMP_DIR) FORCE
30 @echo -n "Checking '$(1)'... "
31 @if $(NO_TRACE_MAKE) -f $(INCLUDE_DIR)/prereq.mk check-$(1) >/dev/null 2>/dev/null; then \
35 echo -e "$(strip $(2))" >> $(TMP_DIR)/.prereq-error; \
50 $$(eval $$(call Require,$(1),$(2)))
53 # Required for the toolchain
54 define Require/working-make
55 echo 'all: test' > $(TMP_DIR)/check.mk
56 echo 'e0 = $$$$(foreach s,foobar,$$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk
57 echo 'e1 = $$$$(foreach s,foobar, $$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk
58 echo 'test: $$$$(strip $$$$(e0)) $$$$(strip $$$$(e1))' >> $(TMP_DIR)/check.mk
59 $(NO_TRACE_MAKE) -f $(TMP_DIR)/check.mk
62 $(eval $(call Require,working-make, \
63 Your make version is buggy. Please install GNU make v3.81 or later. \
66 define Require/working-gcc
67 echo 'int main(int argc, char **argv) { return 0; }' | \
68 gcc -x c -o $(TMP_DIR)/a.out -
71 $(eval $(call Require,working-gcc, \
72 No working GNU C Compiler was found on your system. \
75 define Require/working-g++
76 echo 'int main(int argc, char **argv) { return 0; }' | \
77 g++ -x c++ -o $(TMP_DIR)/a.out -lstdc++ -
80 $(eval $(call Require,working-g++, \
81 No working GNU C++ Compiler was found on your system. \
85 echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
86 gcc -x c -o $(TMP_DIR)/a.out -lz -
89 $(eval $(call Require,zlib, \
90 The development version of zlib was not found on your system. \
94 $(eval $(call RequireCommand,bison, \
95 Please install GNU bison. \
98 $(eval $(call RequireCommand,flex, \
99 Please install flex. \
102 $(eval $(call RequireCommand,python, \
103 Please install python. \
106 $(eval $(call RequireCommand,unzip, \
107 Please install unzip. \
110 $(eval $(call RequireCommand,bzip2, \
111 Please install bzip2. \
114 $(eval $(call RequireCommand,patch, \
115 Please install patch. \