common/autoconf/toolchain.m4

changeset 0
75a576e87639
child 1133
50aaf272884f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/common/autoconf/toolchain.m4	Wed Apr 27 01:39:08 2016 +0800
     1.3 @@ -0,0 +1,1234 @@
     1.4 +#
     1.5 +# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.  Oracle designates this
    1.11 +# particular file as subject to the "Classpath" exception as provided
    1.12 +# by Oracle in the LICENSE file that accompanied this code.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 +# or visit www.oracle.com if you need additional information or have any
    1.26 +# questions.
    1.27 +#
    1.28 +
    1.29 +# $1 = compiler to test (CC or CXX)
    1.30 +# $2 = human readable name of compiler (C or C++)
    1.31 +AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION],
    1.32 +[
    1.33 +  COMPILER=[$]$1
    1.34 +  COMPILER_NAME=$2
    1.35 +
    1.36 +  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
    1.37 +    # Make sure we use the Sun Studio compiler and not gcc on Solaris, which won't work
    1.38 +    COMPILER_VERSION_TEST=`$COMPILER -V 2>&1 | $HEAD -n 1`
    1.39 +    $ECHO $COMPILER_VERSION_TEST | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null
    1.40 +    if test $? -ne 0; then
    1.41 +      GCC_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
    1.42 +
    1.43 +      AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required Sun Studio compiler.])
    1.44 +      AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_TEST" and with --version: "$GCC_VERSION_TEST"])
    1.45 +      AC_MSG_ERROR([Sun Studio compiler is required. Try setting --with-tools-dir.])
    1.46 +    else
    1.47 +      COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*@<:@ ,\t@:>@$COMPILER_NAME@<:@ ,\t@:>@\(@<:@1-9@:>@\.@<:@0-9@:>@@<:@0-9@:>@*\).*/\1/p"`
    1.48 +      COMPILER_VENDOR="Sun Studio"
    1.49 +    fi
    1.50 +  elif test  "x$OPENJDK_TARGET_OS" = xaix; then
    1.51 +      COMPILER_VERSION_TEST=`$COMPILER -qversion  2>&1 | $TAIL -n 1`
    1.52 +      $ECHO $COMPILER_VERSION_TEST | $GREP "^Version: " > /dev/null
    1.53 +      if test $? -ne 0; then
    1.54 +        AC_MSG_ERROR([Failed to detect the compiler version of $COMPILER ....])
    1.55 +      else
    1.56 +        COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n 's/Version: \([0-9][0-9]\.[0-9][0-9]*\).*/\1/p'`
    1.57 +        COMPILER_VENDOR='IBM'
    1.58 +      fi
    1.59 +  elif test  "x$OPENJDK_TARGET_OS" = xwindows; then
    1.60 +    # First line typically looks something like:
    1.61 +    # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
    1.62 +    COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'`
    1.63 +    COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*Version \(@<:@1-9@:>@@<:@0-9.@:>@*\) .*/\1/p"`
    1.64 +    COMPILER_VENDOR="Microsoft CL.EXE"
    1.65 +    COMPILER_CPU_TEST=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* for \(.*\)$/\1/p"`
    1.66 +    if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
    1.67 +      if test "x$COMPILER_CPU_TEST" != "x80x86"; then
    1.68 +        AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86".])
    1.69 +      fi
    1.70 +    elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
    1.71 +      if test "x$COMPILER_CPU_TEST" != "xx64"; then
    1.72 +        AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "x64".])
    1.73 +      fi
    1.74 +    fi
    1.75 +  else
    1.76 +    COMPILER_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
    1.77 +    # Check that this is likely to be GCC.
    1.78 +    $COMPILER --version 2>&1 | $GREP "Free Software Foundation" > /dev/null
    1.79 +    if test $? -ne 0; then
    1.80 +      AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required GCC compiler.])
    1.81 +      AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION_TEST"])
    1.82 +      AC_MSG_ERROR([GCC compiler is required. Try setting --with-tools-dir.])
    1.83 +    fi
    1.84 +
    1.85 +    # First line typically looks something like:
    1.86 +    # gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
    1.87 +    COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/p"`
    1.88 +    COMPILER_VENDOR=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^\(.*\) @<:@1-9@:>@@<:@0-9.@:>@*/\1/p"`
    1.89 +  fi
    1.90 +  # This sets CC_VERSION or CXX_VERSION. (This comment is a grep marker)
    1.91 +  $1_VERSION="$COMPILER_VERSION"
    1.92 +  # This sets CC_VENDOR or CXX_VENDOR. (This comment is a grep marker)
    1.93 +  $1_VENDOR="$COMPILER_VENDOR"
    1.94 +
    1.95 +  AC_MSG_NOTICE([Using $COMPILER_VENDOR $COMPILER_NAME compiler version $COMPILER_VERSION (located at $COMPILER)])
    1.96 +])
    1.97 +
    1.98 +
    1.99 +AC_DEFUN_ONCE([TOOLCHAIN_SETUP_SYSROOT_AND_OUT_OPTIONS],
   1.100 +[
   1.101 +  ###############################################################################
   1.102 +  #
   1.103 +  # Configure the development tool paths and potential sysroot.
   1.104 +  #
   1.105 +  AC_LANG(C++)
   1.106 +
   1.107 +  # The option used to specify the target .o,.a or .so file.
   1.108 +  # When compiling, how to specify the to be created object file.
   1.109 +  CC_OUT_OPTION='-o$(SPACE)'
   1.110 +  # When linking, how to specify the to be created executable.
   1.111 +  EXE_OUT_OPTION='-o$(SPACE)'
   1.112 +  # When linking, how to specify the to be created dynamically linkable library.
   1.113 +  LD_OUT_OPTION='-o$(SPACE)'
   1.114 +  # When archiving, how to specify the to be create static archive for object files.
   1.115 +  AR_OUT_OPTION='rcs$(SPACE)'
   1.116 +  AC_SUBST(CC_OUT_OPTION)
   1.117 +  AC_SUBST(EXE_OUT_OPTION)
   1.118 +  AC_SUBST(LD_OUT_OPTION)
   1.119 +  AC_SUBST(AR_OUT_OPTION)
   1.120 +])
   1.121 +
   1.122 +# $1 = compiler to test (CC or CXX)
   1.123 +# $2 = human readable name of compiler (C or C++)
   1.124 +# $3 = list of compiler names to search for
   1.125 +AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
   1.126 +[
   1.127 +  COMPILER_NAME=$2
   1.128 +
   1.129 +  $1=
   1.130 +  # If TOOLS_DIR is set, check for all compiler names in there first
   1.131 +  # before checking the rest of the PATH.
   1.132 +  if test -n "$TOOLS_DIR"; then
   1.133 +    PATH_save="$PATH"
   1.134 +    PATH="$TOOLS_DIR"
   1.135 +    AC_PATH_PROGS(TOOLS_DIR_$1, $3)
   1.136 +    $1=$TOOLS_DIR_$1
   1.137 +    PATH="$PATH_save"
   1.138 +  fi
   1.139 +
   1.140 +  # AC_PATH_PROGS can't be run multiple times with the same variable,
   1.141 +  # so create a new name for this run.
   1.142 +  if test "x[$]$1" = x; then
   1.143 +    AC_PATH_PROGS(POTENTIAL_$1, $3)
   1.144 +    $1=$POTENTIAL_$1
   1.145 +  fi
   1.146 +
   1.147 +  if test "x[$]$1" = x; then
   1.148 +    HELP_MSG_MISSING_DEPENDENCY([devkit])
   1.149 +    AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
   1.150 +  fi
   1.151 +  BASIC_FIXUP_EXECUTABLE($1)
   1.152 +  TEST_COMPILER="[$]$1"
   1.153 +  # Don't remove symbolic links on AIX because 'xlc_r' and 'xlC_r' may all be links
   1.154 +  # to 'xlc' but it is crucial that we invoke the compiler with the right name!
   1.155 +  if test "x$OPENJDK_BUILD_OS" != xaix; then
   1.156 +    AC_MSG_CHECKING([resolved symbolic links for $1])
   1.157 +    BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
   1.158 +    AC_MSG_RESULT([$TEST_COMPILER])
   1.159 +  fi
   1.160 +  AC_MSG_CHECKING([if $1 is disguised ccache])
   1.161 +
   1.162 +  COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"`
   1.163 +  if test "x$COMPILER_BASENAME" = "xccache"; then
   1.164 +    AC_MSG_RESULT([yes, trying to find proper $COMPILER_NAME compiler])
   1.165 +    # We /usr/lib/ccache in the path, so cc is a symlink to /usr/bin/ccache.
   1.166 +    # We want to control ccache invocation ourselves, so ignore this cc and try
   1.167 +    # searching again.
   1.168 +
   1.169 +    # Remove the path to the fake ccache cc from the PATH
   1.170 +    RETRY_COMPILER_SAVED_PATH="$PATH"
   1.171 +    COMPILER_DIRNAME=`$DIRNAME [$]$1`
   1.172 +    PATH="`$ECHO $PATH | $SED -e "s,$COMPILER_DIRNAME,,g" -e "s,::,:,g" -e "s,^:,,g"`"
   1.173 +
   1.174 +    # Try again looking for our compiler
   1.175 +    AC_CHECK_TOOLS(PROPER_COMPILER_$1, $3)
   1.176 +    BASIC_FIXUP_EXECUTABLE(PROPER_COMPILER_$1)
   1.177 +    PATH="$RETRY_COMPILER_SAVED_PATH"
   1.178 +
   1.179 +    AC_MSG_CHECKING([for resolved symbolic links for $1])
   1.180 +    BASIC_REMOVE_SYMBOLIC_LINKS(PROPER_COMPILER_$1)
   1.181 +    AC_MSG_RESULT([$PROPER_COMPILER_$1])
   1.182 +    $1="$PROPER_COMPILER_$1"
   1.183 +  else
   1.184 +    AC_MSG_RESULT([no, keeping $1])
   1.185 +    $1="$TEST_COMPILER"
   1.186 +  fi
   1.187 +  TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME])
   1.188 +])
   1.189 +
   1.190 +
   1.191 +AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
   1.192 +[
   1.193 +  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   1.194 +    TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
   1.195 +    TOOLCHAIN_SETUP_MSVCR_DLL
   1.196 +    BASIC_DEPRECATED_ARG_WITH([dxsdk])
   1.197 +    BASIC_DEPRECATED_ARG_WITH([dxsdk-lib])
   1.198 +    BASIC_DEPRECATED_ARG_WITH([dxsdk-include])
   1.199 +  fi
   1.200 +
   1.201 +  AC_SUBST(MSVCR_DLL)
   1.202 +
   1.203 +  # If --build AND --host is set, then the configure script will find any
   1.204 +  # cross compilation tools in the PATH. Cross compilation tools
   1.205 +  # follows the cross compilation standard where they are prefixed with ${host}.
   1.206 +  # For example the binary i686-sun-solaris2.10-gcc
   1.207 +  # will cross compile for i686-sun-solaris2.10
   1.208 +  # If neither of build and host is not set, then build=host and the
   1.209 +  # default compiler found in the path will be used.
   1.210 +  # Setting only --host, does not seem to be really supported.
   1.211 +  # Please set both --build and --host if you want to cross compile.
   1.212 +
   1.213 +  if test "x$COMPILE_TYPE" = "xcross"; then
   1.214 +    # Now we to find a C/C++ compiler that can build executables for the build
   1.215 +    # platform. We can't use the AC_PROG_CC macro, since it can only be used
   1.216 +    # once. Also, we need to do this before adding a tools dir to the path,
   1.217 +    # otherwise we might pick up cross-compilers which don't use standard naming.
   1.218 +    # Otherwise, we'll set the BUILD_tools to the native tools, but that'll have
   1.219 +    # to wait until they are properly discovered.
   1.220 +    AC_PATH_PROGS(BUILD_CC, [cl cc gcc])
   1.221 +    BASIC_FIXUP_EXECUTABLE(BUILD_CC)
   1.222 +    AC_PATH_PROGS(BUILD_CXX, [cl CC g++])
   1.223 +    BASIC_FIXUP_EXECUTABLE(BUILD_CXX)
   1.224 +    AC_PATH_PROG(BUILD_LD, ld)
   1.225 +    BASIC_FIXUP_EXECUTABLE(BUILD_LD)
   1.226 +  fi
   1.227 +  AC_SUBST(BUILD_CC)
   1.228 +  AC_SUBST(BUILD_CXX)
   1.229 +  AC_SUBST(BUILD_LD)
   1.230 +
   1.231 +  # If a devkit is found on the builddeps server, then prepend its path to the
   1.232 +  # PATH variable. If there are cross compilers available in the devkit, these
   1.233 +  # will be found by AC_PROG_CC et al.
   1.234 +  DEVKIT=
   1.235 +  BDEPS_CHECK_MODULE(DEVKIT, devkit, xxx,
   1.236 +      [
   1.237 +        # Found devkit
   1.238 +        PATH="$DEVKIT/bin:$PATH"
   1.239 +        SYS_ROOT="$DEVKIT/${rewritten_target}/sys-root"
   1.240 +        if test "x$x_includes" = "xNONE"; then
   1.241 +          x_includes="$SYS_ROOT/usr/include/X11"
   1.242 +        fi
   1.243 +        if test "x$x_libraries" = "xNONE"; then
   1.244 +          x_libraries="$SYS_ROOT/usr/lib"
   1.245 +        fi
   1.246 +      ],
   1.247 +      [])
   1.248 +
   1.249 +  # Store the CFLAGS etal passed to the configure script.
   1.250 +  ORG_CFLAGS="$CFLAGS"
   1.251 +  ORG_CXXFLAGS="$CXXFLAGS"
   1.252 +  ORG_OBJCFLAGS="$OBJCFLAGS"
   1.253 +
   1.254 +  # autoconf magic only relies on PATH, so update it if tools dir is specified
   1.255 +  OLD_PATH="$PATH"
   1.256 +  if test "x$TOOLS_DIR" != x; then
   1.257 +    PATH=$TOOLS_DIR:$PATH
   1.258 +  fi
   1.259 +
   1.260 +
   1.261 +  ### Locate C compiler (CC)
   1.262 +
   1.263 +  # On windows, only cl.exe is supported.
   1.264 +  # On Solaris, cc is preferred to gcc.
   1.265 +  # Elsewhere, gcc is preferred to cc.
   1.266 +
   1.267 +  if test "x$CC" != x; then
   1.268 +    COMPILER_CHECK_LIST="$CC"
   1.269 +  elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   1.270 +    COMPILER_CHECK_LIST="cl"
   1.271 +  elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
   1.272 +    COMPILER_CHECK_LIST="cc gcc"
   1.273 +  elif test "x$OPENJDK_TARGET_OS" = "xaix"; then
   1.274 +    # Do not probe for cc on AIX.
   1.275 +    COMPILER_CHECK_LIST="xlc_r"
   1.276 +  else
   1.277 +    COMPILER_CHECK_LIST="gcc cc"
   1.278 +  fi
   1.279 +
   1.280 +  TOOLCHAIN_FIND_COMPILER([CC],[C],[$COMPILER_CHECK_LIST])
   1.281 +  # Now that we have resolved CC ourself, let autoconf have its go at it
   1.282 +  AC_PROG_CC([$CC])
   1.283 +
   1.284 +  # Option used to tell the compiler whether to create 32- or 64-bit executables
   1.285 +  # Notice that CC contains the full compiler path at this point.
   1.286 +  case $CC in
   1.287 +    *xlc_r) COMPILER_TARGET_BITS_FLAG="-q";;
   1.288 +    *)      COMPILER_TARGET_BITS_FLAG="-m";;
   1.289 +  esac
   1.290 +  AC_SUBST(COMPILER_TARGET_BITS_FLAG)
   1.291 +
   1.292 +  ### Locate C++ compiler (CXX)
   1.293 +
   1.294 +  if test "x$CXX" != x; then
   1.295 +    COMPILER_CHECK_LIST="$CXX"
   1.296 +  elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   1.297 +    COMPILER_CHECK_LIST="cl"
   1.298 +  elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
   1.299 +    COMPILER_CHECK_LIST="CC g++"
   1.300 +  elif test "x$OPENJDK_TARGET_OS" = "xaix"; then
   1.301 +    # Do not probe for CC on AIX .
   1.302 +    COMPILER_CHECK_LIST="xlC_r"
   1.303 +  else
   1.304 +    COMPILER_CHECK_LIST="g++ CC"
   1.305 +  fi
   1.306 +
   1.307 +  TOOLCHAIN_FIND_COMPILER([CXX],[C++],[$COMPILER_CHECK_LIST])
   1.308 +  # Now that we have resolved CXX ourself, let autoconf have its go at it
   1.309 +  AC_PROG_CXX([$CXX])
   1.310 +
   1.311 +  ### Locate other tools
   1.312 +
   1.313 +  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   1.314 +    AC_PROG_OBJC
   1.315 +    BASIC_FIXUP_EXECUTABLE(OBJC)
   1.316 +  else
   1.317 +    OBJC=
   1.318 +  fi
   1.319 +
   1.320 +  # Restore the flags to the user specified values.
   1.321 +  # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
   1.322 +  CFLAGS="$ORG_CFLAGS"
   1.323 +  CXXFLAGS="$ORG_CXXFLAGS"
   1.324 +  OBJCFLAGS="$ORG_OBJCFLAGS"
   1.325 +
   1.326 +  LD="$CC"
   1.327 +  LDEXE="$CC"
   1.328 +  LDCXX="$CXX"
   1.329 +  LDEXECXX="$CXX"
   1.330 +  AC_SUBST(LD)
   1.331 +  # LDEXE is the linker to use, when creating executables.
   1.332 +  AC_SUBST(LDEXE)
   1.333 +  # Linking C++ libraries.
   1.334 +  AC_SUBST(LDCXX)
   1.335 +  # Linking C++ executables.
   1.336 +  AC_SUBST(LDEXECXX)
   1.337 +
   1.338 +  if test "x$OPENJDK_TARGET_OS" != xwindows; then
   1.339 +    AC_CHECK_TOOL(AR, ar)
   1.340 +    BASIC_FIXUP_EXECUTABLE(AR)
   1.341 +  fi
   1.342 +  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   1.343 +    ARFLAGS="-r"
   1.344 +  elif test "x$OPENJDK_TARGET_OS" = xaix; then
   1.345 +    ARFLAGS="-X64"
   1.346 +  else
   1.347 +    ARFLAGS=""
   1.348 +  fi
   1.349 +  AC_SUBST(ARFLAGS)
   1.350 +
   1.351 +  # For hotspot, we need these in Windows mixed path; other platforms keep them the same
   1.352 +  HOTSPOT_CXX="$CXX"
   1.353 +  HOTSPOT_LD="$LD"
   1.354 +  AC_SUBST(HOTSPOT_CXX)
   1.355 +  AC_SUBST(HOTSPOT_LD)
   1.356 +
   1.357 +  COMPILER_NAME=gcc
   1.358 +  COMPILER_TYPE=CC
   1.359 +  AS_IF([test "x$OPENJDK_TARGET_OS" = xwindows], [
   1.360 +    # For now, assume that we are always compiling using cl.exe.
   1.361 +    CC_OUT_OPTION=-Fo
   1.362 +    EXE_OUT_OPTION=-out:
   1.363 +    LD_OUT_OPTION=-out:
   1.364 +    AR_OUT_OPTION=-out:
   1.365 +    # On Windows, reject /usr/bin/link (as determined in CYGWIN_LINK), which is a cygwin
   1.366 +    # program for something completely different.
   1.367 +    AC_CHECK_PROG([WINLD], [link],[link],,, [$CYGWIN_LINK])
   1.368 +    # Since we must ignore the first found link, WINLD will contain
   1.369 +    # the full path to the link.exe program.
   1.370 +    BASIC_FIXUP_EXECUTABLE(WINLD)
   1.371 +    printf "Windows linker was found at $WINLD\n"
   1.372 +    AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
   1.373 +    "$WINLD" --version > /dev/null
   1.374 +    if test $? -eq 0 ; then
   1.375 +      AC_MSG_RESULT([no])
   1.376 +      AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.])
   1.377 +    else
   1.378 +      AC_MSG_RESULT([yes])
   1.379 +    fi
   1.380 +    LD="$WINLD"
   1.381 +    LDEXE="$WINLD"
   1.382 +    LDCXX="$WINLD"
   1.383 +    LDEXECXX="$WINLD"
   1.384 +
   1.385 +    AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt])
   1.386 +    BASIC_FIXUP_EXECUTABLE(MT)
   1.387 +    # The resource compiler
   1.388 +    AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc])
   1.389 +    BASIC_FIXUP_EXECUTABLE(RC)
   1.390 +
   1.391 +    # For hotspot, we need these in Windows mixed path,
   1.392 +    # so rewrite them all. Need added .exe suffix.
   1.393 +    HOTSPOT_CXX="$CXX.exe"
   1.394 +    HOTSPOT_LD="$LD.exe"
   1.395 +    HOTSPOT_MT="$MT.exe"
   1.396 +    HOTSPOT_RC="$RC.exe"
   1.397 +    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_CXX)
   1.398 +    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_LD)
   1.399 +    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_MT)
   1.400 +    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_RC)
   1.401 +    AC_SUBST(HOTSPOT_MT)
   1.402 +    AC_SUBST(HOTSPOT_RC)
   1.403 +
   1.404 +    RC_FLAGS="-nologo -l 0x409 -r"
   1.405 +    AS_IF([test "x$VARIANT" = xOPT], [
   1.406 +    RC_FLAGS="$RC_FLAGS -d NDEBUG"
   1.407 +  ])
   1.408 +
   1.409 +  # The version variables used to create RC_FLAGS may be overridden
   1.410 +  # in a custom configure script, or possibly the command line.
   1.411 +  # Let those variables be expanded at make time in spec.gmk.
   1.412 +  # The \$ are escaped to the shell, and the $(...) variables
   1.413 +  # are evaluated by make.
   1.414 +  RC_FLAGS="$RC_FLAGS \
   1.415 +      -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \
   1.416 +      -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \
   1.417 +      -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
   1.418 +      -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \
   1.419 +      -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
   1.420 +      -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \
   1.421 +      -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\""
   1.422 +
   1.423 +  # lib.exe is used to create static libraries.
   1.424 +  AC_CHECK_PROG([WINAR], [lib],[lib],,,)
   1.425 +  BASIC_FIXUP_EXECUTABLE(WINAR)
   1.426 +  AR="$WINAR"
   1.427 +  ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
   1.428 +
   1.429 +  AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,)
   1.430 +      BASIC_FIXUP_EXECUTABLE(DUMPBIN)
   1.431 +
   1.432 +      COMPILER_TYPE=CL
   1.433 +      CCXXFLAGS="$CCXXFLAGS -nologo"
   1.434 +  ])
   1.435 +  AC_SUBST(RC_FLAGS)
   1.436 +  AC_SUBST(COMPILER_TYPE)
   1.437 +
   1.438 +  AC_PROG_CPP
   1.439 +  BASIC_FIXUP_EXECUTABLE(CPP)
   1.440 +
   1.441 +  AC_PROG_CXXCPP
   1.442 +  BASIC_FIXUP_EXECUTABLE(CXXCPP)
   1.443 +
   1.444 +  if test "x$COMPILE_TYPE" != "xcross"; then
   1.445 +    # If we are not cross compiling, use the same compilers for
   1.446 +    # building the build platform executables. The cross-compilation
   1.447 +    # case needed to be done earlier, but this can only be done after
   1.448 +    # the native tools have been localized.
   1.449 +    BUILD_CC="$CC"
   1.450 +    BUILD_CXX="$CXX"
   1.451 +    BUILD_LD="$LD"
   1.452 +  fi
   1.453 +
   1.454 +  # for solaris we really need solaris tools, and not gnu equivalent
   1.455 +  #   these seems to normally reside in /usr/ccs/bin so add that to path before
   1.456 +  #   starting to probe
   1.457 +  #
   1.458 +  #   NOTE: I add this /usr/ccs/bin after TOOLS but before OLD_PATH
   1.459 +  #         so that it can be overriden --with-tools-dir
   1.460 +  if test "x$OPENJDK_BUILD_OS" = xsolaris; then
   1.461 +    PATH="${TOOLS_DIR}:/usr/ccs/bin:${OLD_PATH}"
   1.462 +  fi
   1.463 +
   1.464 +  # Find the right assembler.
   1.465 +  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   1.466 +    AC_PATH_PROG(AS, as)
   1.467 +    BASIC_FIXUP_EXECUTABLE(AS)
   1.468 +  else
   1.469 +    AS="$CC -c"
   1.470 +  fi
   1.471 +  AC_SUBST(AS)
   1.472 +
   1.473 +  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   1.474 +    AC_PATH_PROG(NM, nm)
   1.475 +    BASIC_FIXUP_EXECUTABLE(NM)
   1.476 +    AC_PATH_PROG(GNM, gnm)
   1.477 +    BASIC_FIXUP_EXECUTABLE(GNM)
   1.478 +    AC_PATH_PROG(STRIP, strip)
   1.479 +    BASIC_FIXUP_EXECUTABLE(STRIP)
   1.480 +    AC_PATH_PROG(MCS, mcs)
   1.481 +    BASIC_FIXUP_EXECUTABLE(MCS)
   1.482 +  elif test "x$OPENJDK_TARGET_OS" != xwindows; then
   1.483 +    AC_CHECK_TOOL(NM, nm)
   1.484 +    BASIC_FIXUP_EXECUTABLE(NM)
   1.485 +    GNM="$NM"
   1.486 +    AC_SUBST(GNM)
   1.487 +    AC_CHECK_TOOL(STRIP, strip)
   1.488 +    BASIC_FIXUP_EXECUTABLE(STRIP)
   1.489 +  fi
   1.490 +
   1.491 +  # objcopy is used for moving debug symbols to separate files when
   1.492 +  # full debug symbols are enabled.
   1.493 +  if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
   1.494 +    AC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
   1.495 +    # Only call fixup if objcopy was found.
   1.496 +    if test -n "$OBJCOPY"; then
   1.497 +      BASIC_FIXUP_EXECUTABLE(OBJCOPY)
   1.498 +    fi
   1.499 +  fi
   1.500 +
   1.501 +  AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
   1.502 +  if test "x$OBJDUMP" != x; then
   1.503 +    # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing.
   1.504 +    BASIC_FIXUP_EXECUTABLE(OBJDUMP)
   1.505 +  fi
   1.506 +
   1.507 +  if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
   1.508 +    AC_PATH_PROG(LIPO, lipo)
   1.509 +    BASIC_FIXUP_EXECUTABLE(LIPO)
   1.510 +  fi
   1.511 +
   1.512 +  TOOLCHAIN_SETUP_JTREG
   1.513 +
   1.514 +  # Restore old path without tools dir
   1.515 +  PATH="$OLD_PATH"
   1.516 +])
   1.517 +
   1.518 +
   1.519 +AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_LIBS],
   1.520 +[
   1.521 +
   1.522 +  ###############################################################################
   1.523 +  #
   1.524 +  # How to compile shared libraries.
   1.525 +  #
   1.526 +
   1.527 +  if test "x$GCC" = xyes; then
   1.528 +    COMPILER_NAME=gcc
   1.529 +    PICFLAG="-fPIC"
   1.530 +    LIBRARY_PREFIX=lib
   1.531 +    SHARED_LIBRARY='lib[$]1.so'
   1.532 +    STATIC_LIBRARY='lib[$]1.a'
   1.533 +    SHARED_LIBRARY_FLAGS="-shared"
   1.534 +    SHARED_LIBRARY_SUFFIX='.so'
   1.535 +    STATIC_LIBRARY_SUFFIX='.a'
   1.536 +    OBJ_SUFFIX='.o'
   1.537 +    EXE_SUFFIX=''
   1.538 +    SET_SHARED_LIBRARY_NAME='-Xlinker -soname=[$]1'
   1.539 +    SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=[$]1'
   1.540 +    C_FLAG_REORDER=''
   1.541 +    CXX_FLAG_REORDER=''
   1.542 +    SET_SHARED_LIBRARY_ORIGIN='-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1'
   1.543 +    SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1'
   1.544 +    LD="$CC"
   1.545 +    LDEXE="$CC"
   1.546 +    LDCXX="$CXX"
   1.547 +    LDEXECXX="$CXX"
   1.548 +    POST_STRIP_CMD="$STRIP -g"
   1.549 +
   1.550 +    # Linking is different on MacOSX
   1.551 +    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   1.552 +      # Might change in the future to clang.
   1.553 +      COMPILER_NAME=gcc
   1.554 +      SHARED_LIBRARY='lib[$]1.dylib'
   1.555 +      SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
   1.556 +      SHARED_LIBRARY_SUFFIX='.dylib'
   1.557 +      EXE_SUFFIX=''
   1.558 +      SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1'
   1.559 +      SET_SHARED_LIBRARY_MAPFILE=''
   1.560 +      SET_SHARED_LIBRARY_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
   1.561 +      SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
   1.562 +      POST_STRIP_CMD="$STRIP -S"
   1.563 +    fi
   1.564 +  else
   1.565 +    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   1.566 +      # If it is not gcc, then assume it is the Oracle Solaris Studio Compiler
   1.567 +      COMPILER_NAME=ossc
   1.568 +      PICFLAG="-KPIC"
   1.569 +      LIBRARY_PREFIX=lib
   1.570 +      SHARED_LIBRARY='lib[$]1.so'
   1.571 +      STATIC_LIBRARY='lib[$]1.a'
   1.572 +      SHARED_LIBRARY_FLAGS="-G"
   1.573 +      SHARED_LIBRARY_SUFFIX='.so'
   1.574 +      STATIC_LIBRARY_SUFFIX='.a'
   1.575 +      OBJ_SUFFIX='.o'
   1.576 +      EXE_SUFFIX=''
   1.577 +      SET_SHARED_LIBRARY_NAME=''
   1.578 +      SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
   1.579 +      C_FLAG_REORDER='-xF'
   1.580 +      CXX_FLAG_REORDER='-xF'
   1.581 +      SET_SHARED_LIBRARY_ORIGIN='-R\$$$$ORIGIN[$]1'
   1.582 +      SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
   1.583 +      CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
   1.584 +      CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
   1.585 +      CFLAGS_JDKLIB_EXTRA='-xstrconst'
   1.586 +      POST_STRIP_CMD="$STRIP -x"
   1.587 +      POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\""
   1.588 +    fi
   1.589 +    if test "x$OPENJDK_TARGET_OS" = xaix; then
   1.590 +        COMPILER_NAME=xlc
   1.591 +        PICFLAG="-qpic=large"
   1.592 +        LIBRARY_PREFIX=lib
   1.593 +        SHARED_LIBRARY='lib[$]1.so'
   1.594 +        STATIC_LIBRARY='lib[$]1.a'
   1.595 +        SHARED_LIBRARY_FLAGS="-qmkshrobj"
   1.596 +        SHARED_LIBRARY_SUFFIX='.so'
   1.597 +        STATIC_LIBRARY_SUFFIX='.a'
   1.598 +        OBJ_SUFFIX='.o'
   1.599 +        EXE_SUFFIX=''
   1.600 +        SET_SHARED_LIBRARY_NAME=''
   1.601 +        SET_SHARED_LIBRARY_MAPFILE=''
   1.602 +        C_FLAG_REORDER=''
   1.603 +        CXX_FLAG_REORDER=''
   1.604 +        SET_SHARED_LIBRARY_ORIGIN=''
   1.605 +        SET_EXECUTABLE_ORIGIN=""
   1.606 +        CFLAGS_JDK=""
   1.607 +        CXXFLAGS_JDK=""
   1.608 +        CFLAGS_JDKLIB_EXTRA=''
   1.609 +        POST_STRIP_CMD="$STRIP -X32_64"
   1.610 +        POST_MCS_CMD=""
   1.611 +    fi
   1.612 +    if test "x$OPENJDK_TARGET_OS" = xwindows; then
   1.613 +      # If it is not gcc, then assume it is the MS Visual Studio compiler
   1.614 +      COMPILER_NAME=cl
   1.615 +      PICFLAG=""
   1.616 +      LIBRARY_PREFIX=
   1.617 +      SHARED_LIBRARY='[$]1.dll'
   1.618 +      STATIC_LIBRARY='[$]1.lib'
   1.619 +      SHARED_LIBRARY_FLAGS="-LD"
   1.620 +      SHARED_LIBRARY_SUFFIX='.dll'
   1.621 +      STATIC_LIBRARY_SUFFIX='.lib'
   1.622 +      OBJ_SUFFIX='.obj'
   1.623 +      EXE_SUFFIX='.exe'
   1.624 +      SET_SHARED_LIBRARY_NAME=''
   1.625 +      SET_SHARED_LIBRARY_MAPFILE=''
   1.626 +      SET_SHARED_LIBRARY_ORIGIN=''
   1.627 +      SET_EXECUTABLE_ORIGIN=''
   1.628 +    fi
   1.629 +  fi
   1.630 +
   1.631 +  AC_SUBST(COMPILER_NAME)
   1.632 +  AC_SUBST(OBJ_SUFFIX)
   1.633 +  AC_SUBST(SHARED_LIBRARY)
   1.634 +  AC_SUBST(STATIC_LIBRARY)
   1.635 +  AC_SUBST(LIBRARY_PREFIX)
   1.636 +  AC_SUBST(SHARED_LIBRARY_SUFFIX)
   1.637 +  AC_SUBST(STATIC_LIBRARY_SUFFIX)
   1.638 +  AC_SUBST(EXE_SUFFIX)
   1.639 +  AC_SUBST(SHARED_LIBRARY_FLAGS)
   1.640 +  AC_SUBST(SET_SHARED_LIBRARY_NAME)
   1.641 +  AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
   1.642 +  AC_SUBST(C_FLAG_REORDER)
   1.643 +  AC_SUBST(CXX_FLAG_REORDER)
   1.644 +  AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
   1.645 +  AC_SUBST(SET_EXECUTABLE_ORIGIN)
   1.646 +  AC_SUBST(POST_STRIP_CMD)
   1.647 +  AC_SUBST(POST_MCS_CMD)
   1.648 +
   1.649 +  # The (cross) compiler is now configured, we can now test capabilities
   1.650 +  # of the target platform.
   1.651 +])
   1.652 +
   1.653 +AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
   1.654 +[
   1.655 +
   1.656 +  ###############################################################################
   1.657 +  #
   1.658 +  # Setup the opt flags for different compilers
   1.659 +  # and different operating systems.
   1.660 +  #
   1.661 +
   1.662 +  #
   1.663 +  # NOTE: check for -mstackrealign needs to be below potential addition of -m32
   1.664 +  #
   1.665 +  if test "x$OPENJDK_TARGET_CPU_BITS" = x32 && test "x$OPENJDK_TARGET_OS" = xmacosx; then
   1.666 +    # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned.
   1.667 +    # While waiting for a better solution, the current workaround is to use -mstackrealign.
   1.668 +    CFLAGS="$CFLAGS -mstackrealign"
   1.669 +    AC_MSG_CHECKING([if 32-bit compiler supports -mstackrealign])
   1.670 +    AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
   1.671 +        [
   1.672 +          AC_MSG_RESULT([yes])
   1.673 +        ],
   1.674 +        [
   1.675 +          AC_MSG_RESULT([no])
   1.676 +          AC_MSG_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.])
   1.677 +        ]
   1.678 +    )
   1.679 +  fi
   1.680 +
   1.681 +  C_FLAG_DEPS="-MMD -MF"
   1.682 +  CXX_FLAG_DEPS="-MMD -MF"
   1.683 +
   1.684 +  case $COMPILER_TYPE in
   1.685 +    CC )
   1.686 +      case $COMPILER_NAME in
   1.687 +        gcc )
   1.688 +          case $OPENJDK_TARGET_OS in
   1.689 +            macosx )
   1.690 +              # On MacOSX we optimize for size, something
   1.691 +              # we should do for all platforms?
   1.692 +              C_O_FLAG_HI="-Os"
   1.693 +              C_O_FLAG_NORM="-Os"
   1.694 +              C_O_FLAG_NONE=""
   1.695 +              ;;
   1.696 +            *)
   1.697 +              C_O_FLAG_HI="-O3"
   1.698 +              C_O_FLAG_NORM="-O2"
   1.699 +              C_O_FLAG_NONE="-O0"
   1.700 +              ;;
   1.701 +          esac
   1.702 +          CXX_O_FLAG_HI="$C_O_FLAG_HI"
   1.703 +          CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
   1.704 +          CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
   1.705 +          CFLAGS_DEBUG_SYMBOLS="-g"
   1.706 +          CXXFLAGS_DEBUG_SYMBOLS="-g"
   1.707 +          if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
   1.708 +            CFLAGS_DEBUG_SYMBOLS="-g1"
   1.709 +            CXXFLAGS_DEBUG_SYMBOLS="-g1"
   1.710 +          fi
   1.711 +          ;;
   1.712 +        ossc )
   1.713 +          #
   1.714 +          # Forte has different names for this with their C++ compiler...
   1.715 +          #
   1.716 +          C_FLAG_DEPS="-xMMD -xMF"
   1.717 +          CXX_FLAG_DEPS="-xMMD -xMF"
   1.718 +
   1.719 +          # Extra options used with HIGHEST
   1.720 +          #
   1.721 +          # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
   1.722 +          #          done with care, there are some assumptions below that need to
   1.723 +          #          be understood about the use of pointers, and IEEE behavior.
   1.724 +          #
   1.725 +          # Use non-standard floating point mode (not IEEE 754)
   1.726 +          CC_HIGHEST="$CC_HIGHEST -fns"
   1.727 +          # Do some simplification of floating point arithmetic (not IEEE 754)
   1.728 +          CC_HIGHEST="$CC_HIGHEST -fsimple"
   1.729 +          # Use single precision floating point with 'float'
   1.730 +          CC_HIGHEST="$CC_HIGHEST -fsingle"
   1.731 +          # Assume memory references via basic pointer types do not alias
   1.732 +          #   (Source with excessing pointer casting and data access with mixed
   1.733 +          #    pointer types are not recommended)
   1.734 +          CC_HIGHEST="$CC_HIGHEST -xalias_level=basic"
   1.735 +          # Use intrinsic or inline versions for math/std functions
   1.736 +          #   (If you expect perfect errno behavior, do not use this)
   1.737 +          CC_HIGHEST="$CC_HIGHEST -xbuiltin=%all"
   1.738 +          # Loop data dependency optimizations (need -xO3 or higher)
   1.739 +          CC_HIGHEST="$CC_HIGHEST -xdepend"
   1.740 +          # Pointer parameters to functions do not overlap
   1.741 +          #   (Similar to -xalias_level=basic usage, but less obvious sometimes.
   1.742 +          #    If you pass in multiple pointers to the same data, do not use this)
   1.743 +          CC_HIGHEST="$CC_HIGHEST -xrestrict"
   1.744 +          # Inline some library routines
   1.745 +          #   (If you expect perfect errno behavior, do not use this)
   1.746 +          CC_HIGHEST="$CC_HIGHEST -xlibmil"
   1.747 +          # Use optimized math routines
   1.748 +          #   (If you expect perfect errno behavior, do not use this)
   1.749 +          #  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
   1.750 +          #CC_HIGHEST="$CC_HIGHEST -xlibmopt"
   1.751 +
   1.752 +          if test "x$OPENJDK_TARGET_CPU" = xsparc; then
   1.753 +            CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
   1.754 +            CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
   1.755 +          fi
   1.756 +
   1.757 +          case $OPENJDK_TARGET_CPU_ARCH in
   1.758 +            x86)
   1.759 +              C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xregs=no%frameptr"
   1.760 +              C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr"
   1.761 +              C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr"
   1.762 +              C_O_FLAG_NONE="-xregs=no%frameptr"
   1.763 +              CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xregs=no%frameptr"
   1.764 +              CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz -xregs=no%frameptr"
   1.765 +              CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz -xregs=no%frameptr"
   1.766 +              CXX_O_FLAG_NONE="-xregs=no%frameptr"
   1.767 +              if test "x$OPENJDK_TARGET_CPU" = xx86; then
   1.768 +                C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium"
   1.769 +                CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium"
   1.770 +              fi
   1.771 +              ;;
   1.772 +            sparc)
   1.773 +              CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
   1.774 +              CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
   1.775 +              C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
   1.776 +              C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
   1.777 +              C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
   1.778 +              C_O_FLAG_NONE=""
   1.779 +              CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
   1.780 +              CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
   1.781 +              CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
   1.782 +              CXX_O_FLAG_NONE=""
   1.783 +              ;;
   1.784 +          esac
   1.785 +
   1.786 +          CFLAGS_DEBUG_SYMBOLS="-g -xs"
   1.787 +          CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
   1.788 +          ;;
   1.789 +        xlc )
   1.790 +          C_FLAG_DEPS="-qmakedep=gcc -MF"
   1.791 +          CXX_FLAG_DEPS="-qmakedep=gcc -MF"
   1.792 +          C_O_FLAG_HIGHEST="-O3"
   1.793 +          C_O_FLAG_HI="-O3 -qstrict"
   1.794 +          C_O_FLAG_NORM="-O2"
   1.795 +          C_O_FLAG_NONE=""
   1.796 +          CXX_O_FLAG_HIGHEST="-O3"
   1.797 +          CXX_O_FLAG_HI="-O3 -qstrict"
   1.798 +          CXX_O_FLAG_NORM="-O2"
   1.799 +          CXX_O_FLAG_NONE=""
   1.800 +          CFLAGS_DEBUG_SYMBOLS="-g"
   1.801 +          CXXFLAGS_DEBUG_SYMBOLS="-g"
   1.802 +          LDFLAGS_JDK="${LDFLAGS_JDK} -q64 -brtl -bnolibpath -liconv -bexpall"
   1.803 +          CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
   1.804 +          CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
   1.805 +          ;;
   1.806 +      esac
   1.807 +      ;;
   1.808 +    CL )
   1.809 +      C_O_FLAG_HIGHEST="-O2"
   1.810 +      C_O_FLAG_HI="-O1"
   1.811 +      C_O_FLAG_NORM="-O1"
   1.812 +      C_O_FLAG_NONE="-Od"
   1.813 +      CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
   1.814 +      CXX_O_FLAG_HI="$C_O_FLAG_HI"
   1.815 +      CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
   1.816 +      CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
   1.817 +      ;;
   1.818 +  esac
   1.819 +
   1.820 +  if test -z "$C_O_FLAG_HIGHEST"; then
   1.821 +    C_O_FLAG_HIGHEST="$C_O_FLAG_HI"
   1.822 +  fi
   1.823 +
   1.824 +  if test -z "$CXX_O_FLAG_HIGHEST"; then
   1.825 +    CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HI"
   1.826 +  fi
   1.827 +
   1.828 +  AC_SUBST(C_O_FLAG_HIGHEST)
   1.829 +  AC_SUBST(C_O_FLAG_HI)
   1.830 +  AC_SUBST(C_O_FLAG_NORM)
   1.831 +  AC_SUBST(C_O_FLAG_NONE)
   1.832 +  AC_SUBST(CXX_O_FLAG_HIGHEST)
   1.833 +  AC_SUBST(CXX_O_FLAG_HI)
   1.834 +  AC_SUBST(CXX_O_FLAG_NORM)
   1.835 +  AC_SUBST(CXX_O_FLAG_NONE)
   1.836 +  AC_SUBST(C_FLAG_DEPS)
   1.837 +  AC_SUBST(CXX_FLAG_DEPS)
   1.838 +])
   1.839 +
   1.840 +AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_JDK],
   1.841 +[
   1.842 +
   1.843 +  if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
   1.844 +    AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
   1.845 +  fi
   1.846 +
   1.847 +  if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then
   1.848 +    AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
   1.849 +  fi
   1.850 +
   1.851 +  if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
   1.852 +    AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
   1.853 +  fi
   1.854 +
   1.855 +  AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
   1.856 +      [extra flags to be used when compiling jdk c-files])])
   1.857 +
   1.858 +  AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
   1.859 +      [extra flags to be used when compiling jdk c++-files])])
   1.860 +
   1.861 +  AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
   1.862 +      [extra flags to be used when linking jdk])])
   1.863 +
   1.864 +  CFLAGS_JDK="${CFLAGS_JDK} $with_extra_cflags"
   1.865 +  CXXFLAGS_JDK="${CXXFLAGS_JDK} $with_extra_cxxflags"
   1.866 +  LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags"
   1.867 +
   1.868 +  # Hotspot needs these set in their legacy form
   1.869 +  LEGACY_EXTRA_CFLAGS=$with_extra_cflags
   1.870 +  LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags
   1.871 +  LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags
   1.872 +
   1.873 +  AC_SUBST(LEGACY_EXTRA_CFLAGS)
   1.874 +  AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
   1.875 +  AC_SUBST(LEGACY_EXTRA_LDFLAGS)
   1.876 +
   1.877 +  ###############################################################################
   1.878 +  #
   1.879 +  # Now setup the CFLAGS and LDFLAGS for the JDK build.
   1.880 +  # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
   1.881 +  #
   1.882 +  case $COMPILER_NAME in
   1.883 +    gcc )
   1.884 +      CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \
   1.885 +      -pipe \
   1.886 +      -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
   1.887 +      case $OPENJDK_TARGET_CPU_ARCH in
   1.888 +        arm )
   1.889 +          # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing
   1.890 +          CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
   1.891 +          ;;
   1.892 +        ppc )
   1.893 +          # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing
   1.894 +          ;;
   1.895 +        * )
   1.896 +          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fno-omit-frame-pointer"
   1.897 +          CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
   1.898 +          ;;
   1.899 +      esac
   1.900 +      ;;
   1.901 +    ossc )
   1.902 +      CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
   1.903 +      case $OPENJDK_TARGET_CPU_ARCH in
   1.904 +        x86 )
   1.905 +          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
   1.906 +          CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
   1.907 +          ;;
   1.908 +      esac
   1.909 +
   1.910 +      CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
   1.911 +      CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
   1.912 +
   1.913 +      LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext"
   1.914 +      LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib"
   1.915 +      ;;
   1.916 +    xlc )
   1.917 +      CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
   1.918 +      CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
   1.919 +
   1.920 +      LDFLAGS_JDK="$LDFLAGS_JDK"
   1.921 +      LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK"
   1.922 +      ;;
   1.923 +    cl )
   1.924 +      CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
   1.925 +      -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
   1.926 +      -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
   1.927 +      -DWIN32 -DIAL"
   1.928 +      case $OPENJDK_TARGET_CPU in
   1.929 +        x86 )
   1.930 +          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86"
   1.931 +          ;;
   1.932 +        x86_64 )
   1.933 +          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64"
   1.934 +          ;;
   1.935 +      esac
   1.936 +      ;;
   1.937 +  esac
   1.938 +
   1.939 +  ###############################################################################
   1.940 +
   1.941 +  # Adjust flags according to debug level.
   1.942 +  case $DEBUG_LEVEL in
   1.943 +    fastdebug )
   1.944 +      CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS"
   1.945 +      CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS"
   1.946 +      C_O_FLAG_HI="$C_O_FLAG_NORM"
   1.947 +      C_O_FLAG_NORM="$C_O_FLAG_NORM"
   1.948 +      CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
   1.949 +      CXX_O_FLAG_NORM="$CXX_O_FLAG_NORM"
   1.950 +      JAVAC_FLAGS="$JAVAC_FLAGS -g"
   1.951 +      ;;
   1.952 +    slowdebug )
   1.953 +      CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS"
   1.954 +      CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS"
   1.955 +      C_O_FLAG_HI="$C_O_FLAG_NONE"
   1.956 +      C_O_FLAG_NORM="$C_O_FLAG_NONE"
   1.957 +      CXX_O_FLAG_HI="$CXX_O_FLAG_NONE"
   1.958 +      CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE"
   1.959 +      JAVAC_FLAGS="$JAVAC_FLAGS -g"
   1.960 +      ;;
   1.961 +  esac
   1.962 +
   1.963 +  CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
   1.964 +
   1.965 +  # The package path is used only on macosx?
   1.966 +  PACKAGE_PATH=/opt/local
   1.967 +  AC_SUBST(PACKAGE_PATH)
   1.968 +
   1.969 +  if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
   1.970 +    # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
   1.971 +    #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
   1.972 +    #   (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
   1.973 +    #   Note: -Dmacro         is the same as    #define macro 1
   1.974 +    #         -Dmacro=        is the same as    #define macro
   1.975 +    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   1.976 +      CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
   1.977 +    else
   1.978 +      CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
   1.979 +    fi
   1.980 +  else
   1.981 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
   1.982 +  fi
   1.983 +  if test "x$OPENJDK_TARGET_OS" = xlinux; then
   1.984 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DLINUX"
   1.985 +  fi
   1.986 +  if test "x$OPENJDK_TARGET_OS" = xwindows; then
   1.987 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DWINDOWS"
   1.988 +  fi
   1.989 +  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   1.990 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DSOLARIS"
   1.991 +  fi
   1.992 +  if test "x$OPENJDK_TARGET_OS" = xaix; then
   1.993 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DAIX -DPPC64"
   1.994 +  fi
   1.995 +  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   1.996 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
   1.997 +    # Setting these parameters makes it an error to link to macosx APIs that are
   1.998 +    # newer than the given OS version and makes the linked binaries compatible even
   1.999 +    # if built on a newer version of the OS.
  1.1000 +    # The expected format is X.Y.Z
  1.1001 +    MACOSX_VERSION_MIN=10.7.0
  1.1002 +    AC_SUBST(MACOSX_VERSION_MIN)
  1.1003 +    # The macro takes the version with no dots, ex: 1070
  1.1004 +    # Let the flags variables get resolved in make for easier override on make
  1.1005 +    # command line.
  1.1006 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
  1.1007 +    LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
  1.1008 +  fi
  1.1009 +  if test "x$OPENJDK_TARGET_OS" = xbsd; then
  1.1010 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"
  1.1011 +  fi
  1.1012 +  if test "x$DEBUG_LEVEL" = xrelease; then
  1.1013 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"
  1.1014 +  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
  1.1015 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED"
  1.1016 +  fi
  1.1017 +  else
  1.1018 +    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG"
  1.1019 +  fi
  1.1020 +
  1.1021 +  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
  1.1022 +  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'"
  1.1023 +
  1.1024 +  CCXXFLAGS_JDK="$CCXXFLAGS_JDK \
  1.1025 +      -I${JDK_OUTPUTDIR}/include \
  1.1026 +      -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \
  1.1027 +      -I${JDK_TOPDIR}/src/share/javavm/export \
  1.1028 +      -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_EXPORT_DIR/javavm/export \
  1.1029 +      -I${JDK_TOPDIR}/src/share/native/common \
  1.1030 +      -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common"
  1.1031 +
  1.1032 +  # The shared libraries are compiled using the picflag.
  1.1033 +  CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
  1.1034 +  CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA "
  1.1035 +
  1.1036 +  # Executable flags
  1.1037 +  CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK"
  1.1038 +  CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK"
  1.1039 +
  1.1040 +  # Now this is odd. The JDK native libraries have to link against libjvm.so
  1.1041 +  # On 32-bit machines there is normally two distinct libjvm.so:s, client and server.
  1.1042 +  # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library
  1.1043 +  # is identical for client and server? Yes. Which is picked at runtime (client or server)?
  1.1044 +  # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following
  1.1045 +  # libraries will link to whatever is in memory. Yuck.
  1.1046 +  #
  1.1047 +  # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
  1.1048 +  if test "x$COMPILER_NAME" = xcl; then
  1.1049 +    LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
  1.1050 +    if test "x$OPENJDK_TARGET_CPU" = xx86; then
  1.1051 +      LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
  1.1052 +    fi
  1.1053 +    # TODO: make -debug optional "--disable-full-debug-symbols"
  1.1054 +    LDFLAGS_JDK="$LDFLAGS_JDK -debug"
  1.1055 +    LDFLAGS_JDKLIB="${LDFLAGS_JDK} -dll -libpath:${JDK_OUTPUTDIR}/lib"
  1.1056 +    LDFLAGS_JDKLIB_SUFFIX=""
  1.1057 +    if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
  1.1058 +      LDFLAGS_STACK_SIZE=1048576
  1.1059 +    else
  1.1060 +      LDFLAGS_STACK_SIZE=327680
  1.1061 +    fi
  1.1062 +    LDFLAGS_JDKEXE="${LDFLAGS_JDK} /STACK:$LDFLAGS_STACK_SIZE"
  1.1063 +  else
  1.1064 +    if test "x$COMPILER_NAME" = xgcc; then
  1.1065 +      # If this is a --hash-style=gnu system, use --hash-style=both, why?
  1.1066 +      HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
  1.1067 +      if test -n "$HAS_GNU_HASH"; then
  1.1068 +        LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both "
  1.1069 +      fi
  1.1070 +      if test "x$OPENJDK_TARGET_OS" = xlinux; then
  1.1071 +        # And since we now know that the linker is gnu, then add -z defs, to forbid
  1.1072 +        # undefined symbols in object files.
  1.1073 +        LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs"
  1.1074 +        if test "x$DEBUG_LEVEL" = "xrelease"; then
  1.1075 +          # When building release libraries, tell the linker optimize them.
  1.1076 +          # Should this be supplied to the OSS linker as well?
  1.1077 +          LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1"
  1.1078 +        fi
  1.1079 +      fi
  1.1080 +    fi
  1.1081 +    LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \
  1.1082 +        -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
  1.1083 +
  1.1084 +    # On some platforms (mac) the linker warns about non existing -L dirs.
  1.1085 +    # Add server first if available. Linking aginst client does not always produce the same results.
  1.1086 +    # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
  1.1087 +    # Default to server for other variants.
  1.1088 +    if test "x$JVM_VARIANT_SERVER" = xtrue; then
  1.1089 +      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
  1.1090 +    elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
  1.1091 +      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
  1.1092 +    elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
  1.1093 +      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
  1.1094 +    else
  1.1095 +      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
  1.1096 +    fi
  1.1097 +
  1.1098 +    LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
  1.1099 +    if test "x$COMPILER_NAME" = xossc; then
  1.1100 +      LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc"
  1.1101 +    fi
  1.1102 +
  1.1103 +    LDFLAGS_JDKEXE="${LDFLAGS_JDK}"
  1.1104 +    if test "x$OPENJDK_TARGET_OS" = xlinux; then
  1.1105 +      LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Xlinker --allow-shlib-undefined"
  1.1106 +    fi
  1.1107 +  fi
  1.1108 +
  1.1109 +  AC_SUBST(CFLAGS_JDKLIB)
  1.1110 +  AC_SUBST(CFLAGS_JDKEXE)
  1.1111 +
  1.1112 +  AC_SUBST(CXXFLAGS_JDKLIB)
  1.1113 +  AC_SUBST(CXXFLAGS_JDKEXE)
  1.1114 +
  1.1115 +  AC_SUBST(LDFLAGS_JDKLIB)
  1.1116 +  AC_SUBST(LDFLAGS_JDKEXE)
  1.1117 +  AC_SUBST(LDFLAGS_JDKLIB_SUFFIX)
  1.1118 +  AC_SUBST(LDFLAGS_JDKEXE_SUFFIX)
  1.1119 +  AC_SUBST(LDFLAGS_CXX_JDK)
  1.1120 +])
  1.1121 +
  1.1122 +
  1.1123 +# TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
  1.1124 +#                                   [RUN-IF-FALSE])
  1.1125 +# ------------------------------------------------------------
  1.1126 +# Check that the c and c++ compilers support an argument
  1.1127 +AC_DEFUN([TOOLCHAIN_COMPILER_CHECK_ARGUMENTS],
  1.1128 +[
  1.1129 +  AC_MSG_CHECKING([if compiler supports "$1"])
  1.1130 +  supports=yes
  1.1131 +
  1.1132 +  saved_cflags="$CFLAGS"
  1.1133 +  CFLAGS="$CFLAGS $1"
  1.1134 +  AC_LANG_PUSH([C])
  1.1135 +  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], 
  1.1136 +      [supports=no])
  1.1137 +  AC_LANG_POP([C])
  1.1138 +  CFLAGS="$saved_cflags"
  1.1139 +
  1.1140 +  saved_cxxflags="$CXXFLAGS"
  1.1141 +  CXXFLAGS="$CXXFLAG $1"
  1.1142 +  AC_LANG_PUSH([C++])
  1.1143 +  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], 
  1.1144 +      [supports=no])
  1.1145 +  AC_LANG_POP([C++])
  1.1146 +  CXXFLAGS="$saved_cxxflags"
  1.1147 +
  1.1148 +  AC_MSG_RESULT([$supports])
  1.1149 +  if test "x$supports" = "xyes" ; then
  1.1150 +    m4_ifval([$2], [$2], [:])
  1.1151 +  else
  1.1152 +    m4_ifval([$3], [$3], [:])
  1.1153 +  fi
  1.1154 +])
  1.1155 +
  1.1156 +AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_MISC],
  1.1157 +[
  1.1158 +  # Some Zero and Shark settings.
  1.1159 +  # ZERO_ARCHFLAG tells the compiler which mode to build for
  1.1160 +  case "${OPENJDK_TARGET_CPU}" in
  1.1161 +    s390)
  1.1162 +      ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}31"
  1.1163 +      ;;
  1.1164 +    *)
  1.1165 +      ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
  1.1166 +  esac
  1.1167 +  TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""])
  1.1168 +  AC_SUBST(ZERO_ARCHFLAG)
  1.1169 +
  1.1170 +  # Check that the compiler supports -mX (or -qX on AIX) flags
  1.1171 +  # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
  1.1172 +  TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
  1.1173 +      [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
  1.1174 +      [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
  1.1175 +  AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
  1.1176 +
  1.1177 +
  1.1178 +  # Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed in executable.'
  1.1179 +  USING_BROKEN_SUSE_LD=no
  1.1180 +  if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$GCC" = xyes; then
  1.1181 +    AC_MSG_CHECKING([for broken SuSE 'ld' which only understands anonymous version tags in executables])
  1.1182 +    echo "SUNWprivate_1.1 { local: *; };" > version-script.map
  1.1183 +    echo "int main() { }" > main.c
  1.1184 +    if $CXX -Xlinker -version-script=version-script.map main.c 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
  1.1185 +      AC_MSG_RESULT(no)
  1.1186 +      USING_BROKEN_SUSE_LD=no
  1.1187 +    else
  1.1188 +      AC_MSG_RESULT(yes)
  1.1189 +      USING_BROKEN_SUSE_LD=yes
  1.1190 +    fi
  1.1191 +    rm -rf version-script.map main.c
  1.1192 +  fi
  1.1193 +  AC_SUBST(USING_BROKEN_SUSE_LD)
  1.1194 +])
  1.1195 +
  1.1196 +# Setup the JTREG paths
  1.1197 +AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG],
  1.1198 +[
  1.1199 +  AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg],
  1.1200 +      [Regression Test Harness @<:@probed@:>@])],
  1.1201 +      [],
  1.1202 +      [with_jtreg=no])
  1.1203 +
  1.1204 +  if test "x$with_jtreg" = xno; then
  1.1205 +    # jtreg disabled
  1.1206 +    AC_MSG_CHECKING([for jtreg])
  1.1207 +    AC_MSG_RESULT(no)
  1.1208 +  else
  1.1209 +    if test "x$with_jtreg" != xyes; then
  1.1210 +      # with path specified.
  1.1211 +      JT_HOME="$with_jtreg"
  1.1212 +    fi
  1.1213 +
  1.1214 +    if test "x$JT_HOME" != x; then
  1.1215 +      AC_MSG_CHECKING([for jtreg])
  1.1216 +
  1.1217 +      # use JT_HOME enviroment var.
  1.1218 +      BASIC_FIXUP_PATH([JT_HOME])
  1.1219 +
  1.1220 +      # jtreg win32 script works for everybody
  1.1221 +      JTREGEXE="$JT_HOME/win32/bin/jtreg"
  1.1222 +
  1.1223 +      if test ! -f "$JTREGEXE"; then
  1.1224 +        AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE])
  1.1225 +      fi
  1.1226 +
  1.1227 +      AC_MSG_RESULT($JTREGEXE)
  1.1228 +    else
  1.1229 +      # try to find jtreg on path
  1.1230 +      BASIC_REQUIRE_PROG(JTREGEXE, jtreg)
  1.1231 +      JT_HOME="`$DIRNAME $JTREGEXE`"
  1.1232 +    fi
  1.1233 +  fi
  1.1234 +
  1.1235 +  AC_SUBST(JT_HOME)
  1.1236 +  AC_SUBST(JTREGEXE)
  1.1237 +])

mercurial