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