scripts/build/arch/sh.sh
author Daniel Price <daniel.price@gmail.com>
Tue Nov 20 16:59:17 2012 -0800 (2012-11-20)
changeset 3126 333d3e40cbd1
parent 2760 b402a49734a3
child 3169 9d0b37f08a10
permissions -rw-r--r--
scripts: refine static linking check to better guide the user

The current mechanism to check if static linking is possible, and the mesage
displayed on failure, can be puzzling to the unsuspecting user.

Also, the current implementation is not using the existing infrastructure,
and is thus difficult to enhance with new tests.

So, switch to using the standard CT_DoExecLog infra, and use four tests to
check for the host compiler:
- check we can run it
- check it can build a trivial program
- check it can statically link that program
- check if it statically link with libstdc++

That should cover most of the problems. Hopefully.

(At the same time, fix a typo in a comment)

Signed-off-by: Daniel Price <daniel.price@gmail.com>
[yann.morin.1998@free.fr: split original patch for self-contained changes]
[yann.morin.1998@free.fr: use steps to better see gcc's output]
[yann.morin.1998@free.fr: commit log]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <163f86b5216fc08c672a.1353459722@nipigon.dssd.com>
Patchwork-Id: 200536
yann@413
     1
# Compute sh-specific values
yann@413
     2
yann@964
     3
CT_DoArchTupleValues () {
yann@413
     4
    # The architecture part of the tuple:
yann@413
     5
    CT_TARGET_ARCH="${CT_ARCH_SH_VARIANT}${target_endian_eb}"
yann@413
     6
yann@413
     7
    # gcc ./configure flags
yann@413
     8
    CT_ARCH_WITH_ARCH=
yann@413
     9
    CT_ARCH_WITH_ABI=
yann@413
    10
    CT_ARCH_WITH_CPU=
yann@413
    11
    CT_ARCH_WITH_TUNE=
yann@413
    12
    CT_ARCH_WITH_FPU=
yann@413
    13
    CT_ARCH_WITH_FLOAT=
yann@413
    14
yann@413
    15
    # Endianness stuff
yann@2775
    16
    case "${CT_ARCH_ENDIAN}" in
yann@2775
    17
        big)    CT_ARCH_ENDIAN_CFLAG=-mb;;
yann@2775
    18
        little) CT_ARCH_ENDIAN_CFLAG=-ml;;
yann@413
    19
    esac
yann@413
    20
yann@413
    21
    # CFLAGS
yann@1936
    22
    case "${CT_ARCH_SH_VARIANT}" in
yann@413
    23
        sh3)    CT_ARCH_ARCH_CFLAG=-m3;;
yann@413
    24
        sh4*)
yann@2760
    25
            # softfp is not possible for SuperH, no need to test for it.
yann@2760
    26
            case "${CT_ARCH_FLOAT}" in
yann@2760
    27
                hard)
yann@2760
    28
                    CT_ARCH_ARCH_CFLAG="-m4${CT_ARCH_SH_VARIANT##sh?}"
yann@2760
    29
                    ;;
yann@2760
    30
                soft)
yann@2760
    31
                    CT_ARCH_ARCH_CFLAG="-m4${CT_ARCH_SH_VARIANT##sh?}-nofpu"
yann@2760
    32
                    ;;
yann@413
    33
            esac
yann@413
    34
            ;;
yann@413
    35
    esac
yann@413
    36
    CT_ARCH_FLOAT_CFLAG=
yann@413
    37
}