Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | require gcc-multilib-config.inc |
| 2 | require 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 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 8 | # gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran' |
| 9 | FORTRAN ?= ",f77" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 10 | LANGUAGES ?= "c,c++${FORTRAN}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 11 | |
| 12 | EXTRA_OECONF_BASE ?= "" |
| 13 | EXTRA_OECONF_PATHS ?= "" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 14 | |
| 15 | GCCMULTILIB ?= "--disable-multilib" |
| 16 | GCCTHREADS ?= "posix" |
| 17 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 18 | GCCPIE ??= "" |
| 19 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 20 | EXTRA_OECONF = "\ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 21 | ${@['--enable-clocale=generic', ''][d.getVar('USE_NLS') != 'no']} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 22 | --with-gnu-ld \ |
| 23 | --enable-shared \ |
| 24 | --enable-languages=${LANGUAGES} \ |
| 25 | --enable-threads=${GCCTHREADS} \ |
| 26 | ${GCCMULTILIB} \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 27 | ${GCCPIE} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 28 | --enable-c99 \ |
| 29 | --enable-long-long \ |
| 30 | --enable-symvers=gnu \ |
| 31 | --enable-libstdcxx-pch \ |
| 32 | --program-prefix=${TARGET_PREFIX} \ |
| 33 | --without-local-prefix \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 34 | ${EXTRA_OECONF_BASE} \ |
| 35 | ${EXTRA_OECONF_GCC_FLOAT} \ |
| 36 | ${EXTRA_OECONF_PATHS} \ |
| 37 | ${@get_gcc_mips_plt_setting(bb, d)} \ |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 38 | ${@get_gcc_ppc_plt_settings(bb, d)} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 39 | ${@get_long_double_setting(bb, d)} \ |
| 40 | ${@get_gcc_multiarch_setting(bb, d)} \ |
| 41 | " |
| 42 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 43 | # glibc version is a minimum controlling whether features are enabled. |
| 44 | # Doesn't need to track glibc exactly |
| 45 | EXTRA_OECONF_append_libc-glibc = " --with-glibc-version=2.28 " |
| 46 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 47 | # Set this here since GCC configure won't auto-detect and enable |
| 48 | # initfini-arry when cross compiling. |
| 49 | EXTRA_OECONF_append = " --enable-initfini-array" |
| 50 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 51 | export gcc_cv_collect2_libs = 'none required' |
| 52 | # We need to set gcc_cv_collect2_libs else there is cross-compilation badness |
| 53 | # in the config.log files (which might not get generated until do_compile |
| 54 | # hence being missed by the insane do_configure check). |
| 55 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 56 | EXTRA_OECONF_append_linux = " --enable-__cxa_atexit" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 57 | |
| 58 | EXTRA_OECONF_append_mips64 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64" |
| 59 | EXTRA_OECONF_append_mips64el = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64" |
| 60 | EXTRA_OECONF_append_mips64n32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64" |
| 61 | EXTRA_OECONF_append_mips64eln32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 62 | EXTRA_OECONF_append_mipsisa32r6el = " --with-abi=32 --with-arch=mips32r6" |
| 63 | EXTRA_OECONF_append_mipsisa32r6 = " --with-abi=32 --with-arch=mips32r6" |
| 64 | EXTRA_OECONF_append_mipsisa64r6el = " --with-abi=64 --with-arch-64=mips64r6" |
| 65 | EXTRA_OECONF_append_mipsisa64r6 = " --with-abi=64 --with-arch-64=mips64r6" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 66 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 67 | EXTRA_OECONF_GCC_FLOAT ??= "" |
| 68 | CPPFLAGS = "" |
| 69 | |
| 70 | SYSTEMHEADERS = "${target_includedir}" |
| 71 | SYSTEMLIBS = "${target_base_libdir}/" |
| 72 | SYSTEMLIBS1 = "${target_libdir}/" |
| 73 | |
| 74 | do_configure_prepend () { |
| 75 | # teach gcc to find correct target includedir when checking libc ssp support |
| 76 | mkdir -p ${B}/gcc |
| 77 | echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe |
| 78 | cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new |
| 79 | cat >>${B}/gcc/defaults.h.new <<_EOF |
| 80 | #define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}" |
| 81 | #define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}" |
| 82 | #define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}" |
| 83 | #define SYSTEMLIBS_DIR "${SYSTEMLIBS}" |
| 84 | #endif /* ! GCC_DEFAULTS_H */ |
| 85 | _EOF |
| 86 | mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h |
| 87 | } |
| 88 | |
| 89 | do_configure () { |
| 90 | # Setup these vars for cross building only |
| 91 | # ... because foo_FOR_TARGET apparently gets misinterpreted inside the |
| 92 | # gcc build stuff when the build is producing a cross compiler - i.e. |
| 93 | # when the 'current' target is the 'host' system, and the host is not |
| 94 | # the target (because the build is actually making a cross compiler!) |
| 95 | if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then |
| 96 | export CC_FOR_TARGET="${CC}" |
| 97 | export GCC_FOR_TARGET="${CC}" |
| 98 | export CXX_FOR_TARGET="${CXX}" |
| 99 | export AS_FOR_TARGET="${HOST_PREFIX}as" |
| 100 | export LD_FOR_TARGET="${HOST_PREFIX}ld" |
| 101 | export NM_FOR_TARGET="${HOST_PREFIX}nm" |
| 102 | export AR_FOR_TARGET="${HOST_PREFIX}ar" |
| 103 | export GFORTRAN_FOR_TARGET="gfortran" |
| 104 | export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib" |
| 105 | fi |
| 106 | export CC_FOR_BUILD="${BUILD_CC}" |
| 107 | export CXX_FOR_BUILD="${BUILD_CXX}" |
| 108 | export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}" |
| 109 | export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}" |
| 110 | export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}" |
| 111 | export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}" |
| 112 | export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}" |
| 113 | export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}" |
| 114 | export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}" |
| 115 | export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}" |
| 116 | |
| 117 | |
| 118 | oe_runconf |
| 119 | } |
| 120 | |