blob: a14be738c5e98a94d9702fc6338b2503da5ecb66 [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)} \
50 ${@get_long_double_setting(bb, d)} \
51 ${@get_gcc_multiarch_setting(bb, d)} \
52"
53
54export 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
59# Build uclibc compilers without cxa_atexit support
60EXTRA_OECONF_append_linux = " --enable-__cxa_atexit"
61EXTRA_OECONF_append_libc-uclibc = " --enable-__cxa_atexit"
62
63EXTRA_OECONF_append_mips64 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
64EXTRA_OECONF_append_mips64el = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
65EXTRA_OECONF_append_mips64n32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
66EXTRA_OECONF_append_mips64eln32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
67
68# ARMv6+ adds atomic instructions that affect the ABI in libraries built
69# with TUNE_CCARGS in gcc-runtime. Make the compiler default to a
70# compatible architecture. armv6 and armv7a cover the minimum tune
71# features used in OE.
72EXTRA_OECONF_append_armv6 = " --with-arch=armv6"
73EXTRA_OECONF_append_armv7a = " --with-arch=armv7-a"
74
75EXTRA_OECONF_GCC_FLOAT ??= ""
76CPPFLAGS = ""
77
78SYSTEMHEADERS = "${target_includedir}"
79SYSTEMLIBS = "${target_base_libdir}/"
80SYSTEMLIBS1 = "${target_libdir}/"
81
82do_configure_prepend () {
83 # teach gcc to find correct target includedir when checking libc ssp support
84 mkdir -p ${B}/gcc
85 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
86 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
87 cat >>${B}/gcc/defaults.h.new <<_EOF
88#define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}"
89#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
90#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
91#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
92#endif /* ! GCC_DEFAULTS_H */
93_EOF
94 mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
95}
96
97do_configure () {
98 # Setup these vars for cross building only
99 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
100 # gcc build stuff when the build is producing a cross compiler - i.e.
101 # when the 'current' target is the 'host' system, and the host is not
102 # the target (because the build is actually making a cross compiler!)
103 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
104 export CC_FOR_TARGET="${CC}"
105 export GCC_FOR_TARGET="${CC}"
106 export CXX_FOR_TARGET="${CXX}"
107 export AS_FOR_TARGET="${HOST_PREFIX}as"
108 export LD_FOR_TARGET="${HOST_PREFIX}ld"
109 export NM_FOR_TARGET="${HOST_PREFIX}nm"
110 export AR_FOR_TARGET="${HOST_PREFIX}ar"
111 export GFORTRAN_FOR_TARGET="gfortran"
112 export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
113 fi
114 export CC_FOR_BUILD="${BUILD_CC}"
115 export CXX_FOR_BUILD="${BUILD_CXX}"
116 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
117 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
118 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
119 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
120 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
121 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
122 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
123 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
124
125
126 oe_runconf
127}
128