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
20169691Skan#                          if cpu/host_cpu doesn't exist.  This is not used
21169691Skan#                          directly, but sets the default for others.
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#
33169691Skan#   abi_tweaks_dir         location of cxxabi_tweaks.h,
34169691Skan#                          defaults to cpu_include_dir
35169691Skan#
36132720Skan#   atomicity_dir          location of atomicity.h,
37132720Skan#                          defaults to cpu_include_dir
38132720Skan#
39132720Skan#   atomic_word_dir        location of atomic_word.h
40132720Skan#                          defaults to generic.
41132720Skan#
42169691Skan#   cpu_defines_dir        location of cpu_defines.h
43169691Skan#                          defaults to generic.
44169691Skan#
45132720Skan# It possibly modifies the following variables:
46132720Skan#
47132720Skan#   OPT_LDFLAGS            extra flags to pass when linking the library, of
48132720Skan#                          the form '-Wl,blah'
49132720Skan#                          (defaults to empty in acinclude.m4)
50132720Skan#
51132720Skan#   port_specific_symbol_files
52132720Skan#                          whitespace-seperated list of files containing
53132720Skan#                          additional symbols to export from the shared
54132720Skan#                          library, when symbol versioning is in use
55132720Skan#
56132720Skan#
57132720Skan# If the defaults will not work for your platform, you need only change the
58132720Skan# variables that won't work, i.e., you do not need to explicitly set a
59132720Skan# working variable to its default.  Most hosts only need to change the two
60132720Skan# *_include_dir variables.
61132720Skan
62132720Skan
63132720Skan# DEFAULTS
64132720Skan# Try to guess a default cpu_include_dir based on the name of the CPU.  We
65132720Skan# cannot do this for os_include_dir; there are too many portable operating
66132720Skan# systems out there.  :-)
67132720Skanc_model=c_std
68132720Skanc_compatibility=no
69132720Skanatomic_word_dir=cpu/generic
70169691Skanatomicity_dir="cpu/generic"
71169691Skancpu_defines_dir="cpu/generic"
72169691Skantry_cpu=generic
73169691Skanabi_tweaks_dir="cpu/generic"
74132720Skan
75132720Skan# HOST-SPECIFIC OVERRIDES
76132720Skan# Set any CPU-dependent bits.
77132720Skan
78169691Skan# Provide a way to funnel exotic flavors and prefixed/postfixed chip
79169691Skan# variants into the established source config/cpu/* sub-directories.
80132720Skan# THIS TABLE IS SORTED.  KEEP IT THAT WAY.
81132720Skancase "${host_cpu}" in
82132720Skan  alpha*)
83132720Skan    try_cpu=alpha
84132720Skan    ;;
85169691Skan  arm* | xscale | ep9312)
86169691Skan    try_cpu=arm
87169691Skan    ;;
88132720Skan  i[567]86 | x86_64)
89132720Skan    try_cpu=i486
90132720Skan    ;;
91132720Skan  hppa*)
92132720Skan    try_cpu=hppa
93132720Skan    ;;
94132720Skan  mips*)
95169691Skan    try_cpu=mips
96132720Skan    ;;
97132720Skan  m680[246]0)
98132720Skan    try_cpu=m68k
99132720Skan    ;;
100132720Skan  powerpc* | rs6000)
101132720Skan    try_cpu=powerpc
102132720Skan    ;;
103132720Skan  sparc* | ultrasparc)
104132720Skan    try_cpu=sparc
105132720Skan    ;;
106132720Skan  *)
107169691Skan    if test -d ${glibcxx_srcdir}/config/cpu/${host_cpu}; then
108132720Skan      try_cpu=${host_cpu}
109132720Skan    fi
110169691Skanesac
111169691Skan
112169691Skan
113169691Skan# Now look for the file(s) usually tied to a CPU model, and make
114169691Skan# default choices for those if they haven't been explicitly set
115169691Skan# already.  
116169691Skancpu_include_dir=cpu/${try_cpu}
117169691Skan
118169691Skan
119169691Skan# Set specific CPU overrides for cpu_defines_dir. Most can just use generic.
120169691Skan# THIS TABLE IS SORTED.  KEEP IT THAT WAY.
121169691Skancase "${host_cpu}" in
122169691Skan  powerpc* | rs6000)
123169691Skan    cpu_defines_dir=cpu/powerpc
124132720Skan    ;;
125132720Skanesac
126132720Skan
127169691Skan
128132720Skan# Set specific CPU overrides for atomic_word_dir. Most can just use generic.
129132720Skan# THIS TABLE IS SORTED.  KEEP IT THAT WAY.
130132720Skancase "${host_cpu}" in
131169691Skan  alpha*)
132169691Skan    atomic_word_dir=cpu/alpha
133169691Skan    ;;
134132720Skan  cris*)
135132720Skan    atomic_word_dir=cpu/cris
136132720Skan    ;;
137169691Skan  ia64)
138169691Skan    atomic_word_dir=cpu/ia64
139169691Skan    ;;
140169691Skan  powerpc* | rs6000)
141169691Skan    atomic_word_dir=cpu/powerpc
142169691Skan    ;;
143132720Skan  sparc* | ultrasparc)
144132720Skan    atomic_word_dir=cpu/sparc
145132720Skan    ;;
146132720Skanesac
147132720Skan
148132720Skan
149169691Skan# Set specific CPU overrides for atomicity_dir.
150169691Skan# This can be over-ridden in GLIBCXX_ENABLE_ATOMIC_BUILTINS.
151169691Skan# THIS TABLE IS SORTED.  KEEP IT THAT WAY.
152169691Skanif test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then
153169691Skan  atomicity_dir=$cpu_include_dir
154169691Skanfi
155132720Skan
156169691Skan
157169691Skanif test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/cxxabi_tweaks.h ; then
158169691Skan  abi_tweaks_dir=$cpu_include_dir
159169691Skanfi
160169691Skan
161169691Skan
162132720Skan# Set any OS-dependent bits.
163132720Skan# Set the os_include_dir.
164132720Skan# Set c_model, c_compatibility here.
165132720Skan# If atomic ops and/or numeric limits are OS-specific rather than
166132720Skan# CPU-specifc, set those here too.
167132720Skan# THIS TABLE IS SORTED.  KEEP IT THAT WAY.
168132720Skancase "${host_os}" in
169132720Skan  aix4.[3456789]* | aix[56789]*)
170132720Skan    # We set os_include_dir to os/aix only on AIX 4.3 and newer, but
171132720Skan    # os/aix/atomicity.h works on earlier versions of AIX 4.*, so we
172132720Skan    # explicitly duplicate the directory for 4.[<3].
173132720Skan    os_include_dir="os/aix"
174132720Skan    atomicity_dir="os/aix"
175169691Skan    atomic_word_dir="os/aix"
176132720Skan    OPT_LDFLAGS="-Wl,-G"
177132720Skan    ;;
178132720Skan  aix4.*)
179132720Skan    os_include_dir="os/generic"
180132720Skan    atomicity_dir="os/aix"
181169691Skan    atomic_word_dir="os/aix"
182132720Skan    ;;
183132720Skan  aix*)
184132720Skan    os_include_dir="os/generic"
185132720Skan    atomicity_dir="cpu/generic"
186132720Skan    ;;
187132720Skan  bsd*)
188132720Skan    # Plain BSD attempts to share FreeBSD files.
189132720Skan    os_include_dir="os/bsd/freebsd"
190132720Skan    ;;
191132720Skan  cygwin*)
192132720Skan    os_include_dir="os/newlib"
193132720Skan    ;;
194169691Skan  darwin | darwin[1-7] | darwin[1-7].*)
195169691Skan    # On Darwin, performance is improved if libstdc++ is single-module.
196169691Skan    # Up to at least 10.3.7, -flat_namespace is required for proper
197169691Skan    # treatment of coalesced symbols.
198169691Skan    OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module -Wl,-flat_namespace"
199169691Skan    os_include_dir="os/bsd/darwin"
200169691Skan    ;;
201169691Skan  darwin[89] | darwin[89].* | darwin[1-9][0-9]* )
202169691Skan    # On Darwin, performance is improved if libstdc++ is single-module,
203169691Skan    # and on 8+ compatibility is better if not -flat_namespace.
204169691Skan    OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module"
205169691Skan    os_include_dir="os/bsd/darwin"
206169691Skan    ;;
207132720Skan  *djgpp*)      # leading * picks up "msdosdjgpp"
208132720Skan    os_include_dir="os/djgpp"
209132720Skan    ;;
210132720Skan  freebsd*)
211132720Skan    os_include_dir="os/bsd/freebsd"
212132720Skan    ;;
213132720Skan  gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
214169691Skan    if [ "$uclibc" = "yes" ]; then
215169691Skan      os_include_dir="os/uclibc"
216169691Skan    else
217169691Skan      os_include_dir="os/gnu-linux"
218169691Skan    fi
219132720Skan    ;;
220132720Skan  hpux*)
221132720Skan    os_include_dir="os/hpux"
222132720Skan    ;;
223132720Skan  irix[1-6] | irix[1-5].* | irix6.[0-4]*)
224132720Skan    # This is known to work on at least IRIX 5.2 and 6.3.
225132720Skan    os_include_dir="os/irix/irix5.2"
226132720Skan    atomicity_dir=os/irix
227132720Skan    atomic_word_dir=os/irix
228132720Skan    ;;
229132720Skan  irix6.5*)
230132720Skan    os_include_dir="os/irix/irix6.5"
231132720Skan    atomicity_dir=os/irix
232132720Skan    atomic_word_dir=os/irix
233132720Skan    ;;
234132720Skan  mingw32*)
235132720Skan    os_include_dir="os/mingw32"
236132720Skan    ;;
237132720Skan  netbsd*)
238132720Skan    os_include_dir="os/bsd/netbsd"
239132720Skan    ;;
240132720Skan  qnx6.[12]*)
241132720Skan    os_include_dir="os/qnx/qnx6.1"
242132720Skan    c_model=c
243132720Skan    ;;
244132720Skan  solaris2)
245132720Skan    # This too-vague configuration does not provide enough information
246132720Skan    # to select a ctype include, and thus os_include_dir is a crap shoot.
247132720Skan    echo "Please specify the full version of Solaris, ie. solaris2.9 " 1>&2
248169691Skan    exit 1
249132720Skan    ;;
250132720Skan  solaris2.5 | solaris2.5.[0-9])
251132720Skan    os_include_dir="os/solaris/solaris2.5"
252132720Skan    ;;
253132720Skan  solaris2.6)
254132720Skan    os_include_dir="os/solaris/solaris2.6"
255132720Skan    ;;
256132720Skan  solaris2.[789] | solaris2.1[0-9])
257132720Skan    os_include_dir="os/solaris/solaris2.7"
258132720Skan    ;;
259132720Skan  tpf)
260132720Skan    os_include_dir="os/tpf"
261132720Skan    ;;
262132720Skan  vxworks)
263132720Skan    os_include_dir="os/vxworks"
264132720Skan    ;;
265132720Skan  windiss*)
266132720Skan    os_include_dir="os/windiss"
267132720Skan    ;;
268132720Skan  *)
269132720Skan    os_include_dir="os/generic"
270132720Skan    ;;
271132720Skanesac
272132720Skan
273132720Skan
274132720Skan# Set any OS-dependent and CPU-dependent bits.
275132720Skan# THIS TABLE IS SORTED.  KEEP IT THAT WAY.
276132720Skancase "${host}" in
277169691Skan  *-*-linux*)
278169691Skan    case "${host_cpu}" in
279169691Skan      i[567]86)
280169691Skan        abi_baseline_pair=i486-linux-gnu
281169691Skan        ;;
282169691Skan      powerpc64)
283169691Skan        abi_baseline_pair=powerpc64-linux-gnu
284169691Skan        ;;
285169691Skan      s390)
286169691Skan        abi_baseline_pair=s390-linux-gnu
287169691Skan        ;;
288169691Skan      s390x)
289169691Skan        abi_baseline_pair=s390x-linux-gnu
290169691Skan        ;;
291169691Skan      x86_64)
292169691Skan        abi_baseline_pair=x86_64-linux-gnu
293169691Skan        ;;
294169691Skan      *)
295169691Skan        if test -d ${glibcxx_srcdir}/config/abi/post/${try_cpu}-linux-gnu; then
296169691Skan          abi_baseline_pair=${try_cpu}-linux-gnu
297169691Skan        fi
298169691Skan    esac
299132720Skan    ;;
300169691Skan  mips*-*-*)
301169691Skan    case "${host_os}" in
302169691Skan      gnu* | linux* | irix*)
303169691Skan        ;;
304169691Skan      *)
305169691Skan        atomicity_dir="cpu/generic"
306169691Skan        ;;
307169691Skan    esac
308146897Skan    ;;
309169691Skan  powerpc*-*-darwin*)
310169691Skan    port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
311132720Skan    ;;
312132720Skanesac
313