PR middle-end/53850
[official-gcc.git] / libstdc++-v3 / configure.host
blob8b7aae7155bba853cc54b326b0c112deab408f5e
1 # configure.host
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,
28 #                          defaults to no.
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_ext_random     path name of random.h containing CPU-specific
54 #                          optimizations
56 #   error_constants_dir    location of error_constants.h
57 #                          defaults to os/generic.
59 # It possibly modifies the following variables:
61 #   OPT_LDFLAGS            extra flags to pass when linking the library, of
62 #                          the form '-Wl,blah'
63 #                          (defaults to empty in acinclude.m4)
65 #   port_specific_symbol_files
66 #                          whitespace-seperated list of files containing
67 #                          additional symbols to export from the shared
68 #                          library, when symbol versioning is in use
71 # If the defaults will not work for your platform, you need only change the
72 # variables that won't work, i.e., you do not need to explicitly set a
73 # working variable to its default.  Most hosts only need to change the two
74 # *_include_dir variables.
77 # DEFAULTS
78 # Try to guess a default cpu_include_dir based on the name of the CPU.  We
79 # cannot do this for os_include_dir; there are too many portable operating
80 # systems out there.  :-)
81 c_model=c_global
82 c_compatibility=no
83 atomic_word_dir=cpu/generic
84 atomic_flags=""
85 atomicity_dir="cpu/generic"
86 cpu_defines_dir="cpu/generic"
87 try_cpu=generic
88 abi_baseline_subdir_switch=--print-multi-directory
89 abi_tweaks_dir="cpu/generic"
90 error_constants_dir="os/generic"
92 # HOST-SPECIFIC OVERRIDES
93 # Set any CPU-dependent bits.
95 # Provide a way to funnel exotic flavors and prefixed/postfixed chip
96 # variants into the established source config/cpu/* sub-directories.
97 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
98 case "${host_cpu}" in
99   alpha*)
100     try_cpu=alpha
101     ;;
102   arm*)
103     try_cpu=arm
104     ;;
105   crisv32)
106     try_cpu=cris
107     ;;
108   i[567]86 | x86_64)
109     try_cpu=i486
110     ;;
111   hppa*)
112     try_cpu=hppa
113     ;;
114   mep*)
115     EXTRA_CXX_FLAGS=-mm
116     try_cpu=generic
117     ;;
118   mips*)
119     try_cpu=mips
120     ;;
121   powerpc* | rs6000)
122     try_cpu=powerpc
123     ;;
124   sparc* | ultrasparc)
125     try_cpu=sparc
126     ;;
127   *)
128     if test -d ${glibcxx_srcdir}/config/cpu/${host_cpu}; then
129       try_cpu=${host_cpu}
130     fi
131 esac
134 # Now look for the file(s) usually tied to a CPU model, and make
135 # default choices for those if they haven't been explicitly set
136 # already.  
137 cpu_include_dir=cpu/${try_cpu}
140 # Set specific CPU overrides for cpu_defines_dir. Most can just use generic.
141 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
142 case "${host_cpu}" in
143   powerpc* | rs6000)
144     cpu_defines_dir=cpu/powerpc
145     ;;
146 esac
149 # Set specific CPU overrides for atomic_word_dir and atomic_flags. 
150 # Most can just use generic.
151 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
152 case "${host_cpu}" in
153   alpha*)
154     atomic_word_dir=cpu/alpha
155     ;;
156   cris*)
157     atomic_word_dir=cpu/cris
158     ;;
159   ia64)
160     atomic_word_dir=cpu/ia64
161     ;;
162   i[4567]86 | x86_64)
163     atomic_flags="-march=native"
164     ;;
165   powerpc* | rs6000)
166     atomic_word_dir=cpu/powerpc
167     ;;
168   sparc* | ultrasparc)
169     atomic_word_dir=cpu/sparc
170     atomic_flags="-mcpu=v9"
171     ;;
172 esac
175 # Set specific CPU overrides for atomicity_dir.
176 # This can be over-ridden in GLIBCXX_ENABLE_ATOMIC_BUILTINS.
177 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
178 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then
179   atomicity_dir=$cpu_include_dir
183 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/cxxabi_tweaks.h ; then
184   abi_tweaks_dir=$cpu_include_dir
188 # Set directory with CPU-specific optimization
189 cpu_opt_dir=${cpu_include_dir}/opt
190 test -d ${glibcxx_srcdir}/config/${cpu_include_dir}/opt ||
191 cpu_opt_dir=cpu/generic/opt
192 # For each header with CPU-specific optimizations check whether it
193 # exists in ${cpu_opt_dir}.  If not, point the variable at the
194 # appropriate file in the generic directory.
195 cpu_opt_ext_random=${cpu_opt_dir}/ext/opt_random.h
196 test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} ||
197 cpu_opt_ext_random=cpu/generic/opt/ext/opt_random.h
200 # Set any OS-dependent bits.
201 # Set the os_include_dir.
202 # Set the error_costants_dir.
203 # Set c_model, c_compatibility here.
204 # If atomic ops and/or numeric limits are OS-specific rather than
205 # CPU-specifc, set those here too.
206 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
207 case "${host_os}" in
208   aix4.[3456789]* | aix[56789]*)
209     # We set os_include_dir to os/aix only on AIX 4.3 and newer, but
210     # os/aix/atomicity.h works on earlier versions of AIX 4.*, so we
211     # explicitly duplicate the directory for 4.[<3].
212     os_include_dir="os/aix"
213     atomicity_dir="os/aix"
214     atomic_word_dir="os/aix"
215     OPT_LDFLAGS="-Wl,-G"
216     ;;
217   aix4.*)
218     os_include_dir="os/generic"
219     atomicity_dir="os/aix"
220     atomic_word_dir="os/aix"
221     ;;
222   aix*)
223     os_include_dir="os/generic"
224     atomicity_dir="cpu/generic"
225     ;;
226   bsd*)
227     # Plain BSD attempts to share FreeBSD files.
228     os_include_dir="os/bsd/freebsd"
229     ;;
230   cygwin*)
231     os_include_dir="os/newlib"
232     OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
233     ;;
234   darwin | darwin[1-7] | darwin[1-7].*)
235     # On Darwin, performance is improved if libstdc++ is single-module.
236     # Up to at least 10.3.7, -flat_namespace is required for proper
237     # treatment of coalesced symbols.
238     OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module -Wl,-flat_namespace"
239     os_include_dir="os/bsd/darwin"
240     ;;
241   darwin[89] | darwin[89].* | darwin[1-9][0-9]* )
242     # On Darwin, performance is improved if libstdc++ is single-module,
243     # and on 8+ compatibility is better if not -flat_namespace.
244     OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module"
245     case "${host_cpu}" in
246       i[34567]86 | x86_64)
247         OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -fvisibility-inlines-hidden"
248         ;;
249     esac
250     os_include_dir="os/bsd/darwin"
251     ;;
252   *djgpp*)      # leading * picks up "msdosdjgpp"
253     os_include_dir="os/djgpp"
254     error_constants_dir="os/djgpp"
255     ;;
256   freebsd*)
257     os_include_dir="os/bsd/freebsd"
258     ;;
259   gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
260     if [ "$uclibc" = "yes" ]; then
261       os_include_dir="os/uclibc"
262     elif [ "$bionic" = "yes" ]; then
263       os_include_dir="os/bionic"
264     else
265       os_include_dir="os/gnu-linux"
266     fi
267     ;;
268   hpux*)
269     os_include_dir="os/hpux"
270     ;;
271   mingw32*)
272     case "$host" in
273       *-w64-*)
274         os_include_dir="os/mingw32-w64"
275         error_constants_dir="os/mingw32-w64"
276         ;;
277       *)
278         os_include_dir="os/mingw32"
279         error_constants_dir="os/mingw32"
280         ;;
281     esac
282     OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
283     ;;
284   netbsd*)
285     os_include_dir="os/bsd/netbsd"
286     ;;
287   qnx6.[12]*)
288     os_include_dir="os/qnx/qnx6.1"
289     c_model=c
290     ;;
291   solaris2)
292     # This too-vague configuration does not provide enough information
293     # to select a ctype include, and thus os_include_dir is a crap shoot.
294     echo "Please specify the full version of Solaris, ie. solaris2.9 " 1>&2
295     exit 1
296     ;;
297   solaris2.9 | solaris2.1[0-9])
298     os_include_dir="os/solaris/solaris2.9"
299     ;;
300   tpf)
301     os_include_dir="os/tpf"
302     ;;
303   vxworks)
304     os_include_dir="os/vxworks"
305     ;;
306   *)
307     os_include_dir="os/generic"
308     ;;
309 esac
312 # Set any OS-dependent and CPU-dependent bits.
313 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
314 case "${host}" in
315   *-*-linux*)
316     case "${host_cpu}" in
317       i[567]86)
318         abi_baseline_pair=i486-linux-gnu
319         ;;
320       mips64*)
321         abi_baseline_pair=mips64-linux-gnu
322         ;;
323       powerpc64)
324         abi_baseline_pair=powerpc64-linux-gnu
325         ;;
326       s390)
327         abi_baseline_pair=s390-linux-gnu
328         ;;
329       s390x)
330         abi_baseline_pair=s390x-linux-gnu
331         ;;
332       x86_64)
333         abi_baseline_pair=x86_64-linux-gnu
334         ;;
335       *)
336         if test -d ${glibcxx_srcdir}/config/abi/post/${try_cpu}-linux-gnu; then
337           abi_baseline_pair=${try_cpu}-linux-gnu
338         fi
339     esac
340     case "${host}" in
341       arm*-*-linux-*eabi)
342         port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
343         ;;
344     esac
345     ;;
346   powerpc*-*-darwin*)
347     port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
348     ;;
349   *-*-solaris2.9)
350     abi_baseline_pair=solaris2.9
351     abi_baseline_subdir_switch=--print-multi-os-directory
352     ;;
353   *-*-solaris2.1[0-9])
354     abi_baseline_pair=solaris2.10
355     abi_baseline_subdir_switch=--print-multi-os-directory
356     ;;
357 esac