Wed, 22 Jan 2014 12:53:21 -0800
Added tag jdk8-b125 for changeset 790bbd46b201
erikj@459 | 1 | # |
erikj@459 | 2 | # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
erikj@459 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
erikj@459 | 4 | # |
erikj@459 | 5 | # This code is free software; you can redistribute it and/or modify it |
erikj@459 | 6 | # under the terms of the GNU General Public License version 2 only, as |
erikj@459 | 7 | # published by the Free Software Foundation. Oracle designates this |
erikj@459 | 8 | # particular file as subject to the "Classpath" exception as provided |
erikj@459 | 9 | # by Oracle in the LICENSE file that accompanied this code. |
erikj@459 | 10 | # |
erikj@459 | 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
erikj@459 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
erikj@459 | 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
erikj@459 | 14 | # version 2 for more details (a copy is included in the LICENSE file that |
erikj@459 | 15 | # accompanied this code). |
erikj@459 | 16 | # |
erikj@459 | 17 | # You should have received a copy of the GNU General Public License version |
erikj@459 | 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
erikj@459 | 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
erikj@459 | 20 | # |
erikj@459 | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
erikj@459 | 22 | # or visit www.oracle.com if you need additional information or have any |
erikj@459 | 23 | # questions. |
erikj@459 | 24 | # |
erikj@459 | 25 | |
ohair@494 | 26 | # $1 = compiler to test (CC or CXX) |
ohair@494 | 27 | # $2 = human readable name of compiler (C or C++) |
ohair@494 | 28 | AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION], |
erikj@459 | 29 | [ |
ohair@494 | 30 | COMPILER=[$]$1 |
ohair@494 | 31 | COMPILER_NAME=$2 |
erikj@459 | 32 | |
ohair@494 | 33 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
ohair@494 | 34 | # Make sure we use the Sun Studio compiler and not gcc on Solaris, which won't work |
ohair@494 | 35 | COMPILER_VERSION_TEST=`$COMPILER -V 2>&1 | $HEAD -n 1` |
ohair@494 | 36 | $ECHO $COMPILER_VERSION_TEST | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null |
ohair@494 | 37 | if test $? -ne 0; then |
ohair@494 | 38 | GCC_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1` |
mduigou@728 | 39 | |
ohair@494 | 40 | AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required Sun Studio compiler.]) |
ohair@494 | 41 | AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_TEST" and with --version: "$GCC_VERSION_TEST"]) |
ohair@494 | 42 | AC_MSG_ERROR([Sun Studio compiler is required. Try setting --with-tools-dir.]) |
ohair@478 | 43 | else |
ohair@494 | 44 | COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*@<:@ ,\t@:>@$COMPILER_NAME@<:@ ,\t@:>@\(@<:@1-9@:>@\.@<:@0-9@:>@@<:@0-9@:>@*\).*/\1/p"` |
ohair@494 | 45 | COMPILER_VENDOR="Sun Studio" |
ohair@494 | 46 | fi |
ohair@494 | 47 | elif test "x$OPENJDK_TARGET_OS" = xwindows; then |
ohair@494 | 48 | # First line typically looks something like: |
tbell@838 | 49 | # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86 |
erikj@752 | 50 | COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'` |
ohair@494 | 51 | COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*Version \(@<:@1-9@:>@@<:@0-9.@:>@*\) .*/\1/p"` |
ohair@494 | 52 | COMPILER_VENDOR="Microsoft CL.EXE" |
ohair@494 | 53 | COMPILER_CPU_TEST=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* for \(.*\)$/\1/p"` |
ohair@494 | 54 | if test "x$OPENJDK_TARGET_CPU" = "xx86"; then |
ohair@494 | 55 | if test "x$COMPILER_CPU_TEST" != "x80x86"; then |
ohair@494 | 56 | AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86".]) |
ohair@494 | 57 | fi |
ohair@494 | 58 | elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then |
ohair@494 | 59 | if test "x$COMPILER_CPU_TEST" != "xx64"; then |
ohair@494 | 60 | AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "x64".]) |
ohair@494 | 61 | fi |
ohair@494 | 62 | fi |
ohair@494 | 63 | else |
ohair@494 | 64 | COMPILER_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1` |
ohair@494 | 65 | # Check that this is likely to be GCC. |
ohair@494 | 66 | $COMPILER --version 2>&1 | $GREP "Free Software Foundation" > /dev/null |
ohair@494 | 67 | if test $? -ne 0; then |
ohair@494 | 68 | AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required GCC compiler.]) |
ohair@494 | 69 | AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION_TEST"]) |
ohair@494 | 70 | AC_MSG_ERROR([GCC compiler is required. Try setting --with-tools-dir.]) |
ohair@478 | 71 | fi |
mduigou@728 | 72 | |
ohair@494 | 73 | # First line typically looks something like: |
ohair@494 | 74 | # gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2 |
ohair@494 | 75 | COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/p"` |
ohair@494 | 76 | COMPILER_VENDOR=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^\(.*\) @<:@1-9@:>@@<:@0-9.@:>@*/\1/p"` |
ohair@494 | 77 | fi |
ohair@494 | 78 | # This sets CC_VERSION or CXX_VERSION. (This comment is a grep marker) |
ohair@494 | 79 | $1_VERSION="$COMPILER_VERSION" |
ohair@494 | 80 | # This sets CC_VENDOR or CXX_VENDOR. (This comment is a grep marker) |
ohair@494 | 81 | $1_VENDOR="$COMPILER_VENDOR" |
erikj@459 | 82 | |
ohair@494 | 83 | AC_MSG_NOTICE([Using $COMPILER_VENDOR $COMPILER_NAME compiler version $COMPILER_VERSION (located at $COMPILER)]) |
erikj@459 | 84 | ]) |
erikj@459 | 85 | |
ohair@494 | 86 | |
erikj@459 | 87 | AC_DEFUN_ONCE([TOOLCHAIN_SETUP_SYSROOT_AND_OUT_OPTIONS], |
erikj@459 | 88 | [ |
ihse@839 | 89 | ############################################################################### |
ihse@839 | 90 | # |
ihse@839 | 91 | # Configure the development tool paths and potential sysroot. |
ihse@839 | 92 | # |
ihse@839 | 93 | AC_LANG(C++) |
erikj@459 | 94 | |
ihse@839 | 95 | # The option used to specify the target .o,.a or .so file. |
ihse@839 | 96 | # When compiling, how to specify the to be created object file. |
ihse@839 | 97 | CC_OUT_OPTION='-o$(SPACE)' |
ihse@839 | 98 | # When linking, how to specify the to be created executable. |
ihse@839 | 99 | EXE_OUT_OPTION='-o$(SPACE)' |
ihse@839 | 100 | # When linking, how to specify the to be created dynamically linkable library. |
ihse@839 | 101 | LD_OUT_OPTION='-o$(SPACE)' |
ihse@839 | 102 | # When archiving, how to specify the to be create static archive for object files. |
ihse@839 | 103 | AR_OUT_OPTION='rcs$(SPACE)' |
ihse@839 | 104 | AC_SUBST(CC_OUT_OPTION) |
ihse@839 | 105 | AC_SUBST(EXE_OUT_OPTION) |
ihse@839 | 106 | AC_SUBST(LD_OUT_OPTION) |
ihse@839 | 107 | AC_SUBST(AR_OUT_OPTION) |
erikj@459 | 108 | ]) |
erikj@459 | 109 | |
ohair@494 | 110 | # $1 = compiler to test (CC or CXX) |
ohair@494 | 111 | # $2 = human readable name of compiler (C or C++) |
ohair@494 | 112 | # $3 = list of compiler names to search for |
ohair@494 | 113 | AC_DEFUN([TOOLCHAIN_FIND_COMPILER], |
erikj@459 | 114 | [ |
ohair@494 | 115 | COMPILER_NAME=$2 |
ohair@494 | 116 | |
erikj@532 | 117 | $1= |
erikj@532 | 118 | # If TOOLS_DIR is set, check for all compiler names in there first |
erikj@532 | 119 | # before checking the rest of the PATH. |
erikj@532 | 120 | if test -n "$TOOLS_DIR"; then |
erikj@532 | 121 | PATH_save="$PATH" |
erikj@532 | 122 | PATH="$TOOLS_DIR" |
erikj@532 | 123 | AC_PATH_PROGS(TOOLS_DIR_$1, $3) |
erikj@532 | 124 | $1=$TOOLS_DIR_$1 |
erikj@532 | 125 | PATH="$PATH_save" |
erikj@532 | 126 | fi |
erikj@532 | 127 | |
ohair@494 | 128 | # AC_PATH_PROGS can't be run multiple times with the same variable, |
ohair@494 | 129 | # so create a new name for this run. |
erikj@532 | 130 | if test "x[$]$1" = x; then |
erikj@532 | 131 | AC_PATH_PROGS(POTENTIAL_$1, $3) |
erikj@532 | 132 | $1=$POTENTIAL_$1 |
erikj@532 | 133 | fi |
ohair@494 | 134 | |
erikj@532 | 135 | if test "x[$]$1" = x; then |
ihse@839 | 136 | HELP_MSG_MISSING_DEPENDENCY([devkit]) |
ihse@839 | 137 | AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG]) |
ohair@494 | 138 | fi |
ohair@494 | 139 | BASIC_FIXUP_EXECUTABLE($1) |
ohair@494 | 140 | AC_MSG_CHECKING([resolved symbolic links for $1]) |
ohair@494 | 141 | TEST_COMPILER="[$]$1" |
ohair@494 | 142 | BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER) |
ohair@494 | 143 | AC_MSG_RESULT([$TEST_COMPILER]) |
ohair@494 | 144 | AC_MSG_CHECKING([if $1 is disguised ccache]) |
mduigou@728 | 145 | |
ohair@494 | 146 | COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"` |
ohair@494 | 147 | if test "x$COMPILER_BASENAME" = "xccache"; then |
ohair@494 | 148 | AC_MSG_RESULT([yes, trying to find proper $COMPILER_NAME compiler]) |
ohair@494 | 149 | # We /usr/lib/ccache in the path, so cc is a symlink to /usr/bin/ccache. |
ohair@494 | 150 | # We want to control ccache invocation ourselves, so ignore this cc and try |
ohair@494 | 151 | # searching again. |
ohair@494 | 152 | |
ohair@494 | 153 | # Remove the path to the fake ccache cc from the PATH |
ohair@494 | 154 | RETRY_COMPILER_SAVED_PATH="$PATH" |
ohair@494 | 155 | COMPILER_DIRNAME=`$DIRNAME [$]$1` |
ohair@494 | 156 | PATH="`$ECHO $PATH | $SED -e "s,$COMPILER_DIRNAME,,g" -e "s,::,:,g" -e "s,^:,,g"`" |
ohair@494 | 157 | |
ohair@494 | 158 | # Try again looking for our compiler |
ohair@494 | 159 | AC_CHECK_TOOLS(PROPER_COMPILER_$1, $3) |
ohair@494 | 160 | BASIC_FIXUP_EXECUTABLE(PROPER_COMPILER_$1) |
ohair@494 | 161 | PATH="$RETRY_COMPILER_SAVED_PATH" |
ohair@494 | 162 | |
ohair@494 | 163 | AC_MSG_CHECKING([for resolved symbolic links for $1]) |
ohair@494 | 164 | BASIC_REMOVE_SYMBOLIC_LINKS(PROPER_COMPILER_$1) |
ohair@494 | 165 | AC_MSG_RESULT([$PROPER_COMPILER_$1]) |
ohair@494 | 166 | $1="$PROPER_COMPILER_$1" |
ohair@494 | 167 | else |
ohair@494 | 168 | AC_MSG_RESULT([no, keeping $1]) |
ohair@494 | 169 | $1="$TEST_COMPILER" |
ohair@494 | 170 | fi |
ohair@494 | 171 | TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME]) |
ohair@494 | 172 | ]) |
ohair@494 | 173 | |
ohair@494 | 174 | |
ohair@494 | 175 | AC_DEFUN([TOOLCHAIN_SETUP_PATHS], |
ohair@494 | 176 | [ |
ihse@839 | 177 | if test "x$OPENJDK_TARGET_OS" = "xwindows"; then |
ihse@839 | 178 | TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV |
ihse@857 | 179 | TOOLCHAIN_SETUP_MSVCR_DLL |
ihse@839 | 180 | BASIC_DEPRECATED_ARG_WITH([dxsdk]) |
ihse@839 | 181 | BASIC_DEPRECATED_ARG_WITH([dxsdk-lib]) |
ihse@839 | 182 | BASIC_DEPRECATED_ARG_WITH([dxsdk-include]) |
ihse@839 | 183 | fi |
ohair@494 | 184 | |
ihse@839 | 185 | AC_SUBST(MSVCR_DLL) |
ohair@494 | 186 | |
ihse@839 | 187 | # If --build AND --host is set, then the configure script will find any |
ihse@839 | 188 | # cross compilation tools in the PATH. Cross compilation tools |
ihse@839 | 189 | # follows the cross compilation standard where they are prefixed with ${host}. |
ihse@839 | 190 | # For example the binary i686-sun-solaris2.10-gcc |
ihse@839 | 191 | # will cross compile for i686-sun-solaris2.10 |
ihse@839 | 192 | # If neither of build and host is not set, then build=host and the |
ihse@839 | 193 | # default compiler found in the path will be used. |
ihse@839 | 194 | # Setting only --host, does not seem to be really supported. |
ihse@839 | 195 | # Please set both --build and --host if you want to cross compile. |
erikj@459 | 196 | |
ihse@839 | 197 | if test "x$COMPILE_TYPE" = "xcross"; then |
erikj@459 | 198 | # Now we to find a C/C++ compiler that can build executables for the build |
erikj@459 | 199 | # platform. We can't use the AC_PROG_CC macro, since it can only be used |
ohair@478 | 200 | # once. Also, we need to do this before adding a tools dir to the path, |
ohair@478 | 201 | # otherwise we might pick up cross-compilers which don't use standard naming. |
ohair@478 | 202 | # Otherwise, we'll set the BUILD_tools to the native tools, but that'll have |
ohair@478 | 203 | # to wait until they are properly discovered. |
ohair@478 | 204 | AC_PATH_PROGS(BUILD_CC, [cl cc gcc]) |
ohair@494 | 205 | BASIC_FIXUP_EXECUTABLE(BUILD_CC) |
ohair@478 | 206 | AC_PATH_PROGS(BUILD_CXX, [cl CC g++]) |
ohair@494 | 207 | BASIC_FIXUP_EXECUTABLE(BUILD_CXX) |
ohair@478 | 208 | AC_PATH_PROG(BUILD_LD, ld) |
ohair@494 | 209 | BASIC_FIXUP_EXECUTABLE(BUILD_LD) |
ihse@839 | 210 | fi |
ihse@839 | 211 | AC_SUBST(BUILD_CC) |
ihse@839 | 212 | AC_SUBST(BUILD_CXX) |
ihse@839 | 213 | AC_SUBST(BUILD_LD) |
erikj@459 | 214 | |
ihse@839 | 215 | # If a devkit is found on the builddeps server, then prepend its path to the |
ihse@839 | 216 | # PATH variable. If there are cross compilers available in the devkit, these |
ihse@839 | 217 | # will be found by AC_PROG_CC et al. |
ihse@839 | 218 | DEVKIT= |
ihse@839 | 219 | BDEPS_CHECK_MODULE(DEVKIT, devkit, xxx, |
ihse@839 | 220 | [ |
ihse@839 | 221 | # Found devkit |
ihse@839 | 222 | PATH="$DEVKIT/bin:$PATH" |
ihse@839 | 223 | SYS_ROOT="$DEVKIT/${rewritten_target}/sys-root" |
ihse@839 | 224 | if test "x$x_includes" = "xNONE"; then |
ihse@839 | 225 | x_includes="$SYS_ROOT/usr/include/X11" |
ihse@839 | 226 | fi |
ihse@839 | 227 | if test "x$x_libraries" = "xNONE"; then |
ihse@839 | 228 | x_libraries="$SYS_ROOT/usr/lib" |
ihse@839 | 229 | fi |
ihse@839 | 230 | ], |
ihse@839 | 231 | []) |
erikj@459 | 232 | |
ihse@839 | 233 | # Store the CFLAGS etal passed to the configure script. |
ihse@839 | 234 | ORG_CFLAGS="$CFLAGS" |
ihse@839 | 235 | ORG_CXXFLAGS="$CXXFLAGS" |
ihse@839 | 236 | ORG_OBJCFLAGS="$OBJCFLAGS" |
erikj@459 | 237 | |
ihse@839 | 238 | # autoconf magic only relies on PATH, so update it if tools dir is specified |
ihse@839 | 239 | OLD_PATH="$PATH" |
ihse@839 | 240 | if test "x$TOOLS_DIR" != x; then |
ihse@839 | 241 | PATH=$TOOLS_DIR:$PATH |
ihse@839 | 242 | fi |
erikj@459 | 243 | |
ohair@494 | 244 | |
ihse@839 | 245 | ### Locate C compiler (CC) |
ohair@494 | 246 | |
ihse@839 | 247 | # On windows, only cl.exe is supported. |
ihse@839 | 248 | # On Solaris, cc is preferred to gcc. |
ihse@839 | 249 | # Elsewhere, gcc is preferred to cc. |
martin@648 | 250 | |
ihse@839 | 251 | if test "x$CC" != x; then |
ihse@839 | 252 | COMPILER_CHECK_LIST="$CC" |
ihse@839 | 253 | elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then |
ihse@839 | 254 | COMPILER_CHECK_LIST="cl" |
ihse@839 | 255 | elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then |
ihse@839 | 256 | COMPILER_CHECK_LIST="cc gcc" |
ihse@839 | 257 | else |
ihse@839 | 258 | COMPILER_CHECK_LIST="gcc cc" |
ihse@839 | 259 | fi |
erikj@459 | 260 | |
ihse@839 | 261 | TOOLCHAIN_FIND_COMPILER([CC],[C],[$COMPILER_CHECK_LIST]) |
ihse@839 | 262 | # Now that we have resolved CC ourself, let autoconf have its go at it |
ihse@839 | 263 | AC_PROG_CC([$CC]) |
ohair@494 | 264 | |
ihse@839 | 265 | ### Locate C++ compiler (CXX) |
ohair@494 | 266 | |
ihse@839 | 267 | if test "x$CXX" != x; then |
ihse@839 | 268 | COMPILER_CHECK_LIST="$CXX" |
ihse@839 | 269 | elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then |
ihse@839 | 270 | COMPILER_CHECK_LIST="cl" |
ihse@839 | 271 | elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then |
ihse@839 | 272 | COMPILER_CHECK_LIST="CC g++" |
ihse@839 | 273 | else |
ihse@839 | 274 | COMPILER_CHECK_LIST="g++ CC" |
ihse@839 | 275 | fi |
martin@648 | 276 | |
ihse@839 | 277 | TOOLCHAIN_FIND_COMPILER([CXX],[C++],[$COMPILER_CHECK_LIST]) |
ihse@839 | 278 | # Now that we have resolved CXX ourself, let autoconf have its go at it |
ihse@839 | 279 | AC_PROG_CXX([$CXX]) |
ohair@494 | 280 | |
ihse@839 | 281 | ### Locate other tools |
ohair@494 | 282 | |
ihse@839 | 283 | if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
erikj@459 | 284 | AC_PROG_OBJC |
ohair@494 | 285 | BASIC_FIXUP_EXECUTABLE(OBJC) |
ihse@839 | 286 | else |
erikj@459 | 287 | OBJC= |
ihse@839 | 288 | fi |
erikj@459 | 289 | |
ihse@839 | 290 | # Restore the flags to the user specified values. |
ihse@839 | 291 | # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2" |
ihse@839 | 292 | CFLAGS="$ORG_CFLAGS" |
ihse@839 | 293 | CXXFLAGS="$ORG_CXXFLAGS" |
ihse@839 | 294 | OBJCFLAGS="$ORG_OBJCFLAGS" |
erikj@459 | 295 | |
ihse@839 | 296 | LD="$CC" |
ihse@839 | 297 | LDEXE="$CC" |
ihse@839 | 298 | LDCXX="$CXX" |
ihse@839 | 299 | LDEXECXX="$CXX" |
ihse@839 | 300 | AC_SUBST(LD) |
ihse@839 | 301 | # LDEXE is the linker to use, when creating executables. |
ihse@839 | 302 | AC_SUBST(LDEXE) |
ihse@839 | 303 | # Linking C++ libraries. |
ihse@839 | 304 | AC_SUBST(LDCXX) |
ihse@839 | 305 | # Linking C++ executables. |
ihse@839 | 306 | AC_SUBST(LDEXECXX) |
erikj@459 | 307 | |
ihse@839 | 308 | if test "x$OPENJDK_TARGET_OS" != xwindows; then |
ohair@478 | 309 | AC_CHECK_TOOL(AR, ar) |
ohair@494 | 310 | BASIC_FIXUP_EXECUTABLE(AR) |
ihse@839 | 311 | fi |
ihse@839 | 312 | if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
erikj@459 | 313 | ARFLAGS="-r" |
ihse@839 | 314 | else |
erikj@459 | 315 | ARFLAGS="" |
ihse@839 | 316 | fi |
ihse@839 | 317 | AC_SUBST(ARFLAGS) |
erikj@459 | 318 | |
ihse@839 | 319 | # For hotspot, we need these in Windows mixed path; other platforms keep them the same |
ihse@839 | 320 | HOTSPOT_CXX="$CXX" |
ihse@839 | 321 | HOTSPOT_LD="$LD" |
ihse@839 | 322 | AC_SUBST(HOTSPOT_CXX) |
ihse@839 | 323 | AC_SUBST(HOTSPOT_LD) |
ohair@494 | 324 | |
ihse@839 | 325 | COMPILER_NAME=gcc |
ihse@839 | 326 | COMPILER_TYPE=CC |
ihse@839 | 327 | AS_IF([test "x$OPENJDK_TARGET_OS" = xwindows], [ |
mduigou@728 | 328 | # For now, assume that we are always compiling using cl.exe. |
erikj@459 | 329 | CC_OUT_OPTION=-Fo |
erikj@459 | 330 | EXE_OUT_OPTION=-out: |
erikj@459 | 331 | LD_OUT_OPTION=-out: |
erikj@459 | 332 | AR_OUT_OPTION=-out: |
ohair@478 | 333 | # On Windows, reject /usr/bin/link (as determined in CYGWIN_LINK), which is a cygwin |
erikj@459 | 334 | # program for something completely different. |
ohair@478 | 335 | AC_CHECK_PROG([WINLD], [link],[link],,, [$CYGWIN_LINK]) |
erikj@459 | 336 | # Since we must ignore the first found link, WINLD will contain |
erikj@459 | 337 | # the full path to the link.exe program. |
ohair@494 | 338 | BASIC_FIXUP_EXECUTABLE(WINLD) |
ohair@478 | 339 | printf "Windows linker was found at $WINLD\n" |
ohair@478 | 340 | AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker]) |
ohair@478 | 341 | "$WINLD" --version > /dev/null |
ohair@478 | 342 | if test $? -eq 0 ; then |
ohair@478 | 343 | AC_MSG_RESULT([no]) |
ohair@478 | 344 | AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.]) |
ohair@478 | 345 | else |
ohair@478 | 346 | AC_MSG_RESULT([yes]) |
ohair@478 | 347 | fi |
erikj@459 | 348 | LD="$WINLD" |
erikj@459 | 349 | LDEXE="$WINLD" |
erikj@459 | 350 | LDCXX="$WINLD" |
erikj@459 | 351 | LDEXECXX="$WINLD" |
erikj@459 | 352 | |
erikj@459 | 353 | AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt]) |
ohair@494 | 354 | BASIC_FIXUP_EXECUTABLE(MT) |
erikj@459 | 355 | # The resource compiler |
erikj@459 | 356 | AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc]) |
ohair@494 | 357 | BASIC_FIXUP_EXECUTABLE(RC) |
erikj@459 | 358 | |
ohair@494 | 359 | # For hotspot, we need these in Windows mixed path, |
ohair@494 | 360 | # so rewrite them all. Need added .exe suffix. |
ohair@494 | 361 | HOTSPOT_CXX="$CXX.exe" |
ohair@494 | 362 | HOTSPOT_LD="$LD.exe" |
ohair@494 | 363 | HOTSPOT_MT="$MT.exe" |
ohair@494 | 364 | HOTSPOT_RC="$RC.exe" |
ohair@494 | 365 | BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_CXX) |
ohair@494 | 366 | BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_LD) |
ohair@494 | 367 | BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_MT) |
ohair@494 | 368 | BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_RC) |
ohair@494 | 369 | AC_SUBST(HOTSPOT_MT) |
ohair@494 | 370 | AC_SUBST(HOTSPOT_RC) |
ohair@494 | 371 | |
ohair@494 | 372 | RC_FLAGS="-nologo -l 0x409 -r" |
erikj@459 | 373 | AS_IF([test "x$VARIANT" = xOPT], [ |
ihse@839 | 374 | RC_FLAGS="$RC_FLAGS -d NDEBUG" |
ihse@839 | 375 | ]) |
erikj@755 | 376 | |
ihse@839 | 377 | # The version variables used to create RC_FLAGS may be overridden |
ihse@839 | 378 | # in a custom configure script, or possibly the command line. |
ihse@839 | 379 | # Let those variables be expanded at make time in spec.gmk. |
ihse@839 | 380 | # The \$ are escaped to the shell, and the $(...) variables |
ihse@839 | 381 | # are evaluated by make. |
ihse@839 | 382 | RC_FLAGS="$RC_FLAGS \ |
ihse@839 | 383 | -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \ |
ihse@839 | 384 | -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \ |
ihse@839 | 385 | -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \ |
ihse@839 | 386 | -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \ |
ihse@839 | 387 | -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \ |
ihse@839 | 388 | -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \ |
ihse@839 | 389 | -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\"" |
erikj@459 | 390 | |
ihse@839 | 391 | # lib.exe is used to create static libraries. |
ihse@839 | 392 | AC_CHECK_PROG([WINAR], [lib],[lib],,,) |
ihse@839 | 393 | BASIC_FIXUP_EXECUTABLE(WINAR) |
ihse@839 | 394 | AR="$WINAR" |
ihse@839 | 395 | ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT" |
erikj@459 | 396 | |
ihse@839 | 397 | AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,) |
ihse@839 | 398 | BASIC_FIXUP_EXECUTABLE(DUMPBIN) |
erikj@459 | 399 | |
ihse@839 | 400 | COMPILER_TYPE=CL |
ihse@839 | 401 | CCXXFLAGS="$CCXXFLAGS -nologo" |
ihse@839 | 402 | ]) |
ihse@839 | 403 | AC_SUBST(RC_FLAGS) |
ihse@839 | 404 | AC_SUBST(COMPILER_TYPE) |
erikj@459 | 405 | |
ihse@839 | 406 | AC_PROG_CPP |
ihse@839 | 407 | BASIC_FIXUP_EXECUTABLE(CPP) |
erikj@459 | 408 | |
ihse@839 | 409 | AC_PROG_CXXCPP |
ihse@839 | 410 | BASIC_FIXUP_EXECUTABLE(CXXCPP) |
ohair@478 | 411 | |
ihse@839 | 412 | if test "x$COMPILE_TYPE" != "xcross"; then |
ohair@478 | 413 | # If we are not cross compiling, use the same compilers for |
ohair@478 | 414 | # building the build platform executables. The cross-compilation |
ohair@478 | 415 | # case needed to be done earlier, but this can only be done after |
ohair@478 | 416 | # the native tools have been localized. |
ohair@478 | 417 | BUILD_CC="$CC" |
ohair@478 | 418 | BUILD_CXX="$CXX" |
ohair@478 | 419 | BUILD_LD="$LD" |
ihse@839 | 420 | fi |
erikj@459 | 421 | |
ihse@839 | 422 | # for solaris we really need solaris tools, and not gnu equivalent |
ihse@839 | 423 | # these seems to normally reside in /usr/ccs/bin so add that to path before |
ihse@839 | 424 | # starting to probe |
ihse@839 | 425 | # |
ihse@839 | 426 | # NOTE: I add this /usr/ccs/bin after TOOLS but before OLD_PATH |
ihse@839 | 427 | # so that it can be overriden --with-tools-dir |
ihse@839 | 428 | if test "x$OPENJDK_BUILD_OS" = xsolaris; then |
erikj@459 | 429 | PATH="${TOOLS_DIR}:/usr/ccs/bin:${OLD_PATH}" |
ihse@839 | 430 | fi |
erikj@459 | 431 | |
ihse@839 | 432 | # Find the right assembler. |
ihse@839 | 433 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
erikj@459 | 434 | AC_PATH_PROG(AS, as) |
ohair@494 | 435 | BASIC_FIXUP_EXECUTABLE(AS) |
ihse@839 | 436 | else |
erikj@459 | 437 | AS="$CC -c" |
ihse@839 | 438 | fi |
ihse@839 | 439 | AC_SUBST(AS) |
erikj@459 | 440 | |
ihse@839 | 441 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
erikj@672 | 442 | AC_PATH_PROG(NM, nm) |
ohair@494 | 443 | BASIC_FIXUP_EXECUTABLE(NM) |
erikj@672 | 444 | AC_PATH_PROG(GNM, gnm) |
erikj@672 | 445 | BASIC_FIXUP_EXECUTABLE(GNM) |
erikj@459 | 446 | AC_PATH_PROG(STRIP, strip) |
ohair@494 | 447 | BASIC_FIXUP_EXECUTABLE(STRIP) |
erikj@459 | 448 | AC_PATH_PROG(MCS, mcs) |
ohair@494 | 449 | BASIC_FIXUP_EXECUTABLE(MCS) |
ihse@839 | 450 | elif test "x$OPENJDK_TARGET_OS" != xwindows; then |
erikj@459 | 451 | AC_CHECK_TOOL(NM, nm) |
ohair@494 | 452 | BASIC_FIXUP_EXECUTABLE(NM) |
erikj@672 | 453 | GNM="$NM" |
erikj@672 | 454 | AC_SUBST(GNM) |
erikj@459 | 455 | AC_CHECK_TOOL(STRIP, strip) |
ohair@494 | 456 | BASIC_FIXUP_EXECUTABLE(STRIP) |
ihse@839 | 457 | fi |
erikj@459 | 458 | |
ihse@839 | 459 | # objcopy is used for moving debug symbols to separate files when |
ihse@839 | 460 | # full debug symbols are enabled. |
ihse@839 | 461 | if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then |
ohair@494 | 462 | AC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy]) |
tbell@516 | 463 | # Only call fixup if objcopy was found. |
tbell@516 | 464 | if test -n "$OBJCOPY"; then |
ihse@839 | 465 | BASIC_FIXUP_EXECUTABLE(OBJCOPY) |
tbell@516 | 466 | fi |
ihse@839 | 467 | fi |
ohair@494 | 468 | |
ihse@839 | 469 | AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump]) |
ihse@839 | 470 | if test "x$OBJDUMP" != x; then |
ihse@839 | 471 | # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing. |
ihse@839 | 472 | BASIC_FIXUP_EXECUTABLE(OBJDUMP) |
ihse@839 | 473 | fi |
erikj@459 | 474 | |
ihse@839 | 475 | if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then |
ihse@839 | 476 | AC_PATH_PROG(LIPO, lipo) |
ihse@839 | 477 | BASIC_FIXUP_EXECUTABLE(LIPO) |
ihse@839 | 478 | fi |
ohair@478 | 479 | |
ihse@839 | 480 | TOOLCHAIN_SETUP_JTREG |
erikj@718 | 481 | |
ihse@839 | 482 | # Restore old path without tools dir |
ihse@839 | 483 | PATH="$OLD_PATH" |
erikj@459 | 484 | ]) |
erikj@459 | 485 | |
erikj@459 | 486 | |
erikj@459 | 487 | AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_LIBS], |
erikj@459 | 488 | [ |
erikj@459 | 489 | |
ihse@839 | 490 | ############################################################################### |
ihse@839 | 491 | # |
ihse@839 | 492 | # How to compile shared libraries. |
ihse@839 | 493 | # |
erikj@459 | 494 | |
ihse@839 | 495 | if test "x$GCC" = xyes; then |
erikj@459 | 496 | COMPILER_NAME=gcc |
erikj@459 | 497 | PICFLAG="-fPIC" |
erikj@459 | 498 | LIBRARY_PREFIX=lib |
erikj@459 | 499 | SHARED_LIBRARY='lib[$]1.so' |
erikj@459 | 500 | STATIC_LIBRARY='lib[$]1.a' |
erikj@459 | 501 | SHARED_LIBRARY_FLAGS="-shared" |
erikj@459 | 502 | SHARED_LIBRARY_SUFFIX='.so' |
erikj@459 | 503 | STATIC_LIBRARY_SUFFIX='.a' |
erikj@459 | 504 | OBJ_SUFFIX='.o' |
erikj@459 | 505 | EXE_SUFFIX='' |
erikj@459 | 506 | SET_SHARED_LIBRARY_NAME='-Xlinker -soname=[$]1' |
erikj@459 | 507 | SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=[$]1' |
erikj@459 | 508 | C_FLAG_REORDER='' |
erikj@459 | 509 | CXX_FLAG_REORDER='' |
ohair@478 | 510 | SET_SHARED_LIBRARY_ORIGIN='-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1' |
ohair@478 | 511 | SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1' |
erikj@459 | 512 | LD="$CC" |
erikj@459 | 513 | LDEXE="$CC" |
erikj@459 | 514 | LDCXX="$CXX" |
erikj@459 | 515 | LDEXECXX="$CXX" |
erikj@459 | 516 | POST_STRIP_CMD="$STRIP -g" |
erikj@459 | 517 | |
erikj@459 | 518 | # Linking is different on MacOSX |
ohair@494 | 519 | if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
ihse@839 | 520 | # Might change in the future to clang. |
ihse@839 | 521 | COMPILER_NAME=gcc |
ihse@839 | 522 | SHARED_LIBRARY='lib[$]1.dylib' |
ihse@839 | 523 | SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG" |
ihse@839 | 524 | SHARED_LIBRARY_SUFFIX='.dylib' |
ihse@839 | 525 | EXE_SUFFIX='' |
ihse@839 | 526 | SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1' |
ihse@839 | 527 | SET_SHARED_LIBRARY_MAPFILE='' |
ihse@839 | 528 | SET_SHARED_LIBRARY_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.' |
ihse@839 | 529 | SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN" |
ihse@839 | 530 | POST_STRIP_CMD="$STRIP -S" |
erikj@459 | 531 | fi |
ihse@839 | 532 | else |
ohair@494 | 533 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
ihse@839 | 534 | # If it is not gcc, then assume it is the Oracle Solaris Studio Compiler |
ihse@839 | 535 | COMPILER_NAME=ossc |
ihse@839 | 536 | PICFLAG="-KPIC" |
ihse@839 | 537 | LIBRARY_PREFIX=lib |
ihse@839 | 538 | SHARED_LIBRARY='lib[$]1.so' |
ihse@839 | 539 | STATIC_LIBRARY='lib[$]1.a' |
ihse@839 | 540 | SHARED_LIBRARY_FLAGS="-G" |
ihse@839 | 541 | SHARED_LIBRARY_SUFFIX='.so' |
ihse@839 | 542 | STATIC_LIBRARY_SUFFIX='.a' |
ihse@839 | 543 | OBJ_SUFFIX='.o' |
ihse@839 | 544 | EXE_SUFFIX='' |
ihse@839 | 545 | SET_SHARED_LIBRARY_NAME='' |
ihse@839 | 546 | SET_SHARED_LIBRARY_MAPFILE='-M[$]1' |
ihse@839 | 547 | C_FLAG_REORDER='-xF' |
ihse@839 | 548 | CXX_FLAG_REORDER='-xF' |
ihse@839 | 549 | SET_SHARED_LIBRARY_ORIGIN='-R\$$$$ORIGIN[$]1' |
ihse@839 | 550 | SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN" |
ihse@839 | 551 | CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__" |
ihse@839 | 552 | CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__" |
ihse@839 | 553 | CFLAGS_JDKLIB_EXTRA='-xstrconst' |
ihse@839 | 554 | POST_STRIP_CMD="$STRIP -x" |
ihse@839 | 555 | POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\"" |
erikj@459 | 556 | fi |
ohair@494 | 557 | if test "x$OPENJDK_TARGET_OS" = xwindows; then |
ihse@839 | 558 | # If it is not gcc, then assume it is the MS Visual Studio compiler |
ihse@839 | 559 | COMPILER_NAME=cl |
ihse@839 | 560 | PICFLAG="" |
ihse@839 | 561 | LIBRARY_PREFIX= |
ihse@839 | 562 | SHARED_LIBRARY='[$]1.dll' |
ihse@839 | 563 | STATIC_LIBRARY='[$]1.lib' |
ihse@839 | 564 | SHARED_LIBRARY_FLAGS="-LD" |
ihse@839 | 565 | SHARED_LIBRARY_SUFFIX='.dll' |
ihse@839 | 566 | STATIC_LIBRARY_SUFFIX='.lib' |
ihse@839 | 567 | OBJ_SUFFIX='.obj' |
ihse@839 | 568 | EXE_SUFFIX='.exe' |
ihse@839 | 569 | SET_SHARED_LIBRARY_NAME='' |
ihse@839 | 570 | SET_SHARED_LIBRARY_MAPFILE='' |
ihse@839 | 571 | SET_SHARED_LIBRARY_ORIGIN='' |
ihse@839 | 572 | SET_EXECUTABLE_ORIGIN='' |
erikj@459 | 573 | fi |
ihse@839 | 574 | fi |
erikj@459 | 575 | |
ihse@839 | 576 | AC_SUBST(COMPILER_NAME) |
ihse@839 | 577 | AC_SUBST(OBJ_SUFFIX) |
ihse@839 | 578 | AC_SUBST(SHARED_LIBRARY) |
ihse@839 | 579 | AC_SUBST(STATIC_LIBRARY) |
ihse@839 | 580 | AC_SUBST(LIBRARY_PREFIX) |
ihse@839 | 581 | AC_SUBST(SHARED_LIBRARY_SUFFIX) |
ihse@839 | 582 | AC_SUBST(STATIC_LIBRARY_SUFFIX) |
ihse@839 | 583 | AC_SUBST(EXE_SUFFIX) |
ihse@839 | 584 | AC_SUBST(SHARED_LIBRARY_FLAGS) |
ihse@839 | 585 | AC_SUBST(SET_SHARED_LIBRARY_NAME) |
ihse@839 | 586 | AC_SUBST(SET_SHARED_LIBRARY_MAPFILE) |
ihse@839 | 587 | AC_SUBST(C_FLAG_REORDER) |
ihse@839 | 588 | AC_SUBST(CXX_FLAG_REORDER) |
ihse@839 | 589 | AC_SUBST(SET_SHARED_LIBRARY_ORIGIN) |
ihse@839 | 590 | AC_SUBST(SET_EXECUTABLE_ORIGIN) |
ihse@839 | 591 | AC_SUBST(POST_STRIP_CMD) |
ihse@839 | 592 | AC_SUBST(POST_MCS_CMD) |
erikj@459 | 593 | |
ihse@839 | 594 | # The (cross) compiler is now configured, we can now test capabilities |
ihse@839 | 595 | # of the target platform. |
erikj@459 | 596 | ]) |
erikj@459 | 597 | |
erikj@459 | 598 | AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION], |
erikj@459 | 599 | [ |
erikj@459 | 600 | |
ihse@839 | 601 | ############################################################################### |
ihse@839 | 602 | # |
ihse@839 | 603 | # Setup the opt flags for different compilers |
ihse@839 | 604 | # and different operating systems. |
ihse@839 | 605 | # |
ohair@478 | 606 | |
ihse@839 | 607 | # |
ihse@839 | 608 | # NOTE: check for -mstackrealign needs to be below potential addition of -m32 |
ihse@839 | 609 | # |
ihse@839 | 610 | if test "x$OPENJDK_TARGET_CPU_BITS" = x32 && test "x$OPENJDK_TARGET_OS" = xmacosx; then |
ohair@478 | 611 | # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned. |
ohair@478 | 612 | # While waiting for a better solution, the current workaround is to use -mstackrealign. |
ohair@478 | 613 | CFLAGS="$CFLAGS -mstackrealign" |
ohair@478 | 614 | AC_MSG_CHECKING([if 32-bit compiler supports -mstackrealign]) |
ohair@478 | 615 | AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])], |
ihse@839 | 616 | [ |
ihse@839 | 617 | AC_MSG_RESULT([yes]) |
ihse@839 | 618 | ], |
ihse@839 | 619 | [ |
ihse@839 | 620 | AC_MSG_RESULT([no]) |
ihse@839 | 621 | AC_MSG_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.]) |
ihse@839 | 622 | ] |
ihse@839 | 623 | ) |
ihse@839 | 624 | fi |
ohair@478 | 625 | |
ihse@839 | 626 | C_FLAG_DEPS="-MMD -MF" |
ihse@839 | 627 | CXX_FLAG_DEPS="-MMD -MF" |
erikj@459 | 628 | |
ihse@839 | 629 | case $COMPILER_TYPE in |
ihse@839 | 630 | CC ) |
ihse@839 | 631 | case $COMPILER_NAME in |
ihse@839 | 632 | gcc ) |
ihse@839 | 633 | case $OPENJDK_TARGET_OS in |
ihse@839 | 634 | macosx ) |
ihse@839 | 635 | # On MacOSX we optimize for size, something |
ihse@839 | 636 | # we should do for all platforms? |
ihse@839 | 637 | C_O_FLAG_HI="-Os" |
ihse@839 | 638 | C_O_FLAG_NORM="-Os" |
ihse@839 | 639 | C_O_FLAG_NONE="" |
ihse@839 | 640 | ;; |
ihse@839 | 641 | *) |
ihse@839 | 642 | C_O_FLAG_HI="-O3" |
ihse@839 | 643 | C_O_FLAG_NORM="-O2" |
ihse@839 | 644 | C_O_FLAG_NONE="-O0" |
ihse@839 | 645 | ;; |
ihse@839 | 646 | esac |
ihse@839 | 647 | CXX_O_FLAG_HI="$C_O_FLAG_HI" |
ihse@839 | 648 | CXX_O_FLAG_NORM="$C_O_FLAG_NORM" |
ihse@839 | 649 | CXX_O_FLAG_NONE="$C_O_FLAG_NONE" |
ihse@839 | 650 | CFLAGS_DEBUG_SYMBOLS="-g" |
ihse@839 | 651 | CXXFLAGS_DEBUG_SYMBOLS="-g" |
ihse@839 | 652 | if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then |
erikj@739 | 653 | CFLAGS_DEBUG_SYMBOLS="-g1" |
erikj@739 | 654 | CXXFLAGS_DEBUG_SYMBOLS="-g1" |
ihse@839 | 655 | fi |
ihse@839 | 656 | ;; |
ihse@839 | 657 | ossc ) |
ihse@839 | 658 | # |
ihse@839 | 659 | # Forte has different names for this with their C++ compiler... |
ihse@839 | 660 | # |
ihse@839 | 661 | C_FLAG_DEPS="-xMMD -xMF" |
ihse@839 | 662 | CXX_FLAG_DEPS="-xMMD -xMF" |
erikj@459 | 663 | |
ihse@839 | 664 | # Extra options used with HIGHEST |
ihse@839 | 665 | # |
ihse@839 | 666 | # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be |
ihse@839 | 667 | # done with care, there are some assumptions below that need to |
ihse@839 | 668 | # be understood about the use of pointers, and IEEE behavior. |
ihse@839 | 669 | # |
ihse@839 | 670 | # Use non-standard floating point mode (not IEEE 754) |
ihse@839 | 671 | CC_HIGHEST="$CC_HIGHEST -fns" |
ihse@839 | 672 | # Do some simplification of floating point arithmetic (not IEEE 754) |
ihse@839 | 673 | CC_HIGHEST="$CC_HIGHEST -fsimple" |
ihse@839 | 674 | # Use single precision floating point with 'float' |
ihse@839 | 675 | CC_HIGHEST="$CC_HIGHEST -fsingle" |
ihse@839 | 676 | # Assume memory references via basic pointer types do not alias |
ihse@839 | 677 | # (Source with excessing pointer casting and data access with mixed |
ihse@839 | 678 | # pointer types are not recommended) |
ihse@839 | 679 | CC_HIGHEST="$CC_HIGHEST -xalias_level=basic" |
ihse@839 | 680 | # Use intrinsic or inline versions for math/std functions |
ihse@839 | 681 | # (If you expect perfect errno behavior, do not use this) |
ihse@839 | 682 | CC_HIGHEST="$CC_HIGHEST -xbuiltin=%all" |
ihse@839 | 683 | # Loop data dependency optimizations (need -xO3 or higher) |
ihse@839 | 684 | CC_HIGHEST="$CC_HIGHEST -xdepend" |
ihse@839 | 685 | # Pointer parameters to functions do not overlap |
ihse@839 | 686 | # (Similar to -xalias_level=basic usage, but less obvious sometimes. |
ihse@839 | 687 | # If you pass in multiple pointers to the same data, do not use this) |
ihse@839 | 688 | CC_HIGHEST="$CC_HIGHEST -xrestrict" |
ihse@839 | 689 | # Inline some library routines |
ihse@839 | 690 | # (If you expect perfect errno behavior, do not use this) |
ihse@839 | 691 | CC_HIGHEST="$CC_HIGHEST -xlibmil" |
ihse@839 | 692 | # Use optimized math routines |
ihse@839 | 693 | # (If you expect perfect errno behavior, do not use this) |
ihse@839 | 694 | # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now |
ihse@839 | 695 | #CC_HIGHEST="$CC_HIGHEST -xlibmopt" |
erikj@459 | 696 | |
ihse@839 | 697 | if test "x$OPENJDK_TARGET_CPU" = xsparc; then |
ihse@839 | 698 | CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s" |
ihse@839 | 699 | CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s" |
ihse@839 | 700 | fi |
ohair@494 | 701 | |
ihse@839 | 702 | case $OPENJDK_TARGET_CPU_ARCH in |
ihse@839 | 703 | x86) |
ihse@839 | 704 | C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xregs=no%frameptr" |
ihse@839 | 705 | C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr" |
ihse@839 | 706 | C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr" |
ihse@839 | 707 | C_O_FLAG_NONE="-xregs=no%frameptr" |
ihse@839 | 708 | CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xregs=no%frameptr" |
ihse@839 | 709 | CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz -xregs=no%frameptr" |
ihse@839 | 710 | CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz -xregs=no%frameptr" |
ihse@839 | 711 | CXX_O_FLAG_NONE="-xregs=no%frameptr" |
ihse@839 | 712 | if test "x$OPENJDK_TARGET_CPU" = xx86; then |
ihse@839 | 713 | C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium" |
ihse@839 | 714 | CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium" |
ihse@839 | 715 | fi |
ihse@839 | 716 | ;; |
ihse@839 | 717 | sparc) |
ihse@839 | 718 | CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl" |
ihse@839 | 719 | CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl" |
ihse@839 | 720 | C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra" |
ihse@839 | 721 | C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0" |
ihse@839 | 722 | C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0" |
ihse@839 | 723 | C_O_FLAG_NONE="" |
ihse@839 | 724 | CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra" |
ihse@839 | 725 | CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0" |
ihse@839 | 726 | CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0" |
ihse@839 | 727 | CXX_O_FLAG_NONE="" |
ihse@839 | 728 | ;; |
ihse@839 | 729 | esac |
erikj@459 | 730 | |
ihse@839 | 731 | CFLAGS_DEBUG_SYMBOLS="-g -xs" |
ihse@839 | 732 | CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs" |
ihse@839 | 733 | esac |
ihse@839 | 734 | ;; |
ihse@839 | 735 | CL ) |
ihse@839 | 736 | C_O_FLAG_HIGHEST="-O2" |
ihse@839 | 737 | C_O_FLAG_HI="-O1" |
ihse@839 | 738 | C_O_FLAG_NORM="-O1" |
ihse@839 | 739 | C_O_FLAG_NONE="-Od" |
ihse@839 | 740 | CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST" |
ihse@839 | 741 | CXX_O_FLAG_HI="$C_O_FLAG_HI" |
ihse@839 | 742 | CXX_O_FLAG_NORM="$C_O_FLAG_NORM" |
ihse@839 | 743 | CXX_O_FLAG_NONE="$C_O_FLAG_NONE" |
ihse@839 | 744 | ;; |
ihse@839 | 745 | esac |
erikj@459 | 746 | |
ihse@839 | 747 | if test -z "$C_O_FLAG_HIGHEST"; then |
ihse@839 | 748 | C_O_FLAG_HIGHEST="$C_O_FLAG_HI" |
ihse@839 | 749 | fi |
erikj@459 | 750 | |
ihse@839 | 751 | if test -z "$CXX_O_FLAG_HIGHEST"; then |
ihse@839 | 752 | CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HI" |
ihse@839 | 753 | fi |
erikj@459 | 754 | |
ihse@839 | 755 | AC_SUBST(C_O_FLAG_HIGHEST) |
ihse@839 | 756 | AC_SUBST(C_O_FLAG_HI) |
ihse@839 | 757 | AC_SUBST(C_O_FLAG_NORM) |
ihse@839 | 758 | AC_SUBST(C_O_FLAG_NONE) |
ihse@839 | 759 | AC_SUBST(CXX_O_FLAG_HIGHEST) |
ihse@839 | 760 | AC_SUBST(CXX_O_FLAG_HI) |
ihse@839 | 761 | AC_SUBST(CXX_O_FLAG_NORM) |
ihse@839 | 762 | AC_SUBST(CXX_O_FLAG_NONE) |
ihse@839 | 763 | AC_SUBST(C_FLAG_DEPS) |
ihse@839 | 764 | AC_SUBST(CXX_FLAG_DEPS) |
erikj@459 | 765 | ]) |
erikj@459 | 766 | |
erikj@459 | 767 | AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_JDK], |
erikj@459 | 768 | [ |
erikj@459 | 769 | |
ihse@839 | 770 | if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then |
ihse@839 | 771 | AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags]) |
ihse@839 | 772 | fi |
erikj@459 | 773 | |
ihse@839 | 774 | if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then |
ihse@839 | 775 | AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags]) |
ihse@839 | 776 | fi |
erikj@459 | 777 | |
ihse@839 | 778 | if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then |
ihse@839 | 779 | AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags]) |
ihse@839 | 780 | fi |
erikj@459 | 781 | |
ihse@839 | 782 | AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags], |
ihse@839 | 783 | [extra flags to be used when compiling jdk c-files])]) |
erikj@459 | 784 | |
ihse@839 | 785 | AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags], |
ihse@839 | 786 | [extra flags to be used when compiling jdk c++-files])]) |
erikj@459 | 787 | |
ihse@839 | 788 | AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags], |
ihse@839 | 789 | [extra flags to be used when linking jdk])]) |
erikj@459 | 790 | |
ihse@839 | 791 | CFLAGS_JDK="${CFLAGS_JDK} $with_extra_cflags" |
ihse@839 | 792 | CXXFLAGS_JDK="${CXXFLAGS_JDK} $with_extra_cxxflags" |
ihse@839 | 793 | LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags" |
erikj@459 | 794 | |
ihse@839 | 795 | # Hotspot needs these set in their legacy form |
ihse@839 | 796 | LEGACY_EXTRA_CFLAGS=$with_extra_cflags |
ihse@839 | 797 | LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags |
ihse@839 | 798 | LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags |
ohair@478 | 799 | |
ihse@839 | 800 | AC_SUBST(LEGACY_EXTRA_CFLAGS) |
ihse@839 | 801 | AC_SUBST(LEGACY_EXTRA_CXXFLAGS) |
ihse@839 | 802 | AC_SUBST(LEGACY_EXTRA_LDFLAGS) |
ohair@478 | 803 | |
ihse@839 | 804 | ############################################################################### |
ihse@839 | 805 | # |
ihse@839 | 806 | # Now setup the CFLAGS and LDFLAGS for the JDK build. |
ihse@839 | 807 | # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build. |
ihse@839 | 808 | # |
ihse@839 | 809 | case $COMPILER_NAME in |
ihse@839 | 810 | gcc ) |
ihse@839 | 811 | CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \ |
ihse@839 | 812 | -pipe \ |
ihse@839 | 813 | -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" |
ihse@839 | 814 | case $OPENJDK_TARGET_CPU_ARCH in |
ihse@839 | 815 | arm ) |
ihse@839 | 816 | # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing |
ihse@839 | 817 | CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing" |
erikj@459 | 818 | ;; |
ihse@839 | 819 | ppc ) |
ihse@839 | 820 | # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing |
erikj@459 | 821 | ;; |
ihse@839 | 822 | * ) |
ihse@839 | 823 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fno-omit-frame-pointer" |
ihse@839 | 824 | CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing" |
ohair@478 | 825 | ;; |
ihse@839 | 826 | esac |
ihse@839 | 827 | ;; |
ihse@839 | 828 | ossc ) |
ihse@839 | 829 | CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS" |
ihse@839 | 830 | case $OPENJDK_TARGET_CPU_ARCH in |
ihse@839 | 831 | x86 ) |
ihse@839 | 832 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB" |
ihse@839 | 833 | CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE" |
ihse@839 | 834 | ;; |
ihse@839 | 835 | esac |
ohair@478 | 836 | |
ihse@839 | 837 | CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal" |
ihse@839 | 838 | CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib" |
ohair@478 | 839 | |
ihse@839 | 840 | LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext" |
ihse@839 | 841 | LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib" |
ihse@839 | 842 | ;; |
ihse@839 | 843 | cl ) |
ihse@839 | 844 | CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \ |
ihse@839 | 845 | -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \ |
ihse@839 | 846 | -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \ |
ihse@839 | 847 | -DWIN32 -DIAL" |
ihse@839 | 848 | case $OPENJDK_TARGET_CPU in |
ihse@839 | 849 | x86 ) |
ihse@839 | 850 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86" |
erikj@459 | 851 | ;; |
ihse@839 | 852 | x86_64 ) |
ihse@839 | 853 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64" |
erikj@459 | 854 | ;; |
ihse@839 | 855 | esac |
ihse@839 | 856 | ;; |
ihse@839 | 857 | esac |
erikj@459 | 858 | |
ihse@839 | 859 | ############################################################################### |
erikj@459 | 860 | |
ihse@839 | 861 | # Adjust flags according to debug level. |
ihse@839 | 862 | case $DEBUG_LEVEL in |
ihse@839 | 863 | fastdebug ) |
ihse@839 | 864 | CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS" |
ihse@839 | 865 | CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS" |
ihse@839 | 866 | C_O_FLAG_HI="$C_O_FLAG_NORM" |
ihse@839 | 867 | C_O_FLAG_NORM="$C_O_FLAG_NORM" |
ihse@839 | 868 | CXX_O_FLAG_HI="$CXX_O_FLAG_NORM" |
ihse@839 | 869 | CXX_O_FLAG_NORM="$CXX_O_FLAG_NORM" |
ihse@839 | 870 | JAVAC_FLAGS="$JAVAC_FLAGS -g" |
ihse@839 | 871 | ;; |
ihse@839 | 872 | slowdebug ) |
ihse@839 | 873 | CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS" |
ihse@839 | 874 | CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS" |
ihse@839 | 875 | C_O_FLAG_HI="$C_O_FLAG_NONE" |
ihse@839 | 876 | C_O_FLAG_NORM="$C_O_FLAG_NONE" |
ihse@839 | 877 | CXX_O_FLAG_HI="$CXX_O_FLAG_NONE" |
ihse@839 | 878 | CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE" |
ihse@839 | 879 | JAVAC_FLAGS="$JAVAC_FLAGS -g" |
ihse@839 | 880 | ;; |
ihse@839 | 881 | esac |
erikj@739 | 882 | |
ihse@839 | 883 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64" |
erikj@459 | 884 | |
ihse@839 | 885 | # The package path is used only on macosx? |
ihse@839 | 886 | PACKAGE_PATH=/opt/local |
ihse@839 | 887 | AC_SUBST(PACKAGE_PATH) |
erikj@459 | 888 | |
ihse@839 | 889 | if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then |
ohair@478 | 890 | # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the |
ohair@478 | 891 | # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN |
ohair@478 | 892 | # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h). |
ohair@478 | 893 | # Note: -Dmacro is the same as #define macro 1 |
ihse@839 | 894 | # -Dmacro= is the same as #define macro |
ohair@478 | 895 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
ihse@839 | 896 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN=" |
ohair@478 | 897 | else |
ihse@839 | 898 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN" |
ohair@478 | 899 | fi |
ihse@839 | 900 | else |
erikj@459 | 901 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN" |
ihse@839 | 902 | fi |
ihse@839 | 903 | if test "x$OPENJDK_TARGET_OS" = xlinux; then |
erikj@459 | 904 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DLINUX" |
ihse@839 | 905 | fi |
ihse@839 | 906 | if test "x$OPENJDK_TARGET_OS" = xwindows; then |
erikj@459 | 907 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DWINDOWS" |
ihse@839 | 908 | fi |
ihse@839 | 909 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
erikj@459 | 910 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DSOLARIS" |
ihse@839 | 911 | fi |
ihse@839 | 912 | if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
aefimov@771 | 913 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT" |
mduigou@728 | 914 | # Setting these parameters makes it an error to link to macosx APIs that are |
erikj@631 | 915 | # newer than the given OS version and makes the linked binaries compatible even |
erikj@631 | 916 | # if built on a newer version of the OS. |
erikj@631 | 917 | # The expected format is X.Y.Z |
erikj@631 | 918 | MACOSX_VERSION_MIN=10.7.0 |
erikj@631 | 919 | AC_SUBST(MACOSX_VERSION_MIN) |
erikj@631 | 920 | # The macro takes the version with no dots, ex: 1070 |
erikj@631 | 921 | # Let the flags variables get resolved in make for easier override on make |
erikj@631 | 922 | # command line. |
erikj@631 | 923 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" |
erikj@631 | 924 | LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" |
ihse@839 | 925 | fi |
ihse@839 | 926 | if test "x$OPENJDK_TARGET_OS" = xbsd; then |
erikj@459 | 927 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE" |
ihse@839 | 928 | fi |
ihse@839 | 929 | if test "x$DEBUG_LEVEL" = xrelease; then |
erikj@459 | 930 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG" |
ihse@839 | 931 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
ihse@839 | 932 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED" |
ihse@839 | 933 | fi |
ihse@839 | 934 | else |
erikj@459 | 935 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG" |
ihse@839 | 936 | fi |
erikj@459 | 937 | |
ihse@839 | 938 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY" |
erikj@926 | 939 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'" |
erikj@459 | 940 | |
ihse@839 | 941 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK \ |
ihse@839 | 942 | -I${JDK_OUTPUTDIR}/include \ |
ihse@839 | 943 | -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \ |
ihse@839 | 944 | -I${JDK_TOPDIR}/src/share/javavm/export \ |
dholmes@872 | 945 | -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_EXPORT_DIR/javavm/export \ |
ihse@839 | 946 | -I${JDK_TOPDIR}/src/share/native/common \ |
ihse@839 | 947 | -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common" |
erikj@459 | 948 | |
ihse@839 | 949 | # The shared libraries are compiled using the picflag. |
ihse@839 | 950 | CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA" |
ihse@839 | 951 | CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA " |
erikj@459 | 952 | |
ihse@839 | 953 | # Executable flags |
ihse@839 | 954 | CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK" |
ihse@839 | 955 | CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK" |
erikj@459 | 956 | |
ihse@839 | 957 | # Now this is odd. The JDK native libraries have to link against libjvm.so |
ihse@839 | 958 | # On 32-bit machines there is normally two distinct libjvm.so:s, client and server. |
ihse@839 | 959 | # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library |
ihse@839 | 960 | # is identical for client and server? Yes. Which is picked at runtime (client or server)? |
ihse@839 | 961 | # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following |
ihse@839 | 962 | # libraries will link to whatever is in memory. Yuck. |
ihse@839 | 963 | # |
ihse@839 | 964 | # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh. |
ihse@839 | 965 | if test "x$COMPILER_NAME" = xcl; then |
erikj@459 | 966 | LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no" |
mduigou@728 | 967 | if test "x$OPENJDK_TARGET_CPU" = xx86; then |
ihse@839 | 968 | LDFLAGS_JDK="$LDFLAGS_JDK -safeseh" |
erikj@459 | 969 | fi |
erikj@459 | 970 | # TODO: make -debug optional "--disable-full-debug-symbols" |
erikj@459 | 971 | LDFLAGS_JDK="$LDFLAGS_JDK -debug" |
erikj@459 | 972 | LDFLAGS_JDKLIB="${LDFLAGS_JDK} -dll -libpath:${JDK_OUTPUTDIR}/lib" |
erikj@459 | 973 | LDFLAGS_JDKLIB_SUFFIX="" |
erikj@459 | 974 | if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then |
ihse@839 | 975 | LDFLAGS_STACK_SIZE=1048576 |
erikj@459 | 976 | else |
ihse@839 | 977 | LDFLAGS_STACK_SIZE=327680 |
erikj@459 | 978 | fi |
erikj@459 | 979 | LDFLAGS_JDKEXE="${LDFLAGS_JDK} /STACK:$LDFLAGS_STACK_SIZE" |
ihse@839 | 980 | else |
ohair@494 | 981 | if test "x$COMPILER_NAME" = xgcc; then |
ihse@839 | 982 | # If this is a --hash-style=gnu system, use --hash-style=both, why? |
ihse@839 | 983 | HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'` |
ihse@839 | 984 | if test -n "$HAS_GNU_HASH"; then |
ihse@839 | 985 | LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both " |
ihse@839 | 986 | fi |
ihse@839 | 987 | if test "x$OPENJDK_TARGET_OS" = xlinux; then |
ihse@839 | 988 | # And since we now know that the linker is gnu, then add -z defs, to forbid |
ihse@839 | 989 | # undefined symbols in object files. |
ihse@839 | 990 | LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs" |
ihse@839 | 991 | if test "x$DEBUG_LEVEL" = "xrelease"; then |
ihse@839 | 992 | # When building release libraries, tell the linker optimize them. |
ihse@839 | 993 | # Should this be supplied to the OSS linker as well? |
ihse@839 | 994 | LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1" |
ohair@494 | 995 | fi |
ihse@839 | 996 | fi |
erikj@459 | 997 | fi |
erikj@459 | 998 | LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \ |
ihse@839 | 999 | -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}" |
ohair@478 | 1000 | |
erikj@517 | 1001 | # On some platforms (mac) the linker warns about non existing -L dirs. |
erikj@519 | 1002 | # Add server first if available. Linking aginst client does not always produce the same results. |
dholmes@542 | 1003 | # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1. |
dholmes@542 | 1004 | # Default to server for other variants. |
erikj@519 | 1005 | if test "x$JVM_VARIANT_SERVER" = xtrue; then |
ihse@839 | 1006 | LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server" |
erikj@519 | 1007 | elif test "x$JVM_VARIANT_CLIENT" = xtrue; then |
ihse@839 | 1008 | LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client" |
dholmes@542 | 1009 | elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then |
ihse@839 | 1010 | LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal" |
erikj@517 | 1011 | else |
ihse@839 | 1012 | LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server" |
erikj@517 | 1013 | fi |
erikj@517 | 1014 | |
ohair@478 | 1015 | LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm" |
erikj@459 | 1016 | if test "x$COMPILER_NAME" = xossc; then |
ihse@839 | 1017 | LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc" |
erikj@459 | 1018 | fi |
erikj@459 | 1019 | |
erikj@459 | 1020 | LDFLAGS_JDKEXE="${LDFLAGS_JDK}" |
ohair@478 | 1021 | if test "x$OPENJDK_TARGET_OS" = xlinux; then |
ihse@839 | 1022 | LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Xlinker --allow-shlib-undefined" |
erikj@459 | 1023 | fi |
ihse@839 | 1024 | fi |
erikj@459 | 1025 | |
ihse@839 | 1026 | AC_SUBST(CFLAGS_JDKLIB) |
ihse@839 | 1027 | AC_SUBST(CFLAGS_JDKEXE) |
erikj@459 | 1028 | |
ihse@839 | 1029 | AC_SUBST(CXXFLAGS_JDKLIB) |
ihse@839 | 1030 | AC_SUBST(CXXFLAGS_JDKEXE) |
erikj@459 | 1031 | |
ihse@839 | 1032 | AC_SUBST(LDFLAGS_JDKLIB) |
ihse@839 | 1033 | AC_SUBST(LDFLAGS_JDKEXE) |
ihse@839 | 1034 | AC_SUBST(LDFLAGS_JDKLIB_SUFFIX) |
ihse@839 | 1035 | AC_SUBST(LDFLAGS_JDKEXE_SUFFIX) |
ihse@839 | 1036 | AC_SUBST(LDFLAGS_CXX_JDK) |
erikj@459 | 1037 | ]) |
erikj@698 | 1038 | |
erikj@698 | 1039 | |
erikj@698 | 1040 | # TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE], |
erikj@698 | 1041 | # [RUN-IF-FALSE]) |
erikj@698 | 1042 | # ------------------------------------------------------------ |
erikj@698 | 1043 | # Check that the c and c++ compilers support an argument |
erikj@698 | 1044 | AC_DEFUN([TOOLCHAIN_COMPILER_CHECK_ARGUMENTS], |
erikj@698 | 1045 | [ |
erikj@698 | 1046 | AC_MSG_CHECKING([if compiler supports "$1"]) |
erikj@698 | 1047 | supports=yes |
erikj@698 | 1048 | |
erikj@698 | 1049 | saved_cflags="$CFLAGS" |
erikj@698 | 1050 | CFLAGS="$CFLAGS $1" |
erikj@698 | 1051 | AC_LANG_PUSH([C]) |
ihse@839 | 1052 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], |
ihse@839 | 1053 | [supports=no]) |
erikj@698 | 1054 | AC_LANG_POP([C]) |
erikj@698 | 1055 | CFLAGS="$saved_cflags" |
erikj@698 | 1056 | |
erikj@698 | 1057 | saved_cxxflags="$CXXFLAGS" |
erikj@698 | 1058 | CXXFLAGS="$CXXFLAG $1" |
erikj@698 | 1059 | AC_LANG_PUSH([C++]) |
ihse@839 | 1060 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], |
ihse@839 | 1061 | [supports=no]) |
erikj@698 | 1062 | AC_LANG_POP([C++]) |
erikj@698 | 1063 | CXXFLAGS="$saved_cxxflags" |
erikj@698 | 1064 | |
erikj@698 | 1065 | AC_MSG_RESULT([$supports]) |
erikj@698 | 1066 | if test "x$supports" = "xyes" ; then |
erikj@698 | 1067 | m4_ifval([$2], [$2], [:]) |
erikj@698 | 1068 | else |
erikj@698 | 1069 | m4_ifval([$3], [$3], [:]) |
erikj@698 | 1070 | fi |
erikj@698 | 1071 | ]) |
erikj@698 | 1072 | |
erikj@698 | 1073 | AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_MISC], |
erikj@698 | 1074 | [ |
erikj@698 | 1075 | # Some Zero and Shark settings. |
erikj@698 | 1076 | # ZERO_ARCHFLAG tells the compiler which mode to build for |
erikj@698 | 1077 | case "${OPENJDK_TARGET_CPU}" in |
erikj@698 | 1078 | s390) |
erikj@698 | 1079 | ZERO_ARCHFLAG="-m31" |
erikj@698 | 1080 | ;; |
erikj@698 | 1081 | *) |
erikj@698 | 1082 | ZERO_ARCHFLAG="-m${OPENJDK_TARGET_CPU_BITS}" |
erikj@698 | 1083 | esac |
erikj@698 | 1084 | TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""]) |
erikj@698 | 1085 | AC_SUBST(ZERO_ARCHFLAG) |
erikj@698 | 1086 | |
erikj@698 | 1087 | # Check that the compiler supports -mX flags |
erikj@698 | 1088 | # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does |
erikj@698 | 1089 | TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([-m${OPENJDK_TARGET_CPU_BITS}], |
ihse@839 | 1090 | [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true], |
ihse@839 | 1091 | [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false]) |
erikj@698 | 1092 | AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG) |
erikj@698 | 1093 | ]) |
erikj@718 | 1094 | |
mduigou@728 | 1095 | # Setup the JTREG paths |
mduigou@728 | 1096 | AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG], |
mduigou@728 | 1097 | [ |
mduigou@728 | 1098 | AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg], |
ihse@839 | 1099 | [Regression Test Harness @<:@probed@:>@])], |
ihse@839 | 1100 | [], |
ihse@839 | 1101 | [with_jtreg=no]) |
mduigou@728 | 1102 | |
mduigou@728 | 1103 | if test "x$with_jtreg" = xno; then |
mduigou@728 | 1104 | # jtreg disabled |
mduigou@728 | 1105 | AC_MSG_CHECKING([for jtreg]) |
mduigou@728 | 1106 | AC_MSG_RESULT(no) |
mduigou@728 | 1107 | else |
mduigou@728 | 1108 | if test "x$with_jtreg" != xyes; then |
mduigou@728 | 1109 | # with path specified. |
mduigou@728 | 1110 | JT_HOME="$with_jtreg" |
erikj@718 | 1111 | fi |
mduigou@728 | 1112 | |
mduigou@728 | 1113 | if test "x$JT_HOME" != x; then |
mduigou@728 | 1114 | AC_MSG_CHECKING([for jtreg]) |
mduigou@728 | 1115 | |
mduigou@728 | 1116 | # use JT_HOME enviroment var. |
mduigou@728 | 1117 | BASIC_FIXUP_PATH([JT_HOME]) |
mduigou@728 | 1118 | |
mduigou@728 | 1119 | # jtreg win32 script works for everybody |
mduigou@728 | 1120 | JTREGEXE="$JT_HOME/win32/bin/jtreg" |
mduigou@728 | 1121 | |
mduigou@728 | 1122 | if test ! -f "$JTREGEXE"; then |
mduigou@728 | 1123 | AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE]) |
mduigou@728 | 1124 | fi |
mduigou@728 | 1125 | |
mduigou@728 | 1126 | AC_MSG_RESULT($JTREGEXE) |
mduigou@728 | 1127 | else |
mduigou@728 | 1128 | # try to find jtreg on path |
mduigou@728 | 1129 | BASIC_REQUIRE_PROG(JTREGEXE, jtreg) |
mduigou@728 | 1130 | JT_HOME="`$DIRNAME $JTREGEXE`" |
mduigou@728 | 1131 | fi |
mduigou@728 | 1132 | fi |
mduigou@728 | 1133 | |
mduigou@728 | 1134 | AC_SUBST(JT_HOME) |
mduigou@728 | 1135 | AC_SUBST(JTREGEXE) |
erikj@718 | 1136 | ]) |