]>
Commit | Line | Data |
---|---|---|
b731048b | 1 | # configure.host |
2c839a4e | 2 | # |
b731048b BK |
3 | # This shell script handles all host based configuration for libstdc++. |
4 | # It sets various shell variables based on the the host and the | |
2c839a4e PE |
5 | # configuration options. You can modify this shell script without needing |
6 | # to rerun autoconf/aclocal/etc. This file is "sourced" not executed. | |
7 | # | |
8 | # You should read docs/html/17_intro/porting.* to make sense of this file. | |
9 | # | |
10 | # | |
11 | # It uses the following shell variables as set by config.guess: | |
b731048b BK |
12 | # host The configuration host (full CPU-vendor-OS triplet) |
13 | # host_cpu The configuration host CPU | |
14 | # host_os The configuration host OS | |
2c839a4e PE |
15 | # |
16 | # | |
17 | # It sets the following shell variables: | |
18 | # | |
19 | # cpu_include_dir CPU-specific directory, defaults to cpu/generic | |
7d3998a4 PE |
20 | # if cpu/host_cpu doesn't exist. This is not used |
21 | # directly, but sets the default for others. | |
2c839a4e PE |
22 | # |
23 | # os_include_dir OS-specific directory, defaults to os/generic. | |
24 | # | |
803f183a | 25 | # c_model the "C" header model, defaults to c_global. |
e01c9849 | 26 | # |
17640f24 | 27 | # c_compatibility if "C" compatibility headers are necessary, |
ef16a298 | 28 | # defaults to no. |
2c839a4e | 29 | # |
ef16a298 BK |
30 | # abi_baseline_pair directory name for ABI compat testing, |
31 | # defaults to host_cpu-host_os (as per config.guess) | |
314b5a68 | 32 | # |
00fc1bf6 RO |
33 | # abi_baseline_subdir_switch |
34 | # g++ switch to determine ABI baseline subdir for | |
35 | # multilibbed targets, | |
36 | # defaults to --print-multi-directory | |
37 | # | |
7d3998a4 PE |
38 | # abi_tweaks_dir location of cxxabi_tweaks.h, |
39 | # defaults to cpu_include_dir | |
40 | # | |
2c5d0ae8 | 41 | # atomicity_dir location of atomicity.h, |
ef16a298 | 42 | # defaults to cpu_include_dir |
ca017eef | 43 | # |
2c5d0ae8 BK |
44 | # atomic_word_dir location of atomic_word.h |
45 | # defaults to generic. | |
46 | # | |
c2ba9709 JS |
47 | # atomic_flags extra flags to pass to use atomic instructions |
48 | # defaults to nothing. | |
49 | # | |
4b90c838 PC |
50 | # cpu_defines_dir location of cpu_defines.h |
51 | # defaults to generic. | |
52 | # | |
48c7b524 | 53 | # cpu_opt_bits_random path name of random.h containing CPU-specific |
9bf714c2 | 54 | # optimizations |
e4bf5dfc | 55 | # |
48c7b524 UD |
56 | # cpu_opt_ext_random path name of random.h containing CPU-specific |
57 | # optimizations for extensions | |
58 | # | |
e4bf5dfc DS |
59 | # error_constants_dir location of error_constants.h |
60 | # defaults to os/generic. | |
61 | # | |
2c839a4e PE |
62 | # It possibly modifies the following variables: |
63 | # | |
64 | # OPT_LDFLAGS extra flags to pass when linking the library, of | |
ef16a298 BK |
65 | # the form '-Wl,blah' |
66 | # (defaults to empty in acinclude.m4) | |
2c839a4e | 67 | # |
58579a27 | 68 | # port_specific_symbol_files |
1d77bc54 | 69 | # whitespace-separated list of files containing |
ff66d28f PE |
70 | # additional symbols to export from the shared |
71 | # library, when symbol versioning is in use | |
e6b7a69a | 72 | # |
2c839a4e PE |
73 | # |
74 | # If the defaults will not work for your platform, you need only change the | |
75 | # variables that won't work, i.e., you do not need to explicitly set a | |
b731048b | 76 | # working variable to its default. Most hosts only need to change the two |
2c839a4e | 77 | # *_include_dir variables. |
d0941a31 | 78 | |
d0941a31 | 79 | |
e01c9849 | 80 | # DEFAULTS |
2c839a4e PE |
81 | # Try to guess a default cpu_include_dir based on the name of the CPU. We |
82 | # cannot do this for os_include_dir; there are too many portable operating | |
83 | # systems out there. :-) | |
af13a7a6 | 84 | c_model=c_global |
85ab9d23 | 85 | c_compatibility=no |
2c5d0ae8 | 86 | atomic_word_dir=cpu/generic |
c2ba9709 | 87 | atomic_flags="" |
701a3eee BK |
88 | atomicity_dir="cpu/generic" |
89 | cpu_defines_dir="cpu/generic" | |
90 | try_cpu=generic | |
00fc1bf6 | 91 | abi_baseline_subdir_switch=--print-multi-directory |
701a3eee | 92 | abi_tweaks_dir="cpu/generic" |
e4bf5dfc | 93 | error_constants_dir="os/generic" |
2c839a4e | 94 | |
b731048b | 95 | # HOST-SPECIFIC OVERRIDES |
e01c9849 | 96 | # Set any CPU-dependent bits. |
ef16a298 | 97 | |
701a3eee BK |
98 | # Provide a way to funnel exotic flavors and prefixed/postfixed chip |
99 | # variants into the established source config/cpu/* sub-directories. | |
d0941a31 | 100 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. |
b731048b | 101 | case "${host_cpu}" in |
d0941a31 | 102 | alpha*) |
ef16a298 | 103 | try_cpu=alpha |
d0941a31 | 104 | ;; |
cd985f66 | 105 | arm*) |
7d3998a4 PE |
106 | try_cpu=arm |
107 | ;; | |
06785812 HPN |
108 | crisv32) |
109 | try_cpu=cris | |
110 | ;; | |
e6b7a69a | 111 | i[567]86 | x86_64) |
ef16a298 | 112 | try_cpu=i486 |
d0941a31 | 113 | ;; |
49dd74ef | 114 | hppa*) |
ef16a298 | 115 | try_cpu=hppa |
49dd74ef | 116 | ;; |
92d568f2 | 117 | mips*) |
701a3eee | 118 | try_cpu=mips |
92d568f2 | 119 | ;; |
bd11db39 | 120 | powerpc* | rs6000) |
ef16a298 | 121 | try_cpu=powerpc |
d0941a31 | 122 | ;; |
0fe707cc | 123 | sparc* | ultrasparc) |
ef16a298 BK |
124 | try_cpu=sparc |
125 | ;; | |
126 | *) | |
1568430f | 127 | if test -d ${glibcxx_srcdir}/config/cpu/${host_cpu}; then |
bbdfb3e8 | 128 | try_cpu=${host_cpu} |
bbdfb3e8 | 129 | fi |
d0941a31 PE |
130 | esac |
131 | ||
701a3eee BK |
132 | |
133 | # Now look for the file(s) usually tied to a CPU model, and make | |
134 | # default choices for those if they haven't been explicitly set | |
135 | # already. | |
136 | cpu_include_dir=cpu/${try_cpu} | |
137 | ||
2c5d0ae8 | 138 | |
4b90c838 PC |
139 | # Set specific CPU overrides for cpu_defines_dir. Most can just use generic. |
140 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. | |
141 | case "${host_cpu}" in | |
49c65434 RR |
142 | arm*) |
143 | cpu_defines_dir=cpu/arm | |
144 | ;; | |
460d832b | 145 | powerpc* | rs6000) |
4b90c838 PC |
146 | cpu_defines_dir=cpu/powerpc |
147 | ;; | |
148 | esac | |
149 | ||
2c839a4e | 150 | |
c2ba9709 JS |
151 | # Set specific CPU overrides for atomic_word_dir and atomic_flags. |
152 | # Most can just use generic. | |
701a3eee | 153 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. |
7c499eeb | 154 | case "${host_cpu}" in |
701a3eee BK |
155 | cris*) |
156 | atomic_word_dir=cpu/cris | |
157 | ;; | |
bdfb7c6d | 158 | i[4567]86 | x86_64) |
c2ba9709 JS |
159 | atomic_flags="-march=native" |
160 | ;; | |
701a3eee BK |
161 | sparc* | ultrasparc) |
162 | atomic_word_dir=cpu/sparc | |
c2ba9709 | 163 | atomic_flags="-mcpu=v9" |
7c499eeb PC |
164 | ;; |
165 | esac | |
1568430f | 166 | |
701a3eee BK |
167 | |
168 | # Set specific CPU overrides for atomicity_dir. | |
169 | # This can be over-ridden in GLIBCXX_ENABLE_ATOMIC_BUILTINS. | |
170 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. | |
171 | if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then | |
172 | atomicity_dir=$cpu_include_dir | |
173 | fi | |
174 | ||
175 | ||
1568430f PB |
176 | if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/cxxabi_tweaks.h ; then |
177 | abi_tweaks_dir=$cpu_include_dir | |
1568430f | 178 | fi |
2c839a4e | 179 | |
701a3eee | 180 | |
9bf714c2 UD |
181 | # Set directory with CPU-specific optimization |
182 | cpu_opt_dir=${cpu_include_dir}/opt | |
183 | test -d ${glibcxx_srcdir}/config/${cpu_include_dir}/opt || | |
184 | cpu_opt_dir=cpu/generic/opt | |
185 | # For each header with CPU-specific optimizations check whether it | |
186 | # exists in ${cpu_opt_dir}. If not, point the variable at the | |
187 | # appropriate file in the generic directory. | |
188 | cpu_opt_ext_random=${cpu_opt_dir}/ext/opt_random.h | |
189 | test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} || | |
190 | cpu_opt_ext_random=cpu/generic/opt/ext/opt_random.h | |
191 | ||
48c7b524 UD |
192 | cpu_opt_bits_random=${cpu_opt_dir}/bits/opt_random.h |
193 | test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} || | |
194 | cpu_opt_ext_random=cpu/generic/opt/bits/opt_random.h | |
195 | ||
9bf714c2 | 196 | |
e01c9849 | 197 | # Set any OS-dependent bits. |
17640f24 | 198 | # Set the os_include_dir. |
e4bf5dfc | 199 | # Set the error_costants_dir. |
e01c9849 BK |
200 | # Set c_model, c_compatibility here. |
201 | # If atomic ops and/or numeric limits are OS-specific rather than | |
202 | # CPU-specifc, set those here too. | |
d0941a31 | 203 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. |
b731048b | 204 | case "${host_os}" in |
020bd6f4 DE |
205 | aix[56789]*) |
206 | # Newer versions of AIX only support PowerPC architecture, so use | |
207 | # atomic instructions directly. | |
208 | os_include_dir="os/aix" | |
020bd6f4 DE |
209 | ;; |
210 | aix4.[3456789]*) | |
2c839a4e | 211 | # We set os_include_dir to os/aix only on AIX 4.3 and newer, but |
d32e25df | 212 | # os/aix/atomicity.h works on earlier versions of AIX 4.*, so we |
2c839a4e PE |
213 | # explicitly duplicate the directory for 4.[<3]. |
214 | os_include_dir="os/aix" | |
2c5d0ae8 | 215 | atomicity_dir="os/aix" |
d0941a31 | 216 | ;; |
2c839a4e | 217 | aix4.*) |
47395a24 | 218 | os_include_dir="os/generic" |
2c5d0ae8 | 219 | atomicity_dir="os/aix" |
2c839a4e PE |
220 | ;; |
221 | aix*) | |
47395a24 | 222 | os_include_dir="os/generic" |
2c5d0ae8 | 223 | atomicity_dir="cpu/generic" |
2c839a4e | 224 | ;; |
8478f170 LR |
225 | bsd*) |
226 | # Plain BSD attempts to share FreeBSD files. | |
2c839a4e | 227 | os_include_dir="os/bsd/freebsd" |
d0941a31 | 228 | ;; |
c383aafd | 229 | cygwin*) |
2c839a4e | 230 | os_include_dir="os/newlib" |
7de6ba7a | 231 | OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)" |
2c839a4e | 232 | ;; |
ae59b55c | 233 | darwin | darwin[1-7] | darwin[1-7].*) |
f1a66265 | 234 | # On Darwin, performance is improved if libstdc++ is single-module. |
ae59b55c | 235 | # Up to at least 10.3.7, -flat_namespace is required for proper |
f1a66265 GK |
236 | # treatment of coalesced symbols. |
237 | OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module -Wl,-flat_namespace" | |
f9686024 | 238 | os_include_dir="os/bsd/darwin" |
f1a66265 | 239 | ;; |
ae59b55c GK |
240 | darwin[89] | darwin[89].* | darwin[1-9][0-9]* ) |
241 | # On Darwin, performance is improved if libstdc++ is single-module, | |
242 | # and on 8+ compatibility is better if not -flat_namespace. | |
243 | OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module" | |
62801a96 HH |
244 | case "${host_cpu}" in |
245 | i[34567]86 | x86_64) | |
246 | OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -fvisibility-inlines-hidden" | |
247 | ;; | |
248 | esac | |
ae59b55c GK |
249 | os_include_dir="os/bsd/darwin" |
250 | ;; | |
2c839a4e PE |
251 | *djgpp*) # leading * picks up "msdosdjgpp" |
252 | os_include_dir="os/djgpp" | |
a51d1999 | 253 | error_constants_dir="os/djgpp" |
c383aafd | 254 | ;; |
dbed5a9b JM |
255 | dragonfly*) |
256 | os_include_dir="os/bsd/dragonfly" | |
257 | ;; | |
8478f170 LR |
258 | freebsd*) |
259 | os_include_dir="os/bsd/freebsd" | |
8478f170 | 260 | ;; |
85da5c30 SN |
261 | linux-musl*) |
262 | os_include_dir="os/generic" | |
263 | ;; | |
8466af06 | 264 | gnu* | linux* | kfreebsd*-gnu) |
464aea98 JM |
265 | if [ "$uclibc" = "yes" ]; then |
266 | os_include_dir="os/uclibc" | |
aa6a73b9 MK |
267 | elif [ "$bionic" = "yes" ]; then |
268 | os_include_dir="os/bionic" | |
464aea98 JM |
269 | else |
270 | os_include_dir="os/gnu-linux" | |
271 | fi | |
6f87af20 | 272 | ;; |
2c839a4e PE |
273 | hpux*) |
274 | os_include_dir="os/hpux" | |
d0941a31 | 275 | ;; |
944effb6 | 276 | mingw32*) |
d7a3ef97 JY |
277 | case "$host" in |
278 | *-w64-*) | |
279 | os_include_dir="os/mingw32-w64" | |
280 | error_constants_dir="os/mingw32-w64" | |
281 | ;; | |
282 | *) | |
283 | os_include_dir="os/mingw32" | |
284 | error_constants_dir="os/mingw32" | |
285 | ;; | |
286 | esac | |
7de6ba7a | 287 | OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)" |
944effb6 | 288 | ;; |
11b176c1 | 289 | netbsd*) |
2c839a4e | 290 | os_include_dir="os/bsd/netbsd" |
11b176c1 | 291 | ;; |
1f726ff8 MK |
292 | openbsd*) |
293 | os_include_dir="os/bsd/openbsd" | |
294 | ;; | |
ff66d28f PE |
295 | qnx6.[12]*) |
296 | os_include_dir="os/qnx/qnx6.1" | |
297 | c_model=c | |
298 | ;; | |
320c7be3 SH |
299 | rtems*) |
300 | # Use libatomic if necessary and avoid libstdc++ specific atomicity support | |
301 | atomicity_dir="cpu/generic/atomicity_builtins" | |
302 | ;; | |
43892f8c BK |
303 | solaris2) |
304 | # This too-vague configuration does not provide enough information | |
305 | # to select a ctype include, and thus os_include_dir is a crap shoot. | |
d9f069ab | 306 | echo "Please specify the full version of Solaris, ie. solaris2.10 " 1>&2 |
7d3998a4 | 307 | exit 1 |
43892f8c | 308 | ;; |
d9f069ab RO |
309 | solaris2.1[0-9]) |
310 | os_include_dir="os/solaris/solaris2.10" | |
a1998fab | 311 | ;; |
6e198ee0 UW |
312 | tpf) |
313 | os_include_dir="os/tpf" | |
314 | ;; | |
65fc9769 PE |
315 | vxworks) |
316 | os_include_dir="os/vxworks" | |
317 | ;; | |
d0941a31 | 318 | *) |
2c839a4e | 319 | os_include_dir="os/generic" |
d0941a31 PE |
320 | ;; |
321 | esac | |
322 | ||
323 | ||
e01c9849 | 324 | # Set any OS-dependent and CPU-dependent bits. |
d0941a31 | 325 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. |
b731048b | 326 | case "${host}" in |
701a3eee BK |
327 | *-*-linux*) |
328 | case "${host_cpu}" in | |
329 | i[567]86) | |
330 | abi_baseline_pair=i486-linux-gnu | |
331 | ;; | |
8deecedf AN |
332 | mips64*) |
333 | abi_baseline_pair=mips64-linux-gnu | |
334 | ;; | |
8f7fa4ba | 335 | powerpc64*) |
701a3eee BK |
336 | abi_baseline_pair=powerpc64-linux-gnu |
337 | ;; | |
338 | s390) | |
339 | abi_baseline_pair=s390-linux-gnu | |
340 | ;; | |
341 | s390x) | |
342 | abi_baseline_pair=s390x-linux-gnu | |
343 | ;; | |
344 | x86_64) | |
345 | abi_baseline_pair=x86_64-linux-gnu | |
346 | ;; | |
347 | *) | |
2529c937 AS |
348 | if test $try_cpu = generic; then |
349 | try_abi_cpu=$host_cpu | |
350 | else | |
351 | try_abi_cpu=$try_cpu | |
352 | fi | |
353 | if test -d ${glibcxx_srcdir}/config/abi/post/${try_abi_cpu}-linux-gnu; then | |
354 | abi_baseline_pair=${try_abi_cpu}-linux-gnu | |
701a3eee BK |
355 | fi |
356 | esac | |
5194c5c1 | 357 | case "${host}" in |
9945a876 | 358 | arm*-*-linux-*) |
5194c5c1 MM |
359 | port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver" |
360 | ;; | |
361 | esac | |
701a3eee | 362 | ;; |
82a19768 AT |
363 | arm*-*-freebsd*) |
364 | port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver" | |
365 | ;; | |
f9314d01 GK |
366 | powerpc*-*-darwin*) |
367 | port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver" | |
368 | ;; | |
33f49367 | 369 | *-*-solaris2.1[0-9]) |
e862906c RO |
370 | # On Solaris 10 with Solaris ld, there's no COMDAT support. GNU ld always |
371 | # provides it, as does Solaris ld since Solaris 11, leading to different | |
372 | # baselines. | |
373 | case "${host_os}:${with_gnu_ld}" in | |
374 | # with_gnu_ld may either be unset (default) or no (with --without-gnu-ld). | |
375 | solaris2.10: | solaris2.10:no) | |
376 | abi_baseline_pair=solaris2.10 | |
377 | ;; | |
378 | *) | |
379 | abi_baseline_pair=solaris2.11 | |
380 | ;; | |
381 | esac | |
00fc1bf6 | 382 | abi_baseline_subdir_switch=--print-multi-os-directory |
c18dc5cc | 383 | ;; |
6414587c | 384 | esac |