blob: cee6f4a58f76beba01fca75b9eec9b6000d7c108 [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}"
17# disable --enable-target-optspace for powerpc SPE
18# at -Os libgcc.so.1 creates references into
19# hidden symbols in libgcc.a which linker complains
20# when linking shared libraries further in the build like (gnutls)
21
22SPECIAL_ARCH_LIST = "powerpc"
23OPTSPACE = '${@bb.utils.contains("SPECIAL_ARCH_LIST", "${TARGET_ARCH}", "", "--enable-target-optspace",d)}'
24
25EXTRA_OECONF_BASE ?= ""
26EXTRA_OECONF_PATHS ?= ""
27EXTRA_OECONF_INITIAL ?= ""
28
29GCCMULTILIB ?= "--disable-multilib"
30GCCTHREADS ?= "posix"
31
32EXTRA_OECONF = "\
33 ${@['--enable-clocale=generic', ''][d.getVar('USE_NLS', True) != 'no']} \
34 --with-gnu-ld \
35 --enable-shared \
36 --enable-languages=${LANGUAGES} \
37 --enable-threads=${GCCTHREADS} \
38 ${GCCMULTILIB} \
39 --enable-c99 \
40 --enable-long-long \
41 --enable-symvers=gnu \
42 --enable-libstdcxx-pch \
43 --program-prefix=${TARGET_PREFIX} \
44 --without-local-prefix \
45 ${OPTSPACE} \
46 ${EXTRA_OECONF_BASE} \
47 ${EXTRA_OECONF_GCC_FLOAT} \
48 ${EXTRA_OECONF_PATHS} \
49 ${@get_gcc_mips_plt_setting(bb, d)} \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050050 ${@get_gcc_ppc_plt_settings(bb, d)} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051 ${@get_long_double_setting(bb, d)} \
52 ${@get_gcc_multiarch_setting(bb, d)} \
53"
54
55export gcc_cv_collect2_libs = 'none required'
56# We need to set gcc_cv_collect2_libs else there is cross-compilation badness
57# in the config.log files (which might not get generated until do_compile
58# hence being missed by the insane do_configure check).
59
60# Build uclibc compilers without cxa_atexit support
61EXTRA_OECONF_append_linux = " --enable-__cxa_atexit"
62EXTRA_OECONF_append_libc-uclibc = " --enable-__cxa_atexit"
63
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"
68
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"
75
76EXTRA_OECONF_GCC_FLOAT ??= ""
77CPPFLAGS = ""
78
79SYSTEMHEADERS = "${target_includedir}"
80SYSTEMLIBS = "${target_base_libdir}/"
81SYSTEMLIBS1 = "${target_libdir}/"
82
83do_configure_prepend () {
84 # teach gcc to find correct target includedir when checking libc ssp support
85 mkdir -p ${B}/gcc
86 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
87 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
88 cat >>${B}/gcc/defaults.h.new <<_EOF
89#define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}"
90#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
91#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
92#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
93#endif /* ! GCC_DEFAULTS_H */
94_EOF
95 mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
96}
97
98do_configure () {
99 # Setup these vars for cross building only
100 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
101 # gcc build stuff when the build is producing a cross compiler - i.e.
102 # when the 'current' target is the 'host' system, and the host is not
103 # the target (because the build is actually making a cross compiler!)
104 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
105 export CC_FOR_TARGET="${CC}"
106 export GCC_FOR_TARGET="${CC}"
107 export CXX_FOR_TARGET="${CXX}"
108 export AS_FOR_TARGET="${HOST_PREFIX}as"
109 export LD_FOR_TARGET="${HOST_PREFIX}ld"
110 export NM_FOR_TARGET="${HOST_PREFIX}nm"
111 export AR_FOR_TARGET="${HOST_PREFIX}ar"
112 export GFORTRAN_FOR_TARGET="gfortran"
113 export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
114 fi
115 export CC_FOR_BUILD="${BUILD_CC}"
116 export CXX_FOR_BUILD="${BUILD_CXX}"
117 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
118 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
119 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
120 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
121 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
122 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
123 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
124 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
125
126
127 oe_runconf
128}
129