diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2009-08-19 19:52:04 +0200 |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2009-08-19 19:52:04 +0200 |
commit | 4de6139e7ed8927c1d7c3f72f5efae697a3bd7ca (patch) | |
tree | 9bd09638b85d7ad2d3aaaf4b8d4f308b0f3433cf /scripts/build/cc/gcc.sh | |
parent | 9d1cbf2b4145a6ff0ac4834be3459320b35ee7a0 (diff) | |
parent | 83a48e12f08e375bddd42ca27eab4896234a42b8 (diff) | |
download | crosstool-ng-4de6139e7ed8927c1d7c3f72f5efae697a3bd7ca.tar.gz crosstool-ng-4de6139e7ed8927c1d7c3f72f5efae697a3bd7ca.tar.bz2 crosstool-ng-4de6139e7ed8927c1d7c3f72f5efae697a3bd7ca.zip |
Merge the bash_array branch.
For every components where it makes sense, use bash arrays (instead
of a string with space-separated values) to store the options pased
to ./configure.
Diffstat (limited to 'scripts/build/cc/gcc.sh')
-rw-r--r-- | scripts/build/cc/gcc.sh | 94 |
1 files changed, 53 insertions, 41 deletions
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh index e1f5d25c..1737b44d 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -92,8 +92,9 @@ do_cc_core() { local mode local build_libgcc local core_prefix_dir - local extra_config local lang_opt + local tmp + local -a extra_config eval $1 eval $2 @@ -110,17 +111,21 @@ do_cc_core() { case "${mode}" in static) core_prefix_dir="${CT_CC_CORE_STATIC_PREFIX_DIR}" - extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared" + extra_config+=("--with-newlib") + extra_config+=("--enable-threads=no") + extra_config+=("--disable-shared") copy_headers=y ;; shared) core_prefix_dir="${CT_CC_CORE_SHARED_PREFIX_DIR}" - extra_config="${extra_config} --enable-shared" + extra_config+=("--enable-shared") copy_headers=y ;; baremetal) core_prefix_dir="${CT_PREFIX_DIR}" - extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared" + extra_config+=("--with-newlib") + extra_config+=("--enable-threads=no") + extra_config+=("--disable-shared") [ "${CT_CC_LANG_CXX}" = "y" ] && lang_opt="${lang_opt},c++" copy_headers=n ;; @@ -134,28 +139,28 @@ do_cc_core() { CT_DoLog EXTRA "Configuring ${mode} core C compiler" - extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}" - extra_config="${extra_config} ${CT_ARCH_WITH_ABI}" - extra_config="${extra_config} ${CT_ARCH_WITH_CPU}" - extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}" - extra_config="${extra_config} ${CT_ARCH_WITH_FPU}" - extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}" + for tmp in ARCH ABI CPU TUNE FPU FLOAT; do + eval tmp="\${CT_ARCH_WITH_${tmp}}" + if [ -n "${tmp}" ]; then + extra_config+=("${tmp}") + fi + done if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then - extra_config="${extra_config} --enable-__cxa_atexit" + extra_config+=("--enable-__cxa_atexit") else - extra_config="${extra_config} --disable-__cxa_atexit" + extra_config+=("--disable-__cxa_atexit") fi if [ "${CT_GMP_MPFR}" = "y" ]; then - extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR}" - extra_config="${extra_config} --with-mpfr=${CT_PREFIX_DIR}" + extra_config+=("--with-gmp=${CT_PREFIX_DIR}") + extra_config+=("--with-mpfr=${CT_PREFIX_DIR}") fi if [ "${CT_PPL_CLOOG_MPC}" = "y" ]; then - extra_config="${extra_config} --with-ppl=${CT_PREFIX_DIR}" - extra_config="${extra_config} --with-cloog=${CT_PREFIX_DIR}" - extra_config="${extra_config} --with-mpc=${CT_PREFIX_DIR}" + extra_config+=("--with-ppl=${CT_PREFIX_DIR}") + extra_config+=("--with-cloog=${CT_PREFIX_DIR}") + extra_config+=("--with-mpc=${CT_PREFIX_DIR}") fi - CT_DoLog DEBUG "Extra config passed: '${extra_config}'" + CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'" # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532) CC_FOR_BUILD="${CT_BUILD}-gcc" \ @@ -169,7 +174,7 @@ do_cc_core() { --with-local-prefix="${CT_SYSROOT_DIR}" \ --disable-multilib \ ${CC_CORE_SYSROOT_ARG} \ - ${extra_config} \ + "${extra_config[@]}" \ --disable-nls \ --enable-symvers=gnu \ --enable-languages="${lang_opt}" \ @@ -249,6 +254,9 @@ do_cc_core() { #------------------------------------------------------------------------------ # Build final gcc do_cc() { + local -a extra_config + local tmp + # If building for bare metal, nothing to be done here, the static core conpiler is enough! [ "${CT_BARE_METAL}" = "y" ] && return 0 @@ -273,35 +281,39 @@ do_cc() { CT_Test "Building ${CT_CC_LANG_OTHERS//,/ } language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}" lang_opt=$(echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/,+/,/g; s/,*$//;') - extra_config="--enable-languages=${lang_opt}" - extra_config="${extra_config} --disable-multilib" - extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}" - extra_config="${extra_config} ${CT_ARCH_WITH_ABI}" - extra_config="${extra_config} ${CT_ARCH_WITH_CPU}" - extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}" - extra_config="${extra_config} ${CT_ARCH_WITH_FPU}" - extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}" - [ "${CT_SHARED_LIBS}" = "y" ] || extra_config="${extra_config} --disable-shared" - [ -n "${CT_CC_PKGVERSION}" ] && extra_config="${extra_config} --with-pkgversion=${CT_CC_PKGVERSION}" - [ -n "${CT_CC_BUGURL}" ] && extra_config="${extra_config} --with-bugurl=${CT_CC_BUGURL}" - [ "${CT_CC_SJLJ_EXCEPTIONS_USE}" = "y" ] && extra_config="${extra_config} --enable-sjlj-exceptions" - [ "${CT_CC_SJLJ_EXCEPTIONS_DONT_USE}" = "y" ] && extra_config="${extra_config} --disable-sjlj-exceptions" + extra_config+=("--enable-languages=${lang_opt}") + extra_config+=("--disable-multilib") + for tmp in ARCH ABI CPU TUNE FPU FLOAT; do + eval tmp="\${CT_ARCH_WITH_${tmp}}" + if [ -n "${tmp}" ]; then + extra_config+=("${tmp}") + fi + done + + [ "${CT_SHARED_LIBS}" = "y" ] || extra_config+=("--disable-shared") + [ -n "${CT_CC_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_CC_PKGVERSION}") + [ -n "${CT_CC_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_CC_BUGURL}") + [ "${CT_CC_SJLJ_EXCEPTIONS_USE}" = "y" ] && extra_config+=("--enable-sjlj-exceptions") + [ "${CT_CC_SJLJ_EXCEPTIONS_DONT_USE}" = "y" ] && extra_config+=("--disable-sjlj-exceptions") if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then - extra_config="${extra_config} --enable-__cxa_atexit" + extra_config+=("--enable-__cxa_atexit") else - extra_config="${extra_config} --disable-__cxa_atexit" + extra_config+=("--disable-__cxa_atexit") fi if [ "${CT_GMP_MPFR}" = "y" ]; then - extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR}" - extra_config="${extra_config} --with-mpfr=${CT_PREFIX_DIR}" + extra_config+=("--with-gmp=${CT_PREFIX_DIR}") + extra_config+=("--with-mpfr=${CT_PREFIX_DIR}") fi if [ "${CT_PPL_CLOOG_MPC}" = "y" ]; then - extra_config="${extra_config} --with-ppl=${CT_PREFIX_DIR}" - extra_config="${extra_config} --with-cloog=${CT_PREFIX_DIR}" - extra_config="${extra_config} --with-mpc=${CT_PREFIX_DIR}" + extra_config+=("--with-ppl=${CT_PREFIX_DIR}") + extra_config+=("--with-cloog=${CT_PREFIX_DIR}") + extra_config+=("--with-mpc=${CT_PREFIX_DIR}") + fi + if [ -n "${CC_ENABLE_CXX_FLAGS}" ]; then + extra_config+=("--enable-cxx-flags=${CC_ENABLE_CXX_FLAGS}") fi - CT_DoLog DEBUG "Extra config passed: '${extra_config}'" + CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'" # --enable-symvers=gnu really only needed for sh4 to work around a # detection problem only matters for gcc-3.2.x and later, I think. @@ -319,7 +331,7 @@ do_cc() { --target=${CT_TARGET} \ --prefix="${CT_PREFIX_DIR}" \ ${CC_SYSROOT_ARG} \ - ${extra_config} \ + "${extra_config[@]}" \ --with-local-prefix="${CT_SYSROOT_DIR}" \ --disable-nls \ --enable-threads=posix \ |