2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/prereq.mk
10 include $(INCLUDE_DIR)/host.mk
12 PKG_NAME:=Build dependency
14 define Require/non-root
15 [ "$$(shell whoami)" != "root" ]
17 $(eval $(call Require,non-root, \
18 Please do not compile as root. \
21 # Required for the toolchain
22 define Require/working-make
23 echo 'all: test' > $(TMP_DIR)/check.mk
24 echo 'e0 = $$$$(foreach s,foobar,$$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk
25 echo 'e1 = $$$$(foreach s,foobar, $$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk
26 echo 'test: $$$$(strip $$$$(e0)) $$$$(strip $$$$(e1))' >> $(TMP_DIR)/check.mk
27 $(NO_TRACE_MAKE) -f $(TMP_DIR)/check.mk
30 $(eval $(call Require,working-make, \
31 Please install GNU make v3.81 or later. (This version has bugs) \
34 define Require/case-sensitive-fs
35 rm -f $(TMP_DIR)/test.*
36 touch $(TMP_DIR)/test.fs
37 [ \! -f $(TMP_DIR)/test.FS ]
40 $(eval $(call Require,case-sensitive-fs, \
41 OpenWrt can only be built on a case-sensitive filesystem \
44 define Require/working-gcc
45 echo 'int main(int argc, char **argv) { return 0; }' | \
46 gcc -x c -o $(TMP_DIR)/a.out -
49 $(eval $(call Require,working-gcc, \
50 Please install the GNU C Compiler (gcc). \
53 define Require/working-g++
54 echo 'int main(int argc, char **argv) { return 0; }' | \
55 g++ -x c++ -o $(TMP_DIR)/a.out -lstdc++ -
58 $(eval $(call Require,working-g++, \
59 Please install the GNU C++ Compiler (g++). \
62 define Require/ncurses
63 echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
64 gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out -lncurses -
67 $(eval $(call Require,ncurses, \
68 Please install ncurses. (Missing libncurses.so or ncurses.h) \
73 echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
74 gcc -include zlib.h -x c -o $(TMP_DIR)/a.out -lz -
77 $(eval $(call Require,zlib, \
78 Please install zlib. (Missing libz.so or zlib.h) \
81 $(eval $(call RequireCommand,gawk, \
82 Please install GNU awk. \
85 $(eval $(call RequireCommand,bison, \
86 Please install GNU bison. \
89 $(eval $(call RequireCommand,flex, \
90 Please install flex. \
93 $(eval $(call RequireCommand,unzip, \
94 Please install unzip. \
97 $(eval $(call RequireCommand,bzip2, \
98 Please install bzip2. \
101 $(eval $(call RequireCommand,patch, \
102 Please install patch. \
105 $(eval $(call RequireCommand,perl, \
106 Please install perl. \
109 $(eval $(call RequireCommand,wget, \
110 Please install wget. \
113 define Require/gnutar
114 $(TAR) --version 2>&1 | grep GNU > /dev/null
117 $(eval $(call Require,gnutar, \
118 Please install GNU tar. \
121 $(eval $(call RequireCommand,autoconf, \
122 Please install GNU autoconf. \