preconfigure 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # This file is generated from configure.ac by Autoconf. DO NOT EDIT!
  2. # Local preconfigure fragment for sysdeps/riscv
  3. case "$machine" in
  4. riscv*)
  5. xlen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_xlen \(.*\)/\1/p'`
  6. flen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_flen \(.*\)/\1/p'`
  7. float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_float_abi_\([^ ]*\) .*/\1/p'`
  8. atomic=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | grep '#define __riscv_atomic' | cut -d' ' -f2`
  9. vector=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_v \(.*\)/\1/p'`
  10. case "$xlen" in
  11. 64 | 32)
  12. ;;
  13. *)
  14. as_fn_error 1 "Unable to determine XLEN" "$LINENO" 5
  15. ;;
  16. esac
  17. case "$flen" in
  18. 64)
  19. float_machine=rvd
  20. with_fp_cond=1
  21. ;;
  22. 32)
  23. as_fn_error 1 "glibc does not yet support systems with the F but not D extensions" "$LINENO" 5
  24. ;;
  25. "")
  26. with_fp_cond=0
  27. ;;
  28. *)
  29. as_fn_error 1 "Unable to determine FLEN" "$LINENO" 5
  30. ;;
  31. esac
  32. case "$float_abi" in
  33. soft)
  34. abi_flen=0
  35. ;;
  36. single)
  37. as_fn_error 1 "glibc does not yet support the single floating-point ABI" "$LINENO" 5
  38. ;;
  39. double)
  40. abi_flen=64
  41. ;;
  42. *)
  43. as_fn_error 1 "Unable to determine floating-point ABI" "$LINENO" 5
  44. ;;
  45. esac
  46. case "$atomic" in
  47. __riscv_atomic)
  48. ;;
  49. *)
  50. as_fn_error 1 "glibc requires the A extension" "$LINENO" 5
  51. ;;
  52. esac
  53. if test -n "$vector"; then
  54. version=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __GNUC__ \(.*\)/\1/p'`
  55. test $version -lt 15 && as_fn_error 1 "glibc requires GCC 15 or later for the V extension" "$LINENO" 5
  56. test $vector -lt "1000000" && as_fn_error 1 "glibc requires at least RVV 1.0 for the V extension" "$LINENO" 5
  57. float_machine=rvv
  58. fi
  59. base_machine=riscv
  60. machine=riscv/rv$xlen/$float_machine
  61. printf "%s\n" "#define RISCV_ABI_XLEN $xlen" >>confdefs.h
  62. printf "%s\n" "#define RISCV_ABI_FLEN $abi_flen" >>confdefs.h
  63. ;;
  64. esac