add prereq check for wget
[openwrt/svn-archive/archive.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 TMP_DIR:=$(TOPDIR)/tmp
10 include $(INCLUDE_DIR)/prereq.mk
11 include $(INCLUDE_DIR)/host.mk
12
13 define Require/non-root
14 [ "$$(shell whoami)" != "root" ]
15 endef
16 $(eval $(call Require,non-root, \
17 Please do not compile as root. \
18 ))
19
20 # Required for the toolchain
21 define Require/working-make
22 echo 'all: test' > $(TMP_DIR)/check.mk
23 echo 'e0 = $$$$(foreach s,foobar,$$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk
24 echo 'e1 = $$$$(foreach s,foobar, $$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk
25 echo 'test: $$$$(strip $$$$(e0)) $$$$(strip $$$$(e1))' >> $(TMP_DIR)/check.mk
26 $(NO_TRACE_MAKE) -f $(TMP_DIR)/check.mk
27 endef
28
29 $(eval $(call Require,working-make, \
30 Please install GNU make v3.81 or later. (This version has bugs) \
31 ))
32
33 define Require/working-gcc
34 echo 'int main(int argc, char **argv) { return 0; }' | \
35 gcc -x c -o $(TMP_DIR)/a.out -
36 endef
37
38 $(eval $(call Require,working-gcc, \
39 Please install the GNU C Compiler (gcc). \
40 ))
41
42 define Require/working-g++
43 echo 'int main(int argc, char **argv) { return 0; }' | \
44 g++ -x c++ -o $(TMP_DIR)/a.out -lstdc++ -
45 endef
46
47 $(eval $(call Require,working-g++, \
48 Please install the GNU C++ Compiler (g++). \
49 ))
50
51 define Require/ncurses
52 echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
53 gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out -lncurses -
54 endef
55
56 $(eval $(call Require,ncurses, \
57 Please install ncurses. (Missing libncurses.so or ncurses.h) \
58 ))
59
60
61 define Require/zlib
62 echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
63 gcc -include zlib.h -x c -o $(TMP_DIR)/a.out -lz -
64 endef
65
66 $(eval $(call Require,zlib, \
67 Please install zlib. (Missing libz.so or zlib.h) \
68 ))
69
70
71 $(eval $(call RequireCommand,bison, \
72 Please install GNU bison. \
73 ))
74
75 $(eval $(call RequireCommand,flex, \
76 Please install flex. \
77 ))
78
79 $(eval $(call RequireCommand,python, \
80 Please install python. \
81 ))
82
83 $(eval $(call RequireCommand,unzip, \
84 Please install unzip. \
85 ))
86
87 $(eval $(call RequireCommand,bzip2, \
88 Please install bzip2. \
89 ))
90
91 $(eval $(call RequireCommand,patch, \
92 Please install patch. \
93 ))
94
95 $(eval $(call RequireCommand,perl, \
96 Please install perl. \
97 ))
98
99 $(eval $(call RequireCommand,wget, \
100 Please install wget. \
101 ))
102
103 define Require/gnutar
104 $(TAR) --version 2>&1 | grep GNU > /dev/null
105 endef
106
107 $(eval $(call Require,gnutar, \
108 Please install GNU tar. \
109 ))