about summary refs log tree commit diff
path: root/sysdeps/csky/preconfigure
blob: 7f8621b6075858f09ad0ba359c1f636a386f3364 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
# Local preconfigure fragment for sysdeps/csky

case "$machine" in
csky*)
    abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
      sed -n 's/^#define __CSKYABI__ \(.*\)/\1/p'`
    soft_float=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
      sed -n 's/^#define __CSKY_SOFT_FLOAT__ \(.*\)/\1/p'`
    hard_float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
      sed -n 's/^#define __CSKY_HARD_FLOAT_ABI__ \(.*\)/\1/p'`

    case "$abi" in
    1)
	as_fn_error 1 "glibc does not support abiv1 yet" "$LINENO" 5
	;;
    2)
	machine=abiv2
	;;
    *)
	as_fn_error 1 "Unknown abi" "$LINENO" 5
	;;
    esac

    # This check is for compatibility with GCC versions earlier than 11.
    # The older versions of C-SKY GCC do not support the '-mfloat-abi=softfp' option
    # and never define the '__CSKY_HARD_FLOAT_ABI__'.
    # Therefore, if a check for '-mfloat-abi=softfp' is added as the expression
    #     'defined(__CSKY_HARD_FLOAT__) && !defined(__CSKY_HARD_FLOAT_ABI__)'
    # which is correct for newer versions of GCC will not work for those older versions.
    # Since no expression compatible with all versions of GCC exists,
    # a check for the '-mfloat-abi=softfp' option is added.
    if { ac_try='${CC-cc} -S -mfloat-abi=softfp /dev/null 1>&5'
  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; }; then
      soft_float_abi_support=1
    else
      soft_float_abi_support=0
    fi

    if test -n "$soft_float"; then
	with_fp_cond=0
	with_hard_float_abi=0
    else
	with_fp_cond=1
	if test -n "$soft_float_abi_support"; then
	    if test -n "$hard_float_abi"; then
		with_hard_float_abi=1
	    else
		with_hard_float_abi=0
	    fi
	else
	    with_hard_float_abi=1
	fi
    fi

    base_machine=csky
    machine=csky/$machine

    cat >>confdefs.h <<_ACEOF
#define CSKYABI $abi
_ACEOF

    cat >>confdefs.h <<_ACEOF
#define CSKY_HARD_FLOAT $with_fp_cond
_ACEOF

    cat >>confdefs.h <<_ACEOF
#define CSKY_HARD_FLOAT_ABI $with_hard_float_abi
_ACEOF

    ;;
esac