2 # Build the list of lanaguages to build.
4 # These can be overridden by the version specific .inc file.
6 # Java (gcj doesn't work on all architectures)
12 OBJC_libc-uclibc ?= ""
18 # disable --enable-target-optspace for powerpc SPE
19 # at -Os libgcc.so.1 creates references into
20 # hidden symbols in libgcc.a which linker complains
21 # when linking shared libraries further in the build like (gnutls)
23 OPTSPACE = "${@base_contains('TARGET_ARCH', 'powerpc', '', '--enable-target-optspace',d)}"
24 # gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
26 LANGUAGES ?= "c,c++${OBJC}${FORTRAN}${JAVA}"
28 EXTRA_OECONF_BASE ?= ""
29 EXTRA_OECONF_PATHS ?= ""
30 EXTRA_OECONF_INITIAL ?= ""
31 EXTRA_OECONF_INTERMEDIATE ?= ""
33 EXTRA_OECONF = "${@['--enable-clocale=generic', ''][bb.data.getVar('USE_NLS', d, 1) != 'no']} \
36 --enable-languages=${LANGUAGES} \
37 --enable-threads=posix \
41 --enable-symvers=gnu \
42 --enable-libstdcxx-pch \
43 --program-prefix=${TARGET_PREFIX} \
45 ${EXTRA_OECONF_BASE} \
47 ${EXTRA_OECONF_PATHS} \
48 ${@get_gcc_mips_plt_setting(bb, d)}"
50 # Build uclibc compilers without cxa_atexit support
51 EXTRA_OECONF_append_linux = " --enable-__cxa_atexit"
52 EXTRA_OECONF_append_linux-gnueabi = " --enable-__cxa_atexit"
53 EXTRA_OECONF_append_libc-uclibc = " --disable-__cxa_atexit"
54 EXTRA_OECONF_append_mips64 = " --with-abi=64"
55 EXTRA_OECONF_append_mips64el = " --with-abi=64"
56 EXTRA_OECONF_FPU = "${@get_gcc_fpu_setting(bb, d)}"
59 # Used by configure to define additional values for FLAGS_FOR_TARGET -
60 # passed to all the compilers.
61 ARCH_FLAGS_FOR_TARGET = "${TARGET_CC_ARCH}"
62 EXTRA_OEMAKE += "ARCH_FLAGS_FOR_TARGET='${ARCH_FLAGS_FOR_TARGET}'"
65 # Setup these vars for cross building only
66 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
67 # gcc build stuff when the build is producing a cross compiler - i.e.
68 # when the 'current' target is the 'host' system, and the host is not
69 # the target (because the build is actually making a cross compiler!)
70 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
71 export CC_FOR_TARGET="${CC}"
72 export GCC_FOR_TARGET="${CC}"
73 export CXX_FOR_TARGET="${CXX}"
74 export AS_FOR_TARGET="${HOST_PREFIX}as"
75 export LD_FOR_TARGET="${HOST_PREFIX}ld"
76 export NM_FOR_TARGET="${HOST_PREFIX}nm"
77 export AR_FOR_TARGET="${HOST_PREFIX}ar"
78 export GFORTRAN_FOR_TARGET="gfortran"
79 export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
81 export CC_FOR_BUILD="${BUILD_CC}"
82 export CXX_FOR_BUILD="${BUILD_CXX}"
83 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
84 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
85 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
86 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
87 export ARCH_FLAGS_FOR_TARGET="${ARCH_FLAGS_FOR_TARGET}"
89 # Make sure LDFLAGS are honored.
90 sed -i 's/^LDFLAGS = $/LDFLAGS = @LDFLAGS@/' ${S}/Makefile.in
91 sed -i 's/^LDFLAGS = $/LDFLAGS = @LDFLAGS@/' ${S}/Makefile.tpl
93 (cd ${S} && gnu-configize) || die "failure running gnu-configize"
94 # gcc assumes ${sysroot}/usr to be prefix on linux targets
95 # but we have distro option to flatten out the tree and micro
96 # uses root file system without leading /usr so we need to
97 # teach gcc configure to look in correct include paths
98 # unfortunately there is no configure knob to indicate this
99 # to configury hence the sed :(
100 sed -i 's:/usr/include:${target_includedir}:g' ${S}/gcc/configure.ac
101 sed -i 's:/usr/include:${target_includedir}:g' ${S}/gcc/configure
102 if [ "${HOST_SYS}" != "${TARGET_SYS}" ]; then
103 # splice our idea of where the headers live into gcc's world
104 echo "NATIVE_SYSTEM_HEADER_DIR = ${target_includedir}" > ${T}/t-oe
105 sed 's%^tmake_file=.*$%& ${T}/t-oe%' < ${S}/gcc/Makefile.in >${S}/gcc/Makefile.in.new
106 mv ${S}/gcc/Makefile.in.new ${S}/gcc/Makefile.in
107 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${S}/gcc/defaults.h.new
108 echo "#ifndef STANDARD_INCLUDE_DIR" >> ${S}/gcc/defaults.h.new
109 echo "#define STANDARD_INCLUDE_DIR \"${target_includedir}\"" >> ${S}/gcc/defaults.h.new
110 echo "#endif" >> ${S}/gcc/defaults.h.new
111 echo "#endif /* ! GCC_DEFAULTS_H */" >> ${S}/gcc/defaults.h.new
112 mv ${S}/gcc/defaults.h.new ${S}/gcc/defaults.h
117 # make sure that no @LDFLAG@ is left in the generated Makefile
118 sed -i "s/@LDFLAGS@//g" ${B}/Makefile