changed Makefile and profiles, added patches for kernel 2.6.24
[openwrt.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 PKG_NAME:=Build dependency
13
14 define Require/non-root
15         [ "$$(shell whoami)" != "root" ]
16 endef
17 $(eval $(call Require,non-root, \
18         Please do not compile as root. \
19 ))
20
21 # Required for the toolchain
22 define Require/working-make
23         $(MAKE) -v | awk '($$$$1 == "GNU") && ($$$$2 = "Make") && ($$$$3 >= "3.81") { print "ok" }' | grep ok > /dev/null
24 endef
25
26 $(eval $(call Require,working-make, \
27         Please install GNU make v3.81 or later. (This version has bugs) \
28 ))
29
30 define Require/case-sensitive-fs
31         rm -f $(TMP_DIR)/test.*
32         touch $(TMP_DIR)/test.fs
33         [ \! -f $(TMP_DIR)/test.FS ]
34 endef
35
36 $(eval $(call Require,case-sensitive-fs, \
37         OpenWrt can only be built on a case-sensitive filesystem \
38 ))
39
40 define Require/working-gcc
41         echo 'int main(int argc, char **argv) { return 0; }' | \
42                 gcc -x c -o $(TMP_DIR)/a.out -
43 endef
44
45 $(eval $(call Require,working-gcc, \
46         Please install the GNU C Compiler (gcc). \
47 ))
48
49 define Require/working-g++
50         echo 'int main(int argc, char **argv) { return 0; }' | \
51                 g++ -x c++ -o $(TMP_DIR)/a.out -lstdc++ - && \
52                 $(TMP_DIR)/a.out
53 endef
54
55 $(eval $(call Require,working-g++, \
56         Please install the GNU C++ Compiler (g++). \
57 ))
58
59 define Require/ncurses
60         echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
61                 gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out -lncurses -
62 endef
63
64 $(eval $(call Require,ncurses, \
65         Please install ncurses. (Missing libncurses.so or ncurses.h) \
66 ))
67
68
69 define Require/zlib
70         echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
71                 gcc -include zlib.h -x c -o $(TMP_DIR)/a.out -lz -
72 endef
73
74 $(eval $(call Require,zlib, \
75         Please install zlib. (Missing libz.so or zlib.h) \
76 ))
77
78 $(eval $(call RequireCommand,gawk, \
79         Please install GNU awk. \
80 ))
81
82 $(eval $(call RequireCommand,bison, \
83         Please install GNU bison. \
84 ))
85
86 $(eval $(call RequireCommand,flex, \
87         Please install flex. \
88 ))
89
90 $(eval $(call RequireCommand,unzip, \
91         Please install unzip. \
92 ))
93
94 $(eval $(call RequireCommand,bzip2, \
95         Please install bzip2. \
96 ))
97
98 $(eval $(call RequireCommand,patch, \
99         Please install patch. \
100 ))
101
102 $(eval $(call RequireCommand,perl, \
103         Please install perl. \
104 ))
105
106 $(eval $(call RequireCommand,python, \
107         Please install python. \
108 ))
109
110 $(eval $(call RequireCommand,wget, \
111         Please install wget. \
112 ))
113
114 define Require/gnutar
115         $(TAR) --version 2>&1 | grep GNU > /dev/null
116 endef
117
118 $(eval $(call Require,gnutar, \
119         Please install GNU tar. \
120 ))
121
122 $(eval $(call RequireCommand,svn, \
123         Please install the subversion client. \
124 ))
125
126 $(eval $(call RequireCommand,autoconf, \
127         Please install GNU autoconf. \
128 ))
129
130 define Require/gnu-find
131         $(FIND) $(TMP_DIR) -lname foo
132 endef
133
134 $(eval $(call Require,gnu-find, \
135         Please install GNU find \
136 ))
137
138 define Require/getopt-extended
139         getopt --long - - >/dev/null
140 endef
141
142 $(eval $(call Require,getopt-extended, \
143         Please install an extended getopt version that supports --long \
144 ))