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.
54 # error_constants_dir location of error_constants.h
55 # defaults to os/generic.
57 # It possibly modifies the following variables:
59 # OPT_LDFLAGS extra flags to pass when linking the library, of
61 # (defaults to empty in acinclude.m4)
63 # port_specific_symbol_files
64 # whitespace-seperated list of files containing
65 # additional symbols to export from the shared
66 # library, when symbol versioning is in use
69 # If the defaults will not work for your platform, you need only change the
70 # variables that won't work, i.e., you do not need to explicitly set a
71 # working variable to its default. Most hosts only need to change the two
72 # *_include_dir variables.
76 # Try to guess a default cpu_include_dir based on the name of the CPU. We
77 # cannot do this for os_include_dir; there are too many portable operating
78 # systems out there. :-)
81 atomic_word_dir=cpu/generic
83 atomicity_dir="cpu/generic"
84 cpu_defines_dir="cpu/generic"
86 abi_baseline_subdir_switch=--print-multi-directory
87 abi_tweaks_dir="cpu/generic"
88 error_constants_dir="os/generic"
90 # HOST-SPECIFIC OVERRIDES
91 # Set any CPU-dependent bits.
93 # Provide a way to funnel exotic flavors and prefixed/postfixed chip
94 # variants into the established source config/cpu/* sub-directories.
95 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
126 if test -d ${glibcxx_srcdir}/config/cpu/${host_cpu}; then
132 # Now look for the file(s) usually tied to a CPU model, and make
133 # default choices for those if they haven't been explicitly set
135 cpu_include_dir=cpu/${try_cpu}
138 # Set specific CPU overrides for cpu_defines_dir. Most can just use generic.
139 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
140 case "${host_cpu}" in
142 cpu_defines_dir=cpu/powerpc
147 # Set specific CPU overrides for atomic_word_dir and atomic_flags.
148 # Most can just use generic.
149 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
150 case "${host_cpu}" in
152 atomic_word_dir=cpu/alpha
155 atomic_word_dir=cpu/cris
158 atomic_word_dir=cpu/ia64
161 atomic_flags="-march=native"
164 atomic_word_dir=cpu/powerpc
167 atomic_word_dir=cpu/sparc
168 atomic_flags="-mcpu=v9"
173 # Set specific CPU overrides for atomicity_dir.
174 # This can be over-ridden in GLIBCXX_ENABLE_ATOMIC_BUILTINS.
175 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
176 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then
177 atomicity_dir=$cpu_include_dir
181 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/cxxabi_tweaks.h ; then
182 abi_tweaks_dir=$cpu_include_dir
186 # Set any OS-dependent bits.
187 # Set the os_include_dir.
188 # Set the error_costants_dir.
189 # Set c_model, c_compatibility here.
190 # If atomic ops and/or numeric limits are OS-specific rather than
191 # CPU-specifc, set those here too.
192 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
194 aix4.[3456789]* | aix[56789]*)
195 # We set os_include_dir to os/aix only on AIX 4.3 and newer, but
196 # os/aix/atomicity.h works on earlier versions of AIX 4.*, so we
197 # explicitly duplicate the directory for 4.[<3].
198 os_include_dir="os/aix"
199 atomicity_dir="os/aix"
200 atomic_word_dir="os/aix"
204 os_include_dir="os/generic"
205 atomicity_dir="os/aix"
206 atomic_word_dir="os/aix"
209 os_include_dir="os/generic"
210 atomicity_dir="cpu/generic"
213 # Plain BSD attempts to share FreeBSD files.
214 os_include_dir="os/bsd/freebsd"
217 os_include_dir="os/newlib"
218 OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
220 darwin | darwin[1-7] | darwin[1-7].*)
221 # On Darwin, performance is improved if libstdc++ is single-module.
222 # Up to at least 10.3.7, -flat_namespace is required for proper
223 # treatment of coalesced symbols.
224 OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module -Wl,-flat_namespace"
225 os_include_dir="os/bsd/darwin"
227 darwin[89] | darwin[89].* | darwin[1-9][0-9]* )
228 # On Darwin, performance is improved if libstdc++ is single-module,
229 # and on 8+ compatibility is better if not -flat_namespace.
230 OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module"
231 case "${host_cpu}" in
233 OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -fvisibility-inlines-hidden"
236 os_include_dir="os/bsd/darwin"
238 *djgpp*) # leading * picks up "msdosdjgpp"
239 os_include_dir="os/djgpp"
240 error_constants_dir="os/djgpp"
243 os_include_dir="os/bsd/freebsd"
245 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
246 if [ "$uclibc" = "yes" ]; then
247 os_include_dir="os/uclibc"
248 elif [ "$bionic" = "yes" ]; then
249 os_include_dir="os/bionic"
251 os_include_dir="os/gnu-linux"
255 os_include_dir="os/hpux"
258 os_include_dir="os/irix/irix6.5"
259 atomicity_dir=os/irix
260 atomic_word_dir=os/irix
265 os_include_dir="os/mingw32-w64"
266 error_constants_dir="os/mingw32-w64"
269 os_include_dir="os/mingw32"
270 error_constants_dir="os/mingw32"
273 OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
276 os_include_dir="os/bsd/netbsd"
279 os_include_dir="os/generic"
280 # libstdc++.so relies on emutls on Tru64 UNIX, which only works with the
281 # real functions implemented in libpthread.so, not with the dummies in
282 # libgcc, so always pass -lpthread.
283 OPT_LDFLAGS="${OPT_LDFLAGS} -lpthread"
286 os_include_dir="os/qnx/qnx6.1"
290 # This too-vague configuration does not provide enough information
291 # to select a ctype include, and thus os_include_dir is a crap shoot.
292 echo "Please specify the full version of Solaris, ie. solaris2.9 " 1>&2
295 solaris2.[89] | solaris2.1[0-9])
296 os_include_dir="os/solaris/solaris2.8"
299 os_include_dir="os/tpf"
302 os_include_dir="os/vxworks"
305 os_include_dir="os/generic"
310 # Set any OS-dependent and CPU-dependent bits.
311 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
314 case "${host_cpu}" in
316 abi_baseline_pair=i486-linux-gnu
319 abi_baseline_pair=mips64-linux-gnu
322 abi_baseline_pair=powerpc64-linux-gnu
325 abi_baseline_pair=s390-linux-gnu
328 abi_baseline_pair=s390x-linux-gnu
331 abi_baseline_pair=x86_64-linux-gnu
334 if test -d ${glibcxx_srcdir}/config/abi/post/${try_cpu}-linux-gnu; then
335 abi_baseline_pair=${try_cpu}-linux-gnu
340 port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
345 port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
348 abi_baseline_pair=solaris2.8
349 abi_baseline_subdir_switch=--print-multi-os-directory
352 abi_baseline_pair=solaris2.10
353 abi_baseline_subdir_switch=--print-multi-os-directory