gcc-configure-common.inc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. --enable-shared \
  19. --enable-languages=${LANGUAGES} \
  20. --enable-threads=${GCCTHREADS} \
  21. ${GCCMULTILIB} \
  22. ${GCCPIE} \
  23. ${SYMVERS_CONF} \
  24. --program-prefix=${TARGET_PREFIX} \
  25. --without-local-prefix \
  26. --enable-lto \
  27. ${EXTRA_OECONF_BASE} \
  28. ${EXTRA_OECONF_GCC_FLOAT} \
  29. ${EXTRA_OECONF_PATHS} \
  30. ${@get_gcc_mips_plt_setting(bb, d)} \
  31. ${@get_gcc_ppc_plt_settings(bb, d)} \
  32. ${@get_gcc_multiarch_setting(bb, d)} \
  33. --enable-standard-branch-protection \
  34. --disable-libmudflap \
  35. --disable-libgomp \
  36. --disable-libssp \
  37. --disable-libquadmath \
  38. --disable-libquadmath-support \
  39. --disable-libmpx \
  40. --enable-target-optspace \
  41. --with-gmp \
  42. --with-mpfr \
  43. --with-mpc \
  44. --enable-tls \
  45. --without-isl \
  46. "
  47. # glibc version is a minimum controlling whether features are enabled.
  48. # Doesn't need to track glibc exactly
  49. EXTRA_OECONF:append:libc-glibc = " --with-glibc-version=2.28 "
  50. # Set this here since GCC configure won't auto-detect and enable
  51. # initfini-arry when cross compiling.
  52. #EXTRA_OECONF:append = " --enable-initfini-array"
  53. export gcc_cv_collect2_libs = 'none required'
  54. # We need to set gcc_cv_collect2_libs else there is cross-compilation badness
  55. # in the config.log files (which might not get generated until do_compile
  56. # hence being missed by the insane do_configure check).
  57. EXTRA_OECONF:append:linux = " --enable-__cxa_atexit"
  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"
  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"
  66. EXTRA_OECONF_GCC_FLOAT ??= ""
  67. CPPFLAGS = ""
  68. SYSTEMHEADERS = "${target_includedir}"
  69. SYSTEMLIBS = "${target_base_libdir}/"
  70. SYSTEMLIBS1 = "${target_libdir}/"
  71. do_configure:prepend () {
  72. # teach gcc to find correct target includedir when checking libc ssp support
  73. mkdir -p ${B}/gcc
  74. echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
  75. cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
  76. cat >>${B}/gcc/defaults.h.new <<_EOF
  77. #define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}"
  78. #define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
  79. #define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
  80. #define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
  81. #endif /* ! GCC_DEFAULTS_H */
  82. _EOF
  83. mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
  84. }
  85. do_configure () {
  86. # Setup these vars for cross building only
  87. # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
  88. # gcc build stuff when the build is producing a cross compiler - i.e.
  89. # when the 'current' target is the 'host' system, and the host is not
  90. # the target (because the build is actually making a cross compiler!)
  91. if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
  92. export CC_FOR_TARGET="${CC}"
  93. export GCC_FOR_TARGET="${CC}"
  94. export CXX_FOR_TARGET="${CXX}"
  95. export AS_FOR_TARGET="${HOST_PREFIX}as"
  96. export LD_FOR_TARGET="${HOST_PREFIX}ld"
  97. export NM_FOR_TARGET="${HOST_PREFIX}nm"
  98. export AR_FOR_TARGET="${HOST_PREFIX}ar"
  99. export GFORTRAN_FOR_TARGET="gfortran"
  100. export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
  101. fi
  102. export CC_FOR_BUILD="${BUILD_CC}"
  103. export CXX_FOR_BUILD="${BUILD_CXX}"
  104. export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
  105. export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
  106. export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
  107. export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
  108. export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
  109. export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
  110. export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
  111. export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
  112. oe_runconf
  113. }