blob: 375c5e90c9671dedf13fd9c573c2d73ceee1f618 [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
8# Java (gcj doesn't work on all architectures)
9JAVA ?= ",java"
10JAVA_arm ?= ""
11JAVA_armeb ?= ""
12JAVA_mipsel ?= ""
13JAVA_sh3 ?= ""
14# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
15FORTRAN ?= ",f77"
16LANGUAGES ?= "c,c++${FORTRAN}${JAVA}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017
18EXTRA_OECONF_BASE ?= ""
19EXTRA_OECONF_PATHS ?= ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020
21GCCMULTILIB ?= "--disable-multilib"
22GCCTHREADS ?= "posix"
23
Brad Bishopd7bf8c12018-02-25 22:55:05 -050024GCCPIE ??= ""
25
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026EXTRA_OECONF = "\
Brad Bishop6e60e8b2018-02-01 10:27:11 -050027 ${@['--enable-clocale=generic', ''][d.getVar('USE_NLS') != 'no']} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028 --with-gnu-ld \
29 --enable-shared \
30 --enable-languages=${LANGUAGES} \
31 --enable-threads=${GCCTHREADS} \
32 ${GCCMULTILIB} \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050033 ${GCCPIE} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034 --enable-c99 \
35 --enable-long-long \
36 --enable-symvers=gnu \
37 --enable-libstdcxx-pch \
38 --program-prefix=${TARGET_PREFIX} \
39 --without-local-prefix \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050040 ${EXTRA_OECONF_BASE} \
41 ${EXTRA_OECONF_GCC_FLOAT} \
42 ${EXTRA_OECONF_PATHS} \
43 ${@get_gcc_mips_plt_setting(bb, d)} \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050044 ${@get_gcc_ppc_plt_settings(bb, d)} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045 ${@get_long_double_setting(bb, d)} \
46 ${@get_gcc_multiarch_setting(bb, d)} \
47"
48
Brad Bishop19323692019-04-05 15:28:33 -040049# glibc version is a minimum controlling whether features are enabled.
50# Doesn't need to track glibc exactly
51EXTRA_OECONF_append_libc-glibc = " --with-glibc-version=2.28 "
52
Patrick Williamsc0f7c042017-02-23 20:41:17 -060053# Set this here since GCC configure won't auto-detect and enable
54# initfini-arry when cross compiling.
55EXTRA_OECONF_append = " --enable-initfini-array"
56
Patrick Williamsc124f4f2015-09-15 14:41:29 -050057export gcc_cv_collect2_libs = 'none required'
58# We need to set gcc_cv_collect2_libs else there is cross-compilation badness
59# in the config.log files (which might not get generated until do_compile
60# hence being missed by the insane do_configure check).
61
Patrick Williamsc124f4f2015-09-15 14:41:29 -050062EXTRA_OECONF_append_linux = " --enable-__cxa_atexit"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050063
64EXTRA_OECONF_append_mips64 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
65EXTRA_OECONF_append_mips64el = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
66EXTRA_OECONF_append_mips64n32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
67EXTRA_OECONF_append_mips64eln32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060068EXTRA_OECONF_append_mipsisa32r6el = " --with-abi=32 --with-arch=mips32r6"
69EXTRA_OECONF_append_mipsisa32r6 = " --with-abi=32 --with-arch=mips32r6"
70EXTRA_OECONF_append_mipsisa64r6el = " --with-abi=64 --with-arch-64=mips64r6"
71EXTRA_OECONF_append_mipsisa64r6 = " --with-abi=64 --with-arch-64=mips64r6"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050072
Patrick Williamsc124f4f2015-09-15 14:41:29 -050073EXTRA_OECONF_GCC_FLOAT ??= ""
74CPPFLAGS = ""
75
76SYSTEMHEADERS = "${target_includedir}"
77SYSTEMLIBS = "${target_base_libdir}/"
78SYSTEMLIBS1 = "${target_libdir}/"
79
80do_configure_prepend () {
81 # teach gcc to find correct target includedir when checking libc ssp support
82 mkdir -p ${B}/gcc
83 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
84 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
85 cat >>${B}/gcc/defaults.h.new <<_EOF
86#define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}"
87#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
88#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
89#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
90#endif /* ! GCC_DEFAULTS_H */
91_EOF
92 mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
93}
94
95do_configure () {
96 # Setup these vars for cross building only
97 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
98 # gcc build stuff when the build is producing a cross compiler - i.e.
99 # when the 'current' target is the 'host' system, and the host is not
100 # the target (because the build is actually making a cross compiler!)
101 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
102 export CC_FOR_TARGET="${CC}"
103 export GCC_FOR_TARGET="${CC}"
104 export CXX_FOR_TARGET="${CXX}"
105 export AS_FOR_TARGET="${HOST_PREFIX}as"
106 export LD_FOR_TARGET="${HOST_PREFIX}ld"
107 export NM_FOR_TARGET="${HOST_PREFIX}nm"
108 export AR_FOR_TARGET="${HOST_PREFIX}ar"
109 export GFORTRAN_FOR_TARGET="gfortran"
110 export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
111 fi
112 export CC_FOR_BUILD="${BUILD_CC}"
113 export CXX_FOR_BUILD="${BUILD_CXX}"
114 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
115 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
116 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
117 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
118 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
119 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
120 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
121 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
122
123
124 oe_runconf
125}
126