blob: e2ce234aa145a420db2bdf7b94c2c0e25dcbc410 [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
Brad Bishopd7bf8c12018-02-25 22:55:05 -050025GCCPIE ??= ""
26
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027EXTRA_OECONF = "\
Brad Bishop6e60e8b2018-02-01 10:27:11 -050028 ${@['--enable-clocale=generic', ''][d.getVar('USE_NLS') != 'no']} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029 --with-gnu-ld \
30 --enable-shared \
31 --enable-languages=${LANGUAGES} \
32 --enable-threads=${GCCTHREADS} \
33 ${GCCMULTILIB} \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050034 ${GCCPIE} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035 --enable-c99 \
36 --enable-long-long \
37 --enable-symvers=gnu \
38 --enable-libstdcxx-pch \
39 --program-prefix=${TARGET_PREFIX} \
40 --without-local-prefix \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050041 ${EXTRA_OECONF_BASE} \
42 ${EXTRA_OECONF_GCC_FLOAT} \
43 ${EXTRA_OECONF_PATHS} \
44 ${@get_gcc_mips_plt_setting(bb, d)} \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050045 ${@get_gcc_ppc_plt_settings(bb, d)} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046 ${@get_long_double_setting(bb, d)} \
47 ${@get_gcc_multiarch_setting(bb, d)} \
48"
49
Patrick Williamsc0f7c042017-02-23 20:41:17 -060050# Set this here since GCC configure won't auto-detect and enable
51# initfini-arry when cross compiling.
52EXTRA_OECONF_append = " --enable-initfini-array"
53
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054export gcc_cv_collect2_libs = 'none required'
55# We need to set gcc_cv_collect2_libs else there is cross-compilation badness
56# in the config.log files (which might not get generated until do_compile
57# hence being missed by the insane do_configure check).
58
Patrick Williamsc124f4f2015-09-15 14:41:29 -050059EXTRA_OECONF_append_linux = " --enable-__cxa_atexit"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050060
61EXTRA_OECONF_append_mips64 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
62EXTRA_OECONF_append_mips64el = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
63EXTRA_OECONF_append_mips64n32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
64EXTRA_OECONF_append_mips64eln32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060065EXTRA_OECONF_append_mipsisa32r6el = " --with-abi=32 --with-arch=mips32r6"
66EXTRA_OECONF_append_mipsisa32r6 = " --with-abi=32 --with-arch=mips32r6"
67EXTRA_OECONF_append_mipsisa64r6el = " --with-abi=64 --with-arch-64=mips64r6"
68EXTRA_OECONF_append_mipsisa64r6 = " --with-abi=64 --with-arch-64=mips64r6"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050069
Patrick Williamsc124f4f2015-09-15 14:41:29 -050070EXTRA_OECONF_GCC_FLOAT ??= ""
71CPPFLAGS = ""
72
73SYSTEMHEADERS = "${target_includedir}"
74SYSTEMLIBS = "${target_base_libdir}/"
75SYSTEMLIBS1 = "${target_libdir}/"
76
77do_configure_prepend () {
78 # teach gcc to find correct target includedir when checking libc ssp support
79 mkdir -p ${B}/gcc
80 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
81 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
82 cat >>${B}/gcc/defaults.h.new <<_EOF
83#define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}"
84#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
85#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
86#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
87#endif /* ! GCC_DEFAULTS_H */
88_EOF
89 mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
90}
91
92do_configure () {
93 # Setup these vars for cross building only
94 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
95 # gcc build stuff when the build is producing a cross compiler - i.e.
96 # when the 'current' target is the 'host' system, and the host is not
97 # the target (because the build is actually making a cross compiler!)
98 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
99 export CC_FOR_TARGET="${CC}"
100 export GCC_FOR_TARGET="${CC}"
101 export CXX_FOR_TARGET="${CXX}"
102 export AS_FOR_TARGET="${HOST_PREFIX}as"
103 export LD_FOR_TARGET="${HOST_PREFIX}ld"
104 export NM_FOR_TARGET="${HOST_PREFIX}nm"
105 export AR_FOR_TARGET="${HOST_PREFIX}ar"
106 export GFORTRAN_FOR_TARGET="gfortran"
107 export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
108 fi
109 export CC_FOR_BUILD="${BUILD_CC}"
110 export CXX_FOR_BUILD="${BUILD_CXX}"
111 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
112 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
113 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
114 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
115 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
116 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
117 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
118 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
119
120
121 oe_runconf
122}
123