blob: 24ba8ce75fa84de24890426a0b7534af624288e6 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001require gcc-multilib-config.inc
2require gcc-shared-source.inc
3#
4# Build the list of lanaguages to build.
5#
6# These can be overridden by the version specific .inc file.
7
Patrick Williamsc124f4f2015-09-15 14:41:29 -05008# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
9FORTRAN ?= ",f77"
Brad Bishopc342db32019-05-15 21:57:59 -040010LANGUAGES ?= "c,c++${FORTRAN}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011
12EXTRA_OECONF_BASE ?= ""
13EXTRA_OECONF_PATHS ?= ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014
15GCCMULTILIB ?= "--disable-multilib"
16GCCTHREADS ?= "posix"
17
Brad Bishopd7bf8c12018-02-25 22:55:05 -050018GCCPIE ??= ""
19
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020EXTRA_OECONF = "\
Brad Bishop6e60e8b2018-02-01 10:27:11 -050021 ${@['--enable-clocale=generic', ''][d.getVar('USE_NLS') != 'no']} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022 --with-gnu-ld \
23 --enable-shared \
24 --enable-languages=${LANGUAGES} \
25 --enable-threads=${GCCTHREADS} \
26 ${GCCMULTILIB} \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050027 ${GCCPIE} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028 --enable-c99 \
29 --enable-long-long \
30 --enable-symvers=gnu \
31 --enable-libstdcxx-pch \
32 --program-prefix=${TARGET_PREFIX} \
33 --without-local-prefix \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034 ${EXTRA_OECONF_BASE} \
35 ${EXTRA_OECONF_GCC_FLOAT} \
36 ${EXTRA_OECONF_PATHS} \
37 ${@get_gcc_mips_plt_setting(bb, d)} \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050038 ${@get_gcc_ppc_plt_settings(bb, d)} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050039 ${@get_gcc_multiarch_setting(bb, d)} \
40"
41
Brad Bishop19323692019-04-05 15:28:33 -040042# glibc version is a minimum controlling whether features are enabled.
43# Doesn't need to track glibc exactly
44EXTRA_OECONF_append_libc-glibc = " --with-glibc-version=2.28 "
45
Patrick Williamsc0f7c042017-02-23 20:41:17 -060046# Set this here since GCC configure won't auto-detect and enable
47# initfini-arry when cross compiling.
48EXTRA_OECONF_append = " --enable-initfini-array"
49
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050export gcc_cv_collect2_libs = 'none required'
51# We need to set gcc_cv_collect2_libs else there is cross-compilation badness
52# in the config.log files (which might not get generated until do_compile
53# hence being missed by the insane do_configure check).
54
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055EXTRA_OECONF_append_linux = " --enable-__cxa_atexit"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056
57EXTRA_OECONF_append_mips64 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
58EXTRA_OECONF_append_mips64el = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
59EXTRA_OECONF_append_mips64n32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
60EXTRA_OECONF_append_mips64eln32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060061EXTRA_OECONF_append_mipsisa32r6el = " --with-abi=32 --with-arch=mips32r6"
62EXTRA_OECONF_append_mipsisa32r6 = " --with-abi=32 --with-arch=mips32r6"
63EXTRA_OECONF_append_mipsisa64r6el = " --with-abi=64 --with-arch-64=mips64r6"
64EXTRA_OECONF_append_mipsisa64r6 = " --with-abi=64 --with-arch-64=mips64r6"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050065
Patrick Williamsc124f4f2015-09-15 14:41:29 -050066EXTRA_OECONF_GCC_FLOAT ??= ""
67CPPFLAGS = ""
68
69SYSTEMHEADERS = "${target_includedir}"
70SYSTEMLIBS = "${target_base_libdir}/"
71SYSTEMLIBS1 = "${target_libdir}/"
72
73do_configure_prepend () {
74 # teach gcc to find correct target includedir when checking libc ssp support
75 mkdir -p ${B}/gcc
76 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
77 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
78 cat >>${B}/gcc/defaults.h.new <<_EOF
79#define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}"
80#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
81#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
82#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
83#endif /* ! GCC_DEFAULTS_H */
84_EOF
85 mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
86}
87
88do_configure () {
89 # Setup these vars for cross building only
90 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
91 # gcc build stuff when the build is producing a cross compiler - i.e.
92 # when the 'current' target is the 'host' system, and the host is not
93 # the target (because the build is actually making a cross compiler!)
94 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
95 export CC_FOR_TARGET="${CC}"
96 export GCC_FOR_TARGET="${CC}"
97 export CXX_FOR_TARGET="${CXX}"
98 export AS_FOR_TARGET="${HOST_PREFIX}as"
99 export LD_FOR_TARGET="${HOST_PREFIX}ld"
100 export NM_FOR_TARGET="${HOST_PREFIX}nm"
101 export AR_FOR_TARGET="${HOST_PREFIX}ar"
102 export GFORTRAN_FOR_TARGET="gfortran"
103 export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
104 fi
105 export CC_FOR_BUILD="${BUILD_CC}"
106 export CXX_FOR_BUILD="${BUILD_CXX}"
107 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
108 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
109 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
110 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
111 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
112 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
113 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
114 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
115
116
117 oe_runconf
118}
119