configure.tgt 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. # -*- shell-script -*-
  2. # Copyright (C) 2012-2015 Free Software Foundation, Inc.
  3. # Contributed by Richard Henderson <rth@redhat.com>.
  4. #
  5. # This file is part of the GNU Atomic Library (libatomic).
  6. #
  7. # Libatomic is free software; you can redistribute it and/or modify it
  8. # under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
  13. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  14. # FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  15. # more details.
  16. #
  17. # Under Section 7 of GPL version 3, you are granted additional
  18. # permissions described in the GCC Runtime Library Exception, version
  19. # 3.1, as published by the Free Software Foundation.
  20. #
  21. # You should have received a copy of the GNU General Public License and
  22. # a copy of the GCC Runtime Library Exception along with this program;
  23. # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  24. # <http://www.gnu.org/licenses/>.
  25. # Map the target cpu to an ARCH sub-directory. At the same time,
  26. # work out any special compilation flags as necessary.
  27. case "${target_cpu}" in
  28. alpha*)
  29. # fenv.c needs this option to generate inexact exceptions.
  30. XCFLAGS="${XCFLAGS} -mfp-trap-mode=sui"
  31. ARCH=alpha
  32. ;;
  33. rs6000 | powerpc*) ARCH=powerpc ;;
  34. sh*) ARCH=sh ;;
  35. arm*)
  36. ARCH=arm
  37. case "${target}" in
  38. arm*-*-freebsd*)
  39. ;;
  40. *)
  41. # ??? Detect when -march=armv7 is already enabled.
  42. try_ifunc=yes
  43. ;;
  44. esac
  45. ;;
  46. sparc)
  47. case " ${CC} ${CFLAGS} " in
  48. *" -m64 "*)
  49. ;;
  50. *)
  51. if test -z "$with_cpu"; then
  52. XCFLAGS="${XCFLAGS} -mcpu=v9"
  53. fi
  54. esac
  55. ARCH=sparc
  56. ;;
  57. sparc64|sparcv9)
  58. case " ${CC} ${CFLAGS} " in
  59. *" -m32 "*)
  60. XCFLAGS="${XCFLAGS} -mcpu=v9"
  61. ;;
  62. esac
  63. ARCH=sparc
  64. ;;
  65. i[3456]86)
  66. case " ${CC} ${CFLAGS} " in
  67. *" -m64 "*|*" -mx32 "*)
  68. ;;
  69. *)
  70. if test -z "$with_arch"; then
  71. XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
  72. XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
  73. fi
  74. esac
  75. ARCH=x86
  76. # ??? Detect when -march=i686 is already enabled.
  77. try_ifunc=yes
  78. ;;
  79. x86_64)
  80. case " ${CC} ${CFLAGS} " in
  81. *" -m32 "*)
  82. XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
  83. XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
  84. ;;
  85. *)
  86. ;;
  87. esac
  88. ARCH=x86
  89. # ??? Detect when -mcx16 is already enabled.
  90. try_ifunc=yes
  91. ;;
  92. *) ARCH="${target_cpu}" ;;
  93. esac
  94. # The cpu configury is always most relevant.
  95. if test -d ${srcdir}/config/$ARCH ; then
  96. config_path="$ARCH"
  97. fi
  98. # Other system configury
  99. case "${target}" in
  100. arm*-*-linux*)
  101. # OS support for atomic primitives.
  102. config_path="${config_path} linux/arm posix"
  103. ;;
  104. *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu \
  105. | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* \
  106. | *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \
  107. | *-*-darwin* | *-*-aix* | *-*-cygwin*)
  108. # POSIX system. The OS is supported.
  109. config_path="${config_path} posix"
  110. ;;
  111. *-*-mingw*)
  112. # OS support for atomic primitives.
  113. case ${target_thread_file} in
  114. win32)
  115. config_path="${config_path} mingw"
  116. ;;
  117. posix)
  118. config_path="${config_path} posix"
  119. ;;
  120. esac
  121. ;;
  122. *-*-elf*)
  123. # ??? No target OS. We could be targeting bare-metal kernel-mode,
  124. # or user-mode for some custom OS. If the target supports TAS,
  125. # we can build our own spinlocks, given there are no signals.
  126. # If the target supports disabling interrupts, we can work in
  127. # kernel-mode, given the system is not multi-processor.
  128. UNSUPPORTED=1
  129. ;;
  130. *)
  131. # Who are you?
  132. UNSUPPORTED=1
  133. ;;
  134. esac