]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/configure.host
re PR middle-end/57134 (ICE with -mstrict-align and inline assembly on ppc64)
[thirdparty/gcc.git] / libstdc++-v3 / configure.host
CommitLineData
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
e6b7a69a 69# whitespace-seperated 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 84c_model=c_global
85ab9d23 85c_compatibility=no
2c5d0ae8 86atomic_word_dir=cpu/generic
c2ba9709 87atomic_flags=""
701a3eee
BK
88atomicity_dir="cpu/generic"
89cpu_defines_dir="cpu/generic"
90try_cpu=generic
00fc1bf6 91abi_baseline_subdir_switch=--print-multi-directory
701a3eee 92abi_tweaks_dir="cpu/generic"
e4bf5dfc 93error_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 101case "${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 ;;
7acf4da6
DD
117 mep*)
118 EXTRA_CXX_FLAGS=-mm
119 try_cpu=generic
120 ;;
92d568f2 121 mips*)
701a3eee 122 try_cpu=mips
92d568f2 123 ;;
bd11db39 124 powerpc* | rs6000)
ef16a298 125 try_cpu=powerpc
d0941a31 126 ;;
0fe707cc 127 sparc* | ultrasparc)
ef16a298
BK
128 try_cpu=sparc
129 ;;
130 *)
1568430f 131 if test -d ${glibcxx_srcdir}/config/cpu/${host_cpu}; then
bbdfb3e8 132 try_cpu=${host_cpu}
bbdfb3e8 133 fi
d0941a31
PE
134esac
135
701a3eee
BK
136
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
139# already.
140cpu_include_dir=cpu/${try_cpu}
141
2c5d0ae8 142
4b90c838
PC
143# Set specific CPU overrides for cpu_defines_dir. Most can just use generic.
144# THIS TABLE IS SORTED. KEEP IT THAT WAY.
145case "${host_cpu}" in
460d832b 146 powerpc* | rs6000)
4b90c838
PC
147 cpu_defines_dir=cpu/powerpc
148 ;;
149esac
150
2c839a4e 151
c2ba9709
JS
152# Set specific CPU overrides for atomic_word_dir and atomic_flags.
153# Most can just use generic.
701a3eee 154# THIS TABLE IS SORTED. KEEP IT THAT WAY.
7c499eeb 155case "${host_cpu}" in
701a3eee
BK
156 alpha*)
157 atomic_word_dir=cpu/alpha
7c499eeb 158 ;;
701a3eee
BK
159 cris*)
160 atomic_word_dir=cpu/cris
161 ;;
162 ia64)
163 atomic_word_dir=cpu/ia64
164 ;;
bdfb7c6d 165 i[4567]86 | x86_64)
c2ba9709
JS
166 atomic_flags="-march=native"
167 ;;
701a3eee
BK
168 powerpc* | rs6000)
169 atomic_word_dir=cpu/powerpc
170 ;;
171 sparc* | ultrasparc)
172 atomic_word_dir=cpu/sparc
c2ba9709 173 atomic_flags="-mcpu=v9"
7c499eeb
PC
174 ;;
175esac
1568430f 176
701a3eee
BK
177
178# Set specific CPU overrides for atomicity_dir.
179# This can be over-ridden in GLIBCXX_ENABLE_ATOMIC_BUILTINS.
180# THIS TABLE IS SORTED. KEEP IT THAT WAY.
181if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then
182 atomicity_dir=$cpu_include_dir
183fi
184
185
1568430f
PB
186if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/cxxabi_tweaks.h ; then
187 abi_tweaks_dir=$cpu_include_dir
1568430f 188fi
2c839a4e 189
701a3eee 190
9bf714c2
UD
191# Set directory with CPU-specific optimization
192cpu_opt_dir=${cpu_include_dir}/opt
193test -d ${glibcxx_srcdir}/config/${cpu_include_dir}/opt ||
194cpu_opt_dir=cpu/generic/opt
195# For each header with CPU-specific optimizations check whether it
196# exists in ${cpu_opt_dir}. If not, point the variable at the
197# appropriate file in the generic directory.
198cpu_opt_ext_random=${cpu_opt_dir}/ext/opt_random.h
199test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} ||
200cpu_opt_ext_random=cpu/generic/opt/ext/opt_random.h
201
48c7b524
UD
202cpu_opt_bits_random=${cpu_opt_dir}/bits/opt_random.h
203test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} ||
204cpu_opt_ext_random=cpu/generic/opt/bits/opt_random.h
205
9bf714c2 206
e01c9849 207# Set any OS-dependent bits.
17640f24 208# Set the os_include_dir.
e4bf5dfc 209# Set the error_costants_dir.
e01c9849
BK
210# Set c_model, c_compatibility here.
211# If atomic ops and/or numeric limits are OS-specific rather than
212# CPU-specifc, set those here too.
d0941a31 213# THIS TABLE IS SORTED. KEEP IT THAT WAY.
b731048b 214case "${host_os}" in
527b03ed 215 aix4.[3456789]* | aix[56789]*)
2c839a4e 216 # We set os_include_dir to os/aix only on AIX 4.3 and newer, but
d32e25df 217 # os/aix/atomicity.h works on earlier versions of AIX 4.*, so we
2c839a4e
PE
218 # explicitly duplicate the directory for 4.[<3].
219 os_include_dir="os/aix"
2c5d0ae8 220 atomicity_dir="os/aix"
7afe555c 221 atomic_word_dir="os/aix"
34e3a8d5 222 OPT_LDFLAGS="-Wl,-G"
d0941a31 223 ;;
2c839a4e 224 aix4.*)
47395a24 225 os_include_dir="os/generic"
2c5d0ae8 226 atomicity_dir="os/aix"
7afe555c 227 atomic_word_dir="os/aix"
2c839a4e
PE
228 ;;
229 aix*)
47395a24 230 os_include_dir="os/generic"
2c5d0ae8 231 atomicity_dir="cpu/generic"
2c839a4e 232 ;;
8478f170
LR
233 bsd*)
234 # Plain BSD attempts to share FreeBSD files.
2c839a4e 235 os_include_dir="os/bsd/freebsd"
d0941a31 236 ;;
c383aafd 237 cygwin*)
2c839a4e 238 os_include_dir="os/newlib"
7de6ba7a 239 OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
2c839a4e 240 ;;
ae59b55c 241 darwin | darwin[1-7] | darwin[1-7].*)
f1a66265 242 # On Darwin, performance is improved if libstdc++ is single-module.
ae59b55c 243 # Up to at least 10.3.7, -flat_namespace is required for proper
f1a66265
GK
244 # treatment of coalesced symbols.
245 OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module -Wl,-flat_namespace"
f9686024 246 os_include_dir="os/bsd/darwin"
f1a66265 247 ;;
ae59b55c
GK
248 darwin[89] | darwin[89].* | darwin[1-9][0-9]* )
249 # On Darwin, performance is improved if libstdc++ is single-module,
250 # and on 8+ compatibility is better if not -flat_namespace.
251 OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module"
62801a96
HH
252 case "${host_cpu}" in
253 i[34567]86 | x86_64)
254 OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -fvisibility-inlines-hidden"
255 ;;
256 esac
ae59b55c
GK
257 os_include_dir="os/bsd/darwin"
258 ;;
2c839a4e
PE
259 *djgpp*) # leading * picks up "msdosdjgpp"
260 os_include_dir="os/djgpp"
a51d1999 261 error_constants_dir="os/djgpp"
c383aafd 262 ;;
8478f170
LR
263 freebsd*)
264 os_include_dir="os/bsd/freebsd"
8478f170 265 ;;
b938ad89 266 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
464aea98
JM
267 if [ "$uclibc" = "yes" ]; then
268 os_include_dir="os/uclibc"
aa6a73b9
MK
269 elif [ "$bionic" = "yes" ]; then
270 os_include_dir="os/bionic"
464aea98
JM
271 else
272 os_include_dir="os/gnu-linux"
273 fi
6f87af20 274 ;;
2c839a4e
PE
275 hpux*)
276 os_include_dir="os/hpux"
d0941a31 277 ;;
944effb6 278 mingw32*)
d7a3ef97
JY
279 case "$host" in
280 *-w64-*)
281 os_include_dir="os/mingw32-w64"
282 error_constants_dir="os/mingw32-w64"
283 ;;
284 *)
285 os_include_dir="os/mingw32"
286 error_constants_dir="os/mingw32"
287 ;;
288 esac
7de6ba7a 289 OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
944effb6 290 ;;
11b176c1 291 netbsd*)
2c839a4e 292 os_include_dir="os/bsd/netbsd"
11b176c1 293 ;;
1f726ff8
MK
294 openbsd*)
295 os_include_dir="os/bsd/openbsd"
296 ;;
ff66d28f
PE
297 qnx6.[12]*)
298 os_include_dir="os/qnx/qnx6.1"
299 c_model=c
300 ;;
43892f8c
BK
301 solaris2)
302 # This too-vague configuration does not provide enough information
303 # to select a ctype include, and thus os_include_dir is a crap shoot.
304 echo "Please specify the full version of Solaris, ie. solaris2.9 " 1>&2
7d3998a4 305 exit 1
43892f8c 306 ;;
7888f266
RO
307 solaris2.9 | solaris2.1[0-9])
308 os_include_dir="os/solaris/solaris2.9"
a1998fab 309 ;;
6e198ee0
UW
310 tpf)
311 os_include_dir="os/tpf"
312 ;;
65fc9769
PE
313 vxworks)
314 os_include_dir="os/vxworks"
315 ;;
d0941a31 316 *)
2c839a4e 317 os_include_dir="os/generic"
d0941a31
PE
318 ;;
319esac
320
321
e01c9849 322# Set any OS-dependent and CPU-dependent bits.
d0941a31 323# THIS TABLE IS SORTED. KEEP IT THAT WAY.
b731048b 324case "${host}" in
701a3eee
BK
325 *-*-linux*)
326 case "${host_cpu}" in
327 i[567]86)
328 abi_baseline_pair=i486-linux-gnu
329 ;;
8deecedf
AN
330 mips64*)
331 abi_baseline_pair=mips64-linux-gnu
332 ;;
701a3eee
BK
333 powerpc64)
334 abi_baseline_pair=powerpc64-linux-gnu
335 ;;
336 s390)
337 abi_baseline_pair=s390-linux-gnu
338 ;;
339 s390x)
340 abi_baseline_pair=s390x-linux-gnu
341 ;;
342 x86_64)
343 abi_baseline_pair=x86_64-linux-gnu
344 ;;
345 *)
346 if test -d ${glibcxx_srcdir}/config/abi/post/${try_cpu}-linux-gnu; then
347 abi_baseline_pair=${try_cpu}-linux-gnu
348 fi
349 esac
5194c5c1 350 case "${host}" in
9945a876 351 arm*-*-linux-*)
5194c5c1
MM
352 port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
353 ;;
354 esac
701a3eee 355 ;;
f9314d01
GK
356 powerpc*-*-darwin*)
357 port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
358 ;;
7888f266
RO
359 *-*-solaris2.9)
360 abi_baseline_pair=solaris2.9
00fc1bf6 361 abi_baseline_subdir_switch=--print-multi-os-directory
33f49367
RO
362 ;;
363 *-*-solaris2.1[0-9])
364 abi_baseline_pair=solaris2.10
00fc1bf6 365 abi_baseline_subdir_switch=--print-multi-os-directory
c18dc5cc 366 ;;
6414587c 367esac