1.1 --- a/scripts/build/cc/gcc.sh Sun Mar 27 00:09:42 2011 +0100
1.2 +++ b/scripts/build/cc/gcc.sh Mon Mar 28 01:07:31 2011 +0200
1.3 @@ -117,6 +117,7 @@
1.4 local core_prefix_dir
1.5 local lang_opt
1.6 local tmp
1.7 + local -a host_libstdcxx_flags
1.8 local -a extra_config
1.9 local -a core_LDFLAGS
1.10 local -a core_targets
1.11 @@ -186,7 +187,9 @@
1.12 # with the same block in do_cc, below.
1.13 if [ "${build_staticlinked}" = "yes" ]; then
1.14 core_LDFLAGS+=("-static")
1.15 - extra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++ -lm")
1.16 + host_libstdcxx_flags+=("-static-libgcc")
1.17 + host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++")
1.18 + host_libstdcxx_flags+=("-lm")
1.19 # Companion libraries are build static (eg !shared), so
1.20 # the libstdc++ is not pulled automatically, although it
1.21 # is needed. Shoe-horn it in our LDFLAGS
1.22 @@ -199,7 +202,9 @@
1.23 # build script
1.24 # FIXME: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++,
1.25 # see http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01635.html
1.26 - extra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm")
1.27 + host_libstdcxx_flags+=("-static-libgcc")
1.28 + host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic")
1.29 + host_libstdcxx_flags+=("-lm")
1.30 elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then
1.31 # When companion libraries are build static (eg !shared),
1.32 # the libstdc++ is not pulled automatically, although it
1.33 @@ -219,6 +224,11 @@
1.34 fi
1.35 if [ "${CT_CC_GCC_USE_GRAPHITE}" = "y" ]; then
1.36 extra_config+=("--with-ppl=${CT_COMPLIBS_DIR}")
1.37 + # With PPL 0.11+, also pull libpwl if needed
1.38 + if [ "${CT_PPL_NEEDS_LIBPWL}" = "y" ]; then
1.39 + host_libstdcxx_flags+=("-L${CT_COMPLIBS_DIR}/lib")
1.40 + host_libstdcxx_flags+=("-lpwl")
1.41 + fi
1.42 extra_config+=("--with-cloog=${CT_COMPLIBS_DIR}")
1.43 elif [ "${CT_CC_GCC_HAS_GRAPHITE}" = "y" ]; then
1.44 extra_config+=("--with-ppl=no")
1.45 @@ -232,6 +242,10 @@
1.46 extra_config+=("--disable-lto")
1.47 fi
1.48
1.49 + if [ ${#host_libstdcxx_flags[@]} -ne 0 ]; then
1.50 + extra_config+=("--with-host-libstdcxx=${host_libstdcxx_flags[*]}")
1.51 + fi
1.52 +
1.53 if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then
1.54 extra_config+=("--enable-target-optspace")
1.55 fi
1.56 @@ -349,6 +363,7 @@
1.57 #------------------------------------------------------------------------------
1.58 # Build final gcc
1.59 do_cc() {
1.60 + local -a host_libstdcxx_flags
1.61 local -a extra_config
1.62 local -a final_LDFLAGS
1.63 local tmp
1.64 @@ -423,7 +438,9 @@
1.65 # with the same block in do_cc_core, above.
1.66 if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
1.67 final_LDFLAGS+=("-static")
1.68 - extra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++ -lm")
1.69 + host_libstdcxx_flags+=("-static-libgcc")
1.70 + host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++")
1.71 + host_libstdcxx_flags+=("-lm")
1.72 # Companion libraries are build static (eg !shared), so
1.73 # the libstdc++ is not pulled automatically, although it
1.74 # is needed. Shoe-horn it in our LDFLAGS
1.75 @@ -436,7 +453,9 @@
1.76 # build script
1.77 # FIXME: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++,
1.78 # see http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01635.html
1.79 - extra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm")
1.80 + host_libstdcxx_flags+=("-static-libgcc")
1.81 + host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic")
1.82 + host_libstdcxx_flags+=("-lm")
1.83 elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then
1.84 # When companion libraries are build static (eg !shared),
1.85 # the libstdc++ is not pulled automatically, although it
1.86 @@ -456,6 +475,11 @@
1.87 fi
1.88 if [ "${CT_CC_GCC_USE_GRAPHITE}" = "y" ]; then
1.89 extra_config+=("--with-ppl=${CT_COMPLIBS_DIR}")
1.90 + # With PPL 0.11+, also pull libpwl if needed
1.91 + if [ "${CT_PPL_NEEDS_LIBPWL}" = "y" ]; then
1.92 + host_libstdcxx_flags+=("-L${CT_COMPLIBS_DIR}/lib")
1.93 + host_libstdcxx_flags+=("-lpwl")
1.94 + fi
1.95 extra_config+=("--with-cloog=${CT_COMPLIBS_DIR}")
1.96 elif [ "${CT_CC_GCC_HAS_GRAPHITE}" = "y" ]; then
1.97 extra_config+=("--with-ppl=no")
1.98 @@ -467,6 +491,10 @@
1.99 extra_config+=("--with-libelf=no")
1.100 fi
1.101
1.102 + if [ ${#host_libstdcxx_flags[@]} -ne 0 ]; then
1.103 + extra_config+=("--with-host-libstdcxx=${host_libstdcxx_flags[*]}")
1.104 + fi
1.105 +
1.106 if [ "${CT_THREADS}" = "none" ]; then
1.107 extra_config+=("--disable-threads")
1.108 if [ "${CT_CC_GCC_4_2_or_later}" = y ]; then