common/autoconf/toolchain.m4

Print this page
rev 977 : JDK-8019470: Changes needed to compile JDK8 on MacOS with clang compiler
Reviewed-by:


  79 
  80   AC_SUBST(LIBRARY_PREFIX)
  81   AC_SUBST(SHARED_LIBRARY_SUFFIX)
  82   AC_SUBST(STATIC_LIBRARY_SUFFIX)
  83   AC_SUBST(SHARED_LIBRARY)
  84   AC_SUBST(STATIC_LIBRARY)
  85   AC_SUBST(OBJ_SUFFIX)
  86   AC_SUBST(EXE_SUFFIX)  
  87 ])
  88 
  89 # Determine which toolchain type to use, and make sure it is valid for this
  90 # platform. Setup various information about the selected toolchain.
  91 AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE],
  92 [
  93   AC_ARG_WITH(toolchain-type, [AS_HELP_STRING([--with-toolchain-type],
  94       [the toolchain type (or family) to use, use '--help' to show possible values @<:@platform dependent@:>@])])
  95 
  96   # Use indirect variable referencing
  97   toolchain_var_name=VALID_TOOLCHAINS_$OPENJDK_BUILD_OS
  98   VALID_TOOLCHAINS=${!toolchain_var_name}


















  99   # First toolchain type in the list is the default
 100   DEFAULT_TOOLCHAIN=${VALID_TOOLCHAINS%% *}

 101   
 102   if test "x$with_toolchain_type" = xlist; then
 103     # List all toolchains
 104     AC_MSG_NOTICE([The following toolchains are valid on this platform:])
 105     for toolchain in $VALID_TOOLCHAINS; do
 106       toolchain_var_name=TOOLCHAIN_DESCRIPTION_$toolchain
 107       TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
 108       $PRINTF "  %-10s  %s\n" $toolchain "$TOOLCHAIN_DESCRIPTION"
 109     done
 110     
 111     exit 0
 112   elif test "x$with_toolchain_type" != x; then
 113     # User override; check that it is valid
 114     if test "x${VALID_TOOLCHAINS/$with_toolchain_type/}" = "x${VALID_TOOLCHAINS}"; then
 115       AC_MSG_NOTICE([Toolchain type $with_toolchain_type is not valid on this platform.])
 116       AC_MSG_NOTICE([Valid toolchains: $VALID_TOOLCHAINS.])
 117       AC_MSG_ERROR([Cannot continue.])
 118     fi
 119     TOOLCHAIN_TYPE=$with_toolchain_type
 120   else




  79 
  80   AC_SUBST(LIBRARY_PREFIX)
  81   AC_SUBST(SHARED_LIBRARY_SUFFIX)
  82   AC_SUBST(STATIC_LIBRARY_SUFFIX)
  83   AC_SUBST(SHARED_LIBRARY)
  84   AC_SUBST(STATIC_LIBRARY)
  85   AC_SUBST(OBJ_SUFFIX)
  86   AC_SUBST(EXE_SUFFIX)  
  87 ])
  88 
  89 # Determine which toolchain type to use, and make sure it is valid for this
  90 # platform. Setup various information about the selected toolchain.
  91 AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE],
  92 [
  93   AC_ARG_WITH(toolchain-type, [AS_HELP_STRING([--with-toolchain-type],
  94       [the toolchain type (or family) to use, use '--help' to show possible values @<:@platform dependent@:>@])])
  95 
  96   # Use indirect variable referencing
  97   toolchain_var_name=VALID_TOOLCHAINS_$OPENJDK_BUILD_OS
  98   VALID_TOOLCHAINS=${!toolchain_var_name}
  99 
 100   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 101     # On Mac OS X, default toolchain to clang after Xcode 5
 102     XCODE_VERSION_OUTPUT=`xcodebuild -version 2>&1 | $HEAD -n 1`
 103     $ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
 104     if test $? -ne 0; then
 105       AC_MSG_ERROR([Failed to determine Xcode version.])
 106     fi
 107     XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
 108         $SED -e 's/^Xcode \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/' | \
 109         $CUT -f 1 -d .`
 110     AC_MSG_NOTICE([Xcode major version: $XCODE_MAJOR_VERSION])
 111     if test $XCODE_MAJOR_VERSION -ge 5; then
 112         DEFAULT_TOOLCHAIN="clang"
 113     else
 114         DEFAULT_TOOLCHAIN="gcc"
 115     fi
 116   else
 117     # First toolchain type in the list is the default
 118     DEFAULT_TOOLCHAIN=${VALID_TOOLCHAINS%% *}
 119   fi
 120   
 121   if test "x$with_toolchain_type" = xlist; then
 122     # List all toolchains
 123     AC_MSG_NOTICE([The following toolchains are valid on this platform:])
 124     for toolchain in $VALID_TOOLCHAINS; do
 125       toolchain_var_name=TOOLCHAIN_DESCRIPTION_$toolchain
 126       TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
 127       $PRINTF "  %-10s  %s\n" $toolchain "$TOOLCHAIN_DESCRIPTION"
 128     done
 129     
 130     exit 0
 131   elif test "x$with_toolchain_type" != x; then
 132     # User override; check that it is valid
 133     if test "x${VALID_TOOLCHAINS/$with_toolchain_type/}" = "x${VALID_TOOLCHAINS}"; then
 134       AC_MSG_NOTICE([Toolchain type $with_toolchain_type is not valid on this platform.])
 135       AC_MSG_NOTICE([Valid toolchains: $VALID_TOOLCHAINS.])
 136       AC_MSG_ERROR([Cannot continue.])
 137     fi
 138     TOOLCHAIN_TYPE=$with_toolchain_type
 139   else