111
|
1 # -*- shell-script -*-
|
131
|
2 # Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
111
|
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 # 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
|
|
33 case "${target_cpu}" in
|
|
34 alpha*)
|
|
35 # fenv.c needs this option to generate inexact exceptions.
|
|
36 XCFLAGS="${XCFLAGS} -mfp-trap-mode=sui"
|
|
37 ARCH=alpha
|
|
38 ;;
|
|
39 rs6000 | powerpc*) ARCH=powerpc ;;
|
|
40 riscv*) ARCH=riscv ;;
|
|
41 sh*) ARCH=sh ;;
|
|
42
|
131
|
43 aarch64*)
|
|
44 ARCH=aarch64
|
|
45 case "${target}" in
|
|
46 aarch64*-*-linux*)
|
|
47 if test -n "$enable_aarch64_lse"; then
|
|
48 try_ifunc=yes
|
|
49 fi
|
|
50 ;;
|
|
51 esac
|
|
52 ;;
|
111
|
53 arm*)
|
|
54 ARCH=arm
|
|
55 case "${target}" in
|
|
56 arm*-*-freebsd*)
|
|
57 ;;
|
|
58 *)
|
|
59 # ??? Detect when -march=armv7 is already enabled.
|
|
60 try_ifunc=yes
|
|
61 ;;
|
|
62 esac
|
|
63 ;;
|
|
64 sparc)
|
|
65 case " ${CC} ${CFLAGS} " in
|
|
66 *" -m64 "*)
|
|
67 ;;
|
|
68 *)
|
|
69 if test -z "$with_cpu"; then
|
|
70 XCFLAGS="${XCFLAGS} -mcpu=v9"
|
|
71 fi
|
|
72 esac
|
|
73 ARCH=sparc
|
|
74 ;;
|
|
75 sparc64|sparcv9)
|
|
76 case " ${CC} ${CFLAGS} " in
|
|
77 *" -m32 "*)
|
|
78 XCFLAGS="${XCFLAGS} -mcpu=v9"
|
|
79 ;;
|
|
80 esac
|
|
81 ARCH=sparc
|
|
82 ;;
|
|
83
|
|
84 i[3456]86)
|
|
85 case " ${CC} ${CFLAGS} " in
|
|
86 *" -m64 "*|*" -mx32 "*)
|
|
87 ;;
|
|
88 *)
|
|
89 if test -z "$with_arch"; then
|
|
90 XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
|
|
91 XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
|
|
92 fi
|
|
93 esac
|
|
94 ARCH=x86
|
|
95 # ??? Detect when -march=i686 is already enabled.
|
|
96 try_ifunc=yes
|
|
97 ;;
|
|
98 x86_64)
|
|
99 case " ${CC} ${CFLAGS} " in
|
|
100 *" -m32 "*)
|
|
101 XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
|
|
102 XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
|
|
103 ;;
|
|
104 *)
|
|
105 ;;
|
|
106 esac
|
|
107 ARCH=x86
|
|
108 # ??? Detect when -mcx16 is already enabled.
|
|
109 try_ifunc=yes
|
|
110 ;;
|
|
111
|
|
112 *) ARCH="${target_cpu}" ;;
|
|
113 esac
|
|
114
|
|
115 # The cpu configury is always most relevant.
|
|
116 if test -d ${srcdir}/config/$ARCH ; then
|
|
117 config_path="$ARCH"
|
|
118 fi
|
|
119
|
|
120 # Other system configury
|
|
121 case "${target}" in
|
131
|
122 aarch64*-*-linux*)
|
|
123 # OS support for atomic primitives.
|
|
124 config_path="${config_path} linux/aarch64 posix"
|
|
125 ;;
|
|
126
|
111
|
127 arm*-*-linux*)
|
|
128 # OS support for atomic primitives.
|
|
129 config_path="${config_path} linux/arm posix"
|
|
130 ;;
|
|
131
|
131
|
132 s390*-*-linux*)
|
|
133 # OS support for atomic primitives.
|
|
134 config_path="${config_path} s390 posix"
|
|
135 ;;
|
|
136
|
111
|
137 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu \
|
|
138 | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly* \
|
|
139 | *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \
|
|
140 | *-*-darwin* | *-*-aix* | *-*-cygwin*)
|
|
141 # POSIX system. The OS is supported.
|
|
142 config_path="${config_path} posix"
|
|
143 ;;
|
|
144
|
|
145 *-*-mingw*)
|
|
146 # OS support for atomic primitives.
|
|
147 case ${target_thread_file} in
|
|
148 win32)
|
|
149 config_path="${config_path} mingw"
|
|
150 ;;
|
|
151 posix)
|
|
152 config_path="${config_path} posix"
|
|
153 ;;
|
|
154 esac
|
|
155 ;;
|
|
156
|
|
157 *-*-rtems*)
|
|
158 XCFLAGS="${configure_tgt_pre_target_cpu_XCFLAGS}"
|
|
159 config_path="rtems"
|
|
160 ;;
|
|
161
|
|
162 *-*-elf*)
|
|
163 # ??? No target OS. We could be targeting bare-metal kernel-mode,
|
|
164 # or user-mode for some custom OS. If the target supports TAS,
|
|
165 # we can build our own spinlocks, given there are no signals.
|
|
166 # If the target supports disabling interrupts, we can work in
|
|
167 # kernel-mode, given the system is not multi-processor.
|
|
168 UNSUPPORTED=1
|
|
169 ;;
|
|
170
|
|
171 *)
|
|
172 # Who are you?
|
|
173 UNSUPPORTED=1
|
|
174 ;;
|
|
175 esac
|
131
|
176
|
|
177 # glibc will pass hwcap to ifunc resolver functions as an argument.
|
|
178 # The type may be different on different architectures.
|
|
179 case "${target}" in
|
|
180 aarch64*-*-*)
|
|
181 IFUNC_RESOLVER_ARGS="uint64_t hwcap"
|
|
182 ;;
|
|
183 *)
|
|
184 IFUNC_RESOLVER_ARGS="void"
|
|
185 ;;
|
|
186 esac
|