scripts/build/libc/glibc-eglibc.sh-common
changeset 2822 09abd5f4295b
parent 2821 fc0afaf5c817
child 2823 5b2025372db7
     1.1 --- a/scripts/build/libc/glibc-eglibc.sh-common	Mon Nov 21 23:56:53 2011 +0100
     1.2 +++ b/scripts/build/libc/glibc-eglibc.sh-common	Tue Nov 22 00:11:51 2011 +0100
     1.3 @@ -78,6 +78,7 @@
     1.4      local -a extra_make_args
     1.5      local glibc_cflags
     1.6      local float_extra
     1.7 +    local endian_extra
     1.8  
     1.9      while [ $# -ne 0 ]; do
    1.10          eval "${1// /\\ }"
    1.11 @@ -169,7 +170,23 @@
    1.12          [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
    1.13      fi
    1.14  
    1.15 -    extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
    1.16 +    # Extract the endianness options if any
    1.17 +    # This should cover all possible endianness options
    1.18 +    # in gcc, but it is prone to bit-rot... :-(
    1.19 +    endian_extra="$( echo "${extra_flags}"      \
    1.20 +                     |${sed} -r -e '/^(.*[[:space:]])?-(E[BL]|m((big|little)(-endian)?|e?[bl]))([[:space:]].*)?$/!d;' \
    1.21 +                                -e 's//\2/;'    \
    1.22 +                   )"
    1.23 +    case "${endian_extra}" in
    1.24 +        EB|mbig-endian|mbig|meb|mb)
    1.25 +            extra_cc_args="${extra_cc_args} ${endian_extra}"
    1.26 +            ;;
    1.27 +        EL|mlittle-endian|mlittle|mel|ml)
    1.28 +            extra_cc_args="${extra_cc_args} ${endian_extra}"
    1.29 +            ;;
    1.30 +        "") extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
    1.31 +            ;;
    1.32 +    esac
    1.33  
    1.34      touch config.cache
    1.35      if [ "${CT_LIBC_GLIBC_FORCE_UNWIND}" = "y" ]; then