scripts/build/cc/gcc.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Apr 19 16:17:11 2009 +0000 (2009-04-19)
branchnewlib
changeset 1365 c4d124ed9f8e
parent 1359 877d3d97f806
permissions -rw-r--r--
Update the newlib devel branch with stuf from /trunk.

-------- diffstat follows --------
/devel/newlib/configure | 8 4 4 0
/devel/newlib/scripts/build/kernel/linux.sh | 2 1 1 0
/devel/newlib/scripts/build/cc/gcc.sh | 34 22 12 0 +
/devel/newlib/scripts/build/debug/300-gdb.sh | 52 45 7 0 +
/devel/newlib/scripts/build/libc/uClibc.sh | 6 3 3 0
/devel/newlib/scripts/build/mpfr.sh | 2 1 1 0
/devel/newlib/scripts/crosstool-NG.sh.in | 20 18 2 0 +
/devel/newlib/scripts/functions | 44 34 10 0 +
/devel/newlib/patches/glibc/2_9/500-ppc-glibc-2.9-atomic.patch | 414 0 414 0 ----------
/devel/newlib/patches/glibc/2_9/140-regex-BZ9697.patch | 111 0 111 0 ---
/devel/newlib/patches/glibc/2_9/190-queue-header-updates.patch | 89 0 89 0 --
/devel/newlib/patches/glibc/2_9/370-hppa_glibc-2.7-hppa-nptl-carlos.patch | 249 0 249 0 ------
/devel/newlib/patches/glibc/2_9/450-alpha-glibc-2.5-no-page-header.patch | 32 0 32 0 -
/devel/newlib/patches/glibc/2_9/330-2.3.3-china.patch | 35 0 35 0 -
/devel/newlib/patches/glibc/2_9/270-ldbl-nexttowardf.patch | 68 0 68 0 --
/devel/newlib/patches/glibc/2_9/410-2.9-fnmatch.patch | 64 0 64 0 --
/devel/newlib/patches/glibc/2_9/340-new-valencian-locale.patch | 120 0 120 0 ---
/devel/newlib/patches/glibc/2_9/350-2.4-undefine-__i686.patch | 47 0 47 0 -
/devel/newlib/patches/glibc/2_9/160-i386-x86_64-revert-clone-cfi.patch | 53 0 53 0 -
/devel/newlib/patches/glibc/2_9/150-regex-BZ697.patch | 28 0 28 0 -
/devel/newlib/patches/glibc/2_9/420-dont-build-timezone.patch | 19 0 19 0 -
/devel/newlib/patches/glibc/2_9/290-no-inline-gmon.patch | 38 0 38 0 -
/devel/newlib/patches/glibc/2_9/280-section-comments.patch | 29 0 29 0 -
/devel/newlib/patches/glibc/2_9/180-math-tests.patch | 72 0 72 0 --
/devel/newlib/patches/glibc/2_9/250-resolv-dynamic.patch | 44 0 44 0 -
/devel/newlib/patches/glibc/2_9/120-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch | 35 0 35 0 -
/devel/newlib/patches/glibc/2_9/300-2.9-check_native-headers.patch | 22 0 22 0 -
/devel/newlib/patches/glibc/2_9/130-add_prio-macros.patch | 26 0 26 0 -
/devel/newlib/patches/glibc/2_9/310-2.3.6-fix-pr631.patch | 50 0 50 0 -
/devel/newlib/patches/glibc/2_9/510-sh-no-asm-user-header.patch | 70 0 70 0 --
/devel/newlib/patches/glibc/2_9/260-fadvise64_64.patch | 30 0 30 0 -
/devel/newlib/patches/glibc/2_9/440-alpha-glibc-2.4-xstat.patch | 249 0 249 0 ------
/devel/newlib/patches/glibc/2_9/170-2.10-dns-no-gethostbyname4.patch | 35 0 35 0 -
/devel/newlib/patches/glibc/2_9/230-2.3.3-localedef-fix-trampoline.patch | 74 0 74 0 --
/devel/newlib/patches/glibc/2_9/480-alpha-glibc-2.8-cache-shape.patch | 18 0 18 0 -
/devel/newlib/patches/glibc/2_9/360-2.8-nscd-one-fork.patch | 45 0 45 0 -
/devel/newlib/patches/glibc/2_9/210-2.9-strlen-hack.patch | 109 0 109 0 ---
/devel/newlib/patches/glibc/2_9/320-2.9-assume-pipe2.patch | 59 0 59 0 -
/devel/newlib/patches/glibc/2_9/100-ssp-compat.patch | 193 0 193 0 -----
/devel/newlib/patches/glibc/2_9/110-respect-env-CPPFLAGS.patch | 30 0 30 0 -
/devel/newlib/patches/glibc/2_9/220-manual-no-perl.patch | 29 0 29 0 -
/devel/newlib/patches/glibc/2_9/390-2.3.3_pre20040117-pt_pax.patch | 35 0 35 0 -
/devel/newlib/patches/glibc/2_9/460-alpha-glibc-2.5-no-asm-elf-header.patch | 38 0 38 0 -
/devel/newlib/patches/glibc/2_9/400-tests-sandbox-libdl-paths.patch | 198 0 198 0 -----
/devel/newlib/patches/glibc/2_9/520-sh-no-asm-elf-header.patch | 27 0 27 0 -
/devel/newlib/patches/glibc/2_9/240-i386-LOAD_PIC_REG.patch | 23 0 23 0 -
/devel/newlib/patches/glibc/2_9/200-awk-in-C-locale.patch | 23 0 23 0 -
/devel/newlib/patches/glibc/2_9/430-2.7-cross-compile-nptl.patch | 57 0 57 0 -
/devel/newlib/patches/glibc/2_9/380-2.3.6-dl_execstack-PaX-support.patch | 71 0 71 0 --
/devel/newlib/patches/glibc/2_9/490-ptr-mangling.patch | 114 0 114 0 ---
/devel/newlib/patches/glibc/2_9/470-alpha-glibc-2.8-creat.patch | 19 0 19 0 -
/devel/newlib/patches/glibc/ports-2_9/100-arm_linux_tls.patch | 14 0 14 0 -
/devel/newlib/patches/uClibc/0.9.30.1/140-gnu89-inline.patch | 2 1 1 0
/devel/newlib/docs/known-issues.txt | 16 15 1 0 +
/devel/newlib/docs/overview.txt | 2 1 1 0
/devel/newlib/samples/armeb-unknown-linux-uclibc/uClibc-0.9.30.config | 243 0 243 0 ------
/devel/newlib/samples/armeb-unknown-linux-uclibc/crosstool.config | 78 55 23 0 +-
/devel/newlib/samples/sh4-unknown-linux-gnu/crosstool.config | 35 18 17 0 +
/devel/newlib/samples/x86_64-unknown-linux-gnu/crosstool.config | 104 68 36 0 +--
/devel/newlib/samples/arm-unknown-elf/crosstool.config | 54 47 7 0 +
/devel/newlib/samples/armeb-unknown-eabi/crosstool.config | 54 47 7 0 +
/devel/newlib/samples/arm-unknown-linux-gnueabi/crosstool.config | 113 73 40 0 +--
/devel/newlib/samples/ia64-unknown-linux-gnu/crosstool.config | 91 61 30 0 +-
/devel/newlib/samples/x86_64-unknown-linux-uclibc/uClibc-0.9.30.config | 245 0 245 0 ------
/devel/newlib/samples/x86_64-unknown-linux-uclibc/crosstool.config | 78 55 23 0 +-
/devel/newlib/samples/armeb-unknown-linux-gnueabi/crosstool.config | 105 69 36 0 +--
/devel/newlib/samples/powerpc-e500v2-linux-gnuspe/crosstool.config | 96 63 33 0 +-
/devel/newlib/samples/i686-nptl-linux-gnu/crosstool.config | 78 48 30 0 +-
/devel/newlib/samples/arm-unknown-linux-gnu/crosstool.config | 105 69 36 0 +--
/devel/newlib/samples/powerpc-unknown-linux-gnu/crosstool.config | 103 67 36 0 +-
/devel/newlib/samples/mips-unknown-linux-uclibc/uClibc-0.9.30.config | 254 0 254 0 ------
/devel/newlib/samples/mips-unknown-linux-uclibc/crosstool.config | 77 54 23 0 +-
/devel/newlib/samples/arm-unknown-linux-uclibcgnueabi/uClibc-0.9.30.config | 253 0 253 0 ------
/devel/newlib/samples/arm-unknown-linux-uclibcgnueabi/crosstool.config | 78 55 23 0 +-
/devel/newlib/samples/arm-iphone-linux-gnueabi/crosstool.config | 84 57 27 0 +-
/devel/newlib/samples/armeb-unknown-linux-gnu/crosstool.config | 105 69 36 0 +--
/devel/newlib/samples/powerpc-unknown_nofpu-linux-gnu/crosstool.config | 104 68 36 0 +--
/devel/newlib/samples/i586-geode-linux-uclibc/uClibc-0.9.30.config | 263 0 263 0 ------
/devel/newlib/samples/i586-geode-linux-uclibc/crosstool.config | 78 55 23 0 +-
/devel/newlib/samples/arm-unknown-linux-uclibc/uClibc-0.9.30.config | 253 0 253 0 ------
/devel/newlib/samples/arm-unknown-linux-uclibc/crosstool.config | 78 55 23 0 +-
/devel/newlib/samples/powerpc-unknown-linux-uclibc/uClibc-0.9.30.config | 248 0 248 0 ------
/devel/newlib/samples/powerpc-unknown-linux-uclibc/crosstool.config | 77 54 23 0 +-
/devel/newlib/samples/mips-unknown-elf/crosstool.config | 54 47 7 0 +
/devel/newlib/samples/powerpc-405-linux-gnu/crosstool.config | 104 68 36 0 +--
/devel/newlib/samples/armeb-unknown-linux-uclibcgnueabi/crosstool.config | 26 13 13 0
/devel/newlib/samples/arm-unknown-eabi/crosstool.config | 54 47 7 0 +
/devel/newlib/samples/mipsel-unknown-linux-gnu/crosstool.config | 104 68 36 0 +--
/devel/newlib/samples/powerpc64-unknown-linux-gnu/crosstool.config | 75 49 26 0 +-
/devel/newlib/samples/alphaev56-unknown-linux-gnu/crosstool.config | 94 63 31 0 +-
/devel/newlib/samples/powerpc-860-linux-gnu/crosstool.config | 102 67 35 0 +-
/devel/newlib/config/kernel/linux.in | 87 46 41 0 +-
/devel/newlib/config/cc/gcc.in | 35 30 5 0 +
/devel/newlib/config/debug/gdb.in | 2 1 1 0
94 files changed, 1851 insertions(+), 5813 deletions(-)
     1 # This file adds the function to build the gcc C compiler
     2 # Copyright 2007 Yann E. MORIN
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 
     5 # Download gcc
     6 do_cc_get() {
     7     local version="${CT_CC_VERSION}${CT_CC_GCC_4_4_snapshot_date}"
     8 
     9     # Ah! gcc folks are kind of 'different': they store the tarballs in
    10     # subdirectories of the same name! That's because gcc is such /crap/ that
    11     # it is such /big/ that it needs being splitted for distribution! Sad. :-(
    12     # Arrgghh! Some of those versions does not follow this convention:
    13     # gcc-3.3.3 lives in releases/gcc-3.3.3, while gcc-2.95.* isn't in a
    14     # subdirectory! You bastard!
    15     CT_GetFile "gcc-${version}"                                                         \
    16                {ftp,http}://ftp.gnu.org/gnu/gcc{,{,/releases}/gcc-${version}}           \
    17                ftp://ftp.irisa.fr/pub/mirrors/gcc.gnu.org/gcc/releases/gcc-${version}   \
    18                ftp://ftp.uvsq.fr/pub/gcc/snapshots/${version}
    19 
    20     # Starting with GCC 4.3, ecj is used for Java, and will only be
    21     # built if the configure script finds ecj.jar at the top of the
    22     # GCC source tree, which will not be there unless we get it and
    23     # put it there ourselves
    24     if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" ]; then
    25         CT_GetFile ecj-latest .jar ftp://gcc.gnu.org/pub/java   \
    26                                    ftp://sourceware.org/pub/java
    27     fi
    28 }
    29 
    30 # Extract gcc
    31 do_cc_extract() {
    32     local version="${CT_CC_VERSION}${CT_CC_GCC_4_4_snapshot_date}"
    33 
    34     CT_Extract "gcc-${version}"
    35     CT_Patch "gcc-${version}"
    36 
    37     # Copy ecj-latest.jar to ecj.jar at the top of the GCC source tree
    38     if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y"             \
    39          -a ! -f "${CT_SRC_DIR}/gcc-${version}/ecj.jar" \
    40        ]; then
    41         CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc-${version}/ecj.jar"
    42     fi
    43 }
    44 
    45 #------------------------------------------------------------------------------
    46 # Core gcc pass 1
    47 do_cc_core_pass_1() {
    48     # If we're building for bare metal, build the static core gcc,
    49     # with libgcc.
    50     # In case we're not bare metal, and we're NPTL, build the static core gcc.
    51     # In any other case, do nothing.
    52     case "${CT_BARE_METAL},${CT_THREADS}" in
    53         y,*)    do_cc_core mode=baremetal build_libgcc=yes;;
    54         ,nptl)  do_cc_core mode=static build_libgcc=no;;
    55         *)      ;;
    56     esac
    57 }
    58 
    59 # Core gcc pass 2
    60 do_cc_core_pass_2() {
    61     # In case we're building for bare metal, do nothing, we already have
    62     # our compiler.
    63     # In case we're NPTL, build the shared core gcc and the target libgcc.
    64     # In any other case, build the static core gcc and, if using gcc-4.3+,
    65     # also build the target libgcc.
    66     case "${CT_BARE_METAL},${CT_THREADS}" in
    67         y,*)    ;;
    68         ,nptl)
    69             do_cc_core mode=shared build_libgcc=yes
    70             ;;
    71         *)  if [ "${CT_CC_GCC_4_3_or_later}" = "y" ]; then
    72                 do_cc_core mode=static build_libgcc=yes
    73             else
    74                 do_cc_core mode=static build_libgcc=no
    75             fi
    76             ;;
    77     esac
    78 }
    79 
    80 #------------------------------------------------------------------------------
    81 # Build core gcc
    82 # This function is used to build both the static and the shared core C conpiler,
    83 # with or without the target libgcc. We need to know wether:
    84 #  - we're building static, shared or bare metal: mode=[static|shared|baremetal]
    85 #  - we need to build libgcc or not             : build_libgcc=[yes|no]
    86 # Usage: do_cc_core_static mode=[static|shared|baremetal] build_libgcc=[yes|no]
    87 do_cc_core() {
    88     local mode
    89     local build_libgcc
    90     local core_prefix_dir
    91     local extra_config
    92     local lang_opt
    93     local version="${CT_CC_VERSION}${CT_CC_GCC_4_4_snapshot_date}"
    94 
    95     eval $1
    96     eval $2
    97     CT_TestOrAbort "Internal Error: 'mode' must either 'static', 'shared' or 'baremetal', not '${mode:-(empty)}'" "${mode}" = "static" -o "${mode}" = "shared" -o "${mode}" = "baremetal"
    98     CT_TestOrAbort "Internal Error: 'build_libgcc' must be either 'yes' or 'no', not '${build_libgcc:-(empty)}'" "${build_libgcc}" = "yes" -o "${build_libgcc}" = "no"
    99     # In normal conditions, ( "${mode}" = "shared" ) implies
   100     # ( "${build_libgcc}" = "yes" ), but I won't check for that
   101 
   102     CT_DoStep INFO "Installing ${mode} core C compiler"
   103     mkdir -p "${CT_BUILD_DIR}/build-cc-core-${mode}"
   104     cd "${CT_BUILD_DIR}/build-cc-core-${mode}"
   105 
   106     lang_opt=c
   107     case "${mode}" in
   108         static)
   109             core_prefix_dir="${CT_CC_CORE_STATIC_PREFIX_DIR}"
   110             extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared"
   111             copy_headers=y
   112             ;;
   113         shared)
   114             core_prefix_dir="${CT_CC_CORE_SHARED_PREFIX_DIR}"
   115             extra_config="${extra_config} --enable-shared"
   116             copy_headers=y
   117             ;;
   118         baremetal)
   119             core_prefix_dir="${CT_PREFIX_DIR}"
   120             extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared"
   121             [ "${CT_CC_LANG_CXX}" = "y" ] && lang_opt="${lang_opt},c++"
   122             copy_headers=n
   123             ;;
   124     esac
   125 
   126     if [ "${copy_headers}" = "y" ]; then
   127         CT_DoLog DEBUG "Copying headers to install area of bootstrap gcc, so it can build libgcc2"
   128         CT_DoExecLog ALL mkdir -p "${core_prefix_dir}/${CT_TARGET}/include"
   129         CT_DoExecLog ALL cp -r "${CT_HEADERS_DIR}"/* "${core_prefix_dir}/${CT_TARGET}/include"
   130     fi
   131 
   132     CT_DoLog EXTRA "Configuring ${mode} core C compiler"
   133 
   134     extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}"
   135     extra_config="${extra_config} ${CT_ARCH_WITH_ABI}"
   136     extra_config="${extra_config} ${CT_ARCH_WITH_CPU}"
   137     extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}"
   138     extra_config="${extra_config} ${CT_ARCH_WITH_FPU}"
   139     extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}"
   140     [ "${CT_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
   141     if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
   142         extra_config="${extra_config} --enable-__cxa_atexit"
   143     else
   144         extra_config="${extra_config} --disable-__cxa_atexit"
   145     fi
   146 
   147     CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
   148 
   149     # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532)
   150     CC_FOR_BUILD="${CT_BUILD}-gcc"                  \
   151     CFLAGS="${CT_CFLAGS_FOR_HOST}"                  \
   152     CT_DoExecLog ALL                                \
   153     "${CT_SRC_DIR}/gcc-${version}/configure"        \
   154         --build=${CT_BUILD}                         \
   155         --host=${CT_HOST}                           \
   156         --target=${CT_TARGET}                       \
   157         --prefix="${core_prefix_dir}"               \
   158         --with-local-prefix="${CT_SYSROOT_DIR}"     \
   159         --disable-multilib                          \
   160         ${CC_CORE_SYSROOT_ARG}                      \
   161         ${extra_config}                             \
   162         --disable-nls                               \
   163         --enable-symvers=gnu                        \
   164         --enable-languages="${lang_opt}"            \
   165         --enable-target-optspace                    \
   166         ${CT_CC_CORE_EXTRA_CONFIG}
   167 
   168     if [ "${build_libgcc}" = "yes" ]; then
   169         # HACK: we need to override SHLIB_LC from gcc/config/t-slibgcc-elf-ver or
   170         # gcc/config/t-libunwind so -lc is removed from the link for
   171         # libgcc_s.so, as we do not have a target -lc yet.
   172         # This is not as ugly as it appears to be ;-) All symbols get resolved
   173         # during the glibc build, and we provide a proper libgcc_s.so for the
   174         # cross toolchain during the final gcc build.
   175         #
   176         # As we cannot modify the source tree, nor override SHLIB_LC itself
   177         # during configure or make, we have to edit the resultant
   178         # gcc/libgcc.mk itself to remove -lc from the link.
   179         # This causes us to have to jump through some hoops...
   180         #
   181         # To produce libgcc.mk to edit we firstly require libiberty.a,
   182         # so we configure then build it.
   183         # Next we have to configure gcc, create libgcc.mk then edit it...
   184         # So much easier if we just edit the source tree, but hey...
   185         if [ ! -f "${CT_SRC_DIR}/gcc-${version}/gcc/BASE-VER" ]; then
   186             CT_DoExecLog ALL make configure-libiberty
   187             CT_DoExecLog ALL make ${PARALLELMFLAGS} -C libiberty libiberty.a
   188             CT_DoExecLog ALL make configure-gcc configure-libcpp
   189             CT_DoExecLog ALL make ${PARALLELMFLAGS} all-libcpp
   190         else
   191             CT_DoExecLog ALL make configure-gcc configure-libcpp configure-build-libiberty
   192             CT_DoExecLog ALL make ${PARALLELMFLAGS} all-libcpp all-build-libiberty
   193         fi
   194         # HACK: gcc-4.2 uses libdecnumber to build libgcc.mk, so build it here.
   195         if [ -d "${CT_SRC_DIR}/gcc-${version}/libdecnumber" ]; then
   196             CT_DoExecLog ALL make configure-libdecnumber
   197             CT_DoExecLog ALL make ${PARALLELMFLAGS} -C libdecnumber libdecnumber.a
   198         fi
   199 
   200         # Starting with GCC 4.3, libgcc.mk is no longer built,
   201         # and libgcc.mvars is used instead.
   202 
   203         if [ "${CT_CC_GCC_4_3_or_later}" = "y" ]; then
   204             libgcc_rule="libgcc.mvars"
   205             build_rules="all-gcc all-target-libgcc"
   206             install_rules="install-gcc install-target-libgcc"
   207         else
   208             libgcc_rule="libgcc.mk"
   209             build_rules="all-gcc"
   210             install_rules="install-gcc"
   211         fi
   212 
   213         CT_DoExecLog ALL make ${PARALLELMFLAGS} -C gcc ${libgcc_rule}
   214         sed -r -i -e 's@-lc@@g' gcc/${libgcc_rule}
   215     else # build_libgcc
   216             build_rules="all-gcc"
   217             install_rules="install-gcc"
   218     fi   # ! build libgcc
   219 
   220     if [ "${CT_CANADIAN}" = "y" ]; then
   221         CT_DoLog EXTRA "Building libiberty"
   222         CT_DoExecLog ALL make ${PARALLELMFLAGS} all-build-libiberty
   223     fi
   224 
   225     CT_DoLog EXTRA "Building ${mode} core C compiler"
   226     CT_DoExecLog ALL make ${PARALLELMFLAGS} ${build_rules}
   227 
   228     CT_DoLog EXTRA "Installing ${mode} core C compiler"
   229     CT_DoExecLog ALL make ${install_rules}
   230 
   231     # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able
   232     # to call the C compiler with the same, somewhat canonical name.
   233     CT_DoExecLog ALL ln -sv "${CT_TARGET}"-gcc "${core_prefix_dir}/bin/${CT_TARGET}"-cc
   234 
   235     CT_EndStep
   236 }
   237 
   238 #------------------------------------------------------------------------------
   239 # Build final gcc
   240 do_cc() {
   241     local version="${CT_CC_VERSION}${CT_CC_GCC_4_4_snapshot_date}"
   242 
   243     # If building for bare metal, nothing to be done here, the static core conpiler is enough!
   244     [ "${CT_BARE_METAL}" = "y" ] && return 0
   245 
   246     CT_DoStep INFO "Installing final compiler"
   247 
   248     mkdir -p "${CT_BUILD_DIR}/build-cc"
   249     cd "${CT_BUILD_DIR}/build-cc"
   250 
   251     CT_DoLog EXTRA "Configuring final compiler"
   252 
   253     # Enable selected languages
   254     lang_opt="c"
   255     [ "${CT_CC_LANG_CXX}" = "y"      ] && lang_opt="${lang_opt},c++"
   256     [ "${CT_CC_LANG_FORTRAN}" = "y"  ] && lang_opt="${lang_opt},fortran"
   257     [ "${CT_CC_LANG_ADA}" = "y"      ] && lang_opt="${lang_opt},ada"
   258     [ "${CT_CC_LANG_JAVA}" = "y"     ] && lang_opt="${lang_opt},java"
   259     [ "${CT_CC_LANG_OBJC}" = "y"     ] && lang_opt="${lang_opt},objc"
   260     [ "${CT_CC_LANG_OBJCXX}" = "y"   ] && lang_opt="${lang_opt},obj-c++"
   261     CT_Test "Building ADA language is not yet supported. Will try..." "${CT_CC_LANG_ADA}" = "y"
   262     CT_Test "Building Objective-C language is not yet supported. Will try..." "${CT_CC_LANG_OBJC}" = "y"
   263     CT_Test "Building Objective-C++ language is not yet supported. Will try..." "${CT_CC_LANG_OBJCXX}" = "y"
   264     CT_Test "Building ${CT_CC_LANG_OTHERS//,/ } language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
   265     lang_opt=$(echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/,+/,/g; s/,*$//;')
   266 
   267     extra_config="--enable-languages=${lang_opt}"
   268     extra_config="${extra_config} --disable-multilib"
   269     extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}"
   270     extra_config="${extra_config} ${CT_ARCH_WITH_ABI}"
   271     extra_config="${extra_config} ${CT_ARCH_WITH_CPU}"
   272     extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}"
   273     extra_config="${extra_config} ${CT_ARCH_WITH_FPU}"
   274     extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}"
   275     [ "${CT_SHARED_LIBS}" = "y" ]                   || extra_config="${extra_config} --disable-shared"
   276     [ "${CT_GMP_MPFR}" = "y" ]                      && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
   277     [ -n "${CT_CC_PKGVERSION}" ]                    && extra_config="${extra_config} --with-pkgversion=${CT_CC_PKGVERSION}"
   278     [ -n "${CT_CC_BUGURL}" ]                        && extra_config="${extra_config} --with-bugurl=${CT_CC_BUGURL}"
   279     [ "${CT_CC_SJLJ_EXCEPTIONS_USE}" = "y" ]        && extra_config="${extra_config} --enable-sjlj-exceptions"
   280     [ "${CT_CC_SJLJ_EXCEPTIONS_DONT_USE}" = "y" ]   && extra_config="${extra_config} --disable-sjlj-exceptions"
   281     if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
   282         extra_config="${extra_config} --enable-__cxa_atexit"
   283     else
   284         extra_config="${extra_config} --disable-__cxa_atexit"
   285     fi
   286 
   287     CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
   288 
   289     # --enable-symvers=gnu really only needed for sh4 to work around a
   290     # detection problem only matters for gcc-3.2.x and later, I think.
   291     # --disable-nls to work around crash bug on ppc405, but also because
   292     # embedded systems don't really need message catalogs...
   293     CC_FOR_BUILD="${CT_BUILD}-gcc"                  \
   294     CFLAGS="${CT_CFLAGS_FOR_HOST}"                  \
   295     CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}"         \
   296     CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}"       \
   297     LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}"       \
   298     CT_DoExecLog ALL                                \
   299     "${CT_SRC_DIR}/gcc-${version}/configure"        \
   300         --build=${CT_BUILD}                         \
   301         --host=${CT_HOST}                           \
   302         --target=${CT_TARGET}                       \
   303         --prefix="${CT_PREFIX_DIR}"                 \
   304         ${CC_SYSROOT_ARG}                           \
   305         ${extra_config}                             \
   306         --with-local-prefix="${CT_SYSROOT_DIR}"     \
   307         --disable-nls                               \
   308         --enable-threads=posix                      \
   309         --enable-symvers=gnu                        \
   310         --enable-c99                                \
   311         --enable-long-long                          \
   312         --enable-target-optspace                    \
   313         ${CT_CC_EXTRA_CONFIG}
   314 
   315     if [ "${CT_CANADIAN}" = "y" ]; then
   316         CT_DoLog EXTRA "Building libiberty"
   317         CT_DoExecLog ALL make ${PARALLELMFLAGS} all-build-libiberty
   318     fi
   319 
   320     CT_DoLog EXTRA "Building final compiler"
   321     CT_DoExecLog ALL make ${PARALLELMFLAGS} all
   322 
   323     CT_DoLog EXTRA "Installing final compiler"
   324     CT_DoExecLog ALL make install
   325 
   326     # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able
   327     # to call the C compiler with the same, somewhat canonical name.
   328     CT_DoExecLog ALL ln -sv "${CT_TARGET}"-gcc "${CT_PREFIX_DIR}/bin/${CT_TARGET}"-cc
   329 
   330     CT_EndStep
   331 }