3 # This shell script handles all host based configuration for libstdc++.
4 # It sets various shell variables based on the 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.
8 # You should read docs/html/17_intro/porting.* to make sense of this file.
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
17 # It sets the following shell variables:
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.
23 # os_include_dir OS-specific directory, defaults to os/generic.
25 # c_model the "C" header model, defaults to c_global.
27 # c_compatibility if "C" compatibility headers are necessary,
30 # abi_baseline_pair directory name for ABI compat testing,
31 # defaults to host_cpu-host_os (as per config.guess)
33 # abi_baseline_subdir_switch
34 # g++ switch to determine ABI baseline subdir for
35 # multilibbed targets,
36 # defaults to --print-multi-directory
38 # abi_tweaks_dir location of cxxabi_tweaks.h,
39 # defaults to cpu_include_dir
41 # atomicity_dir location of atomicity.h,
42 # defaults to cpu_include_dir
44 # atomic_word_dir location of atomic_word.h
45 # defaults to generic.
47 # atomic_flags extra flags to pass to use atomic instructions
48 # defaults to nothing.
50 # cpu_defines_dir location of cpu_defines.h
51 # defaults to generic.
53 # cpu_opt_bits_random path name of random.h containing CPU-specific
56 # cpu_opt_ext_random path name of random.h containing CPU-specific
57 # optimizations for extensions
59 # error_constants_dir location of error_constants.h
60 # defaults to os/generic.
62 # It possibly modifies the following variables:
64 # OPT_LDFLAGS extra flags to pass when linking the library, of
66 # (defaults to empty in acinclude.m4)
68 # port_specific_symbol_files
69 # whitespace-separated list of files containing
70 # additional symbols to export from the shared
71 # library, when symbol versioning is in use
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
76 # working variable to its default. Most hosts only need to change the two
77 # *_include_dir variables.
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. :-)
86 atomic_word_dir=cpu/generic
88 atomicity_dir="cpu/generic"
89 cpu_defines_dir="cpu/generic"
91 abi_baseline_subdir_switch=--print-multi-directory
92 abi_tweaks_dir="cpu/generic"
93 error_constants_dir="os/generic"
95 # HOST-SPECIFIC OVERRIDES
96 # Set any CPU-dependent bits.
98 # Provide a way to funnel exotic flavors and prefixed/postfixed chip
99 # variants into the established source config/cpu/* sub-directories.
100 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
101 case "${host_cpu}" in
131 if test -d ${glibcxx_srcdir}/config/cpu/${host_cpu}; then
137 # Now look for the file(s) usually tied to a CPU model, and make
138 # default choices for those if they haven't been explicitly set
140 cpu_include_dir=cpu/${try_cpu}
143 # Set specific CPU overrides for cpu_defines_dir. Most can just use generic.
144 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
145 case "${host_cpu}" in
147 cpu_defines_dir=cpu/arm
150 cpu_defines_dir=cpu/powerpc
155 # Set specific CPU overrides for atomic_word_dir and atomic_flags.
156 # Most can just use generic.
157 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
158 case "${host_cpu}" in
160 atomic_word_dir=cpu/cris
163 atomic_flags="-march=native"
166 atomic_word_dir=cpu/sparc
167 atomic_flags="-mcpu=v9"
172 # Set specific CPU overrides for atomicity_dir.
173 # This can be over-ridden in GLIBCXX_ENABLE_ATOMIC_BUILTINS.
174 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
175 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then
176 atomicity_dir=$cpu_include_dir
180 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/cxxabi_tweaks.h ; then
181 abi_tweaks_dir=$cpu_include_dir
185 # Set directory with CPU-specific optimization
186 cpu_opt_dir=${cpu_include_dir}/opt
187 test -d ${glibcxx_srcdir}/config/${cpu_include_dir}/opt ||
188 cpu_opt_dir=cpu/generic/opt
189 # For each header with CPU-specific optimizations check whether it
190 # exists in ${cpu_opt_dir}. If not, point the variable at the
191 # appropriate file in the generic directory.
192 cpu_opt_ext_random=${cpu_opt_dir}/ext/opt_random.h
193 test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} ||
194 cpu_opt_ext_random=cpu/generic/opt/ext/opt_random.h
196 cpu_opt_bits_random=${cpu_opt_dir}/bits/opt_random.h
197 test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} ||
198 cpu_opt_ext_random=cpu/generic/opt/bits/opt_random.h
201 # Set any OS-dependent bits.
202 # Set the os_include_dir.
203 # Set the error_costants_dir.
204 # Set c_model, c_compatibility here.
205 # If atomic ops and/or numeric limits are OS-specific rather than
206 # CPU-specifc, set those here too.
207 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
210 # Newer versions of AIX only support PowerPC architecture, so use
211 # atomic instructions directly.
212 os_include_dir="os/aix"
215 # We set os_include_dir to os/aix only on AIX 4.3 and newer, but
216 # os/aix/atomicity.h works on earlier versions of AIX 4.*, so we
217 # explicitly duplicate the directory for 4.[<3].
218 os_include_dir="os/aix"
219 atomicity_dir="os/aix"
222 os_include_dir="os/generic"
223 atomicity_dir="os/aix"
226 os_include_dir="os/generic"
227 atomicity_dir="cpu/generic"
230 # Plain BSD attempts to share FreeBSD files.
231 os_include_dir="os/bsd/freebsd"
234 os_include_dir="os/newlib"
235 OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
237 darwin | darwin[1-7] | darwin[1-7].*)
238 # On Darwin, performance is improved if libstdc++ is single-module.
239 # Up to at least 10.3.7, -flat_namespace is required for proper
240 # treatment of coalesced symbols.
241 OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module -Wl,-flat_namespace"
242 os_include_dir="os/bsd/darwin"
244 darwin[89] | darwin[89].* | darwin[1-9][0-9]* )
245 # On Darwin, performance is improved if libstdc++ is single-module,
246 # and on 8+ compatibility is better if not -flat_namespace.
247 OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module"
248 case "${host_cpu}" in
250 OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -fvisibility-inlines-hidden"
253 os_include_dir="os/bsd/darwin"
255 *djgpp*) # leading * picks up "msdosdjgpp"
256 os_include_dir="os/djgpp"
257 error_constants_dir="os/djgpp"
260 os_include_dir="os/bsd/dragonfly"
263 os_include_dir="os/bsd/freebsd"
266 os_include_dir="os/generic"
268 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
269 if [ "$uclibc" = "yes" ]; then
270 os_include_dir="os/uclibc"
271 elif [ "$bionic" = "yes" ]; then
272 os_include_dir="os/bionic"
274 os_include_dir="os/gnu-linux"
278 os_include_dir="os/hpux"
283 os_include_dir="os/mingw32-w64"
284 error_constants_dir="os/mingw32-w64"
287 os_include_dir="os/mingw32"
288 error_constants_dir="os/mingw32"
291 OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
294 os_include_dir="os/bsd/netbsd"
297 os_include_dir="os/bsd/openbsd"
300 os_include_dir="os/qnx/qnx6.1"
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.
306 echo "Please specify the full version of Solaris, ie. solaris2.10 " 1>&2
310 os_include_dir="os/solaris/solaris2.10"
313 os_include_dir="os/tpf"
316 os_include_dir="os/vxworks"
319 os_include_dir="os/generic"
324 # Set any OS-dependent and CPU-dependent bits.
325 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
328 case "${host_cpu}" in
330 abi_baseline_pair=i486-linux-gnu
333 abi_baseline_pair=mips64-linux-gnu
336 abi_baseline_pair=powerpc64-linux-gnu
339 abi_baseline_pair=s390-linux-gnu
342 abi_baseline_pair=s390x-linux-gnu
345 abi_baseline_pair=x86_64-linux-gnu
348 if test $try_cpu = generic; then
349 try_abi_cpu=$host_cpu
353 if test -d ${glibcxx_srcdir}/config/abi/post/${try_abi_cpu}-linux-gnu; then
354 abi_baseline_pair=${try_abi_cpu}-linux-gnu
359 port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
364 port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
367 port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
370 abi_baseline_pair=solaris2.10
371 abi_baseline_subdir_switch=--print-multi-os-directory