diff options
Diffstat (limited to 'configure')
| -rwxr-xr-x | configure | 57 | 
1 files changed, 43 insertions, 14 deletions
| @@ -204,7 +204,7 @@ fi  abs_builddir="$(pwd)" || fail "$0: cannot determine working directory"  abs_srcdir="$(cd $srcdir && pwd)" || fail "$0: invalid source directory $srcdir"  test "$abs_srcdir" = "$abs_builddir" && srcdir=. -test "$srcdir" != "." -a -f Makefile -a ! -h Makefile && fail "$0: Makefile already exists in the working directory" +test "$srcdir" != "." && test -f Makefile && test ! -h Makefile && fail "$0: Makefile already exists in the working directory"  #  # Get a temp filename we can use @@ -279,7 +279,7 @@ echo "$cc_family"  #  # Figure out toolchain wrapper to build  # -if test "$wrapper" = auto -o "$wrapper" = detect ; then +if test "$wrapper" = auto || test "$wrapper" = detect ; then  echo "#include <stdlib.h>" > "$tmpc"  echo "#if ! __GLIBC__" >> "$tmpc"  echo "#error no" >> "$tmpc" @@ -328,6 +328,7 @@ i?86*) ARCH=i386 ;;  x86_64-x32*|x32*|x86_64*x32) ARCH=x32 ;;  x86_64-nt64*) ARCH=nt64 ;;  x86_64*) ARCH=x86_64 ;; +loongarch64*) ARCH=loongarch64 ;;  m68k*) ARCH=m68k ;;  mips64*|mipsisa64*) ARCH=mips64 ;;  mips*) ARCH=mips ;; @@ -336,6 +337,7 @@ or1k*) ARCH=or1k ;;  powerpc64*|ppc64*) ARCH=powerpc64 ;;  powerpc*|ppc*) ARCH=powerpc ;;  riscv64*) ARCH=riscv64 ;; +riscv32*) ARCH=riscv32 ;;  sh[1-9bel-]*|sh|superh*) ARCH=sh ;;  s390x*) ARCH=s390x ;;  unknown) fail "$0: unable to detect target arch; try $0 --target=..." ;; @@ -354,6 +356,14 @@ tryflag CFLAGS_C99FSE -fexcess-precision=standard \  tryflag CFLAGS_C99FSE -frounding-math  # +# Semantically we want to insist that our sources follow the +# C rules for type-based aliasing, but most if not all real-world +# compilers are known or suspected to have critical bugs in their +# type-based aliasing analysis. See for example GCC bug 107107. +# +tryflag CFLAGS_C99FSE -fno-strict-aliasing + +#  # We may use the may_alias attribute if __GNUC__ is defined, so  # if the compiler defines __GNUC__ but does not provide it,  # it must be defined away as part of the CFLAGS. @@ -409,7 +419,7 @@ test "$debug" = yes && CFLAGS_AUTO=-g  #  printf "checking whether we should preprocess assembly to add debugging information... "  if fnmatch '-g*|*\ -g*' "$CFLAGS_AUTO $CFLAGS" && -   test -f "tools/add-cfi.$ARCH.awk" && +   test -f "$srcdir/tools/add-cfi.$ARCH.awk" &&     printf ".file 1 \"srcfile.s\"\n.line 1\n.cfi_startproc\n.cfi_endproc" | $CC -g -x assembler -c -o /dev/null 2>/dev/null -  then    ADD_CFI=yes @@ -436,7 +446,20 @@ xno|x) printf "disabled\n" ; optimize=no ;;  *) printf "custom\n" ;;  esac -test "$optimize" = no || tryflag CFLAGS_AUTO -Os || tryflag CFLAGS_AUTO -O2 +if test "$optimize" = no ; then : +else +tryflag CFLAGS_AUTO -O2 +tryflag CFLAGS_AUTO -fno-align-jumps +tryflag CFLAGS_AUTO -fno-align-functions +tryflag CFLAGS_AUTO -fno-align-loops +tryflag CFLAGS_AUTO -fno-align-labels +tryflag CFLAGS_AUTO -fira-region=one +tryflag CFLAGS_AUTO -fira-hoist-pressure +tryflag CFLAGS_AUTO -freorder-blocks-algorithm=simple \ +|| tryflag CFLAGS_AUTO -fno-reorder-blocks +tryflag CFLAGS_AUTO -fno-prefetch-loop-arrays +tryflag CFLAGS_AUTO -fno-tree-ch +fi  test "$optimize" = yes && optimize="internal,malloc,string"  if fnmatch 'no|size' "$optimize" ; then : @@ -468,7 +491,7 @@ tryflag CFLAGS_AUTO -pipe  # pointer is no longer needed for debugging.  #  if fnmatch '-g*|*\ -g*' "$CFLAGS_AUTO $CFLAGS" ; then : -else  +else  tryflag CFLAGS_AUTO -fomit-frame-pointer  fi @@ -650,6 +673,19 @@ if test "$ARCH" = "aarch64" ; then  trycppif __AARCH64EB__ "$t" && SUBARCH=${SUBARCH}_be  fi +if test "$ARCH" = "loongarch64" ; then +trycppif __loongarch_soft_float "$t" && SUBARCH=${SUBARCH}-sf +trycppif __loongarch_single_float "$t" && SUBARCH=${SUBARCH}-sp +printf "checking whether assembler support FCSRs... " +echo "__asm__(\"movfcsr2gr \$t0,\$fcsr0\");" > "$tmpc" +if $CC -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then +printf "yes\n" +else +printf "no\n" +CFLAGS_AUTO="$CFLAGS_AUTO -DBROKEN_LOONGARCH_FCSR_ASM" +fi +fi +  if test "$ARCH" = "m68k" ; then  if trycppif "__HAVE_68881__" ; then : ;  elif trycppif "__mcffpu__" ; then SUBARCH="-fp64" @@ -671,9 +707,7 @@ trycppif __mips_soft_float "$t" && SUBARCH=${SUBARCH}-sf  fi  if test "$ARCH" = "powerpc" ; then -trycppif "__NO_FPRS__ && !_SOFT_FLOAT" "$t" && fail \ -  "$0: error: compiler's floating point configuration is unsupported" -trycppif _SOFT_FLOAT "$t" && SUBARCH=${SUBARCH}-sf +trycppif "_SOFT_FLOAT || __NO_FPRS__" "$t" && SUBARCH=${SUBARCH}-sf  printf "checking whether compiler can use 'd' constraint in asm... "  echo 'double f(double x) { __asm__ ("fabs %0, %1" : "=d"(x) : "d"(x)); return x; }' > "$tmpc"  if $CC $CFLAGS_C99FSE $CPPFLAGS $CFLAGS -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then @@ -694,7 +728,7 @@ trycppif __LITTLE_ENDIAN__ "$t" && SUBARCH=${SUBARCH}le  trycppif _SOFT_FLOAT "$t" && fail "$0: error: soft-float not supported on powerpc64"  fi -if test "$ARCH" = "riscv64" ; then +if test "$ARCH" = "riscv64" -o "$ARCH" = "riscv32" ; then  trycppif __riscv_float_abi_soft "$t" && SUBARCH=${SUBARCH}-sf  trycppif __riscv_float_abi_single "$t" && SUBARCH=${SUBARCH}-sp  fi @@ -725,11 +759,6 @@ fi  test "$SUBARCH" \  && printf "configured for %s variant: %s\n" "$ARCH" "$ARCH$SUBARCH" -case "$ARCH$SUBARCH" in -arm) ASMSUBARCH=el ;; -*) ASMSUBARCH=$SUBARCH ;; -esac -  #  # Some archs (powerpc) have different possible long double formats  # that the compiler can be configured for. The logic for whether this | 
