Changes in tools/toolchain.sh [71e3289:3f7efa79] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/toolchain.sh

    r71e3289 r3f7efa79  
    2828# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2929#
     30
     31GMP_MAIN=<<EOF
     32#define GCC_GMP_VERSION_NUM(a, b, c) \
     33        (((a) << 16L) | ((b) << 8) | (c))
     34
     35#define GCC_GMP_VERSION \
     36        GCC_GMP_VERSION_NUM(__GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL)
     37
     38#if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,2)
     39        choke me
     40#endif
     41EOF
     42
     43MPFR_MAIN=<<EOF
     44#if MPFR_VERSION < MPFR_VERSION_NUM(2, 4, 2)
     45choke me
     46        #endif
     47EOF
     48
     49MPC_MAIN=<<EOF
     50#if MPC_VERSION < MPC_VERSION_NUM(0, 8, 1)
     51        choke me
     52#endif
     53EOF
     54
     55#
     56# Check if the library described in the argument
     57# exists and has acceptable version.
     58#
     59check_dependency() {
     60        DEPENDENCY="$1"
     61        HEADER="$2"
     62        BODY="$3"
     63       
     64        FNAME="/tmp/conftest-$$"
     65       
     66        echo "#include ${HEADER}" > "${FNAME}.c"
     67        echo >> "${FNAME}.c"
     68        echo "int main()" >> "${FNAME}.c"
     69        echo "{" >> "${FNAME}.c"
     70        echo "${BODY}" >> "${FNAME}.c"
     71        echo "  return 0;" >> "${FNAME}.c"
     72        echo "}" >> "${FNAME}.c"
     73       
     74        cc -c -o "${FNAME}.o" "${FNAME}.c" 2> "${FNAME}.log"
     75        RC="$?"
     76       
     77        if [ "$RC" -ne "0" ] ; then
     78                echo " ${DEPENDENCY} not found, too old or compiler error."
     79                echo " Please recheck manually the source file \"${FNAME}.c\"."
     80                echo " The compilation of the toolchain is probably going to fail,"
     81                echo " you have been warned."
     82                echo
     83                echo " ===== Compiler output ====="
     84                cat "${FNAME}.log"
     85                echo " ==========================="
     86                echo
     87        else
     88                echo " ${DEPENDENCY} found"
     89                rm -f "${FNAME}.log" "${FNAME}.o" "${FNAME}.c"
     90        fi
     91}
     92
     93check_dependecies() {
     94        echo ">>> Basic dependency check"
     95        check_dependency "GMP" "<gmp.h>" "${GMP_MAIN}"
     96        check_dependency "MPFR" "<mpfr.h>" "${MPFR_MAIN}"
     97        check_dependency "MPC" "<mpc.h>" "${MPC_MAIN}"
     98        echo
     99}
    30100
    31101check_error() {
     
    69139        echo " sparc64    SPARC V9"
    70140        echo " all        build all targets"
     141        echo
     142        echo "The toolchain will be installed to the directory specified by"
     143        echo "the CROSS_PREFIX environment variable. If the variable is not"
     144        echo "defined, /usr/local will be used by default."
    71145        echo
    72146       
     
    118192        echo " - native C library with headers"
    119193        echo
    120        
    121         show_countdown 10
    122194}
    123195
     
    281353
    282354show_dependencies
     355check_dependecies
     356show_countdown 10
    283357
    284358case "$1" in
Note: See TracChangeset for help on using the changeset viewer.