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