14fee23f9Smrg# configure.host 24fee23f9Smrg# 34fee23f9Smrg# This shell script handles all host based configuration for libstdc++. 44fee23f9Smrg# It sets various shell variables based on the the host and the 54fee23f9Smrg# configuration options. You can modify this shell script without needing 64fee23f9Smrg# to rerun autoconf/aclocal/etc. This file is "sourced" not executed. 74fee23f9Smrg# 84fee23f9Smrg# You should read docs/html/17_intro/porting.* to make sense of this file. 94fee23f9Smrg# 104fee23f9Smrg# 114fee23f9Smrg# It uses the following shell variables as set by config.guess: 124fee23f9Smrg# host The configuration host (full CPU-vendor-OS triplet) 134fee23f9Smrg# host_cpu The configuration host CPU 144fee23f9Smrg# host_os The configuration host OS 154fee23f9Smrg# 164fee23f9Smrg# 174fee23f9Smrg# It sets the following shell variables: 184fee23f9Smrg# 194fee23f9Smrg# cpu_include_dir CPU-specific directory, defaults to cpu/generic 204fee23f9Smrg# if cpu/host_cpu doesn't exist. This is not used 214fee23f9Smrg# directly, but sets the default for others. 224fee23f9Smrg# 234fee23f9Smrg# os_include_dir OS-specific directory, defaults to os/generic. 244fee23f9Smrg# 254fee23f9Smrg# c_model the "C" header model, defaults to c_global. 264fee23f9Smrg# 274fee23f9Smrg# c_compatibility if "C" compatibility headers are necessary, 284fee23f9Smrg# defaults to no. 294fee23f9Smrg# 304fee23f9Smrg# abi_baseline_pair directory name for ABI compat testing, 314fee23f9Smrg# defaults to host_cpu-host_os (as per config.guess) 324fee23f9Smrg# 3348fb7bfaSmrg# abi_baseline_subdir_switch 3448fb7bfaSmrg# g++ switch to determine ABI baseline subdir for 3548fb7bfaSmrg# multilibbed targets, 3648fb7bfaSmrg# defaults to --print-multi-directory 3748fb7bfaSmrg# 384fee23f9Smrg# abi_tweaks_dir location of cxxabi_tweaks.h, 394fee23f9Smrg# defaults to cpu_include_dir 404fee23f9Smrg# 414fee23f9Smrg# atomicity_dir location of atomicity.h, 424fee23f9Smrg# defaults to cpu_include_dir 434fee23f9Smrg# 444fee23f9Smrg# atomic_word_dir location of atomic_word.h 454fee23f9Smrg# defaults to generic. 464fee23f9Smrg# 474fee23f9Smrg# atomic_flags extra flags to pass to use atomic instructions 484fee23f9Smrg# defaults to nothing. 494fee23f9Smrg# 504fee23f9Smrg# cpu_defines_dir location of cpu_defines.h 514fee23f9Smrg# defaults to generic. 524fee23f9Smrg# 5348fb7bfaSmrg# cpu_opt_bits_random path name of random.h containing CPU-specific 5448fb7bfaSmrg# optimizations 5548fb7bfaSmrg# 5648fb7bfaSmrg# cpu_opt_ext_random path name of random.h containing CPU-specific 5748fb7bfaSmrg# optimizations for extensions 584fee23f9Smrg# 594fee23f9Smrg# error_constants_dir location of error_constants.h 604fee23f9Smrg# defaults to os/generic. 614fee23f9Smrg# 624fee23f9Smrg# It possibly modifies the following variables: 634fee23f9Smrg# 644fee23f9Smrg# OPT_LDFLAGS extra flags to pass when linking the library, of 654fee23f9Smrg# the form '-Wl,blah' 664fee23f9Smrg# (defaults to empty in acinclude.m4) 674fee23f9Smrg# 684fee23f9Smrg# port_specific_symbol_files 694d5abbe8Smrg# whitespace-separated list of files containing 704fee23f9Smrg# additional symbols to export from the shared 714fee23f9Smrg# library, when symbol versioning is in use 724fee23f9Smrg# 73*e9e6e0f6Smrg# tmake_file A list of machine-description-specific 74*e9e6e0f6Smrg# makefile fragments. 75*e9e6e0f6Smrg# 764fee23f9Smrg# 774fee23f9Smrg# If the defaults will not work for your platform, you need only change the 784fee23f9Smrg# variables that won't work, i.e., you do not need to explicitly set a 794fee23f9Smrg# working variable to its default. Most hosts only need to change the two 804fee23f9Smrg# *_include_dir variables. 814fee23f9Smrg 824fee23f9Smrg 834fee23f9Smrg# DEFAULTS 844fee23f9Smrg# Try to guess a default cpu_include_dir based on the name of the CPU. We 854fee23f9Smrg# cannot do this for os_include_dir; there are too many portable operating 864fee23f9Smrg# systems out there. :-) 874fee23f9Smrgc_model=c_global 884fee23f9Smrgc_compatibility=no 894fee23f9Smrgatomic_word_dir=cpu/generic 904fee23f9Smrgatomic_flags="" 914fee23f9Smrgatomicity_dir="cpu/generic" 924fee23f9Smrgcpu_defines_dir="cpu/generic" 934fee23f9Smrgtry_cpu=generic 9448fb7bfaSmrgabi_baseline_subdir_switch=--print-multi-directory 954fee23f9Smrgabi_tweaks_dir="cpu/generic" 964fee23f9Smrgerror_constants_dir="os/generic" 97*e9e6e0f6Smrgtmake_file= 984fee23f9Smrg 994fee23f9Smrg# HOST-SPECIFIC OVERRIDES 1004fee23f9Smrg# Set any CPU-dependent bits. 1014fee23f9Smrg 1024fee23f9Smrg# Provide a way to funnel exotic flavors and prefixed/postfixed chip 1034fee23f9Smrg# variants into the established source config/cpu/* sub-directories. 1044fee23f9Smrg# THIS TABLE IS SORTED. KEEP IT THAT WAY. 1054fee23f9Smrgcase "${host_cpu}" in 1064fee23f9Smrg alpha*) 1074fee23f9Smrg try_cpu=alpha 1084fee23f9Smrg ;; 1094fee23f9Smrg arm*) 1104fee23f9Smrg try_cpu=arm 1114fee23f9Smrg ;; 1124fee23f9Smrg crisv32) 1134fee23f9Smrg try_cpu=cris 1144fee23f9Smrg ;; 1154fee23f9Smrg i[567]86 | x86_64) 1164fee23f9Smrg try_cpu=i486 1174fee23f9Smrg ;; 1184fee23f9Smrg hppa*) 1194fee23f9Smrg try_cpu=hppa 1204fee23f9Smrg ;; 1214fee23f9Smrg mips*) 1224fee23f9Smrg try_cpu=mips 1234fee23f9Smrg ;; 1244fee23f9Smrg powerpc* | rs6000) 1254fee23f9Smrg try_cpu=powerpc 1264fee23f9Smrg ;; 1274fee23f9Smrg sparc* | ultrasparc) 1284fee23f9Smrg try_cpu=sparc 1294fee23f9Smrg ;; 1304fee23f9Smrg *) 1314fee23f9Smrg if test -d ${glibcxx_srcdir}/config/cpu/${host_cpu}; then 1324fee23f9Smrg try_cpu=${host_cpu} 1334fee23f9Smrg fi 1344fee23f9Smrgesac 1354fee23f9Smrg 1364fee23f9Smrg 1374fee23f9Smrg# Now look for the file(s) usually tied to a CPU model, and make 1384fee23f9Smrg# default choices for those if they haven't been explicitly set 1394fee23f9Smrg# already. 1404fee23f9Smrgcpu_include_dir=cpu/${try_cpu} 1414fee23f9Smrg 1424fee23f9Smrg 1434fee23f9Smrg# Set specific CPU overrides for cpu_defines_dir. Most can just use generic. 1444fee23f9Smrg# THIS TABLE IS SORTED. KEEP IT THAT WAY. 1454fee23f9Smrgcase "${host_cpu}" in 146cdbfa754Smrg arm*) 147cdbfa754Smrg cpu_defines_dir=cpu/arm 148cdbfa754Smrg ;; 1494fee23f9Smrg powerpc* | rs6000) 1504fee23f9Smrg cpu_defines_dir=cpu/powerpc 1514fee23f9Smrg ;; 1524fee23f9Smrgesac 1534fee23f9Smrg 1544fee23f9Smrg 1554fee23f9Smrg# Set specific CPU overrides for atomic_word_dir and atomic_flags. 1564fee23f9Smrg# Most can just use generic. 1574fee23f9Smrg# THIS TABLE IS SORTED. KEEP IT THAT WAY. 1584fee23f9Smrgcase "${host_cpu}" in 1594fee23f9Smrg cris*) 1604fee23f9Smrg atomic_word_dir=cpu/cris 1614fee23f9Smrg ;; 1624fee23f9Smrg i[4567]86 | x86_64) 1634fee23f9Smrg atomic_flags="-march=native" 1644fee23f9Smrg ;; 1654fee23f9Smrg sparc* | ultrasparc) 1664fee23f9Smrg atomic_word_dir=cpu/sparc 1674fee23f9Smrg atomic_flags="-mcpu=v9" 1684fee23f9Smrg ;; 1694fee23f9Smrgesac 1704fee23f9Smrg 1714fee23f9Smrg 1724fee23f9Smrg# Set specific CPU overrides for atomicity_dir. 1734fee23f9Smrg# This can be over-ridden in GLIBCXX_ENABLE_ATOMIC_BUILTINS. 1744fee23f9Smrg# THIS TABLE IS SORTED. KEEP IT THAT WAY. 1754fee23f9Smrgif test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/atomicity.h ; then 1766b98bddcSchristos# The sh atomicity.h is unusable 1776b98bddcSchristosif test ${cpu_include_dir} != "cpu/sh"; then 1784fee23f9Smrg atomicity_dir=$cpu_include_dir 1794fee23f9Smrgfi 1806b98bddcSchristosfi 1814fee23f9Smrg 1824fee23f9Smrg 1834fee23f9Smrgif test -f ${glibcxx_srcdir}/config/${cpu_include_dir}/cxxabi_tweaks.h ; then 1844fee23f9Smrg abi_tweaks_dir=$cpu_include_dir 1854fee23f9Smrgfi 1864fee23f9Smrg 1874fee23f9Smrg 18848fb7bfaSmrg# Set directory with CPU-specific optimization 18948fb7bfaSmrgcpu_opt_dir=${cpu_include_dir}/opt 19048fb7bfaSmrgtest -d ${glibcxx_srcdir}/config/${cpu_include_dir}/opt || 19148fb7bfaSmrgcpu_opt_dir=cpu/generic/opt 19248fb7bfaSmrg# For each header with CPU-specific optimizations check whether it 19348fb7bfaSmrg# exists in ${cpu_opt_dir}. If not, point the variable at the 19448fb7bfaSmrg# appropriate file in the generic directory. 19548fb7bfaSmrgcpu_opt_ext_random=${cpu_opt_dir}/ext/opt_random.h 19648fb7bfaSmrgtest -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} || 19748fb7bfaSmrgcpu_opt_ext_random=cpu/generic/opt/ext/opt_random.h 19848fb7bfaSmrg 19948fb7bfaSmrgcpu_opt_bits_random=${cpu_opt_dir}/bits/opt_random.h 20048fb7bfaSmrgtest -f ${glibcxx_srcdir}/config/${cpu_opt_ext_random} || 20148fb7bfaSmrgcpu_opt_ext_random=cpu/generic/opt/bits/opt_random.h 20248fb7bfaSmrg 20348fb7bfaSmrg 2044fee23f9Smrg# Set any OS-dependent bits. 2054fee23f9Smrg# Set the os_include_dir. 2064fee23f9Smrg# Set the error_costants_dir. 2074fee23f9Smrg# Set c_model, c_compatibility here. 2084fee23f9Smrg# If atomic ops and/or numeric limits are OS-specific rather than 2094fee23f9Smrg# CPU-specifc, set those here too. 2104fee23f9Smrg# THIS TABLE IS SORTED. KEEP IT THAT WAY. 2114fee23f9Smrgcase "${host_os}" in 2124d5abbe8Smrg aix[56789]*) 2134d5abbe8Smrg # Newer versions of AIX only support PowerPC architecture, so use 2144d5abbe8Smrg # atomic instructions directly. 2154d5abbe8Smrg os_include_dir="os/aix" 216*e9e6e0f6Smrg tmake_file="os/aix/t-aix" 2174fee23f9Smrg ;; 2184fee23f9Smrg aix*) 2194fee23f9Smrg os_include_dir="os/generic" 2204fee23f9Smrg atomicity_dir="cpu/generic" 2214fee23f9Smrg ;; 2224fee23f9Smrg bsd*) 2234fee23f9Smrg # Plain BSD attempts to share FreeBSD files. 2244fee23f9Smrg os_include_dir="os/bsd/freebsd" 2254fee23f9Smrg ;; 2264fee23f9Smrg cygwin*) 2274fee23f9Smrg os_include_dir="os/newlib" 22848fb7bfaSmrg OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)" 2294fee23f9Smrg ;; 2303f8cba22Smrg darwin[4-7] | darwin[4-7].*) 2313f8cba22Smrg # For earlier Darwin, performance is improved if libstdc++ is 2323f8cba22Smrg # single-module. Up to at least 10.3.7, -flat_namespace is required 2333f8cba22Smrg # for proper treatment of coalesced symbols. 2344fee23f9Smrg OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module -Wl,-flat_namespace" 2354fee23f9Smrg os_include_dir="os/bsd/darwin" 2364fee23f9Smrg ;; 2373f8cba22Smrg darwin8 | darwin8.* ) 2383f8cba22Smrg # For 8+ compatibility is better if not -flat_namespace. 2394fee23f9Smrg OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module" 2404fee23f9Smrg case "${host_cpu}" in 2414fee23f9Smrg i[34567]86 | x86_64) 2424fee23f9Smrg OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -fvisibility-inlines-hidden" 2434fee23f9Smrg ;; 2444fee23f9Smrg esac 2454fee23f9Smrg os_include_dir="os/bsd/darwin" 2464fee23f9Smrg ;; 2473f8cba22Smrg darwin*) 2483f8cba22Smrg # Post Darwin8, defaults should be sufficient. 2493f8cba22Smrg os_include_dir="os/bsd/darwin" 2503f8cba22Smrg ;; 2514fee23f9Smrg *djgpp*) # leading * picks up "msdosdjgpp" 2524fee23f9Smrg os_include_dir="os/djgpp" 25348fb7bfaSmrg error_constants_dir="os/djgpp" 2544fee23f9Smrg ;; 2554d5abbe8Smrg dragonfly*) 2564d5abbe8Smrg os_include_dir="os/bsd/dragonfly" 2574d5abbe8Smrg ;; 2584fee23f9Smrg freebsd*) 2594fee23f9Smrg os_include_dir="os/bsd/freebsd" 2604fee23f9Smrg ;; 261cdbfa754Smrg linux-musl*) 262cdbfa754Smrg os_include_dir="os/generic" 263cdbfa754Smrg ;; 26443265c03Smrg gnu* | linux* | kfreebsd*-gnu | uclinux*) 2654fee23f9Smrg if [ "$uclibc" = "yes" ]; then 2664fee23f9Smrg os_include_dir="os/uclibc" 26748fb7bfaSmrg elif [ "$bionic" = "yes" ]; then 26848fb7bfaSmrg os_include_dir="os/bionic" 2694fee23f9Smrg else 2704fee23f9Smrg os_include_dir="os/gnu-linux" 2714fee23f9Smrg fi 2724fee23f9Smrg ;; 2734fee23f9Smrg hpux*) 2744fee23f9Smrg os_include_dir="os/hpux" 2754fee23f9Smrg ;; 2764fee23f9Smrg mingw32*) 27748fb7bfaSmrg case "$host" in 27848fb7bfaSmrg *-w64-*) 27948fb7bfaSmrg os_include_dir="os/mingw32-w64" 28048fb7bfaSmrg error_constants_dir="os/mingw32-w64" 28148fb7bfaSmrg ;; 28248fb7bfaSmrg *) 2834fee23f9Smrg os_include_dir="os/mingw32" 2844fee23f9Smrg error_constants_dir="os/mingw32" 28548fb7bfaSmrg ;; 28648fb7bfaSmrg esac 28748fb7bfaSmrg OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)" 2884fee23f9Smrg ;; 2894fee23f9Smrg netbsd*) 2904fee23f9Smrg os_include_dir="os/bsd/netbsd" 2914fee23f9Smrg ;; 29248fb7bfaSmrg openbsd*) 29348fb7bfaSmrg os_include_dir="os/bsd/openbsd" 2944fee23f9Smrg ;; 2954fee23f9Smrg qnx6.[12]*) 2964fee23f9Smrg os_include_dir="os/qnx/qnx6.1" 2974fee23f9Smrg c_model=c 2984fee23f9Smrg ;; 299cdbfa754Smrg rtems*) 300cdbfa754Smrg # Use libatomic if necessary and avoid libstdc++ specific atomicity support 301cdbfa754Smrg atomicity_dir="cpu/generic/atomicity_builtins" 302cdbfa754Smrg ;; 30343265c03Smrg solaris2*) 30443265c03Smrg os_include_dir="os/solaris" 3054fee23f9Smrg ;; 3064fee23f9Smrg tpf) 3074fee23f9Smrg os_include_dir="os/tpf" 3084fee23f9Smrg ;; 309*e9e6e0f6Smrg vxworks*) 3104fee23f9Smrg os_include_dir="os/vxworks" 3114fee23f9Smrg ;; 3124fee23f9Smrg *) 3134fee23f9Smrg os_include_dir="os/generic" 3144fee23f9Smrg ;; 3154fee23f9Smrgesac 3164fee23f9Smrg 3174fee23f9Smrg 3184fee23f9Smrg# Set any OS-dependent and CPU-dependent bits. 3194fee23f9Smrg# THIS TABLE IS SORTED. KEEP IT THAT WAY. 3204fee23f9Smrgcase "${host}" in 32143265c03Smrg *-*-linux* | *-*-uclinux*) 3224fee23f9Smrg case "${host_cpu}" in 3234fee23f9Smrg i[567]86) 3244fee23f9Smrg abi_baseline_pair=i486-linux-gnu 3254fee23f9Smrg ;; 3264fee23f9Smrg mips64*) 3274fee23f9Smrg abi_baseline_pair=mips64-linux-gnu 3284fee23f9Smrg ;; 32948fb7bfaSmrg powerpc64*) 3304fee23f9Smrg abi_baseline_pair=powerpc64-linux-gnu 3314fee23f9Smrg ;; 3324fee23f9Smrg s390) 3334fee23f9Smrg abi_baseline_pair=s390-linux-gnu 3344fee23f9Smrg ;; 3354fee23f9Smrg s390x) 3364fee23f9Smrg abi_baseline_pair=s390x-linux-gnu 3374fee23f9Smrg ;; 338654d12c0Smrg sparc64) 339654d12c0Smrg abi_baseline_pair=sparc64-linux-gnu 340654d12c0Smrg ;; 3414fee23f9Smrg x86_64) 3424fee23f9Smrg abi_baseline_pair=x86_64-linux-gnu 3434fee23f9Smrg ;; 3444fee23f9Smrg *) 3454d5abbe8Smrg if test $try_cpu = generic; then 3464d5abbe8Smrg try_abi_cpu=$host_cpu 3474d5abbe8Smrg else 3484d5abbe8Smrg try_abi_cpu=$try_cpu 3494d5abbe8Smrg fi 3504d5abbe8Smrg if test -d ${glibcxx_srcdir}/config/abi/post/${try_abi_cpu}-linux-gnu; then 3514d5abbe8Smrg abi_baseline_pair=${try_abi_cpu}-linux-gnu 3524fee23f9Smrg fi 3534fee23f9Smrg esac 3544fee23f9Smrg case "${host}" in 35543265c03Smrg arm*-*-linux-* | arm*-*-uclinuxfdpiceabi) 3564fee23f9Smrg port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver" 3574fee23f9Smrg ;; 3584fee23f9Smrg esac 3594fee23f9Smrg ;; 3604d5abbe8Smrg arm*-*-freebsd*) 3614d5abbe8Smrg port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver" 3624d5abbe8Smrg ;; 3634fee23f9Smrg powerpc*-*-darwin*) 3644fee23f9Smrg port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver" 3654fee23f9Smrg ;; 36643265c03Smrg *-*-solaris2*) 36743265c03Smrg abi_baseline_pair=solaris 368a41324a9Smrg case "${host_cpu}" in 369a41324a9Smrg i?86 | x86_64) 370a41324a9Smrg abi_baseline_pair=i386-${abi_baseline_pair} 371a41324a9Smrg ;; 372a41324a9Smrg sparc*) 373a41324a9Smrg abi_baseline_pair=sparc-${abi_baseline_pair} 374a41324a9Smrg ;; 375a41324a9Smrg esac 37648fb7bfaSmrg abi_baseline_subdir_switch=--print-multi-os-directory 37748fb7bfaSmrg ;; 3784fee23f9Smrgesac 379