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 $(MAKE) -v | awk '($$$$1 == "GNU") && ($$$$2 = "Make") && ($$$$3 >= "3.81") { print "ok" }' | grep ok > /dev/null
26 $(eval $(call Require,working-make, \
27 Please install GNU make v3.81 or later. (This version has bugs) \
30 define Require/case-sensitive-fs
31 rm -f $(TMP_DIR)/test.*
32 touch $(TMP_DIR)/test.fs
33 [ \! -f $(TMP_DIR)/test.FS ]
36 $(eval $(call Require,case-sensitive-fs, \
37 OpenWrt can only be built on a case-sensitive filesystem \
40 define Require/working-gcc
41 echo 'int main(int argc, char **argv) { return 0; }' | \
42 gcc -x c -o $(TMP_DIR)/a.out -
45 $(eval $(call Require,working-gcc, \
46 Please install the GNU C Compiler (gcc). \
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++ - && \
55 $(eval $(call Require,working-g++, \
56 Please install the GNU C++ Compiler (g++). \
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 -
64 $(eval $(call Require,ncurses, \
65 Please install ncurses. (Missing libncurses.so or ncurses.h) \
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 -
74 $(eval $(call Require,zlib, \
75 Please install zlib. (Missing libz.so or zlib.h) \
78 $(eval $(call RequireCommand,gawk, \
79 Please install GNU awk. \
82 $(eval $(call RequireCommand,bison, \
83 Please install GNU bison. \
86 $(eval $(call RequireCommand,flex, \
87 Please install flex. \
90 $(eval $(call RequireCommand,unzip, \
91 Please install unzip. \
94 $(eval $(call RequireCommand,bzip2, \
95 Please install bzip2. \
98 $(eval $(call RequireCommand,patch, \
99 Please install patch. \
102 $(eval $(call RequireCommand,perl, \
103 Please install perl. \
106 $(eval $(call RequireCommand,wget, \
107 Please install wget. \
110 define Require/gnutar
111 $(TAR) --version 2>&1 | grep GNU > /dev/null
114 $(eval $(call Require,gnutar, \
115 Please install GNU tar. \
118 $(eval $(call RequireCommand,svn, \
119 Please install the subversion client. \
122 $(eval $(call RequireCommand,autoconf, \
123 Please install GNU autoconf. \
126 define Require/gnu-find
127 $(FIND) $(TMP_DIR) -lname foo
130 $(eval $(call Require,gnu-find, \
131 Please install GNU find \