2015-05-19 François Dumont <fdumont@gcc.gnu.org>
[official-gcc.git] / libstdc++-v3 / configure.host
blob465a40a437ef382441107b7855f07aa05e6d2fa6
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_bits_random    path name of random.h containing CPU-specific
54 #                          optimizations
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
65 #                          the form '-Wl,blah'
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.
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"
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
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
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}
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   arm*)
147     cpu_defines_dir=cpu/arm
148     ;;
149   powerpc* | rs6000)
150     cpu_defines_dir=cpu/powerpc
151     ;;
152 esac
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
159   alpha*)
160     atomic_word_dir=cpu/alpha
161     ;;
162   cris*)
163     atomic_word_dir=cpu/cris
164     ;;
165   ia64)
166     atomic_word_dir=cpu/ia64
167     ;;
168   i[4567]86 | x86_64)
169     atomic_flags="-march=native"
170     ;;
171   powerpc* | rs6000)
172     atomic_word_dir=cpu/powerpc
173     ;;
174   sparc* | ultrasparc)
175     atomic_word_dir=cpu/sparc
176     atomic_flags="-mcpu=v9"
177     ;;
178 esac
181 # Set specific CPU overrides for atomicity_dir.
182 # This can be over-ridden in GLIBCXX_ENABLE_ATOMIC_BUILTINS.
183 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
184 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then
185   atomicity_dir=$cpu_include_dir
189 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/cxxabi_tweaks.h ; then
190   abi_tweaks_dir=$cpu_include_dir
194 # Set directory with CPU-specific optimization
195 cpu_opt_dir=${cpu_include_dir}/opt
196 test -d ${glibcxx_srcdir}/config/${cpu_include_dir}/opt ||
197 cpu_opt_dir=cpu/generic/opt
198 # For each header with CPU-specific optimizations check whether it
199 # exists in ${cpu_opt_dir}.  If not, point the variable at the
200 # appropriate file in the generic directory.
201 cpu_opt_ext_random=${cpu_opt_dir}/ext/opt_random.h
202 test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} ||
203 cpu_opt_ext_random=cpu/generic/opt/ext/opt_random.h
205 cpu_opt_bits_random=${cpu_opt_dir}/bits/opt_random.h
206 test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} ||
207 cpu_opt_ext_random=cpu/generic/opt/bits/opt_random.h
210 # Set any OS-dependent bits.
211 # Set the os_include_dir.
212 # Set the error_costants_dir.
213 # Set c_model, c_compatibility here.
214 # If atomic ops and/or numeric limits are OS-specific rather than
215 # CPU-specifc, set those here too.
216 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
217 case "${host_os}" in
218   aix[56789]*)
219     # Newer versions of AIX only support PowerPC architecture, so use
220     # atomic instructions directly.
221     os_include_dir="os/aix"
222     atomic_word_dir="os/aix"
223     ;;
224   aix4.[3456789]*)
225     # We set os_include_dir to os/aix only on AIX 4.3 and newer, but
226     # os/aix/atomicity.h works on earlier versions of AIX 4.*, so we
227     # explicitly duplicate the directory for 4.[<3].
228     os_include_dir="os/aix"
229     atomicity_dir="os/aix"
230     atomic_word_dir="os/aix"
231     ;;
232   aix4.*)
233     os_include_dir="os/generic"
234     atomicity_dir="os/aix"
235     atomic_word_dir="os/aix"
236     ;;
237   aix*)
238     os_include_dir="os/generic"
239     atomicity_dir="cpu/generic"
240     ;;
241   bsd*)
242     # Plain BSD attempts to share FreeBSD files.
243     os_include_dir="os/bsd/freebsd"
244     ;;
245   cygwin*)
246     os_include_dir="os/newlib"
247     OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
248     ;;
249   darwin | darwin[1-7] | darwin[1-7].*)
250     # On Darwin, performance is improved if libstdc++ is single-module.
251     # Up to at least 10.3.7, -flat_namespace is required for proper
252     # treatment of coalesced symbols.
253     OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module -Wl,-flat_namespace"
254     os_include_dir="os/bsd/darwin"
255     ;;
256   darwin[89] | darwin[89].* | darwin[1-9][0-9]* )
257     # On Darwin, performance is improved if libstdc++ is single-module,
258     # and on 8+ compatibility is better if not -flat_namespace.
259     OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module"
260     case "${host_cpu}" in
261       i[34567]86 | x86_64)
262         OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -fvisibility-inlines-hidden"
263         ;;
264     esac
265     os_include_dir="os/bsd/darwin"
266     ;;
267   *djgpp*)      # leading * picks up "msdosdjgpp"
268     os_include_dir="os/djgpp"
269     error_constants_dir="os/djgpp"
270     ;;
271   dragonfly*)
272     os_include_dir="os/bsd/dragonfly"
273     ;;
274   freebsd*)
275     os_include_dir="os/bsd/freebsd"
276     ;;
277   linux-musl*)
278     os_include_dir="os/generic"
279     ;;
280   gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
281     if [ "$uclibc" = "yes" ]; then
282       os_include_dir="os/uclibc"
283     elif [ "$bionic" = "yes" ]; then
284       os_include_dir="os/bionic"
285     else
286       os_include_dir="os/gnu-linux"
287     fi
288     ;;
289   hpux*)
290     os_include_dir="os/hpux"
291     ;;
292   mingw32*)
293     case "$host" in
294       *-w64-*)
295         os_include_dir="os/mingw32-w64"
296         error_constants_dir="os/mingw32-w64"
297         ;;
298       *)
299         os_include_dir="os/mingw32"
300         error_constants_dir="os/mingw32"
301         ;;
302     esac
303     OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
304     ;;
305   netbsd*)
306     os_include_dir="os/bsd/netbsd"
307     ;;
308   openbsd*)
309     os_include_dir="os/bsd/openbsd"
310     ;;
311   qnx6.[12]*)
312     os_include_dir="os/qnx/qnx6.1"
313     c_model=c
314     ;;
315   solaris2)
316     # This too-vague configuration does not provide enough information
317     # to select a ctype include, and thus os_include_dir is a crap shoot.
318     echo "Please specify the full version of Solaris, ie. solaris2.10 " 1>&2
319     exit 1
320     ;;
321   solaris2.1[0-9])
322     os_include_dir="os/solaris/solaris2.10"
323     ;;
324   tpf)
325     os_include_dir="os/tpf"
326     ;;
327   vxworks)
328     os_include_dir="os/vxworks"
329     ;;
330   *)
331     os_include_dir="os/generic"
332     ;;
333 esac
336 # Set any OS-dependent and CPU-dependent bits.
337 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
338 case "${host}" in
339   *-*-linux*)
340     case "${host_cpu}" in
341       i[567]86)
342         abi_baseline_pair=i486-linux-gnu
343         ;;
344       mips64*)
345         abi_baseline_pair=mips64-linux-gnu
346         ;;
347       powerpc64*)
348         abi_baseline_pair=powerpc64-linux-gnu
349         ;;
350       s390)
351         abi_baseline_pair=s390-linux-gnu
352         ;;
353       s390x)
354         abi_baseline_pair=s390x-linux-gnu
355         ;;
356       x86_64)
357         abi_baseline_pair=x86_64-linux-gnu
358         ;;
359       *)
360         if test $try_cpu = generic; then
361           try_abi_cpu=$host_cpu
362         else
363           try_abi_cpu=$try_cpu
364         fi
365         if test -d ${glibcxx_srcdir}/config/abi/post/${try_abi_cpu}-linux-gnu; then
366           abi_baseline_pair=${try_abi_cpu}-linux-gnu
367         fi
368     esac
369     case "${host}" in
370       arm*-*-linux-*)
371         port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
372         ;;
373     esac
374     ;;
375   arm*-*-freebsd*)
376      port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
377      ;;
378   powerpc*-*-darwin*)
379     port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
380     ;;
381   *-*-solaris2.1[0-9])
382     abi_baseline_pair=solaris2.10
383     abi_baseline_subdir_switch=--print-multi-os-directory
384     ;;
385 esac