gcc-configure-common.inc 4.3 KB

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