configure.tgt 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. # -*- shell-script -*-
  2. # Copyright (C) 2011-2022 Free Software Foundation, Inc.
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation; either version 2 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software
  15. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. # This is the target specific configuration file. This is invoked by the
  17. # autoconf generated configure script. Putting it in a separate shell file
  18. # lets us skip running autoconf when modifying target specific information.
  19. # This file switches on the shell variable ${target}, and sets the
  20. # following shell variables:
  21. # config_path An ordered list of directories to search for
  22. # sources and headers. This is relative to the
  23. # config subdirectory of the source tree.
  24. # XCFLAGS Add extra compile flags to use.
  25. # XLDFLAGS Add extra link flags to use.
  26. # Optimize TLS usage by avoiding the overhead of dynamic allocation.
  27. if test "$gcc_cv_have_tls" = yes ; then
  28. case "${target}" in
  29. *-*-musl*)
  30. ;;
  31. # For x86, we use slots in the TCB head for most of our TLS.
  32. # The setup of those slots in beginTransaction can afford to
  33. # use the global-dynamic model.
  34. i[456]86-*-linux* | x86_64-*-linux*)
  35. ;;
  36. *-*-linux*)
  37. XCFLAGS="${XCFLAGS} -ftls-model=initial-exec"
  38. ;;
  39. esac
  40. fi
  41. # Map the target cpu to an ARCH sub-directory. At the same time,
  42. # work out any special compilation flags as necessary.
  43. case "${target_cpu}" in
  44. aarch64*) ARCH=aarch64 ;;
  45. alpha*) ARCH=alpha ;;
  46. rs6000 | powerpc*)
  47. XCFLAGS="${XCFLAGS} -mhtm"
  48. ARCH=powerpc
  49. ;;
  50. arm*) ARCH=arm ;;
  51. i[3456]86 | x86_64)
  52. cat > conftestx.c <<EOF
  53. #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
  54. #error need -march=i486
  55. #endif
  56. EOF
  57. if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then
  58. :
  59. else
  60. if test "${target_cpu}" = x86_64; then
  61. XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
  62. else
  63. XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
  64. fi
  65. XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
  66. fi
  67. rm -f conftestx.c
  68. XCFLAGS="${XCFLAGS} -mrtm"
  69. ARCH=x86
  70. ;;
  71. sh*) ARCH=sh ;;
  72. sparc)
  73. case " ${CC} ${CFLAGS} " in
  74. *" -m64 "*)
  75. ;;
  76. *)
  77. if test -z "$with_cpu"; then
  78. XCFLAGS="${XCFLAGS} -mcpu=v9"
  79. fi
  80. esac
  81. ARCH=sparc
  82. ;;
  83. sparc64|sparcv9)
  84. case " ${CC} ${CFLAGS} " in
  85. *" -m32 "*)
  86. XCFLAGS="${XCFLAGS} -mcpu=v9"
  87. ;;
  88. *" -m64 "*)
  89. ;;
  90. *)
  91. if test "x$with_cpu" = xv8; then
  92. XCFLAGS="${XCFLAGS} -mcpu=v9"
  93. fi
  94. ;;
  95. esac
  96. ARCH=sparc
  97. ;;
  98. s390|s390x)
  99. XCFLAGS="${XCFLAGS} -mzarch -mhtm"
  100. ARCH=s390
  101. ;;
  102. *)
  103. ARCH="${target_cpu}"
  104. ;;
  105. esac
  106. # For the benefit of top-level configure, determine if the cpu is supported.
  107. test -d ${srcdir}/config/$ARCH || UNSUPPORTED=1
  108. # Since we require POSIX threads, assume a POSIX system by default.
  109. config_path="$ARCH posix generic"
  110. # Other system configury
  111. case "${target}" in
  112. *-*-linux* | *-*-uclinux*)
  113. if test "$enable_linux_futex" = yes; then
  114. config_path="linux/$ARCH linux $config_path"
  115. fi
  116. ;;
  117. powerpc*-*-aix* | rs6000-*-aix*)
  118. # The system ought to be supported, but sjlj.S has not been ported.
  119. UNSUPPORTED=1
  120. ;;
  121. *-*-gnu* | *-*-k*bsd*-gnu \
  122. | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* \
  123. | *-*-solaris2* | *-*-sysv4* | *-*-hpux11* \
  124. | *-*-aix* | *-*-dragonfly*)
  125. # POSIX system. The OS is supported.
  126. ;;
  127. *-*-darwin*)
  128. # The OS is supported, but we need dynamic lookup to support undefined
  129. # weak symbols at link-time.
  130. XLDFLAGS="${XLDFLAGS} -Wl,-undefined,dynamic_lookup"
  131. ;;
  132. *) # Non-POSIX, or embedded system
  133. UNSUPPORTED=1
  134. ;;
  135. esac