configure.host revision 146897
1132720Skan# configure.host
2132720Skan#
3132720Skan# This shell script handles all host based configuration for libstdc++.
4132720Skan# It sets various shell variables based on the the host and the
5132720Skan# configuration options.  You can modify this shell script without needing
6132720Skan# to rerun autoconf/aclocal/etc.  This file is "sourced" not executed.
7132720Skan#
8132720Skan# You should read docs/html/17_intro/porting.* to make sense of this file.
9132720Skan#
10132720Skan#
11132720Skan# It uses the following shell variables as set by config.guess:
12132720Skan#   host                The configuration host (full CPU-vendor-OS triplet)
13132720Skan#   host_cpu            The configuration host CPU
14132720Skan#   host_os             The configuration host OS
15132720Skan#
16132720Skan#
17132720Skan# It sets the following shell variables:
18132720Skan#
19132720Skan#   cpu_include_dir        CPU-specific directory, defaults to cpu/generic
20132720Skan#                          if cpu/host_cpu doesn't exist.  This is
21132720Skan#                          used to set atomicity_include_dir.
22132720Skan#
23132720Skan#   os_include_dir         OS-specific directory, defaults to os/generic.
24132720Skan#
25132720Skan#   c_model                the "C" header model, defaults to c_std.
26132720Skan#
27132720Skan#   c_compatibility        if "C" compatibility headers are necessary,
28132720Skan#                          defaults to no.
29132720Skan#
30132720Skan#   abi_baseline_pair      directory name for ABI compat testing,
31132720Skan#                          defaults to host_cpu-host_os (as per config.guess)
32132720Skan#
33132720Skan#   atomicity_dir          location of atomicity.h,
34132720Skan#                          defaults to cpu_include_dir
35132720Skan#
36132720Skan#   atomic_word_dir        location of atomic_word.h
37132720Skan#                          defaults to generic.
38132720Skan#
39132720Skan# It possibly modifies the following variables:
40132720Skan#
41132720Skan#   OPT_LDFLAGS            extra flags to pass when linking the library, of
42132720Skan#                          the form '-Wl,blah'
43132720Skan#                          (defaults to empty in acinclude.m4)
44132720Skan#
45132720Skan#   port_specific_symbol_files
46132720Skan#                          whitespace-seperated list of files containing
47132720Skan#                          additional symbols to export from the shared
48132720Skan#                          library, when symbol versioning is in use
49132720Skan#
50132720Skan#
51132720Skan# If the defaults will not work for your platform, you need only change the
52132720Skan# variables that won't work, i.e., you do not need to explicitly set a
53132720Skan# working variable to its default.  Most hosts only need to change the two
54132720Skan# *_include_dir variables.
55132720Skan
56132720Skan
57132720Skan# DEFAULTS
58132720Skan# Try to guess a default cpu_include_dir based on the name of the CPU.  We
59132720Skan# cannot do this for os_include_dir; there are too many portable operating
60132720Skan# systems out there.  :-)
61132720Skanc_model=c_std
62132720Skanc_compatibility=no
63132720Skanatomic_word_dir=cpu/generic
64132720Skan
65132720Skan# HOST-SPECIFIC OVERRIDES
66132720Skan# Set any CPU-dependent bits.
67132720Skan# Here we override defaults and catch more general cases due to naming
68132720Skan# conventions (e.g., chip_name* to catch all variants).
69132720Skan
70132720Skan# THIS TABLE IS SORTED.  KEEP IT THAT WAY.
71132720Skancase "${host_cpu}" in
72132720Skan  alpha*)
73132720Skan    try_cpu=alpha
74132720Skan    ;;
75132720Skan  i[567]86 | x86_64)
76132720Skan    try_cpu=i486
77132720Skan    ;;
78132720Skan  hppa*)
79132720Skan    try_cpu=hppa
80132720Skan    ;;
81132720Skan  mips*)
82132720Skan    # NB: cpu/mips/atomicity.h needs MIPS II or above.  
83132720Skan    # Of course, there is no sane way to test for this, no ABI macro,
84132720Skan    # and no consistent host_cpu name differentiation. Therefore, only
85132720Skan    # use it where it is known to be safe, ie it runs linux (see below).
86132720Skan    try_cpu=generic
87132720Skan    ;;
88132720Skan  m680[246]0)
89132720Skan    try_cpu=m68k
90132720Skan    ;;
91132720Skan  powerpc* | rs6000)
92132720Skan    try_cpu=powerpc
93132720Skan    ;;
94132720Skan  s390x)
95132720Skan    try_cpu=s390
96132720Skan    ;;
97132720Skan  sparc* | ultrasparc)
98132720Skan    try_cpu=sparc
99132720Skan    ;;
100132720Skan  *)
101132720Skan    if test -f ${glibcxx_srcdir}/config/cpu/${host_cpu}/atomicity.h; then
102132720Skan      try_cpu=${host_cpu}
103132720Skan    else
104132720Skan      try_cpu=generic
105132720Skan    fi
106132720Skan    ;;
107132720Skanesac
108132720Skan
109132720Skan# Set specific CPU overrides for atomic_word_dir. Most can just use generic.
110132720Skan# THIS TABLE IS SORTED.  KEEP IT THAT WAY.
111132720Skancase "${host_cpu}" in
112132720Skan  cris*)
113132720Skan    atomic_word_dir=cpu/cris
114132720Skan    ;;
115132720Skan  sparc* | ultrasparc)
116132720Skan    atomic_word_dir=cpu/sparc
117132720Skan    ;;
118132720Skanesac
119132720Skan
120132720Skan# Now look for the file(s) usually tied to a CPU model, and make
121132720Skan# default choices for those if they haven't been explicitly set
122132720Skan# already.  
123132720Skancpu_include_dir="cpu/${try_cpu}"
124132720Skanatomicity_dir=$cpu_include_dir
125132720Skanabi_baseline_pair=${try_cpu}-${host_os}
126132720Skan
127132720Skan
128132720Skan# Set any OS-dependent bits.
129132720Skan# Set the os_include_dir.
130132720Skan# Set c_model, c_compatibility here.
131132720Skan# If atomic ops and/or numeric limits are OS-specific rather than
132132720Skan# CPU-specifc, set those here too.
133132720Skan# THIS TABLE IS SORTED.  KEEP IT THAT WAY.
134132720Skancase "${host_os}" in
135132720Skan  aix4.[3456789]* | aix[56789]*)
136132720Skan    # We set os_include_dir to os/aix only on AIX 4.3 and newer, but
137132720Skan    # os/aix/atomicity.h works on earlier versions of AIX 4.*, so we
138132720Skan    # explicitly duplicate the directory for 4.[<3].
139132720Skan    os_include_dir="os/aix"
140132720Skan    atomicity_dir="os/aix"
141132720Skan    OPT_LDFLAGS="-Wl,-G"
142132720Skan    ;;
143132720Skan  aix4.*)
144132720Skan    os_include_dir="os/generic"
145132720Skan    atomicity_dir="os/aix"
146132720Skan    ;;
147132720Skan  aix*)
148132720Skan    os_include_dir="os/generic"
149132720Skan    atomicity_dir="cpu/generic"
150132720Skan    ;;
151132720Skan  bsd*)
152132720Skan    # Plain BSD attempts to share FreeBSD files.
153132720Skan    os_include_dir="os/bsd/freebsd"
154132720Skan    ;;
155132720Skan  cygwin*)
156132720Skan    os_include_dir="os/newlib"
157132720Skan    ;;
158132720Skan  *djgpp*)      # leading * picks up "msdosdjgpp"
159132720Skan    os_include_dir="os/djgpp"
160132720Skan    ;;
161132720Skan  freebsd*)
162132720Skan    os_include_dir="os/bsd/freebsd"
163132720Skan    ;;
164132720Skan  gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
165132720Skan    os_include_dir="os/gnu-linux"
166132720Skan    ;;
167132720Skan  hpux*)
168132720Skan    os_include_dir="os/hpux"
169132720Skan    ;;
170132720Skan  irix[1-6] | irix[1-5].* | irix6.[0-4]*)
171132720Skan    # This is known to work on at least IRIX 5.2 and 6.3.
172132720Skan    os_include_dir="os/irix/irix5.2"
173132720Skan    atomicity_dir=os/irix
174132720Skan    atomic_word_dir=os/irix
175132720Skan    ;;
176132720Skan  irix6.5*)
177132720Skan    os_include_dir="os/irix/irix6.5"
178132720Skan    atomicity_dir=os/irix
179132720Skan    atomic_word_dir=os/irix
180132720Skan    ;;
181132720Skan  mingw32*)
182132720Skan    os_include_dir="os/mingw32"
183132720Skan    ;;
184132720Skan  netbsd*)
185132720Skan    os_include_dir="os/bsd/netbsd"
186132720Skan    ;;
187132720Skan  qnx6.[12]*)
188132720Skan    os_include_dir="os/qnx/qnx6.1"
189132720Skan    c_model=c
190132720Skan    ;;
191132720Skan  solaris2)
192132720Skan    # This too-vague configuration does not provide enough information
193132720Skan    # to select a ctype include, and thus os_include_dir is a crap shoot.
194132720Skan    echo "Please specify the full version of Solaris, ie. solaris2.9 " 1>&2
195132720Skan    exit 1;
196132720Skan    ;;
197132720Skan  solaris2.5 | solaris2.5.[0-9])
198132720Skan    os_include_dir="os/solaris/solaris2.5"
199132720Skan    ;;
200132720Skan  solaris2.6)
201132720Skan    os_include_dir="os/solaris/solaris2.6"
202132720Skan    ;;
203132720Skan  solaris2.[789] | solaris2.1[0-9])
204132720Skan    os_include_dir="os/solaris/solaris2.7"
205132720Skan    ;;
206132720Skan  tpf)
207132720Skan    os_include_dir="os/tpf"
208132720Skan    ;;
209132720Skan  vxworks)
210132720Skan    os_include_dir="os/vxworks"
211132720Skan    ;;
212132720Skan  windiss*)
213132720Skan    os_include_dir="os/windiss"
214132720Skan    ;;
215132720Skan  *)
216132720Skan    os_include_dir="os/generic"
217132720Skan    ;;
218132720Skanesac
219132720Skan
220132720Skan
221132720Skan# Set any OS-dependent and CPU-dependent bits.
222132720Skan# THIS TABLE IS SORTED.  KEEP IT THAT WAY.
223132720Skancase "${host}" in
224132720Skan  alpha*-*-freebsd5*)
225132720Skan    abi_baseline_pair="alpha-freebsd5"
226132720Skan    ;;
227146897Skan  arm*-*-linux*)
228146897Skan    abi_baseline_pair="arm-linux-gnu"
229146897Skan    ;;
230132720Skan  i*86-*-freebsd4*)
231132720Skan    abi_baseline_pair="i386-freebsd4"
232132720Skan    ;;
233132720Skan  i*86-*-freebsd5*)
234132720Skan    abi_baseline_pair="i386-freebsd5"
235132720Skan    ;;
236146897Skan  mips*-*-linux*)
237146897Skan    atomicity_dir="cpu/mips"
238146897Skan    abi_baseline_pair="mips-linux-gnu"
239146897Skan    cpu_include_dir="cpu/mips"
240146897Skan    ;;
241146897Skan  s390-*-linux*)
242146897Skan    abi_baseline_pair="s390-linux-gnu"
243146897Skan    ;;
244146897Skan  s390x-*-linux*)
245146897Skan    abi_baseline_pair="s390x-linux-gnu"
246146897Skan    ;;
247132720Skan  sparc*-*-freebsd5*)
248132720Skan    abi_baseline_pair="sparc-freebsd5"
249132720Skan    ;;
250146897Skan  x86_64-*-linux*)
251146897Skan    abi_baseline_pair="x86_64-linux-gnu"
252146897Skan    ;;
253132720Skanesac
254