1.1 --- a/config/cc/gcc.in.2 Sun Oct 16 13:26:26 2011 +0200
1.2 +++ b/config/cc/gcc.in.2 Fri Oct 14 22:44:24 2011 +0200
1.3 @@ -44,9 +44,8 @@
1.4 bool
1.5 prompt "Link libstdc++ statically into the gcc binary"
1.6 default y
1.7 - depends on CONFIGURE_static_link_ok
1.8 - depends on CONFIGURE_has_static_libstdcxx
1.9 depends on CC_GCC_4_4_or_later
1.10 + select WANTS_STATIC_LINK
1.11 help
1.12 Newer gcc versions use the PPL library which is C++ code. Statically
1.13 linking libstdc++ increases the likeliness that the gcc binary will
2.1 --- a/config/debug/gdb.in.cross Sun Oct 16 13:26:26 2011 +0200
2.2 +++ b/config/debug/gdb.in.cross Fri Oct 14 22:44:24 2011 +0200
2.3 @@ -3,18 +3,10 @@
2.4 config STATIC_TOOLCHAIN
2.5 select GDB_CROSS_STATIC if GDB_CROSS
2.6
2.7 -comment "Cross-gdb - disabled (requires expat; re-run ./configure to enable)"
2.8 - depends on !CONFIGURE_has_expat
2.9 -
2.10 -comment "Static cross-gdb - disabled (requires static expat; re-run ./configure to enable)"
2.11 - depends on STATIC_TOOLCHAIN && !CONFIGURE_has_static_expat
2.12 -
2.13 config GDB_CROSS
2.14 bool
2.15 prompt "Cross-gdb"
2.16 default y
2.17 - depends on CONFIGURE_has_expat
2.18 - depends on !STATIC_TOOLCHAIN || CONFIGURE_has_static_expat
2.19 select GDB_GDBSERVER if ! BARE_METAL
2.20 help
2.21 Build and install a cross-gdb for the target, to run on host.
2.22 @@ -24,8 +16,7 @@
2.23 config GDB_CROSS_STATIC
2.24 bool
2.25 prompt "Build a static cross gdb"
2.26 - depends on CONFIGURE_static_link_ok
2.27 - depends on CONFIGURE_has_static_expat
2.28 + select WANTS_STATIC_LINK
2.29 help
2.30 A static cross gdb can be usefull if you debug on a machine that is
2.31 not the one that is used to compile the toolchain.
2.32 @@ -36,7 +27,6 @@
2.33 config GDB_CROSS_PYTHON
2.34 bool
2.35 prompt "Enable python scripting"
2.36 - depends on CONFIGURE_has_python
2.37 depends on ! GDB_CROSS_STATIC
2.38 default y
2.39 help
3.1 --- a/config/debug/gdb.in.native Sun Oct 16 13:26:26 2011 +0200
3.2 +++ b/config/debug/gdb.in.native Fri Oct 14 22:44:24 2011 +0200
3.3 @@ -10,13 +10,9 @@
3.4
3.5 if GDB_NATIVE
3.6
3.7 -config GDB_NATIVE_NO_STATIC
3.8 - bool
3.9 -
3.10 config GDB_NATIVE_STATIC
3.11 bool
3.12 prompt "Build a static native gdb"
3.13 - depends on ! GDB_NATIVE_NO_STATIC
3.14 help
3.15 In case you have trouble with dynamic loading of shared libraries,
3.16 you will find that a static gdb comes in handy.
4.1 --- a/config/toolchain.in Sun Oct 16 13:26:26 2011 +0200
4.2 +++ b/config/toolchain.in Fri Oct 14 22:44:24 2011 +0200
4.3 @@ -46,20 +46,14 @@
4.4 In fact, the sysroot path is constructed as:
4.5 ${CT_PREFIX_DIR}/${CT_TARGET}/${CT_SYSROOT_DIR_PREFIX}/${CT_SYSROOT_NAME}
4.6
4.7 -# In case we need to add more conditions to enable static
4.8 -# toolchain, we'll be adding them here
4.9 -config STATIC_TOOLCHAIN_POSSIBLE
4.10 +config WANTS_STATIC_LINK
4.11 bool
4.12 - default y
4.13 - depends on CONFIGURE_static_link_ok
4.14 - depends on CONFIGURE_has_static_libstdcxx
4.15 - # Add new deps here! :-)
4.16
4.17 config STATIC_TOOLCHAIN
4.18 bool
4.19 prompt "Build Static Toolchain (EXPERIMENTAL)"
4.20 depends on EXPERIMENTAL
4.21 - depends on STATIC_TOOLCHAIN_POSSIBLE
4.22 + select WANTS_STATIC_LINK
4.23 help
4.24 Build static host binaries.
4.25
4.26 @@ -68,8 +62,9 @@
4.27 you can say 'Y' here, and all the host tools will be linked statically.
4.28
4.29 The impacted tools are:
4.30 - - the GNU binutils
4.31 - - the cross-gdb
4.32 + - the cross-binutils (GNU binutils, elf2flt)
4.33 + - the cross-compiler (gcc)
4.34 + - the cross-debugger (gdb)
4.35
4.36 The default is 'N', to build dynamicaly-linked host binaries.
4.37
5.1 --- a/configure Sun Oct 16 13:26:26 2011 +0200
5.2 +++ b/configure Fri Oct 14 22:44:24 2011 +0200
5.3 @@ -534,36 +534,8 @@
5.4 ;;
5.5 esac
5.6
5.7 -printf "Checking if static linking is possible... "
5.8 -static_link_ok=""
5.9 -case "${host}" in
5.10 - Darwin) ;;
5.11 - *) tmp=.static.tmp
5.12 - if gcc -xc - -static -o "${tmp}" >/dev/null 2>&1 <<-_EOF_
5.13 - int main() { return 0; }
5.14 - _EOF_
5.15 - then
5.16 - static_link_ok="y"
5.17 - fi
5.18 - rm -f "${tmp}"
5.19 - ;;
5.20 -esac
5.21 -if [ "${static_link_ok}" = "y" ]; then
5.22 - static_link_ko=""
5.23 - printf "yes\n"
5.24 -else
5.25 - static_link_ko="y"
5.26 - printf "no\n"
5.27 - printf " * An optional host feature is missing, some features will be disabled:\n"
5.28 - printf " * - It will not be possible to statically link toolchain's binaries\n"
5.29 -fi
5.30 -add_to_kconfig_list static_link_ok
5.31 -
5.32 # Library checks
5.33 -libs_exts="so dylib"
5.34 -if [ "${static_link_ok}" = "y" ]; then
5.35 - libs_exts="${libs_exts} a"
5.36 -fi
5.37 +libs_exts="so dylib a"
5.38
5.39 ncurses_hdrs="ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h"
5.40 ncurses_libs="libncursesw libncurses libcurses"
5.41 @@ -572,46 +544,6 @@
5.42 inc="${ncurses_hdrs}" \
5.43 err="The 'ncurses' library is needed fo the menuconfig frontend"
5.44
5.45 -has_or_abort lib="libstdc++" \
5.46 - lib_exts="${libs_exts}" \
5.47 - err="The 'libstdc++' library is needed to build gcc"
5.48 -
5.49 -# Yes, we may be checking twice for libstdc++.a
5.50 -# The first is because we need one instance of libstdc++ (shared or static)
5.51 -# because it is needed for PPL; the second is because the static version is
5.52 -# required for static-linking, and if missing, the option is removed.
5.53 -has_or_warn lib="libstdc++" \
5.54 - lib_exts="a" \
5.55 - err="static 'libstdc++' is needed to statically link the toolchain's executables" \
5.56 - kconfig=has_static_libstdcxx \
5.57 - skip="${static_link_ko}"
5.58 -
5.59 -has_or_warn inc="expat.h" \
5.60 - lib="libexpat" \
5.61 - lib_exts="${libs_exts}" \
5.62 - err="The 'expat' header file and library are needed to link cross-gdb's executables" \
5.63 - kconfig=has_expat
5.64 -
5.65 -# Yes, we may be checking twice for libexpat.a
5.66 -# The first is because we need one instance of libexpat (shared or static)
5.67 -# because it is needed for cross-gdb; the second is because the static version
5.68 -# is required for static-linking, and if missing, the option is removed.
5.69 -has_or_warn lib="libexpat" \
5.70 - lib_exts="a" \
5.71 - err="static 'expat' is needed to statically link cross-gdb's executables" \
5.72 - kconfig=has_static_expat \
5.73 - skip="${static_link_ko}"
5.74 -
5.75 -for v in 7 6 5 4; do
5.76 - python_incs="${python_incs} python2.${v}/Python.h"
5.77 - python_libs="${python_libs} libpython2.${v}"
5.78 -done
5.79 -has_or_warn inc="${python_incs}" \
5.80 - lib="${python_libs}" \
5.81 - lib_exts="${libs_exts}" \
5.82 - kconfig=has_python \
5.83 - err="The 'python' header file and library are needed for some features of cross-gdb"
5.84 -
5.85 #---------------------------------------------------------------------
5.86 # Compute the version string
5.87
6.1 --- a/scripts/crosstool-NG.sh.in Sun Oct 16 13:26:26 2011 +0200
6.2 +++ b/scripts/crosstool-NG.sh.in Fri Oct 14 22:44:24 2011 +0200
6.3 @@ -464,6 +464,19 @@
6.4 *) ;;
6.5 esac
6.6
6.7 + # Now we know our host and where to find the host tools, we can check
6.8 + # if static link was requested, but only if it was requested
6.9 + if [ "${CT_WANTS_STATIC_LINK}" = "y" ]; then
6.10 + tmp="${CT_BUILD_DIR}/.static-test"
6.11 + if ! "${CT_HOST}-gcc" -xc - -static -o "${tmp}" >/dev/null 2>&1 <<-_EOF_
6.12 + int main() { return 0; }
6.13 + _EOF_
6.14 + then
6.15 + CT_Abort "Static linking impossible on the host system '${CT_HOST}'"
6.16 + fi
6.17 + rm -f "${tmp}"
6.18 + fi
6.19 +
6.20 # Help gcc
6.21 CT_CFLAGS_FOR_HOST=
6.22 [ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST+=" -pipe"