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