Debian Codegraph @

libstdc++-v3/configure.host

raw
1 # configure.host
2 #
3 # This shell script handles all host based configuration for libstdc++.
4 # It sets various shell variables based on the host and the
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:
12 # host The configuration host (full CPU-vendor-OS triplet)
13 # host_cpu The configuration host CPU
14 # host_os The configuration host OS
15 #
16 #
17 # It sets the following shell variables:
18 #
19 # cpu_include_dir CPU-specific directory, defaults to cpu/generic
20 # if cpu/host_cpu doesn't exist. This is not used
21 # directly, but sets the default for others.
22 #
23 # os_include_dir OS-specific directory, defaults to os/generic.
24 #
25 # c_model the "C" header model, defaults to c_global.
26 #
27 # c_compatibility if "C" compatibility headers are necessary,
28 # defaults to no.
29 #
30 # abi_baseline_pair directory name for ABI compat testing,
31 # defaults to host_cpu-host_os (as per config.guess)
32 #
33 # abi_baseline_subdir_switch
34 # g++ switch to determine ABI baseline subdir for
35 # multilibbed targets,
36 # defaults to --print-multi-directory
37 #
38 # abi_tweaks_dir location of cxxabi_tweaks.h,
39 # defaults to cpu_include_dir
40 #
41 # atomicity_dir location of atomicity.h,
42 # defaults to cpu_include_dir
43 #
44 # atomic_word_dir location of atomic_word.h
45 # defaults to generic.
46 #
47 # atomic_flags extra flags to pass to use atomic instructions
48 # defaults to nothing.
49 #
50 # cpu_defines_dir location of cpu_defines.h
51 # defaults to generic.
52 #
53 # cpu_opt_bits_random path name of random.h containing CPU-specific
54 # optimizations
55 #
56 # cpu_opt_ext_random path name of random.h containing CPU-specific
57 # optimizations for extensions
58 #
59 # error_constants_dir location of error_constants.h
60 # defaults to os/generic.
61 #
62 # It possibly modifies the following variables:
63 #
64 # EXTRA_CFLAGS extra flags to pass when compiling C code
65 #
66 # EXTRA_CXX_FLAGS extra flags to pass when compiling C++ code
67 #
68 # OPT_LDFLAGS extra flags to pass when linking the library, of
69 # the form '-Wl,blah'
70 # (defaults to empty in acinclude.m4)
71 #
72 # port_specific_symbol_files
73 # whitespace-separated list of files containing
74 # additional symbols to export from the shared
75 # library, when symbol versioning is in use
76 #
77 # tmake_file A list of machine-description-specific
78 # makefile fragments.
79 #
80 #
81 # If the defaults will not work for your platform, you need only change the
82 # variables that won't work, i.e., you do not need to explicitly set a
83 # working variable to its default. Most hosts only need to change the two
84 # *_include_dir variables.
85
86
87 # DEFAULTS
88 # Try to guess a default cpu_include_dir based on the name of the CPU. We
89 # cannot do this for os_include_dir; there are too many portable operating
90 # systems out there. :-)
91 c_model=c_global
92 c_compatibility=no
93 atomic_word_dir=cpu/generic
94 atomic_flags=""
95 atomicity_dir="cpu/generic"
96 cpu_defines_dir="cpu/generic"
97 try_cpu=generic
98 abi_baseline_subdir_switch=--print-multi-directory
99 abi_tweaks_dir="cpu/generic"
100 error_constants_dir="os/generic"
101 tmake_file=
102
103 # HOST-SPECIFIC OVERRIDES
104 # Set any CPU-dependent bits.
105
106 # Provide a way to funnel exotic flavors and prefixed/postfixed chip
107 # variants into the established source config/cpu/* sub-directories.
108 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
109 case "${host_cpu}" in
110 alpha*)
111 try_cpu=alpha
112 ;;
113 arm*)
114 try_cpu=arm
115 ;;
116 crisv32)
117 try_cpu=cris
118 ;;
119 i[567]86 | x86_64)
120 try_cpu=i486
121 ;;
122 hppa*)
123 try_cpu=hppa
124 ;;
125 mips*)
126 try_cpu=mips
127 ;;
128 powerpc* | rs6000)
129 try_cpu=powerpc
130 ;;
131 sparc* | ultrasparc)
132 try_cpu=sparc
133 ;;
134 *)
135 if test -d ${glibcxx_srcdir}/config/cpu/${host_cpu}; then
136 try_cpu=${host_cpu}
137 fi
138 esac
139
140
141 # Now look for the file(s) usually tied to a CPU model, and make
142 # default choices for those if they haven't been explicitly set
143 # already.
144 cpu_include_dir=cpu/${try_cpu}
145
146
147 # Set specific CPU overrides for cpu_defines_dir. Most can just use generic.
148 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
149 case "${host_cpu}" in
150 amdgcn)
151 cpu_defines_dir=cpu/gcn
152 ;;
153 arm*)
154 cpu_defines_dir=cpu/arm
155 ;;
156 nvptx)
157 cpu_defines_dir=cpu/nvptx
158 ;;
159 powerpc* | rs6000)
160 cpu_defines_dir=cpu/powerpc
161 ;;
162 esac
163
164
165 # Set specific CPU overrides for atomic_word_dir and atomic_flags.
166 # Most can just use generic.
167 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
168 case "${host_cpu}" in
169 cris*)
170 atomic_word_dir=cpu/cris
171 ;;
172 i[4567]86 | x86_64)
173 atomic_flags="-march=native"
174 ;;
175 sparc* | ultrasparc)
176 atomic_word_dir=cpu/sparc
177 atomic_flags="-mcpu=v9"
178 ;;
179 esac
180
181
182 # Set specific CPU overrides for atomicity_dir.
183 # This can be over-ridden in GLIBCXX_ENABLE_ATOMIC_BUILTINS.
184 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
185 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then
186 atomicity_dir=$cpu_include_dir
187 fi
188
189
190 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/cxxabi_tweaks.h ; then
191 abi_tweaks_dir=$cpu_include_dir
192 fi
193
194
195 # Set directory with CPU-specific optimization
196 cpu_opt_dir=${cpu_include_dir}/opt
197 test -d ${glibcxx_srcdir}/config/${cpu_include_dir}/opt ||
198 cpu_opt_dir=cpu/generic/opt
199 # For each header with CPU-specific optimizations check whether it
200 # exists in ${cpu_opt_dir}. If not, point the variable at the
201 # appropriate file in the generic directory.
202 cpu_opt_ext_random=${cpu_opt_dir}/ext/opt_random.h
203 test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} ||
204 cpu_opt_ext_random=cpu/generic/opt/ext/opt_random.h
205
206 cpu_opt_bits_random=${cpu_opt_dir}/bits/opt_random.h
207 test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} ||
208 cpu_opt_ext_random=cpu/generic/opt/bits/opt_random.h
209
210
211 # Set any OS-dependent bits.
212 # Set the os_include_dir.
213 # Set the error_costants_dir.
214 # Set c_model, c_compatibility here.
215 # If atomic ops and/or numeric limits are OS-specific rather than
216 # CPU-specifc, set those here too.
217 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
218 case "${host_os}" in
219 aix[56789]*)
220 # Newer versions of AIX only support PowerPC architecture, so use
221 # atomic instructions directly.
222 os_include_dir="os/aix"
223 tmake_file="os/aix/t-aix"
224 ;;
225 aix*)
226 os_include_dir="os/generic"
227 atomicity_dir="cpu/generic"
228 ;;
229 bsd*)
230 # Plain BSD attempts to share FreeBSD files.
231 os_include_dir="os/bsd/freebsd"
232 ;;
233 cygwin*)
234 os_include_dir="os/newlib"
235 OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
236 ;;
237 darwin[4-7] | darwin[4-7].*)
238 # For earlier Darwin, performance is improved if libstdc++ is
239 # single-module. Up to at least 10.3.7, -flat_namespace is required
240 # for proper treatment of coalesced symbols.
241 OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module -Wl,-flat_namespace"
242 os_include_dir="os/bsd/darwin"
243 ;;
244 darwin8 | darwin8.* )
245 # For 8+ compatibility is better if not -flat_namespace.
246 OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module"
247 case "${host_cpu}" in
248 i[34567]86 | x86_64)
249 OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -fvisibility-inlines-hidden"
250 ;;
251 esac
252 os_include_dir="os/bsd/darwin"
253 ;;
254 darwin*)
255 # Post Darwin8, defaults should be sufficient.
256 os_include_dir="os/bsd/darwin"
257 ;;
258 *djgpp*) # leading * picks up "msdosdjgpp"
259 os_include_dir="os/djgpp"
260 error_constants_dir="os/djgpp"
261 ;;
262 dragonfly*)
263 os_include_dir="os/bsd/dragonfly"
264 ;;
265 freebsd*)
266 os_include_dir="os/bsd/freebsd"
267 ;;
268 linux-musl*)
269 os_include_dir="os/generic"
270 ;;
271 gnu* | linux* | kfreebsd*-gnu | uclinux*)
272 if [ "$uclibc" = "yes" ]; then
273 os_include_dir="os/uclibc"
274 elif [ "$bionic" = "yes" ]; then
275 os_include_dir="os/bionic"
276 else
277 os_include_dir="os/gnu-linux"
278 fi
279 ;;
280 hpux*)
281 os_include_dir="os/hpux"
282 ;;
283 mingw32*)
284 case "$host" in
285 *-w64-*)
286 os_include_dir="os/mingw32-w64"
287 error_constants_dir="os/mingw32-w64"
288 ;;
289 *)
290 os_include_dir="os/mingw32"
291 error_constants_dir="os/mingw32"
292 ;;
293 esac
294 OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
295 ;;
296 netbsd*)
297 os_include_dir="os/bsd/netbsd"
298 ;;
299 openbsd*)
300 os_include_dir="os/bsd/openbsd"
301 ;;
302 qnx6.[12]*)
303 os_include_dir="os/qnx/qnx6.1"
304 c_model=c
305 ;;
306 rtems*)
307 # Use libatomic if necessary and avoid libstdc++ specific atomicity support
308 atomicity_dir="cpu/generic/atomicity_builtins"
309 ;;
310 solaris2*)
311 os_include_dir="os/solaris"
312 ;;
313 tpf)
314 os_include_dir="os/tpf"
315 ;;
316 vxworks*)
317 os_include_dir="os/vxworks"
318 ;;
319 *)
320 os_include_dir="os/generic"
321 ;;
322 esac
323
324
325 # Set any OS-dependent and CPU-dependent bits.
326 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
327 case "${host}" in
328 loongarch*)
329 tmake_file="cpu/loongarch/t-loongarch"
330 ;;
331 *-*-linux* | *-*-uclinux*)
332 case "${host_cpu}" in
333 i[567]86)
334 abi_baseline_pair=i486-linux-gnu
335 ;;
336 mips64*)
337 abi_baseline_pair=mips64-linux-gnu
338 ;;
339 powerpc64le*)
340 abi_baseline_pair=powerpc64le-linux-gnu
341 ;;
342 powerpc64*)
343 abi_baseline_pair=powerpc64-linux-gnu
344 ;;
345 s390)
346 abi_baseline_pair=s390-linux-gnu
347 ;;
348 s390x)
349 abi_baseline_pair=s390x-linux-gnu
350 ;;
351 sparc64)
352 abi_baseline_pair=sparc64-linux-gnu
353 ;;
354 x86_64)
355 abi_baseline_pair=x86_64-linux-gnu
356 ;;
357 *)
358 if test $try_cpu = generic; then
359 try_abi_cpu=$host_cpu
360 else
361 try_abi_cpu=$try_cpu
362 fi
363 if test -d ${glibcxx_srcdir}/config/abi/post/${try_abi_cpu}-linux-gnu; then
364 abi_baseline_pair=${try_abi_cpu}-linux-gnu
365 fi
366 esac
367 case "${host}" in
368 arm*-*-linux-* | arm*-*-uclinuxfdpiceabi)
369 port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
370 ;;
371 esac
372 ;;
373 amdgcn-*-amdhsa)
374 # To avoid greater pain elsewhere, force use of '__atomic' builtins,
375 # regardless of the outcome of 'configure' checks; see PR119645
376 # "GCN, nvptx: libstdc++ 'checking for atomic builtins [...]... no'".
377 atomicity_dir=cpu/generic/atomicity_builtins
378 ;;
379 arm*-*-freebsd*)
380 port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
381 ;;
382 nvptx-*-none)
383 # To avoid greater pain elsewhere, force use of '__atomic' builtins,
384 # regardless of the outcome of 'configure' checks; see PR119645
385 # "GCN, nvptx: libstdc++ 'checking for atomic builtins [...]... no'".
386 atomicity_dir=cpu/generic/atomicity_builtins
387
388 # For 'make all-target-libstdc++-v3', re 'alloca'/VLA usage:
389 EXTRA_CFLAGS="${EXTRA_CFLAGS} -mfake-ptx-alloca"
390 OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -mfake-ptx-alloca"
391 ;;
392 powerpc*-*-darwin*)
393 port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
394 ;;
395 *-*-solaris2*)
396 abi_baseline_pair=solaris
397 case "${host_cpu}" in
398 i?86 | x86_64)
399 abi_baseline_pair=i386-${abi_baseline_pair}
400 ;;
401 sparc*)
402 abi_baseline_pair=sparc-${abi_baseline_pair}
403 ;;
404 esac
405 abi_baseline_subdir_switch=--print-multi-os-directory
406 ;;
407 esac
408
409
410 # Dumb down libstdc++ for certain configurations.
411 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
412 case "${host}" in
413 amdgcn-*-amdhsa \
414 | nvptx-*-none )
415 # For 'make all-target-libstdc++-v3' and 'make check-target-libstdc++-v3',
416 # exception handling is not supported: in case that exception handling
417 # constructs survive compiler optimizations, the back ends error out:
418 # sorry, unimplemented: exception handling not supported
419 EXTRA_CXX_FLAGS="${EXTRA_CXX_FLAGS} -fno-exceptions"
420
421 # For 'make all-target-libstdc++-v3' and 'make check-target-libstdc++-v3',
422 # RTTI is not supported.
423 EXTRA_CXX_FLAGS="${EXTRA_CXX_FLAGS} -fno-rtti"
424
425 # Cannot '#include' all newlib header files without explosion, for example:
426 # error: 'jmp_buf' was not declared in this scope
427 # Just disable generation of PCH files here, instead of attempting to care
428 # for such special cases in some more complex way.
429 enable_libstdcxx_pch=no
430 ;;
431 esac