1GLIBC_PROVIDES[]dnl See aclocal.m4 in the top level source directory.
2# Local preconfigure fragment for sysdeps/riscv
3
4case "$machine" in
5riscv*)
6    xlen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_xlen \(.*\)/\1/p'`
7    flen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_flen \(.*\)/\1/p'`
8    float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_float_abi_\([^ ]*\) .*/\1/p'`
9    atomic=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | grep '#define __riscv_atomic' | cut -d' ' -f2`
10
11    case "$xlen" in
12    64 | 32)
13	;;
14    *)
15	AC_MSG_ERROR([Unable to determine XLEN], [1])
16	;;
17    esac
18
19    case "$flen" in
20    64)
21	float_machine=rvd
22	with_fp_cond=1
23	;;
24    32)
25	AC_MSG_ERROR([glibc does not yet support systems with the F but not D extensions], 1)
26	;;
27    "")
28	with_fp_cond=0
29	;;
30    *)
31	AC_MSG_ERROR([Unable to determine FLEN], [1])
32	;;
33    esac
34
35    case "$float_abi" in
36    soft)
37	abi_flen=0
38	;;
39    single)
40	AC_MSG_ERROR([glibc does not yet support the single floating-point ABI], [1])
41	;;
42    double)
43	abi_flen=64
44	;;
45    *)
46	AC_MSG_ERROR([Unable to determine floating-point ABI], [1])
47	;;
48    esac
49
50    case "$atomic" in
51    __riscv_atomic)
52	;;
53    *)
54	AC_MSG_ERROR([glibc requires the A extension], [1])
55	;;
56    esac
57
58    base_machine=riscv
59    machine=riscv/rv$xlen/$float_machine
60
61    AC_DEFINE_UNQUOTED([RISCV_ABI_XLEN], [$xlen])
62    AC_DEFINE_UNQUOTED([RISCV_ABI_FLEN], [$abi_flen])
63    ;;
64esac
65