Make gcc's extra_config an array containing ./configure options bash_array
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Aug 19 19:44:42 2009 +0200 (2009-08-19)
branchbash_array
changeset 147970a68892831e
parent 1478 3a9fb0d6d8e2
child 1480 2d3be1a8fe93
Make gcc's extra_config an array containing ./configure options

Change extra_config from a string to a array of options.
scripts/build/cc/gcc.sh
     1.1 --- a/scripts/build/cc/gcc.sh	Wed Aug 19 19:44:30 2009 +0200
     1.2 +++ b/scripts/build/cc/gcc.sh	Wed Aug 19 19:44:42 2009 +0200
     1.3 @@ -92,8 +92,9 @@
     1.4      local mode
     1.5      local build_libgcc
     1.6      local core_prefix_dir
     1.7 -    local extra_config
     1.8      local lang_opt
     1.9 +    local tmp
    1.10 +    local -a extra_config
    1.11  
    1.12      eval $1
    1.13      eval $2
    1.14 @@ -110,17 +111,21 @@
    1.15      case "${mode}" in
    1.16          static)
    1.17              core_prefix_dir="${CT_CC_CORE_STATIC_PREFIX_DIR}"
    1.18 -            extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared"
    1.19 +            extra_config+=("--with-newlib")
    1.20 +            extra_config+=("--enable-threads=no")
    1.21 +            extra_config+=("--disable-shared")
    1.22              copy_headers=y
    1.23              ;;
    1.24          shared)
    1.25              core_prefix_dir="${CT_CC_CORE_SHARED_PREFIX_DIR}"
    1.26 -            extra_config="${extra_config} --enable-shared"
    1.27 +            extra_config+=("--enable-shared")
    1.28              copy_headers=y
    1.29              ;;
    1.30          baremetal)
    1.31              core_prefix_dir="${CT_PREFIX_DIR}"
    1.32 -            extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared"
    1.33 +            extra_config+=("--with-newlib")
    1.34 +            extra_config+=("--enable-threads=no")
    1.35 +            extra_config+=("--disable-shared")
    1.36              [ "${CT_CC_LANG_CXX}" = "y" ] && lang_opt="${lang_opt},c++"
    1.37              copy_headers=n
    1.38              ;;
    1.39 @@ -134,28 +139,28 @@
    1.40  
    1.41      CT_DoLog EXTRA "Configuring ${mode} core C compiler"
    1.42  
    1.43 -    extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}"
    1.44 -    extra_config="${extra_config} ${CT_ARCH_WITH_ABI}"
    1.45 -    extra_config="${extra_config} ${CT_ARCH_WITH_CPU}"
    1.46 -    extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}"
    1.47 -    extra_config="${extra_config} ${CT_ARCH_WITH_FPU}"
    1.48 -    extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}"
    1.49 +    for tmp in ARCH ABI CPU TUNE FPU FLOAT; do
    1.50 +        eval tmp="\${CT_ARCH_WITH_${tmp}}"
    1.51 +        if [ -n "${tmp}" ]; then
    1.52 +            extra_config+=("${tmp}")
    1.53 +        fi
    1.54 +    done
    1.55      if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
    1.56 -        extra_config="${extra_config} --enable-__cxa_atexit"
    1.57 +        extra_config+=("--enable-__cxa_atexit")
    1.58      else
    1.59 -        extra_config="${extra_config} --disable-__cxa_atexit"
    1.60 +        extra_config+=("--disable-__cxa_atexit")
    1.61      fi
    1.62      if [ "${CT_GMP_MPFR}" = "y" ]; then
    1.63 -        extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR}"
    1.64 -        extra_config="${extra_config} --with-mpfr=${CT_PREFIX_DIR}"
    1.65 +        extra_config+=("--with-gmp=${CT_PREFIX_DIR}")
    1.66 +        extra_config+=("--with-mpfr=${CT_PREFIX_DIR}")
    1.67      fi
    1.68      if [ "${CT_PPL_CLOOG_MPC}" = "y" ]; then
    1.69 -        extra_config="${extra_config} --with-ppl=${CT_PREFIX_DIR}"
    1.70 -        extra_config="${extra_config} --with-cloog=${CT_PREFIX_DIR}"
    1.71 -        extra_config="${extra_config} --with-mpc=${CT_PREFIX_DIR}"
    1.72 +        extra_config+=("--with-ppl=${CT_PREFIX_DIR}")
    1.73 +        extra_config+=("--with-cloog=${CT_PREFIX_DIR}")
    1.74 +        extra_config+=("--with-mpc=${CT_PREFIX_DIR}")
    1.75      fi
    1.76  
    1.77 -    CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
    1.78 +    CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
    1.79  
    1.80      # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532)
    1.81      CC_FOR_BUILD="${CT_BUILD}-gcc"                  \
    1.82 @@ -169,7 +174,7 @@
    1.83          --with-local-prefix="${CT_SYSROOT_DIR}"     \
    1.84          --disable-multilib                          \
    1.85          ${CC_CORE_SYSROOT_ARG}                      \
    1.86 -        ${extra_config}                             \
    1.87 +        "${extra_config[@]}"                        \
    1.88          --disable-nls                               \
    1.89          --enable-symvers=gnu                        \
    1.90          --enable-languages="${lang_opt}"            \
    1.91 @@ -249,6 +254,9 @@
    1.92  #------------------------------------------------------------------------------
    1.93  # Build final gcc
    1.94  do_cc() {
    1.95 +    local -a extra_config
    1.96 +    local tmp
    1.97 +
    1.98      # If building for bare metal, nothing to be done here, the static core conpiler is enough!
    1.99      [ "${CT_BARE_METAL}" = "y" ] && return 0
   1.100  
   1.101 @@ -273,35 +281,36 @@
   1.102      CT_Test "Building ${CT_CC_LANG_OTHERS//,/ } language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
   1.103      lang_opt=$(echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/,+/,/g; s/,*$//;')
   1.104  
   1.105 -    extra_config="--enable-languages=${lang_opt}"
   1.106 -    extra_config="${extra_config} --disable-multilib"
   1.107 -    extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}"
   1.108 -    extra_config="${extra_config} ${CT_ARCH_WITH_ABI}"
   1.109 -    extra_config="${extra_config} ${CT_ARCH_WITH_CPU}"
   1.110 -    extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}"
   1.111 -    extra_config="${extra_config} ${CT_ARCH_WITH_FPU}"
   1.112 -    extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}"
   1.113 -    [ "${CT_SHARED_LIBS}" = "y" ]                   || extra_config="${extra_config} --disable-shared"
   1.114 -    [ -n "${CT_CC_PKGVERSION}" ]                    && extra_config="${extra_config} --with-pkgversion=${CT_CC_PKGVERSION}"
   1.115 -    [ -n "${CT_CC_BUGURL}" ]                        && extra_config="${extra_config} --with-bugurl=${CT_CC_BUGURL}"
   1.116 -    [ "${CT_CC_SJLJ_EXCEPTIONS_USE}" = "y" ]        && extra_config="${extra_config} --enable-sjlj-exceptions"
   1.117 -    [ "${CT_CC_SJLJ_EXCEPTIONS_DONT_USE}" = "y" ]   && extra_config="${extra_config} --disable-sjlj-exceptions"
   1.118 +    extra_config+=("--enable-languages=${lang_opt}")
   1.119 +    extra_config+=("--disable-multilib")
   1.120 +    for tmp in ARCH ABI CPU TUNE FPU FLOAT; do
   1.121 +        eval tmp="\${CT_ARCH_WITH_${tmp}}"
   1.122 +        if [ -n "${tmp}" ]; then
   1.123 +            extra_config+=("${tmp}")
   1.124 +        fi
   1.125 +    done
   1.126 +
   1.127 +    [ "${CT_SHARED_LIBS}" = "y" ]                   || extra_config+=("--disable-shared")
   1.128 +    [ -n "${CT_CC_PKGVERSION}" ]                    && extra_config+=("--with-pkgversion=${CT_CC_PKGVERSION}")
   1.129 +    [ -n "${CT_CC_BUGURL}" ]                        && extra_config+=("--with-bugurl=${CT_CC_BUGURL}")
   1.130 +    [ "${CT_CC_SJLJ_EXCEPTIONS_USE}" = "y" ]        && extra_config+=("--enable-sjlj-exceptions")
   1.131 +    [ "${CT_CC_SJLJ_EXCEPTIONS_DONT_USE}" = "y" ]   && extra_config+=("--disable-sjlj-exceptions")
   1.132      if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
   1.133 -        extra_config="${extra_config} --enable-__cxa_atexit"
   1.134 +        extra_config+=("--enable-__cxa_atexit")
   1.135      else
   1.136 -        extra_config="${extra_config} --disable-__cxa_atexit"
   1.137 +        extra_config+=("--disable-__cxa_atexit")
   1.138      fi
   1.139      if [ "${CT_GMP_MPFR}" = "y" ]; then
   1.140 -        extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR}"
   1.141 -        extra_config="${extra_config} --with-mpfr=${CT_PREFIX_DIR}"
   1.142 +        extra_config+=("--with-gmp=${CT_PREFIX_DIR}")
   1.143 +        extra_config+=("--with-mpfr=${CT_PREFIX_DIR}")
   1.144      fi
   1.145      if [ "${CT_PPL_CLOOG_MPC}" = "y" ]; then
   1.146 -        extra_config="${extra_config} --with-ppl=${CT_PREFIX_DIR}"
   1.147 -        extra_config="${extra_config} --with-cloog=${CT_PREFIX_DIR}"
   1.148 -        extra_config="${extra_config} --with-mpc=${CT_PREFIX_DIR}"
   1.149 +        extra_config+=("--with-ppl=${CT_PREFIX_DIR}")
   1.150 +        extra_config+=("--with-cloog=${CT_PREFIX_DIR}")
   1.151 +        extra_config+=("--with-mpc=${CT_PREFIX_DIR}")
   1.152      fi
   1.153  
   1.154 -    CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
   1.155 +    CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
   1.156  
   1.157      # --enable-symvers=gnu really only needed for sh4 to work around a
   1.158      # detection problem only matters for gcc-3.2.x and later, I think.
   1.159 @@ -319,7 +328,7 @@
   1.160          --target=${CT_TARGET}                       \
   1.161          --prefix="${CT_PREFIX_DIR}"                 \
   1.162          ${CC_SYSROOT_ARG}                           \
   1.163 -        ${extra_config}                             \
   1.164 +        "${extra_config[@]}"                        \
   1.165          --with-local-prefix="${CT_SYSROOT_DIR}"     \
   1.166          --disable-nls                               \
   1.167          --enable-threads=posix                      \