modula2: Pass --destdir for dir index during install of m2.info.
[official-gcc.git] / libstdc++-v3 / configure.host
blob7bc430716168748b96053d0c4d7785268706dd1c
1 # configure.host
3 # This shell script handles all host based configuration for libstdc++.
4 # It sets various shell variables based on 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
73 #   tmake_file             A list of machine-description-specific
74 #                          makefile fragments.
77 # If the defaults will not work for your platform, you need only change the
78 # variables that won't work, i.e., you do not need to explicitly set a
79 # working variable to its default.  Most hosts only need to change the two
80 # *_include_dir variables.
83 # DEFAULTS
84 # Try to guess a default cpu_include_dir based on the name of the CPU.  We
85 # cannot do this for os_include_dir; there are too many portable operating
86 # systems out there.  :-)
87 c_model=c_global
88 c_compatibility=no
89 atomic_word_dir=cpu/generic
90 atomic_flags=""
91 atomicity_dir="cpu/generic"
92 cpu_defines_dir="cpu/generic"
93 try_cpu=generic
94 abi_baseline_subdir_switch=--print-multi-directory
95 abi_tweaks_dir="cpu/generic"
96 error_constants_dir="os/generic"
97 tmake_file=
99 # HOST-SPECIFIC OVERRIDES
100 # Set any CPU-dependent bits.
102 # Provide a way to funnel exotic flavors and prefixed/postfixed chip
103 # variants into the established source config/cpu/* sub-directories.
104 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
105 case "${host_cpu}" in
106   alpha*)
107     try_cpu=alpha
108     ;;
109   arm*)
110     try_cpu=arm
111     ;;
112   crisv32)
113     try_cpu=cris
114     ;;
115   i[567]86 | x86_64)
116     try_cpu=i486
117     ;;
118   hppa*)
119     try_cpu=hppa
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   cris*)
160     atomic_word_dir=cpu/cris
161     ;;
162   i[4567]86 | x86_64)
163     atomic_flags="-march=native"
164     ;;
165   sparc* | ultrasparc)
166     atomic_word_dir=cpu/sparc
167     atomic_flags="-mcpu=v9"
168     ;;
169 esac
172 # Set specific CPU overrides for atomicity_dir.
173 # This can be over-ridden in GLIBCXX_ENABLE_ATOMIC_BUILTINS.
174 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
175 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then
176   atomicity_dir=$cpu_include_dir
180 if test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/cxxabi_tweaks.h ; then
181   abi_tweaks_dir=$cpu_include_dir
185 # Set directory with CPU-specific optimization
186 cpu_opt_dir=${cpu_include_dir}/opt
187 test -d ${glibcxx_srcdir}/config/${cpu_include_dir}/opt ||
188 cpu_opt_dir=cpu/generic/opt
189 # For each header with CPU-specific optimizations check whether it
190 # exists in ${cpu_opt_dir}.  If not, point the variable at the
191 # appropriate file in the generic directory.
192 cpu_opt_ext_random=${cpu_opt_dir}/ext/opt_random.h
193 test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} ||
194 cpu_opt_ext_random=cpu/generic/opt/ext/opt_random.h
196 cpu_opt_bits_random=${cpu_opt_dir}/bits/opt_random.h
197 test -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} ||
198 cpu_opt_ext_random=cpu/generic/opt/bits/opt_random.h
201 # Set any OS-dependent bits.
202 # Set the os_include_dir.
203 # Set the error_costants_dir.
204 # Set c_model, c_compatibility here.
205 # If atomic ops and/or numeric limits are OS-specific rather than
206 # CPU-specifc, set those here too.
207 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
208 case "${host_os}" in
209   aix[56789]*)
210     # Newer versions of AIX only support PowerPC architecture, so use
211     # atomic instructions directly.
212     os_include_dir="os/aix"
213     tmake_file="os/aix/t-aix"
214     ;;
215   aix*)
216     os_include_dir="os/generic"
217     atomicity_dir="cpu/generic"
218     ;;
219   bsd*)
220     # Plain BSD attempts to share FreeBSD files.
221     os_include_dir="os/bsd/freebsd"
222     ;;
223   cygwin*)
224     os_include_dir="os/newlib"
225     OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
226     ;;
227   darwin[4-7] | darwin[4-7].*)
228     # For earlier Darwin, performance is improved if libstdc++ is
229     # single-module. Up to at least 10.3.7, -flat_namespace is required
230     # for proper treatment of coalesced symbols.
231     OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module -Wl,-flat_namespace"
232     os_include_dir="os/bsd/darwin"
233     ;;
234   darwin8 | darwin8.* )
235     # For 8+ compatibility is better if not -flat_namespace.
236     OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module"
237     case "${host_cpu}" in
238       i[34567]86 | x86_64)
239         OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -fvisibility-inlines-hidden"
240         ;;
241     esac
242     os_include_dir="os/bsd/darwin"
243     ;;
244   darwin*)
245     # Post Darwin8, defaults should be sufficient.
246     os_include_dir="os/bsd/darwin"
247     ;;
248   *djgpp*)      # leading * picks up "msdosdjgpp"
249     os_include_dir="os/djgpp"
250     error_constants_dir="os/djgpp"
251     ;;
252   dragonfly*)
253     os_include_dir="os/bsd/dragonfly"
254     ;;
255   freebsd*)
256     os_include_dir="os/bsd/freebsd"
257     ;;
258   linux-musl*)
259     os_include_dir="os/generic"
260     ;;
261   gnu* | linux* | kfreebsd*-gnu | uclinux*)
262     if [ "$uclibc" = "yes" ]; then
263       os_include_dir="os/uclibc"
264     elif [ "$bionic" = "yes" ]; then
265       os_include_dir="os/bionic"
266     else
267       os_include_dir="os/gnu-linux"
268     fi
269     ;;
270   hpux*)
271     os_include_dir="os/hpux"
272     ;;
273   mingw32*)
274     case "$host" in
275       *-w64-*)
276         os_include_dir="os/mingw32-w64"
277         error_constants_dir="os/mingw32-w64"
278         ;;
279       *)
280         os_include_dir="os/mingw32"
281         error_constants_dir="os/mingw32"
282         ;;
283     esac
284     OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
285     ;;
286   netbsd*)
287     os_include_dir="os/bsd/netbsd"
288     ;;
289   openbsd*)
290     os_include_dir="os/bsd/openbsd"
291     ;;
292   qnx6.[12]*)
293     os_include_dir="os/qnx/qnx6.1"
294     c_model=c
295     ;;
296   rtems*)
297     # Use libatomic if necessary and avoid libstdc++ specific atomicity support
298     atomicity_dir="cpu/generic/atomicity_builtins"
299     ;;
300   solaris2*)
301     os_include_dir="os/solaris"
302     ;;
303   tpf)
304     os_include_dir="os/tpf"
305     ;;
306   vxworks*)
307     os_include_dir="os/vxworks"
308     ;;
309   *)
310     os_include_dir="os/generic"
311     ;;
312 esac
315 # Set any OS-dependent and CPU-dependent bits.
316 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
317 case "${host}" in
318  loongarch*)
319     tmake_file="cpu/loongarch/t-loongarch"
320     ;;
321  *-*-linux* | *-*-uclinux*)
322     case "${host_cpu}" in
323       i[567]86)
324         abi_baseline_pair=i486-linux-gnu
325         ;;
326       mips64*)
327         abi_baseline_pair=mips64-linux-gnu
328         ;;
329       powerpc64le*)
330         abi_baseline_pair=powerpc64le-linux-gnu
331         ;;
332       powerpc64*)
333         abi_baseline_pair=powerpc64-linux-gnu
334         ;;
335       s390)
336         abi_baseline_pair=s390-linux-gnu
337         ;;
338       s390x)
339         abi_baseline_pair=s390x-linux-gnu
340         ;;
341       sparc64)
342         abi_baseline_pair=sparc64-linux-gnu
343         ;;
344       x86_64)
345         abi_baseline_pair=x86_64-linux-gnu
346         ;;
347       *)
348         if test $try_cpu = generic; then
349           try_abi_cpu=$host_cpu
350         else
351           try_abi_cpu=$try_cpu
352         fi
353         if test -d ${glibcxx_srcdir}/config/abi/post/${try_abi_cpu}-linux-gnu; then
354           abi_baseline_pair=${try_abi_cpu}-linux-gnu
355         fi
356     esac
357     case "${host}" in
358       arm*-*-linux-* | arm*-*-uclinuxfdpiceabi)
359         port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
360         ;;
361     esac
362     ;;
363   arm*-*-freebsd*)
364      port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
365      ;;
366   powerpc*-*-darwin*)
367     port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
368     ;;
369   *-*-solaris2*)
370     abi_baseline_pair=solaris
371     case "${host_cpu}" in
372         i?86 | x86_64)
373             abi_baseline_pair=i386-${abi_baseline_pair}
374             ;;
375         sparc*)
376             abi_baseline_pair=sparc-${abi_baseline_pair}
377             ;;
378     esac
379     abi_baseline_subdir_switch=--print-multi-os-directory
380     ;;
381 esac