]>
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 | # | |
9bf714c2 UD |
53 | # cpu_opt_ext_random path name of random.h containing CPU-specific |
54 | # optimizations | |
e4bf5dfc DS |
55 | # |
56 | # error_constants_dir location of error_constants.h | |
57 | # defaults to os/generic. | |
58 | # | |
2c839a4e PE |
59 | # It possibly modifies the following variables: |
60 | # | |
61 | # OPT_LDFLAGS extra flags to pass when linking the library, of | |
ef16a298 BK |
62 | # the form '-Wl,blah' |
63 | # (defaults to empty in acinclude.m4) | |
2c839a4e | 64 | # |
58579a27 | 65 | # port_specific_symbol_files |
e6b7a69a | 66 | # whitespace-seperated list of files containing |
ff66d28f PE |
67 | # additional symbols to export from the shared |
68 | # library, when symbol versioning is in use | |
e6b7a69a | 69 | # |
2c839a4e PE |
70 | # |
71 | # If the defaults will not work for your platform, you need only change the | |
72 | # variables that won't work, i.e., you do not need to explicitly set a | |
b731048b | 73 | # working variable to its default. Most hosts only need to change the two |
2c839a4e | 74 | # *_include_dir variables. |
d0941a31 | 75 | |
d0941a31 | 76 | |
e01c9849 | 77 | # DEFAULTS |
2c839a4e PE |
78 | # Try to guess a default cpu_include_dir based on the name of the CPU. We |
79 | # cannot do this for os_include_dir; there are too many portable operating | |
80 | # systems out there. :-) | |
af13a7a6 | 81 | c_model=c_global |
85ab9d23 | 82 | c_compatibility=no |
2c5d0ae8 | 83 | atomic_word_dir=cpu/generic |
c2ba9709 | 84 | atomic_flags="" |
701a3eee BK |
85 | atomicity_dir="cpu/generic" |
86 | cpu_defines_dir="cpu/generic" | |
87 | try_cpu=generic | |
00fc1bf6 | 88 | abi_baseline_subdir_switch=--print-multi-directory |
701a3eee | 89 | abi_tweaks_dir="cpu/generic" |
e4bf5dfc | 90 | error_constants_dir="os/generic" |
2c839a4e | 91 | |
b731048b | 92 | # HOST-SPECIFIC OVERRIDES |
e01c9849 | 93 | # Set any CPU-dependent bits. |
ef16a298 | 94 | |
701a3eee BK |
95 | # Provide a way to funnel exotic flavors and prefixed/postfixed chip |
96 | # variants into the established source config/cpu/* sub-directories. | |
d0941a31 | 97 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. |
b731048b | 98 | case "${host_cpu}" in |
d0941a31 | 99 | alpha*) |
ef16a298 | 100 | try_cpu=alpha |
d0941a31 | 101 | ;; |
cd985f66 | 102 | arm*) |
7d3998a4 PE |
103 | try_cpu=arm |
104 | ;; | |
06785812 HPN |
105 | crisv32) |
106 | try_cpu=cris | |
107 | ;; | |
e6b7a69a | 108 | i[567]86 | x86_64) |
ef16a298 | 109 | try_cpu=i486 |
d0941a31 | 110 | ;; |
49dd74ef | 111 | hppa*) |
ef16a298 | 112 | try_cpu=hppa |
49dd74ef | 113 | ;; |
7acf4da6 DD |
114 | mep*) |
115 | EXTRA_CXX_FLAGS=-mm | |
116 | try_cpu=generic | |
117 | ;; | |
92d568f2 | 118 | mips*) |
701a3eee | 119 | try_cpu=mips |
92d568f2 | 120 | ;; |
bd11db39 | 121 | powerpc* | rs6000) |
ef16a298 | 122 | try_cpu=powerpc |
d0941a31 | 123 | ;; |
0fe707cc | 124 | sparc* | ultrasparc) |
ef16a298 BK |
125 | try_cpu=sparc |
126 | ;; | |
127 | *) | |
1568430f | 128 | if test -d ${glibcxx_srcdir}/config/cpu/${host_cpu}; then |
bbdfb3e8 | 129 | try_cpu=${host_cpu} |
bbdfb3e8 | 130 | fi |
d0941a31 PE |
131 | esac |
132 | ||
701a3eee BK |
133 | |
134 | # Now look for the file(s) usually tied to a CPU model, and make | |
135 | # default choices for those if they haven't been explicitly set | |
136 | # already. | |
137 | cpu_include_dir=cpu/${try_cpu} | |
138 | ||
2c5d0ae8 | 139 | |
4b90c838 PC |
140 | # Set specific CPU overrides for cpu_defines_dir. Most can just use generic. |
141 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. | |
142 | case "${host_cpu}" in | |
460d832b | 143 | powerpc* | rs6000) |
4b90c838 PC |
144 | cpu_defines_dir=cpu/powerpc |
145 | ;; | |
146 | esac | |
147 | ||
2c839a4e | 148 | |
c2ba9709 JS |
149 | # Set specific CPU overrides for atomic_word_dir and atomic_flags. |
150 | # Most can just use generic. | |
701a3eee | 151 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. |
7c499eeb | 152 | case "${host_cpu}" in |
701a3eee BK |
153 | alpha*) |
154 | atomic_word_dir=cpu/alpha | |
7c499eeb | 155 | ;; |
701a3eee BK |
156 | cris*) |
157 | atomic_word_dir=cpu/cris | |
158 | ;; | |
159 | ia64) | |
160 | atomic_word_dir=cpu/ia64 | |
161 | ;; | |
bdfb7c6d | 162 | i[4567]86 | x86_64) |
c2ba9709 JS |
163 | atomic_flags="-march=native" |
164 | ;; | |
701a3eee BK |
165 | powerpc* | rs6000) |
166 | atomic_word_dir=cpu/powerpc | |
167 | ;; | |
168 | sparc* | ultrasparc) | |
169 | atomic_word_dir=cpu/sparc | |
c2ba9709 | 170 | atomic_flags="-mcpu=v9" |
7c499eeb PC |
171 | ;; |
172 | esac | |
1568430f | 173 | |
701a3eee BK |
174 | |
175 | # Set specific CPU overrides for atomicity_dir. | |
176 | # This can be over-ridden in GLIBCXX_ENABLE_ATOMIC_BUILTINS. | |
177 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. | |
178 | if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then | |
179 | atomicity_dir=$cpu_include_dir | |
180 | fi | |
181 | ||
182 | ||
1568430f PB |
183 | if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/cxxabi_tweaks.h ; then |
184 | abi_tweaks_dir=$cpu_include_dir | |
1568430f | 185 | fi |
2c839a4e | 186 | |
701a3eee | 187 | |
9bf714c2 UD |
188 | # Set directory with CPU-specific optimization |
189 | cpu_opt_dir=${cpu_include_dir}/opt | |
190 | test -d ${glibcxx_srcdir}/config/${cpu_include_dir}/opt || | |
191 | cpu_opt_dir=cpu/generic/opt | |
192 | # For each header with CPU-specific optimizations check whether it | |
193 | # exists in ${cpu_opt_dir}. If not, point the variable at the | |
194 | # appropriate file in the generic directory. | |
195 | cpu_opt_ext_random=${cpu_opt_dir}/ext/opt_random.h | |
196 | test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} || | |
197 | cpu_opt_ext_random=cpu/generic/opt/ext/opt_random.h | |
198 | ||
199 | ||
e01c9849 | 200 | # Set any OS-dependent bits. |
17640f24 | 201 | # Set the os_include_dir. |
e4bf5dfc | 202 | # Set the error_costants_dir. |
e01c9849 BK |
203 | # Set c_model, c_compatibility here. |
204 | # If atomic ops and/or numeric limits are OS-specific rather than | |
205 | # CPU-specifc, set those here too. | |
d0941a31 | 206 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. |
b731048b | 207 | case "${host_os}" in |
527b03ed | 208 | aix4.[3456789]* | aix[56789]*) |
2c839a4e | 209 | # We set os_include_dir to os/aix only on AIX 4.3 and newer, but |
d32e25df | 210 | # os/aix/atomicity.h works on earlier versions of AIX 4.*, so we |
2c839a4e PE |
211 | # explicitly duplicate the directory for 4.[<3]. |
212 | os_include_dir="os/aix" | |
2c5d0ae8 | 213 | atomicity_dir="os/aix" |
7afe555c | 214 | atomic_word_dir="os/aix" |
34e3a8d5 | 215 | OPT_LDFLAGS="-Wl,-G" |
d0941a31 | 216 | ;; |
2c839a4e | 217 | aix4.*) |
47395a24 | 218 | os_include_dir="os/generic" |
2c5d0ae8 | 219 | atomicity_dir="os/aix" |
7afe555c | 220 | atomic_word_dir="os/aix" |
2c839a4e PE |
221 | ;; |
222 | aix*) | |
47395a24 | 223 | os_include_dir="os/generic" |
2c5d0ae8 | 224 | atomicity_dir="cpu/generic" |
2c839a4e | 225 | ;; |
8478f170 LR |
226 | bsd*) |
227 | # Plain BSD attempts to share FreeBSD files. | |
2c839a4e | 228 | os_include_dir="os/bsd/freebsd" |
d0941a31 | 229 | ;; |
c383aafd | 230 | cygwin*) |
2c839a4e | 231 | os_include_dir="os/newlib" |
7de6ba7a | 232 | OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)" |
2c839a4e | 233 | ;; |
ae59b55c | 234 | darwin | darwin[1-7] | darwin[1-7].*) |
f1a66265 | 235 | # On Darwin, performance is improved if libstdc++ is single-module. |
ae59b55c | 236 | # Up to at least 10.3.7, -flat_namespace is required for proper |
f1a66265 GK |
237 | # treatment of coalesced symbols. |
238 | OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module -Wl,-flat_namespace" | |
f9686024 | 239 | os_include_dir="os/bsd/darwin" |
f1a66265 | 240 | ;; |
ae59b55c GK |
241 | darwin[89] | darwin[89].* | darwin[1-9][0-9]* ) |
242 | # On Darwin, performance is improved if libstdc++ is single-module, | |
243 | # and on 8+ compatibility is better if not -flat_namespace. | |
244 | OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module" | |
62801a96 HH |
245 | case "${host_cpu}" in |
246 | i[34567]86 | x86_64) | |
247 | OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -fvisibility-inlines-hidden" | |
248 | ;; | |
249 | esac | |
ae59b55c GK |
250 | os_include_dir="os/bsd/darwin" |
251 | ;; | |
2c839a4e PE |
252 | *djgpp*) # leading * picks up "msdosdjgpp" |
253 | os_include_dir="os/djgpp" | |
a51d1999 | 254 | error_constants_dir="os/djgpp" |
c383aafd | 255 | ;; |
8478f170 LR |
256 | freebsd*) |
257 | os_include_dir="os/bsd/freebsd" | |
8478f170 | 258 | ;; |
b938ad89 | 259 | gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) |
464aea98 JM |
260 | if [ "$uclibc" = "yes" ]; then |
261 | os_include_dir="os/uclibc" | |
aa6a73b9 MK |
262 | elif [ "$bionic" = "yes" ]; then |
263 | os_include_dir="os/bionic" | |
464aea98 JM |
264 | else |
265 | os_include_dir="os/gnu-linux" | |
266 | fi | |
6f87af20 | 267 | ;; |
2c839a4e PE |
268 | hpux*) |
269 | os_include_dir="os/hpux" | |
d0941a31 | 270 | ;; |
944effb6 | 271 | mingw32*) |
d7a3ef97 JY |
272 | case "$host" in |
273 | *-w64-*) | |
274 | os_include_dir="os/mingw32-w64" | |
275 | error_constants_dir="os/mingw32-w64" | |
276 | ;; | |
277 | *) | |
278 | os_include_dir="os/mingw32" | |
279 | error_constants_dir="os/mingw32" | |
280 | ;; | |
281 | esac | |
7de6ba7a | 282 | OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)" |
944effb6 | 283 | ;; |
11b176c1 | 284 | netbsd*) |
2c839a4e | 285 | os_include_dir="os/bsd/netbsd" |
11b176c1 | 286 | ;; |
ff66d28f PE |
287 | qnx6.[12]*) |
288 | os_include_dir="os/qnx/qnx6.1" | |
289 | c_model=c | |
290 | ;; | |
43892f8c BK |
291 | solaris2) |
292 | # This too-vague configuration does not provide enough information | |
293 | # to select a ctype include, and thus os_include_dir is a crap shoot. | |
294 | echo "Please specify the full version of Solaris, ie. solaris2.9 " 1>&2 | |
7d3998a4 | 295 | exit 1 |
43892f8c | 296 | ;; |
7888f266 RO |
297 | solaris2.9 | solaris2.1[0-9]) |
298 | os_include_dir="os/solaris/solaris2.9" | |
a1998fab | 299 | ;; |
6e198ee0 UW |
300 | tpf) |
301 | os_include_dir="os/tpf" | |
302 | ;; | |
65fc9769 PE |
303 | vxworks) |
304 | os_include_dir="os/vxworks" | |
305 | ;; | |
d0941a31 | 306 | *) |
2c839a4e | 307 | os_include_dir="os/generic" |
d0941a31 PE |
308 | ;; |
309 | esac | |
310 | ||
311 | ||
e01c9849 | 312 | # Set any OS-dependent and CPU-dependent bits. |
d0941a31 | 313 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. |
b731048b | 314 | case "${host}" in |
701a3eee BK |
315 | *-*-linux*) |
316 | case "${host_cpu}" in | |
317 | i[567]86) | |
318 | abi_baseline_pair=i486-linux-gnu | |
319 | ;; | |
8deecedf AN |
320 | mips64*) |
321 | abi_baseline_pair=mips64-linux-gnu | |
322 | ;; | |
701a3eee BK |
323 | powerpc64) |
324 | abi_baseline_pair=powerpc64-linux-gnu | |
325 | ;; | |
326 | s390) | |
327 | abi_baseline_pair=s390-linux-gnu | |
328 | ;; | |
329 | s390x) | |
330 | abi_baseline_pair=s390x-linux-gnu | |
331 | ;; | |
332 | x86_64) | |
333 | abi_baseline_pair=x86_64-linux-gnu | |
334 | ;; | |
335 | *) | |
336 | if test -d ${glibcxx_srcdir}/config/abi/post/${try_cpu}-linux-gnu; then | |
337 | abi_baseline_pair=${try_cpu}-linux-gnu | |
338 | fi | |
339 | esac | |
5194c5c1 MM |
340 | case "${host}" in |
341 | arm*-*-linux-*eabi) | |
342 | port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver" | |
343 | ;; | |
344 | esac | |
701a3eee | 345 | ;; |
f9314d01 GK |
346 | powerpc*-*-darwin*) |
347 | port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver" | |
348 | ;; | |
7888f266 RO |
349 | *-*-solaris2.9) |
350 | abi_baseline_pair=solaris2.9 | |
00fc1bf6 | 351 | abi_baseline_subdir_switch=--print-multi-os-directory |
33f49367 RO |
352 | ;; |
353 | *-*-solaris2.1[0-9]) | |
354 | abi_baseline_pair=solaris2.10 | |
00fc1bf6 | 355 | abi_baseline_subdir_switch=--print-multi-os-directory |
c18dc5cc | 356 | ;; |
6414587c | 357 | esac |