re PR libstdc++/64584 (basic_regex::assign breaks *this if it throws regex_error)
[gcc.git] / libstdc++-v3 / configure.host
1 # configure.host
2 #
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.
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 # OPT_LDFLAGS extra flags to pass when linking the library, of
65 # the form '-Wl,blah'
66 # (defaults to empty in acinclude.m4)
67 #
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
72 #
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
76 # working variable to its default. Most hosts only need to change the two
77 # *_include_dir variables.
78
79
80 # DEFAULTS
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. :-)
84 c_model=c_global
85 c_compatibility=no
86 atomic_word_dir=cpu/generic
87 atomic_flags=""
88 atomicity_dir="cpu/generic"
89 cpu_defines_dir="cpu/generic"
90 try_cpu=generic
91 abi_baseline_subdir_switch=--print-multi-directory
92 abi_tweaks_dir="cpu/generic"
93 error_constants_dir="os/generic"
94
95 # HOST-SPECIFIC OVERRIDES
96 # Set any CPU-dependent bits.
97
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
102 alpha*)
103 try_cpu=alpha
104 ;;
105 arm*)
106 try_cpu=arm
107 ;;
108 crisv32)
109 try_cpu=cris
110 ;;
111 i[567]86 | x86_64)
112 try_cpu=i486
113 ;;
114 hppa*)
115 try_cpu=hppa
116 ;;
117 mep*)
118 EXTRA_CXX_FLAGS=-mm
119 try_cpu=generic
120 ;;
121 mips*)
122 try_cpu=mips
123 ;;
124 powerpc* | rs6000)
125 try_cpu=powerpc
126 ;;
127 sparc* | ultrasparc)
128 try_cpu=sparc
129 ;;
130 *)
131 if test -d ${glibcxx_srcdir}/config/cpu/${host_cpu}; then
132 try_cpu=${host_cpu}
133 fi
134 esac
135
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.
140 cpu_include_dir=cpu/${try_cpu}
141
142
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
146 powerpc* | rs6000)
147 cpu_defines_dir=cpu/powerpc
148 ;;
149 esac
150
151
152 # Set specific CPU overrides for atomic_word_dir and atomic_flags.
153 # Most can just use generic.
154 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
155 case "${host_cpu}" in
156 alpha*)
157 atomic_word_dir=cpu/alpha
158 ;;
159 cris*)
160 atomic_word_dir=cpu/cris
161 ;;
162 ia64)
163 atomic_word_dir=cpu/ia64
164 ;;
165 i[4567]86 | x86_64)
166 atomic_flags="-march=native"
167 ;;
168 powerpc* | rs6000)
169 atomic_word_dir=cpu/powerpc
170 ;;
171 sparc* | ultrasparc)
172 atomic_word_dir=cpu/sparc
173 atomic_flags="-mcpu=v9"
174 ;;
175 esac
176
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.
181 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then
182 atomicity_dir=$cpu_include_dir
183 fi
184
185
186 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/cxxabi_tweaks.h ; then
187 abi_tweaks_dir=$cpu_include_dir
188 fi
189
190
191 # Set directory with CPU-specific optimization
192 cpu_opt_dir=${cpu_include_dir}/opt
193 test -d ${glibcxx_srcdir}/config/${cpu_include_dir}/opt ||
194 cpu_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.
198 cpu_opt_ext_random=${cpu_opt_dir}/ext/opt_random.h
199 test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} ||
200 cpu_opt_ext_random=cpu/generic/opt/ext/opt_random.h
201
202 cpu_opt_bits_random=${cpu_opt_dir}/bits/opt_random.h
203 test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} ||
204 cpu_opt_ext_random=cpu/generic/opt/bits/opt_random.h
205
206
207 # Set any OS-dependent bits.
208 # Set the os_include_dir.
209 # Set the error_costants_dir.
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.
213 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
214 case "${host_os}" in
215 aix[56789]*)
216 # Newer versions of AIX only support PowerPC architecture, so use
217 # atomic instructions directly.
218 os_include_dir="os/aix"
219 atomic_word_dir="os/aix"
220 ;;
221 aix4.[3456789]*)
222 # We set os_include_dir to os/aix only on AIX 4.3 and newer, but
223 # os/aix/atomicity.h works on earlier versions of AIX 4.*, so we
224 # explicitly duplicate the directory for 4.[<3].
225 os_include_dir="os/aix"
226 atomicity_dir="os/aix"
227 atomic_word_dir="os/aix"
228 ;;
229 aix4.*)
230 os_include_dir="os/generic"
231 atomicity_dir="os/aix"
232 atomic_word_dir="os/aix"
233 ;;
234 aix*)
235 os_include_dir="os/generic"
236 atomicity_dir="cpu/generic"
237 ;;
238 bsd*)
239 # Plain BSD attempts to share FreeBSD files.
240 os_include_dir="os/bsd/freebsd"
241 ;;
242 cygwin*)
243 os_include_dir="os/newlib"
244 OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
245 ;;
246 darwin | darwin[1-7] | darwin[1-7].*)
247 # On Darwin, performance is improved if libstdc++ is single-module.
248 # Up to at least 10.3.7, -flat_namespace is required for proper
249 # treatment of coalesced symbols.
250 OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module -Wl,-flat_namespace"
251 os_include_dir="os/bsd/darwin"
252 ;;
253 darwin[89] | darwin[89].* | darwin[1-9][0-9]* )
254 # On Darwin, performance is improved if libstdc++ is single-module,
255 # and on 8+ compatibility is better if not -flat_namespace.
256 OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module"
257 case "${host_cpu}" in
258 i[34567]86 | x86_64)
259 OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -fvisibility-inlines-hidden"
260 ;;
261 esac
262 os_include_dir="os/bsd/darwin"
263 ;;
264 *djgpp*) # leading * picks up "msdosdjgpp"
265 os_include_dir="os/djgpp"
266 error_constants_dir="os/djgpp"
267 ;;
268 dragonfly*)
269 os_include_dir="os/bsd/dragonfly"
270 ;;
271 freebsd*)
272 os_include_dir="os/bsd/freebsd"
273 ;;
274 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
275 if [ "$uclibc" = "yes" ]; then
276 os_include_dir="os/uclibc"
277 elif [ "$bionic" = "yes" ]; then
278 os_include_dir="os/bionic"
279 else
280 os_include_dir="os/gnu-linux"
281 fi
282 ;;
283 hpux*)
284 os_include_dir="os/hpux"
285 ;;
286 mingw32*)
287 case "$host" in
288 *-w64-*)
289 os_include_dir="os/mingw32-w64"
290 error_constants_dir="os/mingw32-w64"
291 ;;
292 *)
293 os_include_dir="os/mingw32"
294 error_constants_dir="os/mingw32"
295 ;;
296 esac
297 OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
298 ;;
299 netbsd*)
300 os_include_dir="os/bsd/netbsd"
301 ;;
302 openbsd*)
303 os_include_dir="os/bsd/openbsd"
304 ;;
305 qnx6.[12]*)
306 os_include_dir="os/qnx/qnx6.1"
307 c_model=c
308 ;;
309 solaris2)
310 # This too-vague configuration does not provide enough information
311 # to select a ctype include, and thus os_include_dir is a crap shoot.
312 echo "Please specify the full version of Solaris, ie. solaris2.10 " 1>&2
313 exit 1
314 ;;
315 solaris2.1[0-9])
316 os_include_dir="os/solaris/solaris2.10"
317 ;;
318 tpf)
319 os_include_dir="os/tpf"
320 ;;
321 vxworks)
322 os_include_dir="os/vxworks"
323 ;;
324 *)
325 os_include_dir="os/generic"
326 ;;
327 esac
328
329
330 # Set any OS-dependent and CPU-dependent bits.
331 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
332 case "${host}" in
333 *-*-linux*)
334 case "${host_cpu}" in
335 i[567]86)
336 abi_baseline_pair=i486-linux-gnu
337 ;;
338 mips64*)
339 abi_baseline_pair=mips64-linux-gnu
340 ;;
341 powerpc64*)
342 abi_baseline_pair=powerpc64-linux-gnu
343 ;;
344 s390)
345 abi_baseline_pair=s390-linux-gnu
346 ;;
347 s390x)
348 abi_baseline_pair=s390x-linux-gnu
349 ;;
350 x86_64)
351 abi_baseline_pair=x86_64-linux-gnu
352 ;;
353 *)
354 if test $try_cpu = generic; then
355 try_abi_cpu=$host_cpu
356 else
357 try_abi_cpu=$try_cpu
358 fi
359 if test -d ${glibcxx_srcdir}/config/abi/post/${try_abi_cpu}-linux-gnu; then
360 abi_baseline_pair=${try_abi_cpu}-linux-gnu
361 fi
362 esac
363 case "${host}" in
364 arm*-*-linux-*)
365 port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
366 ;;
367 esac
368 ;;
369 arm*-*-freebsd*)
370 port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
371 ;;
372 powerpc*-*-darwin*)
373 port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
374 ;;
375 *-*-solaris2.1[0-9])
376 abi_baseline_pair=solaris2.10
377 abi_baseline_subdir_switch=--print-multi-os-directory
378 ;;
379 esac