add support for per-package prereq checks, run global prereq checks before (menu...
[openwrt-10.03/.git] / include / prereq-build.mk
1
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/prereq.mk
10
11 # Required for the toolchain
12 define Require/working-make
13         echo 'all: test' > $(TMP_DIR)/check.mk
14         echo 'e0 = $$$$(foreach s,foobar,$$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk
15         echo 'e1 = $$$$(foreach s,foobar, $$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk
16         echo 'test: $$$$(strip $$$$(e0)) $$$$(strip $$$$(e1))' >> $(TMP_DIR)/check.mk
17         $(NO_TRACE_MAKE) -f $(TMP_DIR)/check.mk
18 endef
19
20 $(eval $(call Require,working-make, \
21         Your make version is buggy. Please install GNU make v3.81 or later. \
22 ))
23
24 define Require/working-gcc
25         echo 'int main(int argc, char **argv) { return 0; }' | \
26                 gcc -x c -o $(TMP_DIR)/a.out -
27 endef
28
29 $(eval $(call Require,working-gcc, \
30         No working GNU C Compiler (gcc) was found on your system. \
31 ))
32
33 define Require/working-g++
34         echo 'int main(int argc, char **argv) { return 0; }' | \
35                 g++ -x c++ -o $(TMP_DIR)/a.out -lstdc++ -
36 endef
37
38 $(eval $(call Require,working-g++, \
39         No working GNU C++ Compiler (g++) was found on your system. \
40 ))
41
42 define Require/ncurses
43         echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
44                 gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out -lncurses -
45 endef
46
47 $(eval $(call Require,ncurses, \
48         No ncurses development files were not found on your system. \
49 ))
50
51
52 define Require/zlib
53         echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
54                 gcc -include zlib.h -x c -o $(TMP_DIR)/a.out -lz -
55 endef
56
57 $(eval $(call Require,zlib, \
58         No zlib development files were not found on your system. \
59 ))
60
61
62 $(eval $(call RequireCommand,bison, \
63         Please install GNU bison. \
64 ))
65
66 $(eval $(call RequireCommand,flex, \
67         Please install flex. \
68 ))
69
70 $(eval $(call RequireCommand,python, \
71         Please install python. \
72 ))
73
74 $(eval $(call RequireCommand,unzip, \
75         Please install unzip. \
76 ))
77
78 $(eval $(call RequireCommand,bzip2, \
79         Please install bzip2. \
80 ))
81
82 $(eval $(call RequireCommand,patch, \
83         Please install patch. \
84 ))
85
86 $(eval $(call RequireCommand,perl, \
87         Please install perl. \
88 ))