]>
Commit | Line | Data |
---|---|---|
48310492 | 1 | # -*- shell-script -*- |
cbe34bb5 | 2 | # Copyright (C) 2012-2017 Free Software Foundation, Inc. |
48310492 RH |
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 | ||
26 | # Map the target cpu to an ARCH sub-directory. At the same time, | |
27 | # work out any special compilation flags as necessary. | |
28 | ||
c47194d2 SH |
29 | # Give operating systems the opportunity to discard XCFLAGS modifications based |
30 | # on ${target_cpu}. For example to allow proper use of multilibs. | |
31 | configure_tgt_pre_target_cpu_XCFLAGS="${XCFLAGS}" | |
32 | ||
48310492 | 33 | case "${target_cpu}" in |
537b5312 UB |
34 | alpha*) |
35 | # fenv.c needs this option to generate inexact exceptions. | |
36 | XCFLAGS="${XCFLAGS} -mfp-trap-mode=sui" | |
37 | ARCH=alpha | |
38 | ;; | |
48310492 | 39 | rs6000 | powerpc*) ARCH=powerpc ;; |
b906c007 | 40 | riscv*) ARCH=riscv ;; |
48310492 RH |
41 | sh*) ARCH=sh ;; |
42 | ||
43 | arm*) | |
44 | ARCH=arm | |
82a19768 AT |
45 | case "${target}" in |
46 | arm*-*-freebsd*) | |
47 | ;; | |
48 | *) | |
49 | # ??? Detect when -march=armv7 is already enabled. | |
50 | try_ifunc=yes | |
51 | ;; | |
52 | esac | |
53 | ;; | |
48310492 RH |
54 | sparc) |
55 | case " ${CC} ${CFLAGS} " in | |
56 | *" -m64 "*) | |
57 | ;; | |
58 | *) | |
59 | if test -z "$with_cpu"; then | |
60 | XCFLAGS="${XCFLAGS} -mcpu=v9" | |
61 | fi | |
62 | esac | |
63 | ARCH=sparc | |
64 | ;; | |
65 | sparc64|sparcv9) | |
66 | case " ${CC} ${CFLAGS} " in | |
67 | *" -m32 "*) | |
68 | XCFLAGS="${XCFLAGS} -mcpu=v9" | |
69 | ;; | |
70 | esac | |
71 | ARCH=sparc | |
72 | ;; | |
73 | ||
74 | i[3456]86) | |
75 | case " ${CC} ${CFLAGS} " in | |
5eb4cb47 | 76 | *" -m64 "*|*" -mx32 "*) |
48310492 RH |
77 | ;; |
78 | *) | |
79 | if test -z "$with_arch"; then | |
80 | XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | |
81 | XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | |
82 | fi | |
83 | esac | |
84 | ARCH=x86 | |
85 | # ??? Detect when -march=i686 is already enabled. | |
86 | try_ifunc=yes | |
87 | ;; | |
88 | x86_64) | |
3dd7e092 L |
89 | case " ${CC} ${CFLAGS} " in |
90 | *" -m32 "*) | |
91 | XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" | |
92 | XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | |
93 | ;; | |
94 | *) | |
95 | ;; | |
96 | esac | |
48310492 RH |
97 | ARCH=x86 |
98 | # ??? Detect when -mcx16 is already enabled. | |
99 | try_ifunc=yes | |
100 | ;; | |
101 | ||
102 | *) ARCH="${target_cpu}" ;; | |
103 | esac | |
104 | ||
105 | # The cpu configury is always most relevant. | |
106 | if test -d ${srcdir}/config/$ARCH ; then | |
107 | config_path="$ARCH" | |
108 | fi | |
109 | ||
110 | # Other system configury | |
111 | case "${target}" in | |
112 | arm*-*-linux*) | |
113 | # OS support for atomic primitives. | |
114 | config_path="${config_path} linux/arm posix" | |
115 | ;; | |
116 | ||
117 | *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu \ | |
b6735e76 | 118 | | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly* \ |
48310492 | 119 | | *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \ |
6fe8c024 | 120 | | *-*-darwin* | *-*-aix* | *-*-cygwin*) |
48310492 RH |
121 | # POSIX system. The OS is supported. |
122 | config_path="${config_path} posix" | |
123 | ;; | |
124 | ||
dc3368d0 KT |
125 | *-*-mingw*) |
126 | # OS support for atomic primitives. | |
127 | case ${target_thread_file} in | |
128 | win32) | |
129 | config_path="${config_path} mingw" | |
130 | ;; | |
131 | posix) | |
132 | config_path="${config_path} posix" | |
133 | ;; | |
134 | esac | |
135 | ;; | |
c47194d2 SH |
136 | |
137 | *-*-rtems*) | |
138 | XCFLAGS="${configure_tgt_pre_target_cpu_XCFLAGS}" | |
139 | config_path="rtems" | |
140 | ;; | |
141 | ||
48310492 RH |
142 | *-*-elf*) |
143 | # ??? No target OS. We could be targeting bare-metal kernel-mode, | |
144 | # or user-mode for some custom OS. If the target supports TAS, | |
145 | # we can build our own spinlocks, given there are no signals. | |
146 | # If the target supports disabling interrupts, we can work in | |
147 | # kernel-mode, given the system is not multi-processor. | |
148 | UNSUPPORTED=1 | |
149 | ;; | |
150 | ||
151 | *) | |
152 | # Who are you? | |
153 | UNSUPPORTED=1 | |
154 | ;; | |
155 | esac |