1.1 --- a/scripts/crosstool-NG.sh.in Tue Nov 20 16:59:17 2012 -0800
1.2 +++ b/scripts/crosstool-NG.sh.in Sun Jan 06 12:08:33 2013 +0100
1.3 @@ -423,8 +423,7 @@
1.4 where=$(CT_Which "${tool}")
1.5 fi
1.6
1.7 - # Not all tools are available for all platforms, but some are really,
1.8 - # bally needed
1.9 + # Not all tools are available for all platforms, but some are required.
1.10 if [ -n "${where}" ]; then
1.11 CT_DoLog DEBUG " '${!v}-${tool}' -> '${where}'"
1.12 printf "#${BANG}${CT_CONFIG_SHELL}\nexec '${where}' \"\${@}\"\n" >"${CT_BUILDTOOLS_PREFIX_DIR}/bin/${!v}-${tool}"
1.13 @@ -476,19 +475,6 @@
1.14 *) ;;
1.15 esac
1.16
1.17 - # Now we know our host and where to find the host tools, we can check
1.18 - # if static link was requested, but only if it was requested
1.19 - if [ "${CT_WANTS_STATIC_LINK}" = "y" ]; then
1.20 - tmp="${CT_BUILD_DIR}/.static-test"
1.21 - if ! "${CT_HOST}-gcc" -xc - -static -o "${tmp}" >/dev/null 2>&1 <<-_EOF_
1.22 - int main() { return 0; }
1.23 - _EOF_
1.24 - then
1.25 - CT_Abort "Static linking impossible on the host system '${CT_HOST}'"
1.26 - fi
1.27 - rm -f "${tmp}"
1.28 - fi
1.29 -
1.30 # Help build gcc
1.31 # Explicitly optimise, else the lines below will overide the
1.32 # package's default optimisation flags
1.33 @@ -505,6 +491,8 @@
1.34 CT_CFLAGS_FOR_HOST+=" ${CT_EXTRA_CFLAGS_FOR_HOST}"
1.35 CT_LDFLAGS_FOR_HOST=
1.36 CT_LDFLAGS_FOR_HOST+=" ${CT_EXTRA_LDFLAGS_FOR_HOST}"
1.37 + CT_DoLog DEBUG "CFLAGS for host compiler: '${CT_CFLAGS_FOR_HOST}'"
1.38 + CT_DoLog DEBUG "LDFLAGS for host compiler: '${CT_LDFLAGS_FOR_HOST}'"
1.39
1.40 # Set the shell to be used by ./configure scripts and by Makefiles (those
1.41 # that support it!).
1.42 @@ -522,6 +510,39 @@
1.43 [ ${CT_PARALLEL_JOBS} -gt 0 ] && JOBSFLAGS="${JOBSFLAGS} -j${CT_PARALLEL_JOBS}"
1.44 [ ${CT_LOAD} -ne 0 ] && JOBSFLAGS="${JOBSFLAGS} -l${CT_LOAD}"
1.45
1.46 + # Now that we've set up $PATH and $CT_CFLAGS_FOR_HOST, sanity test that gcc
1.47 + # is runnable so that the user can troubleshoot problems if not.
1.48 + CT_DoStep DEBUG "Checking that we can run gcc -v"
1.49 + CT_DoExecLog DEBUG "${CT_HOST}-gcc" -v
1.50 + CT_EndStep
1.51 +
1.52 + # Create a simple C program for testing.
1.53 + testc="${CT_BUILD_DIR}/test.c"
1.54 + printf "int main() { return 0; }\n" >"${testc}"
1.55 + gccout="${CT_BUILD_DIR}/.gccout"
1.56 +
1.57 + CT_DoStep DEBUG "Checking that gcc can compile a trivial program"
1.58 + CT_DoExecLog DEBUG "${CT_HOST}-gcc" ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST} "${testc}" -o "${gccout}"
1.59 + rm -f "${gccout}"
1.60 + CT_EndStep
1.61 +
1.62 + if [ "${CT_WANTS_STATIC_LINK}" = "y" ]; then
1.63 + CT_DoStep DEBUG "Checking that gcc can compile a trivial statically linked program (CT_WANTS_STATIC_LINK)"
1.64 + CT_DoLog DEBUG "You may need to ensure that static libraries such as libc.a are installed on your system"
1.65 + CT_DoExecLog DEBUG "${CT_HOST}-gcc" ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST} "${testc}" -static -o "${gccout}"
1.66 + rm -f "${gccout}"
1.67 + CT_EndStep
1.68 + fi
1.69 +
1.70 + if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then
1.71 + CT_DoStep DEBUG "Checking that gcc can statically link libstdc++ (CT_CC_STATIC_LIBSTDCXX)"
1.72 + CT_DoLog DEBUG "You may need to ensure that libstdc++.a is installed on your system"
1.73 + CT_DoExecLog DEBUG "${CT_HOST}-gcc" ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST} "${testc}" -static -lstdc++ -o "${gccout}"
1.74 + rm -f "${gccout}"
1.75 + CT_EndStep
1.76 + fi
1.77 + rm -f "${testc}"
1.78 +
1.79 # We need to save the real .config with kconfig's value,
1.80 # not our mangled .config.2 with arrays.
1.81 CT_DoLog EXTRA "Installing user-supplied crosstool-NG configuration"