6 # Verify that grep works
7 echo "WORKS" | grep "WORKS" >/dev/null 2>&1
10 echo "grep doesn't work"
14 # Sanity check for CWD in LD_LIBRARY_PATH
15 case ":${LD_LIBRARY_PATH:-unset}:" in
18 echo "You seem to have the current working directory in your"
19 echo "LD_LIBRARY_PATH environment variable. This doesn't work."
24 # Sanity check for CWD in PATH. Having the current working directory
25 # in the PATH makes various packages (e.g. toolchain, coreutils...)
26 # build process break.
27 # PATH should not contain a newline, otherwise it fails in spectacular
28 # ways as soon as PATH is referenced in a package rule
29 # An empty PATH is technically possible, but in practice we would not
30 # even arrive here if that was the case.
31 case ":${PATH:-unset}:" in
34 echo "You seem to have the current working directory in your"
35 echo "PATH environment variable. This doesn't work."
40 # Break the '\n' sequence, or a \n is printed (which is not what we want).
41 printf "Your PATH contains a newline (%sn) character.\n" "\\"
42 printf "This doesn't work. Fix you PATH.\n"
47 if test -n "$PERL_MM_OPT" ; then
49 echo "You have PERL_MM_OPT defined because Perl local::lib"
50 echo "is installed on your system. Please unset this variable"
51 echo "before starting Buildroot, otherwise the compilation of"
52 echo "Perl related packages will fail"
59 if ! which $prog > /dev/null ; then
61 echo "You must install '$prog' on your build machine" >&2
66 # Verify that which is installed
67 check_prog_host "which"
68 # Verify that sed is installed
71 # 'file' must be present and must be exactly /usr/bin/file,
72 # otherwise libtool fails in incomprehensible ways.
73 check_prog_host "/usr/bin/file"
76 MAKE=$(which make 2> /dev/null)
77 if [ -z "$MAKE" ] ; then
79 echo "You must install 'make' on your build machine";
82 MAKE_VERSION=$($MAKE --version 2>&1 | sed -e 's/^.* \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
83 if [ -z "$MAKE_VERSION" ] ; then
85 echo "You must install 'make' on your build machine";
88 MAKE_MAJOR=$(echo $MAKE_VERSION | sed -e "s/\..*//g")
89 MAKE_MINOR=$(echo $MAKE_VERSION | sed -e "s/^$MAKE_MAJOR\.//g" -e "s/\..*//g" -e "s/[a-zA-Z].*//g")
90 if [ $MAKE_MAJOR -lt 3 ] || [ $MAKE_MAJOR -eq 3 -a $MAKE_MINOR -lt 81 ] ; then
92 echo "You have make '$MAKE_VERSION' installed. GNU make >=3.81 is required"
97 COMPILER=$(which $HOSTCC_NOCCACHE 2> /dev/null)
98 if [ -z "$COMPILER" ] ; then
99 COMPILER=$(which cc 2> /dev/null)
101 if [ -z "$COMPILER" ] ; then
103 echo "You must install 'gcc' on your build machine";
107 COMPILER_VERSION=$($COMPILER -v 2>&1 | sed -n '/^gcc version/p' |
108 sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
109 if [ -z "$COMPILER_VERSION" ] ; then
111 echo "You must install 'gcc' on your build machine";
114 COMPILER_MAJOR=$(echo $COMPILER_VERSION | sed -e "s/\..*//g")
115 COMPILER_MINOR=$(echo $COMPILER_VERSION | sed -e "s/^$COMPILER_MAJOR\.//g" -e "s/\..*//g")
116 if [ $COMPILER_MAJOR -lt 3 -o $COMPILER_MAJOR -eq 2 -a $COMPILER_MINOR -lt 95 ] ; then
118 echo "You have gcc '$COMPILER_VERSION' installed. gcc >= 2.95 is required"
123 CXXCOMPILER=$(which $HOSTCXX_NOCCACHE 2> /dev/null)
124 if [ -z "$CXXCOMPILER" ] ; then
125 CXXCOMPILER=$(which c++ 2> /dev/null)
128 if [ -z "$CXXCOMPILER" ] ; then
130 echo "You may have to install 'g++' on your build machine"
132 if [ ! -z "$CXXCOMPILER" ] ; then
133 CXXCOMPILER_VERSION=$($CXXCOMPILER -v 2>&1 | sed -n '/^gcc version/p' |
134 sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
135 if [ -z "$CXXCOMPILER_VERSION" ] ; then
137 echo "You may have to install 'g++' on your build machine"
141 if [ -n "$CXXCOMPILER_VERSION" ] ; then
142 CXXCOMPILER_MAJOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/\..*//g")
143 CXXCOMPILER_MINOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/^$CXXCOMPILER_MAJOR\.//g" -e "s/\..*//g")
144 if [ $CXXCOMPILER_MAJOR -lt 3 -o $CXXCOMPILER_MAJOR -eq 2 -a $CXXCOMPILER_MINOR -lt 95 ] ; then
146 echo "You have g++ '$CXXCOMPILER_VERSION' installed. g++ >= 2.95 is required"
152 # We only check bash is available, setting SHELL appropriately is done
153 # in the top-level Makefile, and we mimick the same sequence here
154 if [ -n "${BASH}" ]; then :
155 elif [ -x /bin/bash ]; then :
156 elif [ -z "$( sh -c 'echo $BASH' )" ]; then
158 echo "You must install 'bash' on your build machine"
162 # Check that a few mandatory programs are installed
164 for prog in patch perl tar wget cpio python unzip rsync bc ${DL_TOOLS} ; do
165 if ! which $prog > /dev/null ; then
166 echo "You must install '$prog' on your build machine";
168 if test $prog = "svn" ; then
169 echo " svn is usually part of the subversion package in your distribution"
170 elif test $prog = "hg" ; then
171 echo " hg is usually part of the mercurial package in your distribution"
172 elif test $prog = "zcat" ; then
173 echo " zcat is usually part of the gzip package in your distribution"
174 elif test $prog = "bzcat" ; then
175 echo " bzcat is usually part of the bzip2 package in your distribution"
180 if test "${missing_progs}" = "yes" ; then
184 if grep ^BR2_NEEDS_HOST_UTF8_LOCALE=y $BR2_CONFIG > /dev/null; then
185 if ! which locale > /dev/null ; then
187 echo "You need locale support on your build machine to build a toolchain supporting locales"
190 if ! locale -a | grep -q -i -E 'utf-?8$' ; then
192 echo "You need at least one UTF8 locale to build a toolchain supporting locales"
197 if grep -q ^BR2_NEEDS_HOST_JAVA=y $BR2_CONFIG ; then
198 check_prog_host "java"
199 JAVA_GCJ=$(java -version 2>&1 | grep gcj)
200 if [ ! -z "$JAVA_GCJ" ] ; then
202 echo "$JAVA_GCJ is not sufficient to compile your package selection."
203 echo "Please install an OpenJDK/IcedTea/Oracle Java."
208 if grep -q ^BR2_NEEDS_HOST_JAVAC=y $BR2_CONFIG ; then
209 check_prog_host "javac"
212 if grep -q ^BR2_NEEDS_HOST_JAR=y $BR2_CONFIG ; then
213 check_prog_host "jar"
216 if grep -q ^BR2_HOSTARCH_NEEDS_IA32_LIBS=y $BR2_CONFIG ; then
217 if test ! -f /lib/ld-linux.so.2 ; then
219 echo "Your Buildroot configuration uses pre-built tools for the x86 architecture,"
220 echo "but your build machine uses the x86-64 architecture without the 32 bits compatibility"
222 echo "If you're running a Debian/Ubuntu distribution, install the libc6-i386,"
223 echo "lib32stdc++6, and lib32z1 packages (or alternatively libc6:i386,"
224 echo "libstdc++6:i386, and zlib1g:i386)."
225 echo "For other distributions, refer to the documentation on how to install the 32 bits"
226 echo "compatibility libraries."
231 if grep -q ^BR2_HOSTARCH_NEEDS_IA32_COMPILER=y $BR2_CONFIG ; then
232 if ! echo "int main(void) {}" | gcc -m32 -x c - -o /dev/null 2>/dev/null; then
234 echo "Your Buildroot configuration needs a compiler capable of building 32 bits binaries."
235 echo "If you're running a Debian/Ubuntu distribution, install the gcc-multilib package."
236 echo "For other distributions, refer to their documentation."
240 if ! echo "int main(void) {}" | g++ -m32 -x c++ - -o /dev/null 2>/dev/null; then
242 echo "Your Buildroot configuration needs a compiler capable of building 32 bits binaries."
243 echo "If you're running a Debian/Ubuntu distribution, install the g++-multilib package."
244 echo "For other distributions, refer to their documentation."
249 # Check that the Perl installation is complete enough for Buildroot.
250 required_perl_modules="Data::Dumper" # Needed to build host-autoconf
251 required_perl_modules="$required_perl_modules ExtUtils::MakeMaker" # Used by host-libxml-parser-perl
252 required_perl_modules="$required_perl_modules Thread::Queue" # Used by host-automake
254 if grep -q ^BR2_PACKAGE_MPV=y $BR2_CONFIG ; then
255 required_perl_modules="$required_perl_modules Math::BigInt"
256 required_perl_modules="$required_perl_modules Math::BigRat"
259 # This variable will keep the modules that are missing in your system.
260 missing_perl_modules=""
262 for pm in $required_perl_modules ; do
263 if ! perl -e "require $pm" > /dev/null 2>&1 ; then
264 missing_perl_modules="$missing_perl_modules $pm"
268 if [ -n "$missing_perl_modules" ] ; then
269 echo "Your Perl installation is not complete enough; at least the following"
270 echo "modules are missing:"
272 for pm in $missing_perl_modules ; do
279 if ! python -c "import argparse" > /dev/null 2>&1 ; then
280 echo "Your Python installation is not complete enough: argparse module is missing"