9 # Verify that grep works
10 echo "WORKS" | grep "WORKS" >/dev/null 2>&1
11 if test $? != 0 ; then
13 echo "grep doesn't work"
17 # Sanity check for CWD in LD_LIBRARY_PATH
18 case ":${LD_LIBRARY_PATH:-unset}:" in
21 echo "You seem to have the current working directory in your"
22 echo "LD_LIBRARY_PATH environment variable. This doesn't work."
27 # Sanity check for CWD in PATH. Having the current working directory
28 # in the PATH makes various packages (e.g. toolchain, coreutils...)
29 # build process break.
30 # PATH should not contain a newline, otherwise it fails in spectacular
31 # ways as soon as PATH is referenced in a package rule
32 # An empty PATH is technically possible, but in practice we would not
33 # even arrive here if that was the case.
34 case ":${PATH:-unset}:" in
37 echo "You seem to have the current working directory in your"
38 echo "PATH environment variable. This doesn't work."
41 (*" "*|*"${TAB}"*|*"${NL}"*)
43 printf "Your PATH contains spaces, TABs, and/or newline (\\\n) characters.\n"
44 printf "This doesn't work. Fix you PATH.\n"
49 if test -n "$PERL_MM_OPT" ; then
51 echo "You have PERL_MM_OPT defined because Perl local::lib"
52 echo "is installed on your system. Please unset this variable"
53 echo "before starting Buildroot, otherwise the compilation of"
54 echo "Perl related packages will fail"
61 if ! command -v $prog > /dev/null ; then
63 echo "You must install '$prog' on your build machine" >&2
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=$(command -v 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=$(command -v $HOSTCC_NOCCACHE 2> /dev/null)
98 if [ -z "$COMPILER" ] ; then
99 COMPILER=$(command -v 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 4 -o $COMPILER_MAJOR -eq 4 -a $COMPILER_MINOR -lt 8 ] ; then
118 echo "You have gcc '$COMPILER_VERSION' installed. gcc >= 4.8 is required"
123 CXXCOMPILER=$(command -v $HOSTCXX_NOCCACHE 2> /dev/null)
124 if [ -z "$CXXCOMPILER" ] ; then
125 CXXCOMPILER=$(command -v 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 4 -o $CXXCOMPILER_MAJOR -eq 4 -a $CXXCOMPILER_MINOR -lt 8 ] ; then
146 echo "You have g++ '$CXXCOMPILER_VERSION' installed. g++ >= 4.8 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 perl tar wget cpio unzip rsync bc ${DL_TOOLS} ; do
165 if ! command -v $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 PATCH_VERSION="$(patch -v 2>/dev/null | sed -n 's/^GNU patch \(.*\)/\1/p')"
185 if [ -z "${PATCH_VERSION}" ] ; then
187 echo "You must install GNU patch"
190 PATCH_MAJOR="$(echo "${PATCH_VERSION}" | cut -d . -f 1)"
191 PATCH_MINOR="$(echo "${PATCH_VERSION}" | cut -d . -f 2)"
192 if [ "${PATCH_MAJOR}" -lt 2 ] || [ "${PATCH_MAJOR}" -eq 2 -a "${PATCH_MINOR}" -lt 7 ] ; then
194 echo "You have GNU patch '${PATCH_VERSION}' installed. GNU patch >= 2.7 is required"
198 if grep ^BR2_NEEDS_HOST_UTF8_LOCALE=y $BR2_CONFIG > /dev/null; then
199 if ! command -v locale > /dev/null ; then
201 echo "You need locale support on your build machine to build a toolchain supporting locales"
204 if ! locale -a | grep -q -i -E 'utf-?8$' ; then
206 echo "You need at least one UTF8 locale to build a toolchain supporting locales"
211 if grep -q ^BR2_NEEDS_HOST_JAVA=y $BR2_CONFIG ; then
212 check_prog_host "java"
213 JAVA_GCJ=$(java -version 2>&1 | grep gcj)
214 if [ ! -z "$JAVA_GCJ" ] ; then
216 echo "$JAVA_GCJ is not sufficient to compile your package selection."
217 echo "Please install an OpenJDK/IcedTea/Oracle Java."
222 if grep -q ^BR2_HOSTARCH_NEEDS_IA32_LIBS=y $BR2_CONFIG ; then
223 if test ! -f /lib/ld-linux.so.2 ; then
225 echo "Your Buildroot configuration uses pre-built tools for the x86 architecture,"
226 echo "but your build machine uses the x86-64 architecture without the 32 bits compatibility"
228 echo "If you're running a Debian/Ubuntu distribution, install the libc6-i386,"
229 echo "lib32stdc++6, and lib32z1 packages (or alternatively libc6:i386,"
230 echo "libstdc++6:i386, and zlib1g:i386)."
231 echo "If you're running a RedHat/Fedora distribution, install the glibc.i686 and"
232 echo "zlib.i686 packages."
233 echo "If you're running an ArchLinux distribution, install lib32-glibc."
234 echo "For other distributions, refer to the documentation on how to install the 32 bits"
235 echo "compatibility libraries."
240 if grep -q ^BR2_HOSTARCH_NEEDS_IA32_COMPILER=y $BR2_CONFIG ; then
241 if ! echo "int main(void) {}" | gcc -m32 -x c - -o /dev/null 2>/dev/null; then
243 echo "Your Buildroot configuration needs a compiler capable of building 32 bits binaries."
244 echo "If you're running a Debian/Ubuntu distribution, install the gcc-multilib package."
245 echo "For other distributions, refer to their documentation."
249 if ! echo "int main(void) {}" | g++ -m32 -x c++ - -o /dev/null 2>/dev/null; then
251 echo "Your Buildroot configuration needs a compiler capable of building 32 bits binaries."
252 echo "If you're running a Debian/Ubuntu distribution, install the g++-multilib package."
253 echo "For other distributions, refer to their documentation."
258 if grep ^BR2_NEEDS_HOST_GCC_PLUGIN_SUPPORT=y $BR2_CONFIG ; then
259 if ! echo "#include <gcc-plugin.h>" | $HOSTCXX_NOCCACHE -I$($HOSTCXX_NOCCACHE -print-file-name=plugin)/include -x c++ -c - -o /dev/null ; then
261 echo "Your Buildroot configuration needs a host compiler capable of building gcc plugins."
262 echo "If you're running a Debian/Ubuntu distribution, install gcc-X-plugin-dev package."
263 echo "For other distributions, refer to their documentation."
268 # Check that the Perl installation is complete enough for Buildroot.
269 required_perl_modules="Data::Dumper" # Needed to build host-autoconf
270 required_perl_modules="$required_perl_modules ExtUtils::MakeMaker" # Used by host-libxml-parser-perl
271 required_perl_modules="$required_perl_modules Thread::Queue" # Used by host-automake
273 if grep -q ^BR2_PACKAGE_MPV=y $BR2_CONFIG ; then
274 required_perl_modules="$required_perl_modules Math::BigInt"
275 required_perl_modules="$required_perl_modules Math::BigRat"
278 if grep -q ^BR2_PACKAGE_WHOIS=y $BR2_CONFIG ; then
279 required_perl_modules="$required_perl_modules autodie"
282 if grep -q -E '^BR2_PACKAGE_(WEBKITGTK|WPEWEBKIT)=y' $BR2_CONFIG ; then
283 required_perl_modules="${required_perl_modules} JSON::PP"
286 # This variable will keep the modules that are missing in your system.
287 missing_perl_modules=""
289 for pm in $required_perl_modules ; do
290 if ! perl -e "require $pm" > /dev/null 2>&1 ; then
291 missing_perl_modules="$missing_perl_modules $pm"
295 if [ -n "$missing_perl_modules" ] ; then
296 echo "Your Perl installation is not complete enough; at least the following"
297 echo "modules are missing:"
299 for pm in $missing_perl_modules ; do