Document use of CC and CFLAGS in more detail (bug 20980, bug 21234).
[glibc.git] / sysdeps / riscv / preconfigure
blobd9adb31b649106b004bb3c7e213197ea7809895d
1 case "$machine" in
2 riscv*)
3     xlen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_xlen \(.*\)/\1/p'`
4     flen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_flen \(.*\)/\1/p'`
5     float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_float_abi_\([^ ]*\) .*/\1/p'`
6     atomic=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | grep '#define __riscv_atomic' | cut -d' ' -f2`
8     case "$xlen" in
9     32)
10         echo "glibc does not yet support 32-bit systems" >&2
11         exit 1
12         ;;
13     64)
14         ;;
15     *)
16         echo "Unable to determine XLEN" >&2
17         exit 1
18         ;;
19     esac
21     case "$flen" in
22     64)
23         float_machine=rvd
24         with_fp_cond=1
25         ;;
26     32)
27         echo "glibc does not yet support systems with the F but not D extensions" >&2
28         exit 1
29         ;;
30     "")
31         with_fp_cond=0
32         ;;
33     *)
34         echo "Unable to determine FLEN" >&2
35         exit 1
36         ;;
37     esac
39     case "$float_abi" in
40     soft)
41         abi_flen=0
42         ;;
43     single)
44         echo "glibc does not yet support the single floating-point ABI" >&2
45         exit 1
46         ;;
47     double)
48         abi_flen=64
49         ;;
50     *)
51         echo "Unable to determine floating-point ABI" >&2
52         exit 1
53         ;;
54     esac
56     case "$atomic" in
57     __riscv_atomic)
58         ;;
59     *)
60         echo "glibc requires the A extension" >&2
61         exit 1
62         ;;
63     esac
65     base_machine=riscv
66     machine=riscv/rv$xlen/$float_machine
68     $as_echo "#define RISCV_ABI_XLEN $xlen" >>confdefs.h
69     $as_echo "#define RISCV_ABI_FLEN $abi_flen" >>confdefs.h
70     ;;
71 esac