improve endian setting
[buildroot.git] / toolchain / dependencies / dependencies.sh
blob3d945379a8b3c04ecc695c2adf04dddee34ebc8c
1 #!/bin/sh
2 # vi: set sw=4 ts=4:
3 #set -x
5 echo ""
6 echo "Checking build system dependencies:"
7 export LC_ALL=C
9 #############################################################
11 # check build system 'environment'
13 #############################################################
14 if test -n "$BUILDROOT_DL_DIR" ; then
15 /bin/echo -e "Overriding \$(DL_DIR) in '.config'. Ok"
16 /bin/echo -e "External download directory: Ok ($BUILDROOT_DL_DIR)"
17 else
18 echo "BUILDROOT_DL_DIR clean: Ok"
21 if test -n "$CC" ; then
22 echo "CC clean: FALSE"
23 /bin/echo -e "\n\nYou must run 'unset CC' so buildroot can run with";
24 /bin/echo -e "a clean environment on your build machine\n";
25 exit 1;
26 fi;
27 echo "CC clean: Ok"
29 if test -n "$CXX" ; then
30 echo "CXX clean: FALSE"
31 /bin/echo -e "\n\nYou must run 'unset CXX' so buildroot can run with";
32 /bin/echo -e "a clean environment on your build machine\n";
33 exit 1;
34 fi;
35 echo "CXX clean: Ok"
38 if test -n "$CPP" ; then
39 echo "CPP clean: FALSE"
40 /bin/echo -e "\n\nYou must run 'unset CPP' so buildroot can run with";
41 /bin/echo -e "a clean environment on your build machine\n";
42 exit 1;
43 fi;
44 echo "CPP clean: Ok"
47 if test -n "$CFLAGS" ; then
48 echo "CFLAGS clean: FALSE"
49 /bin/echo -e "\n\nYou must run 'unset CFLAGS' so buildroot can run with";
50 /bin/echo -e "a clean environment on your build machine\n";
51 exit 1;
52 fi;
53 echo "CFLAGS clean: Ok"
55 if test -n "$INCLUDES" ; then
56 echo "INCLUDES clean: FALSE"
57 /bin/echo -e "WARNING: INCLUDES contains:\n\t'$INCLUDES'"
58 else
59 echo "INCLUDES clean: Ok"
62 if test -n "$CXXFLAGS" ; then
63 echo "CXXFLAGS clean: FALSE"
64 /bin/echo -e "\n\nYou must run 'unset CXXFLAGS' so buildroot can run with";
65 /bin/echo -e "a clean environment on your build machine\n";
66 exit 1;
67 fi;
68 echo "CXXFLAGS clean: Ok"
70 if test -n "$GREP_OPTIONS" ; then
71 echo "GREP_OPTIONS clean: FALSE"
72 /bin/echo -e "\n\nYou must run 'unset GREP_OPTIONS' so buildroot can run with";
73 /bin/echo -e "a clean environment on your build machine\n";
74 exit 1;
75 fi;
77 if test -n "$CROSS_COMPILE" ; then
78 echo "CROSS_COMPILE clean: FALSE"
79 /bin/echo -e "\n\nYou must run 'unset CROSS_COMPILE' so buildroot can run with";
80 /bin/echo -e "a clean environment on your build machine\n";
81 exit 1;
82 fi;
84 if test -n "$ARCH" ; then
85 echo "ARCH clean: FALSE"
86 /bin/echo -e "\n\nYou must run 'unset ARCH' so buildroot can run with";
87 /bin/echo -e "a clean environment on your build machine\n";
88 exit 1;
89 fi;
92 echo "WORKS" | grep "WORKS" >/dev/null 2>&1
93 if test $? != 0 ; then
94 echo "grep works: FALSE"
95 exit 1
98 # sanity check for CWD in LD_LIBRARY_PATH
99 # try not to rely on egrep..
100 if test -n "$LD_LIBRARY_PATH" ; then
101 /bin/echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | /bin/grep ':.:' >/dev/null 2>&1 ||
102 /bin/echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | /bin/grep 'TRiGGER_start:' >/dev/null 2>&1 ||
103 /bin/echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | /bin/grep ':TRiGGER_end' >/dev/null 2>&1 ||
104 /bin/echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | /bin/grep '::' >/dev/null 2>&1
105 if test $? = 0; then
106 echo "LD_LIBRARY_PATH sane: FALSE"
107 echo "You seem to have the current working directory in your"
108 echo "LD_LIBRARY_PATH environment variable. This doesn't work."
109 exit 1;
110 else
111 echo "LD_LIBRARY_PATH sane: Ok"
117 #############################################################
119 # check build system 'which'
121 #############################################################
122 if ! which which > /dev/null ; then
123 echo "which installed: FALSE"
124 /bin/echo -e "\n\nYou must install 'which' on your build machine\n";
125 exit 1;
127 echo "which installed: Ok"
131 #############################################################
133 # check build system 'sed'
135 #############################################################
136 SED=$(toolchain/dependencies/check-host-sed.sh)
138 if [ -z "$SED" ] ; then
139 XSED=$HOST_SED_DIR/bin/sed
140 echo "sed works: No, using buildroot version instead"
141 else
142 XSED=$SED
143 echo "sed works: Ok ($SED)"
149 #############################################################
151 # check build system 'make'
153 #############################################################
154 MAKE=$(which make 2> /dev/null)
155 if [ -z "$MAKE" ] ; then
156 echo "make installed: FALSE"
157 /bin/echo -e "\n\nYou must install 'make' on your build machine\n";
158 exit 1;
160 MAKE_VERSION=$($MAKE --version 2>&1 | $XSED -e 's/^.* \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
161 if [ -z "$MAKE_VERSION" ] ; then
162 echo "make installed: FALSE"
163 /bin/echo -e "\n\nYou must install 'make' on your build machine\n";
164 exit 1;
166 MAKE_MAJOR=$(echo $MAKE_VERSION | $XSED -e "s/\..*//g")
167 MAKE_MINOR=$(echo $MAKE_VERSION | $XSED -e "s/^$MAKE_MAJOR\.//g" -e "s/\..*//g" -e "s/[a-zA-Z].*//g")
168 if [ $MAKE_MAJOR -lt 3 ] || [ $MAKE_MAJOR -eq 3 -a $MAKE_MINOR -lt 80 ] ; then
169 echo "You have make '$MAKE_VERSION' installed. GNU make >=3.80 is required"
170 exit 1;
172 echo "GNU make version '$MAKE_VERSION': Ok"
176 #############################################################
178 # check build system 'gcc'
180 #############################################################
181 COMPILER=$(which $HOSTCC 2> /dev/null)
182 if [ -z "$COMPILER" ] ; then
183 COMPILER=$(which cc 2> /dev/null)
185 if [ -z "$COMPILER" ] ; then
186 echo "C Compiler installed: FALSE"
187 /bin/echo -e "\n\nYou must install 'gcc' on your build machine\n";
188 exit 1;
192 COMPILER_VERSION=$($COMPILER --version 2>&1 | $XSED -e 's/^.*(.CC) \([0-9\.]\).*/\1/g' -e "s/[-\ ].*//g" -e '1q')
193 if [ -z "$COMPILER_VERSION" ] ; then
194 echo "gcc installed: FALSE"
195 /bin/echo -e "\n\nYou must install 'gcc' on your build machine\n";
196 exit 1;
199 if /bin/false; then
200 # ignore the version for now
201 COMPILER_MAJOR=$(echo $COMPILER_VERSION | $XSED -e "s/\..*//g")
202 COMPILER_MINOR=$(echo $COMPILER_VERSION | $XSED -e "s/^$COMPILER_MAJOR\.//g" -e "s/\..*//g")
203 if [ $COMPILER_MAJOR -lt 3 -o $COMPILER_MAJOR -eq 2 -a $COMPILER_MINOR -lt 95 ] ; then
204 echo "You have gcc '$COMPILER_VERSION' installed. gcc >= 2.95 is required"
205 exit 1;
208 echo "C compiler '$COMPILER'"
209 #echo "C compiler version '$COMPILER_VERSION': Ok"
212 # check for host CXX
213 CXXCOMPILER=$(which $HOSTCXX 2> /dev/null)
214 if [ -z "$CXXCOMPILER" ] ; then
215 CXXCOMPILER=$(which c++ 2> /dev/null)
217 if [ -z "$CXXCOMPILER" ] ; then
218 echo "C++ Compiler installed: FALSE"
219 /bin/echo -e "\nYou may have to install 'g++' on your build machine\n"
220 #exit 1
222 if [ ! -z "$CXXCOMPILER" ] ; then
223 CXXCOMPILER_VERSION=$($CXXCOMPILER --version 2>&1 | $XSED -e 's/^.*(.CC) \([0-9\.]\)/\1/g' -e "s/[-\ ].*//g" -e '1q')
224 if [ -z "$CXXCOMPILER_VERSION" ] ; then
225 echo "c++ installed: FALSE"
226 /bin/echo -e "\nYou may have to install 'g++' on your build machine\n"
227 #exit 1
230 if /bin/false; then
231 # ignore the version for now
232 CXXCOMPILER_MAJOR=$(echo $CXXCOMPILER_VERSION | $XSED -e "s/\..*//g")
233 CXXCOMPILER_MINOR=$(echo $CXXCOMPILER_VERSION | $XSED -e "s/^$CXXCOMPILER_MAJOR\.//g" -e "s/\..*//g")
234 if [ $CXXCOMPILER_MAJOR -lt 3 -o $CXXCOMPILER_MAJOR -eq 2 -a $CXXCOMPILER_MINOR -lt 95 ] ; then
235 echo "You have g++ '$CXXCOMPILER_VERSION' installed. g++ >= 2.95 is required"
236 exit 1
239 echo "C++ compiler '$CXXCOMPILER'"
240 # echo "C++ compiler version '$CXXCOMPILER_VERSION': Ok"
243 #############################################################
245 # check build system 'bison'
247 #############################################################
248 if ! which bison > /dev/null ; then
249 echo "bison installed: FALSE"
250 /bin/echo -e "\n\nYou must install 'bison' on your build machine\n";
251 exit 1;
253 echo "bison installed: Ok"
256 #############################################################
258 # check build system 'flex'
260 #############################################################
261 if ! which flex > /dev/null ; then
262 echo "flex installed: FALSE"
263 /bin/echo -e "\n\nYou must install 'flex' on your build machine\n";
264 exit 1;
266 echo "flex installed: Ok"
269 #############################################################
271 # check build system 'gettext'
273 #############################################################
274 if ! which msgfmt > /dev/null ; then \
275 echo "gettext installed: FALSE"
276 /bin/echo -e "\n\nYou must install 'gettext' on your build machine\n"; \
277 exit 1; \
279 echo "gettext installed: Ok"
282 if ! which makeinfo > /dev/null ; then \
283 echo "makeinfo installed: FALSE"
284 /bin/echo -e "\n\nMost likely some packages will fail to build their documentation"
285 echo "Either install 'makeinfo' on your host or fix the respective packages."
286 echo "Makeinfo can usually be found in the texinfo package for your host."
287 else
288 echo "makeinfo installed: Ok"
291 #############################################################
293 # check build system 'ruby' interpreter
295 #############################################################
297 if [ "x$NEED_RUBY" = "xy" ]
298 then
299 RUBY=$(which ruby 2> /dev/null)
300 if [ -z "$RUBY" ] ; then
301 echo "ruby installed: FALSE"
302 /bin/echo -e "\n\nYou must install 'ruby' on your build machine\n"
303 exit 1
307 #############################################################
309 # check build system 'help2man'
311 #############################################################
312 if ! which help2man > /dev/null ; then
313 echo "help2man installed: FALSE"
314 /bin/echo -e "\n\nYou should install 'help2man' on your build machine\n";
315 /bin/echo "Creating dummy 'help2man' script since missing doesn't work for me"
316 cat > "$HOST_SED_DIR"/bin/help2man <<EOF
317 #!/bin/sh
318 test \$# -gt 0 &&
319 case \$1 in
320 -version*) ;;
321 *) echo '.ab help2man is required to generate this page' >> \$1 ;;
322 esac
323 exit 0
325 chmod +x "$HOST_SED_DIR"/bin/help2man
326 #exit 1;
327 else
328 echo "help2man installed: Ok"
331 #############################################################
333 # All done
335 #############################################################
336 echo "Build system dependencies: Ok"
337 echo ""