pass ARCH down to uClibc
[buildroot.git] / toolchain / dependencies / dependencies.sh
blob6b0df107c2bbc4a41bdd96ab2e2f2423aadd461f
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 "$CPP" ; then
30 echo "CPP clean: FALSE"
31 /bin/echo -e "\n\nYou must run 'unset CPP' so buildroot can run with";
32 /bin/echo -e "a clean environment on your build machine\n";
33 exit 1;
34 fi;
35 echo "CPP clean: Ok"
37 if test -n "$CXX" ; then
38 echo "CXX clean: FALSE"
39 /bin/echo -e "\n\nYou must run 'unset CXX' so buildroot can run with";
40 /bin/echo -e "a clean environment on your build machine\n";
41 exit 1;
42 fi;
43 echo "CXX clean: Ok"
45 if test -n "$GCJ" ; then
46 echo "GCJ clean: FALSE"
47 /bin/echo -e "\n\nYou must run 'unset GCJ' so buildroot can run with";
48 /bin/echo -e "a clean environment on your build machine\n";
49 exit 1;
50 fi;
51 echo "GCJ clean: Ok"
54 if test -n "$CFLAGS" ; then
55 echo "CFLAGS clean: FALSE"
56 /bin/echo -e "\n\nYou must run 'unset CFLAGS' so buildroot can run with";
57 /bin/echo -e "a clean environment on your build machine\n";
58 exit 1;
59 fi;
60 echo "CFLAGS clean: Ok"
62 if test -n "$INCLUDES" ; then
63 echo "INCLUDES clean: FALSE"
64 /bin/echo -e "WARNING: INCLUDES contains:\n\t'$INCLUDES'"
65 else
66 echo "INCLUDES clean: Ok"
69 if test -n "$CXXFLAGS" ; then
70 echo "CXXFLAGS clean: FALSE"
71 /bin/echo -e "\n\nYou must run 'unset CXXFLAGS' so buildroot can run with";
72 /bin/echo -e "a clean environment on your build machine\n";
73 exit 1;
74 fi;
75 echo "CXXFLAGS clean: Ok"
77 if test -n "$GREP_OPTIONS" ; then
78 echo "GREP_OPTIONS clean: FALSE"
79 /bin/echo -e "\n\nYou must run 'unset GREP_OPTIONS' 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 "$CROSS_COMPILE" ; then
85 echo "CROSS_COMPILE clean: FALSE"
86 /bin/echo -e "\n\nYou must run 'unset CROSS_COMPILE' so buildroot can run with";
87 /bin/echo -e "a clean environment on your build machine\n";
88 exit 1;
89 fi;
91 if test -n "$ARCH" ; then
92 echo "ARCH clean: FALSE"
93 /bin/echo -e "\n\nYou must run 'unset ARCH' so buildroot can run with";
94 /bin/echo -e "a clean environment on your build machine\n";
95 exit 1;
96 fi;
99 echo "WORKS" | grep "WORKS" >/dev/null 2>&1
100 if test $? != 0 ; then
101 echo "grep works: FALSE"
102 exit 1
105 # sanity check for CWD in LD_LIBRARY_PATH
106 # try not to rely on egrep..
107 if test -n "$LD_LIBRARY_PATH" ; then
108 /bin/echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | /bin/grep ':.:' >/dev/null 2>&1 ||
109 /bin/echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | /bin/grep 'TRiGGER_start:' >/dev/null 2>&1 ||
110 /bin/echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | /bin/grep ':TRiGGER_end' >/dev/null 2>&1 ||
111 /bin/echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | /bin/grep '::' >/dev/null 2>&1
112 if test $? = 0; then
113 echo "LD_LIBRARY_PATH sane: FALSE"
114 echo "You seem to have the current working directory in your"
115 echo "LD_LIBRARY_PATH environment variable. This doesn't work."
116 exit 1;
117 else
118 echo "LD_LIBRARY_PATH sane: Ok"
124 #############################################################
126 # check build system 'which'
128 #############################################################
129 if ! which which > /dev/null ; then
130 echo "which installed: FALSE"
131 /bin/echo -e "\n\nYou must install 'which' on your build machine\n";
132 exit 1;
134 echo "which installed: Ok"
138 #############################################################
140 # check build system 'sed'
142 #############################################################
143 SED=$(toolchain/dependencies/check-host-sed.sh)
145 if [ -z "$SED" ] ; then
146 XSED=$HOST_SED_DIR/bin/sed
147 echo "sed works: No, using buildroot version instead"
148 else
149 XSED=$SED
150 echo "sed works: Ok ($SED)"
156 #############################################################
158 # check build system 'make'
160 #############################################################
161 MAKE=$(which make 2> /dev/null)
162 if [ -z "$MAKE" ] ; then
163 echo "make installed: FALSE"
164 /bin/echo -e "\n\nYou must install 'make' on your build machine\n";
165 exit 1;
167 MAKE_VERSION=$($MAKE --version 2>&1 | $XSED -e 's/^.* \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
168 if [ -z "$MAKE_VERSION" ] ; then
169 echo "make installed: FALSE"
170 /bin/echo -e "\n\nYou must install 'make' on your build machine\n";
171 exit 1;
173 MAKE_MAJOR=$(echo $MAKE_VERSION | $XSED -e "s/\..*//g")
174 MAKE_MINOR=$(echo $MAKE_VERSION | $XSED -e "s/^$MAKE_MAJOR\.//g" -e "s/\..*//g" -e "s/[a-zA-Z].*//g")
175 if [ $MAKE_MAJOR -lt 3 ] || [ $MAKE_MAJOR -eq 3 -a $MAKE_MINOR -lt 80 ] ; then
176 echo "You have make '$MAKE_VERSION' installed. GNU make >=3.80 is required"
177 exit 1;
179 echo "GNU make version '$MAKE_VERSION': Ok"
183 #############################################################
185 # check build system 'gcc'
187 #############################################################
188 COMPILER=$(which $HOSTCC 2> /dev/null)
189 if [ -z "$COMPILER" ] ; then
190 COMPILER=$(which cc 2> /dev/null)
192 if [ -z "$COMPILER" ] ; then
193 echo "C Compiler installed: FALSE"
194 /bin/echo -e "\n\nYou must install 'gcc' on your build machine\n";
195 exit 1;
199 COMPILER_VERSION=$($COMPILER --version 2>&1 | $XSED -e 's/^.*(.CC) \([0-9\.]\).*/\1/g' -e "s/[-\ ].*//g" -e '1q')
200 if [ -z "$COMPILER_VERSION" ] ; then
201 echo "gcc installed: FALSE"
202 /bin/echo -e "\n\nYou must install 'gcc' on your build machine\n";
203 exit 1;
206 if /bin/false; then
207 # ignore the version for now
208 COMPILER_MAJOR=$(echo $COMPILER_VERSION | $XSED -e "s/\..*//g")
209 COMPILER_MINOR=$(echo $COMPILER_VERSION | $XSED -e "s/^$COMPILER_MAJOR\.//g" -e "s/\..*//g")
210 if [ $COMPILER_MAJOR -lt 3 -o $COMPILER_MAJOR -eq 2 -a $COMPILER_MINOR -lt 95 ] ; then
211 echo "You have gcc '$COMPILER_VERSION' installed. gcc >= 2.95 is required"
212 exit 1;
215 echo "C compiler '$COMPILER'"
216 #echo "C compiler version '$COMPILER_VERSION': Ok"
219 # check for host CXX
220 CXXCOMPILER=$(which $HOSTCXX 2> /dev/null)
221 if [ -z "$CXXCOMPILER" ] ; then
222 CXXCOMPILER=$(which c++ 2> /dev/null)
224 if [ -z "$CXXCOMPILER" ] ; then
225 echo "C++ Compiler installed: FALSE"
226 /bin/echo -e "\nYou may have to install 'g++' on your build machine\n"
227 #exit 1
229 if [ ! -z "$CXXCOMPILER" ] ; then
230 CXXCOMPILER_VERSION=$($CXXCOMPILER --version 2>&1 | $XSED -e 's/^.*(.CC) \([0-9\.]\)/\1/g' -e "s/[-\ ].*//g" -e '1q')
231 if [ -z "$CXXCOMPILER_VERSION" ] ; then
232 echo "c++ installed: FALSE"
233 /bin/echo -e "\nYou may have to install 'g++' on your build machine\n"
234 #exit 1
237 if /bin/false; then
238 # ignore the version for now
239 CXXCOMPILER_MAJOR=$(echo $CXXCOMPILER_VERSION | $XSED -e "s/\..*//g")
240 CXXCOMPILER_MINOR=$(echo $CXXCOMPILER_VERSION | $XSED -e "s/^$CXXCOMPILER_MAJOR\.//g" -e "s/\..*//g")
241 if [ $CXXCOMPILER_MAJOR -lt 3 -o $CXXCOMPILER_MAJOR -eq 2 -a $CXXCOMPILER_MINOR -lt 95 ] ; then
242 echo "You have g++ '$CXXCOMPILER_VERSION' installed. g++ >= 2.95 is required"
243 exit 1
246 echo "C++ compiler '$CXXCOMPILER'"
247 # echo "C++ compiler version '$CXXCOMPILER_VERSION': Ok"
250 #############################################################
252 # check build system 'bison'
254 #############################################################
255 if ! which bison > /dev/null ; then
256 echo "bison installed: FALSE"
257 /bin/echo -e "\n\nYou must install 'bison' on your build machine\n";
258 exit 1;
260 echo "bison installed: Ok"
263 #############################################################
265 # check build system 'flex'
267 #############################################################
268 if ! which flex > /dev/null ; then
269 echo "flex installed: FALSE"
270 /bin/echo -e "\n\nYou must install 'flex' on your build machine\n";
271 exit 1;
273 echo "flex installed: Ok"
275 #############################################################
277 # check build system 'nasm'
279 #############################################################
280 if [ "x$NEED_NASM" = "xy" ]
281 then
282 NASM=$(toolchain/dependencies/check-host-nasm.sh)
284 if [ -z "$NASM" ] ; then
285 echo "nasm works: No, using buildroot version instead"
286 else
287 echo "nasm works: Ok ($NASM)"
291 #############################################################
293 # check build system 'gettext'
295 #############################################################
296 if ! which msgfmt > /dev/null ; then \
297 echo "gettext installed: FALSE"
298 /bin/echo -e "\n\nYou must install 'gettext' on your build machine\n"; \
299 exit 1; \
301 echo "gettext installed: Ok"
304 if ! which makeinfo > /dev/null ; then \
305 echo "makeinfo installed: FALSE"
306 /bin/echo -e "\n\nMost likely some packages will fail to build their documentation"
307 echo "Either install 'makeinfo' on your host or fix the respective packages."
308 echo "Makeinfo can usually be found in the texinfo package for your host."
309 else
310 echo "makeinfo installed: Ok"
313 #############################################################
315 # check build system 'ruby' interpreter
317 #############################################################
319 if [ "x$NEED_RUBY" = "xy" ]
320 then
321 RUBY=$(which ruby 2> /dev/null)
322 if [ -z "$RUBY" ] ; then
323 echo "ruby installed: FALSE"
324 /bin/echo -e "\n\nYou must install 'ruby' on your build machine\n"
325 exit 1
329 #############################################################
331 # check build system java compiler to build ecj
333 #############################################################
335 if [ "x$NEED_GCJ_FOR_ECJX" != "x" ]
336 then
337 SOME_GCJ_FOR_ECJX=$(which $GCJ_FOR_ECJX 2> /dev/null)
338 if [ -z "$SOME_GCJ_FOR_ECJX" ] ; then
339 echo "gcj for ecj installed: FALSE"
340 /bin/echo -e "\n\nYou must install a java compiler on your build machine\n"
341 exit 1
346 #############################################################
348 # check build system 'help2man'
350 #############################################################
351 if ! which help2man > /dev/null ; then
352 echo "help2man installed: FALSE"
353 /bin/echo -e "\n\nYou should install 'help2man' on your build machine\n";
354 /bin/echo "Creating dummy 'help2man' script since missing doesn't work for me"
355 cat > "$HOST_SED_DIR"/bin/help2man <<EOF
356 #!/bin/sh
357 test \$# -gt 0 &&
358 case \$1 in
359 -version*) ;;
360 *) echo '.ab help2man is required to generate this page' >> \$1 ;;
361 esac
362 exit 0
364 chmod +x "$HOST_SED_DIR"/bin/help2man
365 #exit 1;
366 else
367 echo "help2man installed: Ok"
370 #############################################################
372 # All done
374 #############################################################
375 echo "Build system dependencies: Ok"
376 echo ""