summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-configure-common.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-configure-common.inc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-configure-common.inc107
1 files changed, 107 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc b/meta/recipes-devtools/gcc/gcc-configure-common.inc
new file mode 100644
index 0000000000..5a55025ac5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc
@@ -0,0 +1,107 @@
1#
2# Build the list of lanaguages to build.
3#
4# These can be overridden by the version specific .inc file.
5
6# Java (gcj doesn't work on all architectures)
7JAVA ?= ",java"
8JAVA_arm ?= ""
9JAVA_armeb ?= ""
10JAVA_mipsel ?= ""
11JAVA_sh3 ?= ""
12# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
13FORTRAN ?= ",f77"
14LANGUAGES ?= "c,c++${FORTRAN}${JAVA}"
15# disable --enable-target-optspace for powerpc SPE
16# at -Os libgcc.so.1 creates references into
17# hidden symbols in libgcc.a which linker complains
18# when linking shared libraries further in the build like (gnutls)
19
20OPTSPACE = "${@base_contains('TARGET_ARCH', ['powerpc', 'arm'], '', '--enable-target-optspace',d)}"
21
22EXTRA_OECONF_BASE ?= ""
23EXTRA_OECONF_PATHS ?= ""
24EXTRA_OECONF_INITIAL ?= ""
25EXTRA_OECONF_INTERMEDIATE ?= ""
26
27GCCMULTILIB = "--disable-multilib"
28
29EXTRA_OECONF = "${@['--enable-clocale=generic', ''][bb.data.getVar('USE_NLS', d, 1) != 'no']} \
30 --with-gnu-ld \
31 --enable-shared \
32 --enable-languages=${LANGUAGES} \
33 --enable-threads=posix \
34 ${GCCMULTILIB} \
35 --enable-c99 \
36 --enable-long-long \
37 --enable-symvers=gnu \
38 --enable-libstdcxx-pch \
39 --program-prefix=${TARGET_PREFIX} \
40 ${OPTSPACE} \
41 ${EXTRA_OECONF_BASE} \
42 ${EXTRA_OECONF_FPU} \
43 ${EXTRA_OECONF_PATHS} \
44 ${@get_gcc_mips_plt_setting(bb, d)}"
45
46# Build uclibc compilers without cxa_atexit support
47EXTRA_OECONF_append_linux = " --enable-__cxa_atexit"
48EXTRA_OECONF_append_linux-gnueabi = " --enable-__cxa_atexit"
49EXTRA_OECONF_append_linux-uclibc = " --disable-__cxa_atexit"
50EXTRA_OECONF_append_linux-uclibcgnueabi = " --disable-__cxa_atexit"
51EXTRA_OECONF_FPU = "${@get_gcc_fpu_setting(bb, d)}"
52CPPFLAGS = ""
53
54# Used by configure to define additional values for FLAGS_FOR_TARGET -
55# passed to all the compilers.
56ARCH_FLAGS_FOR_TARGET = "${TARGET_CC_ARCH}"
57EXTRA_OEMAKE += "ARCH_FLAGS_FOR_TARGET='${ARCH_FLAGS_FOR_TARGET}'"
58
59SYSTEMHEADERS = "${target_includedir}"
60SYSTEMLIBS = "${target_base_libdir}/"
61SYSTEMLIBS1 = "${target_libdir}/"
62
63do_configure () {
64 # Setup these vars for cross building only
65 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
66 # gcc build stuff when the build is producing a cross compiler - i.e.
67 # when the 'current' target is the 'host' system, and the host is not
68 # the target (because the build is actually making a cross compiler!)
69 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
70 export CC_FOR_TARGET="${CC}"
71 export GCC_FOR_TARGET="${CC}"
72 export CXX_FOR_TARGET="${CXX}"
73 export AS_FOR_TARGET="${HOST_PREFIX}as"
74 export LD_FOR_TARGET="${HOST_PREFIX}ld"
75 export NM_FOR_TARGET="${HOST_PREFIX}nm"
76 export AR_FOR_TARGET="${HOST_PREFIX}ar"
77 export GFORTRAN_FOR_TARGET="gfortran"
78 export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
79 fi
80 export CC_FOR_BUILD="${BUILD_CC}"
81 export CXX_FOR_BUILD="${BUILD_CXX}"
82 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
83 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
84 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
85 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
86 export ARCH_FLAGS_FOR_TARGET="${ARCH_FLAGS_FOR_TARGET}"
87 (cd ${S} && gnu-configize) || die "failure running gnu-configize"
88
89 # splice our idea of where the headers live into gcc's world
90 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${T}/t-oe
91 sed 's%^tmake_file=.*$%& ${T}/t-oe%' < ${S}/gcc/Makefile.in >${S}/gcc/Makefile.in.new
92 mv ${S}/gcc/Makefile.in.new ${S}/gcc/Makefile.in
93 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${S}/gcc/defaults.h.new
94 echo "#ifndef STANDARD_INCLUDE_DIR" >> ${S}/gcc/defaults.h.new
95 echo "#define STANDARD_INCLUDE_DIR \"${SYSTEMHEADERS}\"" >> ${S}/gcc/defaults.h.new
96 echo "#endif" >> ${S}/gcc/defaults.h.new
97 echo "#ifndef STANDARD_STARTFILE_PREFIX_1" >> ${S}/gcc/defaults.h.new
98 echo "#define STANDARD_STARTFILE_PREFIX_1 \"${SYSTEMLIBS}\"" >> ${S}/gcc/defaults.h.new
99 echo "#endif" >> ${S}/gcc/defaults.h.new
100 echo "#ifndef STANDARD_STARTFILE_PREFIX_2" >> ${S}/gcc/defaults.h.new
101 echo "#define STANDARD_STARTFILE_PREFIX_2 \"${SYSTEMLIBS1}\"" >> ${S}/gcc/defaults.h.new
102 echo "#endif" >> ${S}/gcc/defaults.h.new
103 echo "#endif /* ! GCC_DEFAULTS_H */" >> ${S}/gcc/defaults.h.new
104 mv ${S}/gcc/defaults.h.new ${S}/gcc/defaults.h
105 oe_runconf
106}
107