about summary refs log tree commit diff
path: root/sysdeps/csky/preconfigure
blob: 8a6136dd8dd5e579eb34c37b1f26ce480e880ca4 (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
# 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'`
    hard_float=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
      sed -n 's/^#define __CSKY_HARD_FLOAT__ \(.*\)/\1/p'`
    hard_float_sf=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
      sed -n 's/^#define __CSKY_HARD_FLOAT_FPU_SF__ \(.*\)/\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

    # __CSKY_HARD_FLOAT_ABI__ was added on gcc 11 to specify whether
    # -mfloat-abi=hard is set.  On older gcc, the float ABI is defined solely
    # with __CSKY_HARD_FLOAT__.  If __CSKY_HARD_FLOAT__ is set, it can be
    # either a hard-float ABI (gcc older than 11, or gcc11 -mfloat-abi=hard
    # (__CSKY_HARD_FLOAT_ABI__ is set) or -mfloat-abi=softfp
    # (__CSKY_HARD_FLOAT_ABI__ is not set). To be compatible with older gcc,
    # use __CSKY_HARD_FLOAT_FPU_SF__ identify if -mfloat-abi is supported,
    # because it is added to gcc at the same time as -mfloat-abi.
    if test -n "$hard_float"; then
	if test -z "$hard_float_sf"; then
	    with_fp_cond=1
	else
	    if test -n "$hard_float_abi"; then
		with_fp_cond=1
	    else
		with_fp_cond=0
	    fi
	fi
    else
	with_fp_cond=0
    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

    ;;
esac