blob: 00ef89ec57705459bb97f19c3e3c8c35b42c6b82 [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 ?= ""
20EXTRA_OECONF_INITIAL ?= ""
21
22GCCMULTILIB ?= "--disable-multilib"
23GCCTHREADS ?= "posix"
24
25EXTRA_OECONF = "\
Brad Bishop6e60e8b2018-02-01 10:27:11 -050026 ${@['--enable-clocale=generic', ''][d.getVar('USE_NLS') != 'no']} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027 --with-gnu-ld \
28 --enable-shared \
29 --enable-languages=${LANGUAGES} \
30 --enable-threads=${GCCTHREADS} \
31 ${GCCMULTILIB} \
32 --enable-c99 \
33 --enable-long-long \
34 --enable-symvers=gnu \
35 --enable-libstdcxx-pch \
36 --program-prefix=${TARGET_PREFIX} \
37 --without-local-prefix \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038 ${EXTRA_OECONF_BASE} \
39 ${EXTRA_OECONF_GCC_FLOAT} \
40 ${EXTRA_OECONF_PATHS} \
41 ${@get_gcc_mips_plt_setting(bb, d)} \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050042 ${@get_gcc_ppc_plt_settings(bb, d)} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050043 ${@get_long_double_setting(bb, d)} \
44 ${@get_gcc_multiarch_setting(bb, d)} \
45"
46
Patrick Williamsc0f7c042017-02-23 20:41:17 -060047# Set this here since GCC configure won't auto-detect and enable
48# initfini-arry when cross compiling.
49EXTRA_OECONF_append = " --enable-initfini-array"
50
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051export gcc_cv_collect2_libs = 'none required'
52# We need to set gcc_cv_collect2_libs else there is cross-compilation badness
53# in the config.log files (which might not get generated until do_compile
54# hence being missed by the insane do_configure check).
55
56# Build uclibc compilers without cxa_atexit support
57EXTRA_OECONF_append_linux = " --enable-__cxa_atexit"
58EXTRA_OECONF_append_libc-uclibc = " --enable-__cxa_atexit"
59
60EXTRA_OECONF_append_mips64 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
61EXTRA_OECONF_append_mips64el = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
62EXTRA_OECONF_append_mips64n32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
63EXTRA_OECONF_append_mips64eln32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060064EXTRA_OECONF_append_mipsisa32r6el = " --with-abi=32 --with-arch=mips32r6"
65EXTRA_OECONF_append_mipsisa32r6 = " --with-abi=32 --with-arch=mips32r6"
66EXTRA_OECONF_append_mipsisa64r6el = " --with-abi=64 --with-arch-64=mips64r6"
67EXTRA_OECONF_append_mipsisa64r6 = " --with-abi=64 --with-arch-64=mips64r6"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068
69# ARMv6+ adds atomic instructions that affect the ABI in libraries built
70# with TUNE_CCARGS in gcc-runtime. Make the compiler default to a
71# compatible architecture. armv6 and armv7a cover the minimum tune
72# features used in OE.
73EXTRA_OECONF_append_armv6 = " --with-arch=armv6"
74EXTRA_OECONF_append_armv7a = " --with-arch=armv7-a"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050075EXTRA_OECONF_append_armv7ve = " --with-arch=armv7-a"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050076
77EXTRA_OECONF_GCC_FLOAT ??= ""
78CPPFLAGS = ""
79
80SYSTEMHEADERS = "${target_includedir}"
81SYSTEMLIBS = "${target_base_libdir}/"
82SYSTEMLIBS1 = "${target_libdir}/"
83
84do_configure_prepend () {
85 # teach gcc to find correct target includedir when checking libc ssp support
86 mkdir -p ${B}/gcc
87 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
88 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
89 cat >>${B}/gcc/defaults.h.new <<_EOF
90#define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}"
91#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
92#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
93#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
94#endif /* ! GCC_DEFAULTS_H */
95_EOF
96 mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
97}
98
99do_configure () {
100 # Setup these vars for cross building only
101 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
102 # gcc build stuff when the build is producing a cross compiler - i.e.
103 # when the 'current' target is the 'host' system, and the host is not
104 # the target (because the build is actually making a cross compiler!)
105 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
106 export CC_FOR_TARGET="${CC}"
107 export GCC_FOR_TARGET="${CC}"
108 export CXX_FOR_TARGET="${CXX}"
109 export AS_FOR_TARGET="${HOST_PREFIX}as"
110 export LD_FOR_TARGET="${HOST_PREFIX}ld"
111 export NM_FOR_TARGET="${HOST_PREFIX}nm"
112 export AR_FOR_TARGET="${HOST_PREFIX}ar"
113 export GFORTRAN_FOR_TARGET="gfortran"
114 export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
115 fi
116 export CC_FOR_BUILD="${BUILD_CC}"
117 export CXX_FOR_BUILD="${BUILD_CXX}"
118 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
119 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
120 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
121 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
122 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
123 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
124 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
125 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
126
127
128 oe_runconf
129}
130