OSDN Git Service

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