< prev index next >

make/autoconf/flags.m4

Print this page




  29 
  30 ################################################################################
  31 #
  32 # Setup ABI profile (for arm)
  33 #
  34 AC_DEFUN([FLAGS_SETUP_ABI_PROFILE],
  35 [
  36   AC_ARG_WITH(abi-profile, [AS_HELP_STRING([--with-abi-profile],
  37       [specify ABI profile for ARM builds (arm-vfp-sflt,arm-vfp-hflt,arm-sflt, armv5-vfp-sflt,armv6-vfp-hflt,aarch64) @<:@toolchain dependent@:>@ ])])
  38 
  39   if test "x$with_abi_profile" != x; then
  40     if test "x$OPENJDK_TARGET_CPU" != xarm && \
  41         test "x$OPENJDK_TARGET_CPU" != xaarch64; then
  42       AC_MSG_ERROR([--with-abi-profile only available on arm/aarch64])
  43     fi
  44 
  45     OPENJDK_TARGET_ABI_PROFILE=$with_abi_profile
  46     AC_MSG_CHECKING([for ABI profle])
  47     AC_MSG_RESULT([$OPENJDK_TARGET_ABI_PROFILE])
  48 
  49     # --- Arm-sflt CFLAGS and ASFLAGS ---
  50     # Armv5te is required for assembler, because pld insn used in arm32 hotspot is only in v5E and above.
  51     # However, there is also a GCC bug which generates unaligned strd/ldrd instructions on armv5te:
  52     # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82445, and it was fixed only quite recently.
  53     # The resulting compromise is to enable v5TE for assembler and let GCC generate code for v5T.
  54     if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-sflt; then
  55       ARM_FLOAT_TYPE=vfp-sflt
  56       ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
  57       ARM_ARCH_TYPE_ASFLAGS='-march=armv7-a -mthumb'
  58     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-hflt; then
  59       ARM_FLOAT_TYPE=vfp-hflt
  60       ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
  61       ARM_ARCH_TYPE_ASFLAGS='-march=armv7-a -mthumb'
  62     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-sflt; then
  63       ARM_FLOAT_TYPE=sflt
  64       ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
  65       ARM_ARCH_TYPE_ASFLAGS='-march=armv5te'
  66     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv5-vfp-sflt; then
  67       ARM_FLOAT_TYPE=vfp-sflt
  68       ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
  69       ARM_ARCH_TYPE_ASFLAGS='-march=armv5te'
  70     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv6-vfp-hflt; then
  71       ARM_FLOAT_TYPE=vfp-hflt
  72       ARM_ARCH_TYPE_FLAGS='-march=armv6 -marm'
  73       ARM_ARCH_TYPE_ASFLAGS='-march=armv6'
  74     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xaarch64; then
  75       # No special flags, just need to trigger setting JDK_ARCH_ABI_PROP_NAME
  76       ARM_FLOAT_TYPE=
  77       ARM_ARCH_TYPE_FLAGS=
  78       ARM_ARCH_TYPE_ASFLAGS=
  79     else
  80       AC_MSG_ERROR([Invalid ABI profile: "$OPENJDK_TARGET_ABI_PROFILE"])
  81     fi
  82 
  83     if test "x$ARM_FLOAT_TYPE" = xvfp-sflt; then
  84       ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=softfp -mfpu=vfp -DFLOAT_ARCH=-vfp-sflt'
  85       ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=softfp -mfpu=vfp"
  86     elif test "x$ARM_FLOAT_TYPE" = xvfp-hflt; then
  87       ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=hard -mfpu=vfp -DFLOAT_ARCH=-vfp-hflt'
  88       ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=hard -mfpu=vfp"
  89     elif test "x$ARM_FLOAT_TYPE" = xsflt; then
  90       ARM_FLOAT_TYPE_FLAGS='-msoft-float -mfpu=vfp'
  91       ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=soft -mfpu=vfp"
  92     fi
  93     AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags])
  94     AC_MSG_RESULT([$ARM_FLOAT_TYPE_FLAGS])
  95     AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags for assembler])
  96     AC_MSG_RESULT([$ARM_FLOAT_TYPE_ASFLAGS])
  97 
  98     AC_MSG_CHECKING([for arch type flags])
  99     AC_MSG_RESULT([$ARM_ARCH_TYPE_FLAGS])
 100     AC_MSG_CHECKING([for arch type flags for assembler])
 101     AC_MSG_RESULT([$ARM_ARCH_TYPE_ASFLAGS])
 102 
 103     # Now set JDK_ARCH_ABI_PROP_NAME. This is equivalent to the last part of the
 104     # autoconf target triplet.
 105     [ JDK_ARCH_ABI_PROP_NAME=`$ECHO $OPENJDK_TARGET_AUTOCONF_NAME | $SED -e 's/.*-\([^-]*\)$/\1/'` ]
 106     # Sanity check that it is a known ABI.
 107     if test "x$JDK_ARCH_ABI_PROP_NAME" != xgnu && \
 108         test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabi  && \
 109         test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabihf; then
 110           AC_MSG_WARN([Unknown autoconf target triplet ABI: "$JDK_ARCH_ABI_PROP_NAME"])
 111     fi
 112     AC_MSG_CHECKING([for ABI property name])
 113     AC_MSG_RESULT([$JDK_ARCH_ABI_PROP_NAME])
 114     AC_SUBST(JDK_ARCH_ABI_PROP_NAME)
 115   fi
 116 
 117   # When building with an abi profile, the name of that profile is appended on the
 118   # bundle platform, which is used in bundle names.
 119   if test "x$OPENJDK_TARGET_ABI_PROFILE" != x; then
 120     OPENJDK_TARGET_BUNDLE_PLATFORM="$OPENJDK_TARGET_OS_BUNDLE-$OPENJDK_TARGET_ABI_PROFILE"
 121   fi


 404   FLAGS_SETUP_QUALITY_CHECKS
 405   FLAGS_SETUP_OPTIMIZATION
 406 
 407   FLAGS_SETUP_CFLAGS
 408   FLAGS_SETUP_LDFLAGS
 409 
 410   FLAGS_SETUP_ARFLAGS
 411   FLAGS_SETUP_STRIPFLAGS
 412   FLAGS_SETUP_RCFLAGS
 413 
 414   FLAGS_SETUP_ASFLAGS
 415   FLAGS_SETUP_ASFLAGS_CPU_DEP([TARGET])
 416   FLAGS_SETUP_ASFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
 417 ])
 418 
 419 # FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 420 #                                  IF_FALSE: [RUN-IF-FALSE])
 421 # ------------------------------------------------------------
 422 # Check that the C compiler supports an argument
 423 BASIC_DEFUN_NAMED([FLAGS_C_COMPILER_CHECK_ARGUMENTS],
 424     [*ARGUMENT IF_TRUE IF_FALSE PREFIX], [$@],
 425 [
 426   AC_MSG_CHECKING([if ARG_PREFIX[CC] supports "ARG_ARGUMENT"])
 427   supports=yes
 428 
 429   saved_cflags="$CFLAGS"
 430   saved_cc="$CC"
 431   CFLAGS="$CFLAGS ARG_ARGUMENT"
 432   CC="$ARG_PREFIX[CC]"
 433   AC_LANG_PUSH([C])
 434   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
 435       [supports=no])
 436   AC_LANG_POP([C])
 437   CC="$saved_cc"
 438   CFLAGS="$saved_cflags"
 439 
 440   AC_MSG_RESULT([$supports])
 441   if test "x$supports" = "xyes" ; then
 442     :
 443     ARG_IF_TRUE
 444   else
 445     :
 446     ARG_IF_FALSE
 447   fi
 448 ])
 449 
 450 # FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 451 #                                    IF_FALSE: [RUN-IF-FALSE])
 452 # ------------------------------------------------------------
 453 # Check that the C++ compiler supports an argument
 454 BASIC_DEFUN_NAMED([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS],
 455     [*ARGUMENT IF_TRUE IF_FALSE PREFIX], [$@],
 456 [
 457   AC_MSG_CHECKING([if ARG_PREFIX[CXX] supports "ARG_ARGUMENT"])
 458   supports=yes
 459 
 460   saved_cxxflags="$CXXFLAGS"
 461   saved_cxx="$CXX"
 462   CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
 463   CXX="$ARG_PREFIX[CXX]"
 464   AC_LANG_PUSH([C++])
 465   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
 466       [supports=no])
 467   AC_LANG_POP([C++])
 468   CXX="$saved_cxx"
 469   CXXFLAGS="$saved_cxxflags"
 470 
 471   AC_MSG_RESULT([$supports])
 472   if test "x$supports" = "xyes" ; then
 473     :
 474     ARG_IF_TRUE
 475   else
 476     :
 477     ARG_IF_FALSE
 478   fi
 479 ])
 480 
 481 # FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 482 #                                IF_FALSE: [RUN-IF-FALSE])
 483 # ------------------------------------------------------------
 484 # Check that the C and C++ compilers support an argument
 485 BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
 486     [*ARGUMENT IF_TRUE IF_FALSE PREFIX], [$@],
 487 [
 488   FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
 489       IF_TRUE: [C_COMP_SUPPORTS="yes"],
 490       IF_FALSE: [C_COMP_SUPPORTS="no"],
 491       PREFIX: [ARG_PREFIX])
 492   FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
 493       IF_TRUE: [CXX_COMP_SUPPORTS="yes"],
 494       IF_FALSE: [CXX_COMP_SUPPORTS="no"],
 495       PREFIX: [ARG_PREFIX])
 496 
 497   AC_MSG_CHECKING([if both ARG_PREFIX[CC] and ARG_PREFIX[CXX] support "ARG_ARGUMENT"])
 498   supports=no
 499   if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then
 500     supports=yes;
 501   fi
 502 
 503   AC_MSG_RESULT([$supports])
 504   if test "x$supports" = "xyes" ; then
 505     :
 506     ARG_IF_TRUE
 507   else
 508     :
 509     ARG_IF_FALSE
 510   fi
 511 ])
 512 
 513 # FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 514 #                                   IF_FALSE: [RUN-IF-FALSE])
 515 # ------------------------------------------------------------
 516 # Check that the linker support an argument
 517 BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
 518     [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 519 [
 520   AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
 521   supports=yes


  29 
  30 ################################################################################
  31 #
  32 # Setup ABI profile (for arm)
  33 #
  34 AC_DEFUN([FLAGS_SETUP_ABI_PROFILE],
  35 [
  36   AC_ARG_WITH(abi-profile, [AS_HELP_STRING([--with-abi-profile],
  37       [specify ABI profile for ARM builds (arm-vfp-sflt,arm-vfp-hflt,arm-sflt, armv5-vfp-sflt,armv6-vfp-hflt,aarch64) @<:@toolchain dependent@:>@ ])])
  38 
  39   if test "x$with_abi_profile" != x; then
  40     if test "x$OPENJDK_TARGET_CPU" != xarm && \
  41         test "x$OPENJDK_TARGET_CPU" != xaarch64; then
  42       AC_MSG_ERROR([--with-abi-profile only available on arm/aarch64])
  43     fi
  44 
  45     OPENJDK_TARGET_ABI_PROFILE=$with_abi_profile
  46     AC_MSG_CHECKING([for ABI profle])
  47     AC_MSG_RESULT([$OPENJDK_TARGET_ABI_PROFILE])
  48 





  49     if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-sflt; then
  50       ARM_FLOAT_TYPE=vfp-sflt
  51       ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'

  52     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-hflt; then
  53       ARM_FLOAT_TYPE=vfp-hflt
  54       ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'

  55     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-sflt; then
  56       ARM_FLOAT_TYPE=sflt
  57       ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'

  58     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv5-vfp-sflt; then
  59       ARM_FLOAT_TYPE=vfp-sflt
  60       ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'

  61     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv6-vfp-hflt; then
  62       ARM_FLOAT_TYPE=vfp-hflt
  63       ARM_ARCH_TYPE_FLAGS='-march=armv6 -marm'

  64     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xaarch64; then
  65       # No special flags, just need to trigger setting JDK_ARCH_ABI_PROP_NAME
  66       ARM_FLOAT_TYPE=
  67       ARM_ARCH_TYPE_FLAGS=

  68     else
  69       AC_MSG_ERROR([Invalid ABI profile: "$OPENJDK_TARGET_ABI_PROFILE"])
  70     fi
  71 
  72     if test "x$ARM_FLOAT_TYPE" = xvfp-sflt; then
  73       ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=softfp -mfpu=vfp -DFLOAT_ARCH=-vfp-sflt'

  74     elif test "x$ARM_FLOAT_TYPE" = xvfp-hflt; then
  75       ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=hard -mfpu=vfp -DFLOAT_ARCH=-vfp-hflt'

  76     elif test "x$ARM_FLOAT_TYPE" = xsflt; then
  77       ARM_FLOAT_TYPE_FLAGS='-msoft-float -mfpu=vfp'

  78     fi
  79     AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags])
  80     AC_MSG_RESULT([$ARM_FLOAT_TYPE_FLAGS])


  81 
  82     AC_MSG_CHECKING([for arch type flags])
  83     AC_MSG_RESULT([$ARM_ARCH_TYPE_FLAGS])


  84 
  85     # Now set JDK_ARCH_ABI_PROP_NAME. This is equivalent to the last part of the
  86     # autoconf target triplet.
  87     [ JDK_ARCH_ABI_PROP_NAME=`$ECHO $OPENJDK_TARGET_AUTOCONF_NAME | $SED -e 's/.*-\([^-]*\)$/\1/'` ]
  88     # Sanity check that it is a known ABI.
  89     if test "x$JDK_ARCH_ABI_PROP_NAME" != xgnu && \
  90         test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabi  && \
  91         test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabihf; then
  92           AC_MSG_WARN([Unknown autoconf target triplet ABI: "$JDK_ARCH_ABI_PROP_NAME"])
  93     fi
  94     AC_MSG_CHECKING([for ABI property name])
  95     AC_MSG_RESULT([$JDK_ARCH_ABI_PROP_NAME])
  96     AC_SUBST(JDK_ARCH_ABI_PROP_NAME)
  97   fi
  98 
  99   # When building with an abi profile, the name of that profile is appended on the
 100   # bundle platform, which is used in bundle names.
 101   if test "x$OPENJDK_TARGET_ABI_PROFILE" != x; then
 102     OPENJDK_TARGET_BUNDLE_PLATFORM="$OPENJDK_TARGET_OS_BUNDLE-$OPENJDK_TARGET_ABI_PROFILE"
 103   fi


 386   FLAGS_SETUP_QUALITY_CHECKS
 387   FLAGS_SETUP_OPTIMIZATION
 388 
 389   FLAGS_SETUP_CFLAGS
 390   FLAGS_SETUP_LDFLAGS
 391 
 392   FLAGS_SETUP_ARFLAGS
 393   FLAGS_SETUP_STRIPFLAGS
 394   FLAGS_SETUP_RCFLAGS
 395 
 396   FLAGS_SETUP_ASFLAGS
 397   FLAGS_SETUP_ASFLAGS_CPU_DEP([TARGET])
 398   FLAGS_SETUP_ASFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
 399 ])
 400 
 401 # FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 402 #                                  IF_FALSE: [RUN-IF-FALSE])
 403 # ------------------------------------------------------------
 404 # Check that the C compiler supports an argument
 405 BASIC_DEFUN_NAMED([FLAGS_C_COMPILER_CHECK_ARGUMENTS],
 406     [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 407 [
 408   AC_MSG_CHECKING([if the C compiler supports "ARG_ARGUMENT"])
 409   supports=yes
 410 
 411   saved_cflags="$CFLAGS"

 412   CFLAGS="$CFLAGS ARG_ARGUMENT"

 413   AC_LANG_PUSH([C])
 414   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
 415       [supports=no])
 416   AC_LANG_POP([C])

 417   CFLAGS="$saved_cflags"
 418 
 419   AC_MSG_RESULT([$supports])
 420   if test "x$supports" = "xyes" ; then
 421     :
 422     ARG_IF_TRUE
 423   else
 424     :
 425     ARG_IF_FALSE
 426   fi
 427 ])
 428 
 429 # FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 430 #                                    IF_FALSE: [RUN-IF-FALSE])
 431 # ------------------------------------------------------------
 432 # Check that the C++ compiler supports an argument
 433 BASIC_DEFUN_NAMED([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS],
 434     [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 435 [
 436   AC_MSG_CHECKING([if the C++ compiler supports "ARG_ARGUMENT"])
 437   supports=yes
 438 
 439   saved_cxxflags="$CXXFLAGS"

 440   CXXFLAGS="$CXXFLAG ARG_ARGUMENT"

 441   AC_LANG_PUSH([C++])
 442   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
 443       [supports=no])
 444   AC_LANG_POP([C++])

 445   CXXFLAGS="$saved_cxxflags"
 446 
 447   AC_MSG_RESULT([$supports])
 448   if test "x$supports" = "xyes" ; then
 449     :
 450     ARG_IF_TRUE
 451   else
 452     :
 453     ARG_IF_FALSE
 454   fi
 455 ])
 456 
 457 # FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 458 #                                IF_FALSE: [RUN-IF-FALSE])
 459 # ------------------------------------------------------------
 460 # Check that the C and C++ compilers support an argument
 461 BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
 462     [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 463 [
 464   FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
 465                                              IF_TRUE: [C_COMP_SUPPORTS="yes"],
 466                                              IF_FALSE: [C_COMP_SUPPORTS="no"])

 467   FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
 468                                                IF_TRUE: [CXX_COMP_SUPPORTS="yes"],
 469                                                IF_FALSE: [CXX_COMP_SUPPORTS="no"])

 470 
 471   AC_MSG_CHECKING([if both compilers support "ARG_ARGUMENT"])
 472   supports=no
 473   if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi


 474 
 475   AC_MSG_RESULT([$supports])
 476   if test "x$supports" = "xyes" ; then
 477     :
 478     ARG_IF_TRUE
 479   else
 480     :
 481     ARG_IF_FALSE
 482   fi
 483 ])
 484 
 485 # FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 486 #                                   IF_FALSE: [RUN-IF-FALSE])
 487 # ------------------------------------------------------------
 488 # Check that the linker support an argument
 489 BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
 490     [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 491 [
 492   AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
 493   supports=yes
< prev index next >