add prereq check for gnu find
[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 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,wget, \
107 Please install wget. \
108 ))
109
110 define Require/gnutar
111 $(TAR) --version 2>&1 | grep GNU > /dev/null
112 endef
113
114 $(eval $(call Require,gnutar, \
115 Please install GNU tar. \
116 ))
117
118 $(eval $(call RequireCommand,svn, \
119 Please install the subversion client. \
120 ))
121
122 $(eval $(call RequireCommand,autoconf, \
123 Please install GNU autoconf. \
124 ))
125
126 define Require/gnu-find
127 $(FIND) $(TMP_DIR) -lname foo
128 endef
129
130 $(eval $(call Require,gnu-find, \
131 Please install GNU find \
132 ))