Tue, 02 Apr 2013 14:13:06 -0400
8011278: Allow using a system-installed giflib
Reviewed-by: andrew, prr
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` |
ohair@494 | 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 |
ohair@494 | 50 | COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1` |
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 |
ohair@478 | 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]) |
ohair@494 | 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 | if test "x$SYS_ROOT" != "x/" ; then |
erikj@459 | 230 | CFLAGS="--sysroot=$SYS_ROOT $CFLAGS" |
erikj@459 | 231 | CXXFLAGS="--sysroot=$SYS_ROOT $CXXFLAGS" |
erikj@459 | 232 | OBJCFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" |
erikj@459 | 233 | OBJCXXFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" |
erikj@459 | 234 | CPPFLAGS="--sysroot=$SYS_ROOT $CPPFLAGS" |
erikj@459 | 235 | LDFLAGS="--sysroot=$SYS_ROOT $LDFLAGS" |
erikj@459 | 236 | fi |
erikj@459 | 237 | |
erikj@459 | 238 | # Store the CFLAGS etal passed to the configure script. |
erikj@459 | 239 | ORG_CFLAGS="$CFLAGS" |
erikj@459 | 240 | ORG_CXXFLAGS="$CXXFLAGS" |
erikj@459 | 241 | ORG_OBJCFLAGS="$OBJCFLAGS" |
erikj@459 | 242 | |
erikj@459 | 243 | # autoconf magic only relies on PATH, so update it if tools dir is specified |
erikj@459 | 244 | OLD_PATH="$PATH" |
erikj@459 | 245 | if test "x$TOOLS_DIR" != x; then |
erikj@459 | 246 | PATH=$TOOLS_DIR:$PATH |
erikj@459 | 247 | fi |
erikj@459 | 248 | |
ohair@494 | 249 | |
ohair@494 | 250 | ### Locate C compiler (CC) |
ohair@494 | 251 | |
martin@648 | 252 | # On windows, only cl.exe is supported. |
martin@648 | 253 | # On Solaris, cc is preferred to gcc. |
martin@648 | 254 | # Elsewhere, gcc is preferred to cc. |
martin@648 | 255 | |
martin@648 | 256 | if test "x$CC" != x; then |
martin@648 | 257 | COMPILER_CHECK_LIST="$CC" |
martin@648 | 258 | elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then |
martin@648 | 259 | COMPILER_CHECK_LIST="cl" |
martin@648 | 260 | elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then |
martin@648 | 261 | COMPILER_CHECK_LIST="cc gcc" |
ohair@494 | 262 | else |
martin@648 | 263 | COMPILER_CHECK_LIST="gcc cc" |
erikj@459 | 264 | fi |
erikj@459 | 265 | |
ohair@494 | 266 | TOOLCHAIN_FIND_COMPILER([CC],[C],[$COMPILER_CHECK_LIST]) |
martin@648 | 267 | # Now that we have resolved CC ourself, let autoconf have its go at it |
ohair@494 | 268 | AC_PROG_CC([$CC]) |
ohair@494 | 269 | |
ohair@494 | 270 | ### Locate C++ compiler (CXX) |
ohair@494 | 271 | |
martin@648 | 272 | if test "x$CXX" != x; then |
martin@648 | 273 | COMPILER_CHECK_LIST="$CXX" |
martin@648 | 274 | elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then |
martin@648 | 275 | COMPILER_CHECK_LIST="cl" |
martin@648 | 276 | elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then |
martin@648 | 277 | COMPILER_CHECK_LIST="CC g++" |
ohair@494 | 278 | else |
martin@648 | 279 | COMPILER_CHECK_LIST="g++ CC" |
ohair@494 | 280 | fi |
martin@648 | 281 | |
ohair@494 | 282 | TOOLCHAIN_FIND_COMPILER([CXX],[C++],[$COMPILER_CHECK_LIST]) |
martin@648 | 283 | # Now that we have resolved CXX ourself, let autoconf have its go at it |
ohair@494 | 284 | AC_PROG_CXX([$CXX]) |
ohair@494 | 285 | |
ohair@494 | 286 | ### Locate other tools |
ohair@494 | 287 | |
ihse@495 | 288 | if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
erikj@459 | 289 | AC_PROG_OBJC |
ohair@494 | 290 | BASIC_FIXUP_EXECUTABLE(OBJC) |
erikj@459 | 291 | else |
erikj@459 | 292 | OBJC= |
erikj@459 | 293 | fi |
erikj@459 | 294 | |
erikj@459 | 295 | # Restore the flags to the user specified values. |
erikj@459 | 296 | # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2" |
erikj@459 | 297 | CFLAGS="$ORG_CFLAGS" |
erikj@459 | 298 | CXXFLAGS="$ORG_CXXFLAGS" |
erikj@459 | 299 | OBJCFLAGS="$ORG_OBJCFLAGS" |
erikj@459 | 300 | |
erikj@459 | 301 | LD="$CC" |
erikj@459 | 302 | LDEXE="$CC" |
erikj@459 | 303 | LDCXX="$CXX" |
erikj@459 | 304 | LDEXECXX="$CXX" |
ohair@478 | 305 | AC_SUBST(LD) |
erikj@459 | 306 | # LDEXE is the linker to use, when creating executables. |
erikj@459 | 307 | AC_SUBST(LDEXE) |
erikj@459 | 308 | # Linking C++ libraries. |
erikj@459 | 309 | AC_SUBST(LDCXX) |
erikj@459 | 310 | # Linking C++ executables. |
erikj@459 | 311 | AC_SUBST(LDEXECXX) |
erikj@459 | 312 | |
ohair@494 | 313 | if test "x$OPENJDK_TARGET_OS" != xwindows; then |
ohair@478 | 314 | AC_CHECK_TOOL(AR, ar) |
ohair@494 | 315 | BASIC_FIXUP_EXECUTABLE(AR) |
ohair@478 | 316 | fi |
ohair@494 | 317 | if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
erikj@459 | 318 | ARFLAGS="-r" |
erikj@459 | 319 | else |
erikj@459 | 320 | ARFLAGS="" |
erikj@459 | 321 | fi |
erikj@459 | 322 | AC_SUBST(ARFLAGS) |
erikj@459 | 323 | |
ohair@494 | 324 | # For hotspot, we need these in Windows mixed path; other platforms keep them the same |
ohair@494 | 325 | HOTSPOT_CXX="$CXX" |
ohair@494 | 326 | HOTSPOT_LD="$LD" |
ohair@494 | 327 | AC_SUBST(HOTSPOT_CXX) |
ohair@494 | 328 | AC_SUBST(HOTSPOT_LD) |
ohair@494 | 329 | |
erikj@459 | 330 | COMPILER_NAME=gcc |
erikj@459 | 331 | COMPILER_TYPE=CC |
ohair@494 | 332 | AS_IF([test "x$OPENJDK_TARGET_OS" = xwindows], [ |
erikj@459 | 333 | # For now, assume that we are always compiling using cl.exe. |
erikj@459 | 334 | CC_OUT_OPTION=-Fo |
erikj@459 | 335 | EXE_OUT_OPTION=-out: |
erikj@459 | 336 | LD_OUT_OPTION=-out: |
erikj@459 | 337 | AR_OUT_OPTION=-out: |
ohair@478 | 338 | # On Windows, reject /usr/bin/link (as determined in CYGWIN_LINK), which is a cygwin |
erikj@459 | 339 | # program for something completely different. |
ohair@478 | 340 | AC_CHECK_PROG([WINLD], [link],[link],,, [$CYGWIN_LINK]) |
erikj@459 | 341 | # Since we must ignore the first found link, WINLD will contain |
erikj@459 | 342 | # the full path to the link.exe program. |
ohair@494 | 343 | BASIC_FIXUP_EXECUTABLE(WINLD) |
ohair@478 | 344 | printf "Windows linker was found at $WINLD\n" |
ohair@478 | 345 | AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker]) |
ohair@478 | 346 | "$WINLD" --version > /dev/null |
ohair@478 | 347 | if test $? -eq 0 ; then |
ohair@478 | 348 | AC_MSG_RESULT([no]) |
ohair@478 | 349 | AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.]) |
ohair@478 | 350 | else |
ohair@478 | 351 | AC_MSG_RESULT([yes]) |
ohair@478 | 352 | fi |
erikj@459 | 353 | LD="$WINLD" |
erikj@459 | 354 | LDEXE="$WINLD" |
erikj@459 | 355 | LDCXX="$WINLD" |
erikj@459 | 356 | LDEXECXX="$WINLD" |
erikj@459 | 357 | |
erikj@459 | 358 | AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt]) |
ohair@494 | 359 | BASIC_FIXUP_EXECUTABLE(MT) |
erikj@459 | 360 | # The resource compiler |
erikj@459 | 361 | AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc]) |
ohair@494 | 362 | BASIC_FIXUP_EXECUTABLE(RC) |
erikj@459 | 363 | |
ohair@494 | 364 | # For hotspot, we need these in Windows mixed path, |
ohair@494 | 365 | # so rewrite them all. Need added .exe suffix. |
ohair@494 | 366 | HOTSPOT_CXX="$CXX.exe" |
ohair@494 | 367 | HOTSPOT_LD="$LD.exe" |
ohair@494 | 368 | HOTSPOT_MT="$MT.exe" |
ohair@494 | 369 | HOTSPOT_RC="$RC.exe" |
ohair@494 | 370 | BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_CXX) |
ohair@494 | 371 | BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_LD) |
ohair@494 | 372 | BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_MT) |
ohair@494 | 373 | BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_RC) |
ohair@494 | 374 | AC_SUBST(HOTSPOT_MT) |
ohair@494 | 375 | AC_SUBST(HOTSPOT_RC) |
ohair@494 | 376 | |
ohair@494 | 377 | RC_FLAGS="-nologo -l 0x409 -r" |
erikj@459 | 378 | AS_IF([test "x$VARIANT" = xOPT], [ |
erikj@459 | 379 | RC_FLAGS="$RC_FLAGS -d NDEBUG" |
erikj@459 | 380 | ]) |
erikj@459 | 381 | JDK_UPDATE_VERSION_NOTNULL=$JDK_UPDATE_VERSION |
erikj@459 | 382 | AS_IF([test "x$JDK_UPDATE_VERSION" = x], [ |
erikj@459 | 383 | JDK_UPDATE_VERSION_NOTNULL=0 |
erikj@459 | 384 | ]) |
erikj@459 | 385 | RC_FLAGS="$RC_FLAGS -d \"JDK_BUILD_ID=$FULL_VERSION\"" |
erikj@459 | 386 | RC_FLAGS="$RC_FLAGS -d \"JDK_COMPANY=$COMPANY_NAME\"" |
erikj@459 | 387 | RC_FLAGS="$RC_FLAGS -d \"JDK_COMPONENT=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME binary\"" |
erikj@459 | 388 | RC_FLAGS="$RC_FLAGS -d \"JDK_VER=$JDK_MINOR_VERSION.$JDK_MICRO_VERSION.$JDK_UPDATE_VERSION_NOTNULL.$COOKED_BUILD_NUMBER\"" |
erikj@459 | 389 | RC_FLAGS="$RC_FLAGS -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\"" |
erikj@459 | 390 | RC_FLAGS="$RC_FLAGS -d \"JDK_NAME=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME $JDK_MINOR_VERSION $JDK_UPDATE_META_TAG\"" |
erikj@459 | 391 | RC_FLAGS="$RC_FLAGS -d \"JDK_FVER=$JDK_MINOR_VERSION,$JDK_MICRO_VERSION,$JDK_UPDATE_VERSION_NOTNULL,$COOKED_BUILD_NUMBER\"" |
erikj@459 | 392 | |
erikj@459 | 393 | # lib.exe is used to create static libraries. |
erikj@459 | 394 | AC_CHECK_PROG([WINAR], [lib],[lib],,,) |
ohair@494 | 395 | BASIC_FIXUP_EXECUTABLE(WINAR) |
erikj@459 | 396 | AR="$WINAR" |
erikj@459 | 397 | ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT" |
erikj@459 | 398 | |
erikj@459 | 399 | AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,) |
ohair@494 | 400 | BASIC_FIXUP_EXECUTABLE(DUMPBIN) |
erikj@459 | 401 | |
erikj@459 | 402 | COMPILER_TYPE=CL |
erikj@459 | 403 | CCXXFLAGS="$CCXXFLAGS -nologo" |
erikj@459 | 404 | ]) |
erikj@459 | 405 | AC_SUBST(RC_FLAGS) |
erikj@459 | 406 | AC_SUBST(COMPILER_TYPE) |
erikj@459 | 407 | |
erikj@459 | 408 | AC_PROG_CPP |
ohair@494 | 409 | BASIC_FIXUP_EXECUTABLE(CPP) |
erikj@459 | 410 | |
erikj@459 | 411 | AC_PROG_CXXCPP |
ohair@494 | 412 | BASIC_FIXUP_EXECUTABLE(CXXCPP) |
ohair@478 | 413 | |
ohair@478 | 414 | if test "x$COMPILE_TYPE" != "xcross"; then |
ohair@478 | 415 | # If we are not cross compiling, use the same compilers for |
ohair@478 | 416 | # building the build platform executables. The cross-compilation |
ohair@478 | 417 | # case needed to be done earlier, but this can only be done after |
ohair@478 | 418 | # the native tools have been localized. |
ohair@478 | 419 | BUILD_CC="$CC" |
ohair@478 | 420 | BUILD_CXX="$CXX" |
ohair@478 | 421 | BUILD_LD="$LD" |
ohair@478 | 422 | fi |
erikj@459 | 423 | |
erikj@459 | 424 | # for solaris we really need solaris tools, and not gnu equivalent |
erikj@459 | 425 | # these seems to normally reside in /usr/ccs/bin so add that to path before |
erikj@459 | 426 | # starting to probe |
erikj@459 | 427 | # |
erikj@459 | 428 | # NOTE: I add this /usr/ccs/bin after TOOLS but before OLD_PATH |
erikj@459 | 429 | # so that it can be overriden --with-tools-dir |
erikj@459 | 430 | if test "x$OPENJDK_BUILD_OS" = xsolaris; then |
erikj@459 | 431 | PATH="${TOOLS_DIR}:/usr/ccs/bin:${OLD_PATH}" |
erikj@459 | 432 | fi |
erikj@459 | 433 | |
erikj@459 | 434 | # Find the right assembler. |
ohair@494 | 435 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
erikj@459 | 436 | AC_PATH_PROG(AS, as) |
ohair@494 | 437 | BASIC_FIXUP_EXECUTABLE(AS) |
erikj@459 | 438 | else |
erikj@459 | 439 | AS="$CC -c" |
erikj@459 | 440 | fi |
erikj@459 | 441 | AC_SUBST(AS) |
erikj@459 | 442 | |
ohair@494 | 443 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
ohair@478 | 444 | AC_PATH_PROGS(NM, [gnm nm]) |
ohair@494 | 445 | BASIC_FIXUP_EXECUTABLE(NM) |
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) |
ohair@494 | 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@459 | 453 | AC_CHECK_TOOL(STRIP, strip) |
ohair@494 | 454 | BASIC_FIXUP_EXECUTABLE(STRIP) |
erikj@459 | 455 | fi |
erikj@459 | 456 | |
ohair@494 | 457 | # objcopy is used for moving debug symbols to separate files when |
ohair@494 | 458 | # full debug symbols are enabled. |
ohair@494 | 459 | if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then |
ohair@494 | 460 | AC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy]) |
tbell@516 | 461 | # Only call fixup if objcopy was found. |
tbell@516 | 462 | if test -n "$OBJCOPY"; then |
tbell@516 | 463 | BASIC_FIXUP_EXECUTABLE(OBJCOPY) |
tbell@516 | 464 | fi |
ohair@494 | 465 | fi |
ohair@494 | 466 | |
ohair@494 | 467 | AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump]) |
ohair@494 | 468 | if test "x$OBJDUMP" != x; then |
ohair@494 | 469 | # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing. |
ohair@494 | 470 | BASIC_FIXUP_EXECUTABLE(OBJDUMP) |
erikj@459 | 471 | fi |
erikj@459 | 472 | |
ohair@478 | 473 | if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then |
ohair@478 | 474 | AC_PATH_PROG(LIPO, lipo) |
ohair@494 | 475 | BASIC_FIXUP_EXECUTABLE(LIPO) |
ohair@478 | 476 | fi |
ohair@478 | 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 | # |
erikj@459 | 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='' |
erikj@459 | 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@459 | 572 | AC_SUBST(OBJ_SUFFIX) |
erikj@459 | 573 | AC_SUBST(SHARED_LIBRARY) |
erikj@459 | 574 | AC_SUBST(STATIC_LIBRARY) |
erikj@459 | 575 | AC_SUBST(LIBRARY_PREFIX) |
erikj@459 | 576 | AC_SUBST(SHARED_LIBRARY_SUFFIX) |
erikj@459 | 577 | AC_SUBST(STATIC_LIBRARY_SUFFIX) |
erikj@459 | 578 | AC_SUBST(EXE_SUFFIX) |
erikj@459 | 579 | AC_SUBST(SHARED_LIBRARY_FLAGS) |
erikj@459 | 580 | AC_SUBST(SET_SHARED_LIBRARY_NAME) |
erikj@459 | 581 | AC_SUBST(SET_SHARED_LIBRARY_MAPFILE) |
erikj@459 | 582 | AC_SUBST(C_FLAG_REORDER) |
erikj@459 | 583 | AC_SUBST(CXX_FLAG_REORDER) |
erikj@459 | 584 | AC_SUBST(SET_SHARED_LIBRARY_ORIGIN) |
ohair@478 | 585 | AC_SUBST(SET_EXECUTABLE_ORIGIN) |
erikj@459 | 586 | AC_SUBST(POST_STRIP_CMD) |
erikj@459 | 587 | AC_SUBST(POST_MCS_CMD) |
erikj@459 | 588 | |
erikj@459 | 589 | # The (cross) compiler is now configured, we can now test capabilities |
erikj@459 | 590 | # of the target platform. |
erikj@459 | 591 | ]) |
erikj@459 | 592 | |
erikj@459 | 593 | AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION], |
erikj@459 | 594 | [ |
erikj@459 | 595 | |
erikj@459 | 596 | ############################################################################### |
erikj@459 | 597 | # |
erikj@459 | 598 | # Setup the opt flags for different compilers |
erikj@459 | 599 | # and different operating systems. |
erikj@459 | 600 | # |
ohair@478 | 601 | |
ohair@478 | 602 | # |
ohair@478 | 603 | # NOTE: check for -mstackrealign needs to be below potential addition of -m32 |
ohair@478 | 604 | # |
ohair@478 | 605 | if test "x$OPENJDK_TARGET_CPU_BITS" = x32 && test "x$OPENJDK_TARGET_OS" = xmacosx; then |
ohair@478 | 606 | # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned. |
ohair@478 | 607 | # While waiting for a better solution, the current workaround is to use -mstackrealign. |
ohair@478 | 608 | CFLAGS="$CFLAGS -mstackrealign" |
ohair@478 | 609 | AC_MSG_CHECKING([if 32-bit compiler supports -mstackrealign]) |
ohair@478 | 610 | AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])], |
ohair@478 | 611 | [ |
ohair@478 | 612 | AC_MSG_RESULT([yes]) |
ohair@478 | 613 | ], |
ohair@478 | 614 | [ |
ohair@478 | 615 | AC_MSG_RESULT([no]) |
ohair@478 | 616 | AC_MSG_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.]) |
ohair@478 | 617 | ]) |
ohair@478 | 618 | fi |
ohair@478 | 619 | |
erikj@459 | 620 | C_FLAG_DEPS="-MMD -MF" |
erikj@459 | 621 | CXX_FLAG_DEPS="-MMD -MF" |
erikj@459 | 622 | |
erikj@459 | 623 | case $COMPILER_TYPE in |
erikj@459 | 624 | CC ) |
erikj@459 | 625 | D_FLAG="-g" |
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 | CFLAGS_DEBUG_SYMBOLS="-g" |
erikj@459 | 641 | CXXFLAGS_DEBUG_SYMBOLS="-g" |
erikj@459 | 642 | if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then |
erikj@459 | 643 | CFLAGS_DEBUG_SYMBOLS="-g1" |
ohair@478 | 644 | CXXFLAGS_DEBUG_SYMBOLS="-g1" |
erikj@459 | 645 | fi |
erikj@459 | 646 | ;; |
erikj@459 | 647 | esac |
erikj@459 | 648 | CXX_O_FLAG_HI="$C_O_FLAG_HI" |
erikj@459 | 649 | CXX_O_FLAG_NORM="$C_O_FLAG_NORM" |
erikj@459 | 650 | CXX_O_FLAG_NONE="$C_O_FLAG_NONE" |
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 |
ohair@478 | 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 ) |
erikj@459 | 731 | D_FLAG= |
ohair@478 | 732 | C_O_FLAG_HIGHEST="-O2" |
ohair@478 | 733 | C_O_FLAG_HI="-O1" |
erikj@459 | 734 | C_O_FLAG_NORM="-O1" |
erikj@459 | 735 | C_O_FLAG_NONE="-Od" |
ohair@478 | 736 | CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST" |
erikj@459 | 737 | CXX_O_FLAG_HI="$C_O_FLAG_HI" |
erikj@459 | 738 | CXX_O_FLAG_NORM="$C_O_FLAG_NORM" |
erikj@459 | 739 | CXX_O_FLAG_NONE="$C_O_FLAG_NONE" |
erikj@459 | 740 | ;; |
erikj@459 | 741 | esac |
erikj@459 | 742 | |
erikj@459 | 743 | if test -z "$C_O_FLAG_HIGHEST"; then |
erikj@459 | 744 | C_O_FLAG_HIGHEST="$C_O_FLAG_HI" |
erikj@459 | 745 | fi |
erikj@459 | 746 | |
erikj@459 | 747 | if test -z "$CXX_O_FLAG_HIGHEST"; then |
erikj@459 | 748 | CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HI" |
erikj@459 | 749 | fi |
erikj@459 | 750 | |
erikj@459 | 751 | AC_SUBST(C_O_FLAG_HIGHEST) |
erikj@459 | 752 | AC_SUBST(C_O_FLAG_HI) |
erikj@459 | 753 | AC_SUBST(C_O_FLAG_NORM) |
erikj@459 | 754 | AC_SUBST(C_O_FLAG_NONE) |
erikj@459 | 755 | AC_SUBST(CXX_O_FLAG_HIGHEST) |
erikj@459 | 756 | AC_SUBST(CXX_O_FLAG_HI) |
erikj@459 | 757 | AC_SUBST(CXX_O_FLAG_NORM) |
erikj@459 | 758 | AC_SUBST(CXX_O_FLAG_NONE) |
erikj@459 | 759 | AC_SUBST(C_FLAG_DEPS) |
erikj@459 | 760 | AC_SUBST(CXX_FLAG_DEPS) |
erikj@459 | 761 | ]) |
erikj@459 | 762 | |
erikj@459 | 763 | AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_JDK], |
erikj@459 | 764 | [ |
erikj@459 | 765 | |
erikj@459 | 766 | if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then |
ohair@478 | 767 | AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags]) |
erikj@459 | 768 | fi |
erikj@459 | 769 | |
erikj@459 | 770 | if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then |
ohair@478 | 771 | AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags]) |
erikj@459 | 772 | fi |
erikj@459 | 773 | |
erikj@459 | 774 | if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then |
ohair@478 | 775 | AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags]) |
erikj@459 | 776 | fi |
erikj@459 | 777 | |
erikj@459 | 778 | AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags], |
erikj@459 | 779 | [extra flags to be used when compiling jdk c-files])]) |
erikj@459 | 780 | |
erikj@459 | 781 | AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags], |
erikj@459 | 782 | [extra flags to be used when compiling jdk c++-files])]) |
erikj@459 | 783 | |
erikj@459 | 784 | AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags], |
erikj@459 | 785 | [extra flags to be used when linking jdk])]) |
erikj@459 | 786 | |
erikj@459 | 787 | CFLAGS_JDK="${CFLAGS_JDK} $with_extra_cflags" |
erikj@459 | 788 | CXXFLAGS_JDK="${CXXFLAGS_JDK} $with_extra_cxxflags" |
erikj@459 | 789 | LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags" |
erikj@459 | 790 | |
ohair@478 | 791 | # Hotspot needs these set in their legacy form |
ohair@478 | 792 | LEGACY_EXTRA_CFLAGS=$with_extra_cflags |
ohair@478 | 793 | LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags |
ohair@478 | 794 | LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags |
ohair@478 | 795 | |
ohair@478 | 796 | AC_SUBST(LEGACY_EXTRA_CFLAGS) |
ohair@478 | 797 | AC_SUBST(LEGACY_EXTRA_CXXFLAGS) |
ohair@478 | 798 | AC_SUBST(LEGACY_EXTRA_LDFLAGS) |
ohair@478 | 799 | |
erikj@459 | 800 | ############################################################################### |
erikj@459 | 801 | # |
erikj@459 | 802 | # Now setup the CFLAGS and LDFLAGS for the JDK build. |
erikj@459 | 803 | # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build. |
erikj@459 | 804 | # |
erikj@459 | 805 | case $COMPILER_NAME in |
erikj@459 | 806 | gcc ) |
erikj@459 | 807 | CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \ |
erikj@459 | 808 | -pipe \ |
erikj@459 | 809 | -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" |
erikj@459 | 810 | case $OPENJDK_TARGET_CPU_ARCH in |
erikj@459 | 811 | arm ) |
erikj@459 | 812 | # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing |
erikj@459 | 813 | CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing" |
erikj@459 | 814 | ;; |
erikj@459 | 815 | ppc ) |
erikj@459 | 816 | # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing |
erikj@459 | 817 | ;; |
erikj@459 | 818 | * ) |
erikj@459 | 819 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fno-omit-frame-pointer" |
erikj@459 | 820 | CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing" |
erikj@459 | 821 | ;; |
erikj@459 | 822 | esac |
erikj@459 | 823 | ;; |
erikj@459 | 824 | ossc ) |
ohair@478 | 825 | CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS" |
ohair@478 | 826 | case $OPENJDK_TARGET_CPU_ARCH in |
ohair@478 | 827 | x86 ) |
ohair@494 | 828 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB" |
ohair@478 | 829 | CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE" |
ohair@478 | 830 | ;; |
ohair@478 | 831 | esac |
ohair@478 | 832 | |
ohair@478 | 833 | CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal" |
ohair@478 | 834 | CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib" |
ohair@478 | 835 | |
ohair@478 | 836 | LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext" |
ohair@478 | 837 | LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib" |
erikj@459 | 838 | ;; |
erikj@459 | 839 | cl ) |
erikj@459 | 840 | CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \ |
erikj@459 | 841 | -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \ |
erikj@459 | 842 | -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \ |
erikj@459 | 843 | -DWIN32 -DIAL" |
ohair@478 | 844 | case $OPENJDK_TARGET_CPU in |
ohair@478 | 845 | x86 ) |
erikj@459 | 846 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86" |
erikj@459 | 847 | ;; |
ohair@478 | 848 | x86_64 ) |
erikj@459 | 849 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64" |
erikj@459 | 850 | ;; |
erikj@459 | 851 | esac |
erikj@459 | 852 | ;; |
erikj@459 | 853 | esac |
erikj@459 | 854 | |
erikj@459 | 855 | ############################################################################### |
erikj@459 | 856 | |
erikj@459 | 857 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64" |
erikj@459 | 858 | |
erikj@459 | 859 | # The package path is used only on macosx? |
erikj@459 | 860 | PACKAGE_PATH=/opt/local |
erikj@459 | 861 | AC_SUBST(PACKAGE_PATH) |
erikj@459 | 862 | |
ohair@478 | 863 | if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then |
ohair@478 | 864 | # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the |
ohair@478 | 865 | # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN |
ohair@478 | 866 | # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h). |
ohair@478 | 867 | # Note: -Dmacro is the same as #define macro 1 |
ohair@478 | 868 | # -Dmacro= is the same as #define macro |
ohair@478 | 869 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
ohair@478 | 870 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN=" |
ohair@478 | 871 | else |
ohair@478 | 872 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN" |
ohair@478 | 873 | fi |
erikj@459 | 874 | else |
erikj@459 | 875 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN" |
erikj@459 | 876 | fi |
erikj@459 | 877 | if test "x$OPENJDK_TARGET_OS" = xlinux; then |
erikj@459 | 878 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DLINUX" |
erikj@459 | 879 | fi |
erikj@459 | 880 | if test "x$OPENJDK_TARGET_OS" = xwindows; then |
erikj@459 | 881 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DWINDOWS" |
erikj@459 | 882 | fi |
erikj@459 | 883 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
erikj@459 | 884 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DSOLARIS" |
erikj@459 | 885 | fi |
erikj@459 | 886 | if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
erikj@459 | 887 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE" |
erikj@631 | 888 | # Setting these parameters makes it an error to link to macosx APIs that are |
erikj@631 | 889 | # newer than the given OS version and makes the linked binaries compatible even |
erikj@631 | 890 | # if built on a newer version of the OS. |
erikj@631 | 891 | # The expected format is X.Y.Z |
erikj@631 | 892 | MACOSX_VERSION_MIN=10.7.0 |
erikj@631 | 893 | AC_SUBST(MACOSX_VERSION_MIN) |
erikj@631 | 894 | # The macro takes the version with no dots, ex: 1070 |
erikj@631 | 895 | # Let the flags variables get resolved in make for easier override on make |
erikj@631 | 896 | # command line. |
erikj@631 | 897 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" |
erikj@631 | 898 | LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" |
erikj@459 | 899 | fi |
erikj@459 | 900 | if test "x$OPENJDK_TARGET_OS" = xbsd; then |
erikj@459 | 901 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE" |
erikj@459 | 902 | fi |
erikj@459 | 903 | if test "x$DEBUG_LEVEL" = xrelease; then |
erikj@459 | 904 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG" |
ohair@478 | 905 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
ohair@478 | 906 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED" |
ohair@478 | 907 | fi |
erikj@459 | 908 | else |
erikj@459 | 909 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG" |
erikj@459 | 910 | fi |
erikj@459 | 911 | |
ohair@478 | 912 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY" |
erikj@459 | 913 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"$RELEASE\"'" |
erikj@459 | 914 | |
erikj@459 | 915 | CCXXFLAGS_JDK="$CCXXFLAGS_JDK \ |
erikj@459 | 916 | -I${JDK_OUTPUTDIR}/include \ |
erikj@459 | 917 | -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \ |
erikj@459 | 918 | -I${JDK_TOPDIR}/src/share/javavm/export \ |
ohair@478 | 919 | -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/javavm/export \ |
erikj@459 | 920 | -I${JDK_TOPDIR}/src/share/native/common \ |
ohair@478 | 921 | -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common" |
erikj@459 | 922 | |
erikj@459 | 923 | # The shared libraries are compiled using the picflag. |
erikj@459 | 924 | CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA" |
erikj@459 | 925 | CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA " |
erikj@459 | 926 | |
erikj@459 | 927 | # Executable flags |
erikj@459 | 928 | CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK" |
erikj@459 | 929 | CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK" |
erikj@459 | 930 | |
erikj@459 | 931 | # Now this is odd. The JDK native libraries have to link against libjvm.so |
erikj@459 | 932 | # On 32-bit machines there is normally two distinct libjvm.so:s, client and server. |
erikj@459 | 933 | # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library |
erikj@459 | 934 | # is identical for client and server? Yes. Which is picked at runtime (client or server)? |
erikj@459 | 935 | # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following |
erikj@459 | 936 | # libraries will link to whatever is in memory. Yuck. |
erikj@459 | 937 | # |
erikj@459 | 938 | # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh. |
ohair@494 | 939 | if test "x$COMPILER_NAME" = xcl; then |
erikj@459 | 940 | LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no" |
ohair@478 | 941 | if test "x$OPENJDK_TARGET_CPU" = xx86; then |
erikj@459 | 942 | LDFLAGS_JDK="$LDFLAGS_JDK -safeseh" |
erikj@459 | 943 | fi |
erikj@459 | 944 | # TODO: make -debug optional "--disable-full-debug-symbols" |
erikj@459 | 945 | LDFLAGS_JDK="$LDFLAGS_JDK -debug" |
erikj@459 | 946 | LDFLAGS_JDKLIB="${LDFLAGS_JDK} -dll -libpath:${JDK_OUTPUTDIR}/lib" |
erikj@459 | 947 | LDFLAGS_JDKLIB_SUFFIX="" |
erikj@459 | 948 | if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then |
erikj@459 | 949 | LDFLAGS_STACK_SIZE=1048576 |
erikj@459 | 950 | else |
erikj@459 | 951 | LDFLAGS_STACK_SIZE=327680 |
erikj@459 | 952 | fi |
erikj@459 | 953 | LDFLAGS_JDKEXE="${LDFLAGS_JDK} /STACK:$LDFLAGS_STACK_SIZE" |
erikj@459 | 954 | else |
ohair@494 | 955 | if test "x$COMPILER_NAME" = xgcc; then |
ohair@494 | 956 | # If this is a --hash-style=gnu system, use --hash-style=both, why? |
ohair@494 | 957 | HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'` |
ohair@494 | 958 | if test -n "$HAS_GNU_HASH"; then |
ohair@494 | 959 | LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both " |
ohair@494 | 960 | fi |
ohair@494 | 961 | if test "x$OPENJDK_TARGET_OS" = xlinux; then |
ohair@494 | 962 | # And since we now know that the linker is gnu, then add -z defs, to forbid |
ohair@494 | 963 | # undefined symbols in object files. |
ohair@494 | 964 | LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs" |
ohair@494 | 965 | if test "x$DEBUG_LEVEL" = "xrelease"; then |
ohair@494 | 966 | # When building release libraries, tell the linker optimize them. |
ohair@494 | 967 | # Should this be supplied to the OSS linker as well? |
ohair@494 | 968 | LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1" |
ohair@494 | 969 | fi |
erikj@459 | 970 | fi |
erikj@459 | 971 | fi |
erikj@459 | 972 | LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \ |
ohair@478 | 973 | -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}" |
ohair@478 | 974 | |
erikj@517 | 975 | # On some platforms (mac) the linker warns about non existing -L dirs. |
erikj@519 | 976 | # Add server first if available. Linking aginst client does not always produce the same results. |
dholmes@542 | 977 | # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1. |
dholmes@542 | 978 | # Default to server for other variants. |
erikj@519 | 979 | if test "x$JVM_VARIANT_SERVER" = xtrue; then |
erikj@519 | 980 | LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server" |
erikj@519 | 981 | elif test "x$JVM_VARIANT_CLIENT" = xtrue; then |
erikj@517 | 982 | LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client" |
dholmes@542 | 983 | elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then |
dholmes@542 | 984 | LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal" |
erikj@517 | 985 | else |
erikj@517 | 986 | LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server" |
erikj@517 | 987 | fi |
erikj@517 | 988 | |
ohair@478 | 989 | LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm" |
erikj@459 | 990 | if test "x$COMPILER_NAME" = xossc; then |
erikj@459 | 991 | LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc" |
erikj@459 | 992 | fi |
erikj@459 | 993 | |
erikj@459 | 994 | LDFLAGS_JDKEXE="${LDFLAGS_JDK}" |
ohair@478 | 995 | if test "x$OPENJDK_TARGET_OS" = xlinux; then |
ohair@478 | 996 | LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Xlinker --allow-shlib-undefined" |
erikj@459 | 997 | fi |
erikj@459 | 998 | fi |
erikj@459 | 999 | |
erikj@459 | 1000 | # Adjust flags according to debug level. |
erikj@459 | 1001 | case $DEBUG_LEVEL in |
erikj@459 | 1002 | fastdebug ) |
erikj@459 | 1003 | CFLAGS="$CFLAGS $D_FLAG" |
erikj@459 | 1004 | JAVAC_FLAGS="$JAVAC_FLAGS -g" |
erikj@459 | 1005 | ;; |
erikj@459 | 1006 | slowdebug ) |
erikj@459 | 1007 | CFLAGS="$CFLAGS $D_FLAG" |
erikj@459 | 1008 | C_O_FLAG_HI="$C_O_FLAG_NONE" |
erikj@459 | 1009 | C_O_FLAG_NORM="$C_O_FLAG_NONE" |
erikj@459 | 1010 | CXX_O_FLAG_HI="$CXX_O_FLAG_NONE" |
erikj@459 | 1011 | CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE" |
erikj@459 | 1012 | JAVAC_FLAGS="$JAVAC_FLAGS -g" |
erikj@459 | 1013 | ;; |
erikj@459 | 1014 | esac |
erikj@459 | 1015 | |
erikj@459 | 1016 | |
erikj@459 | 1017 | AC_SUBST(CFLAGS_JDKLIB) |
erikj@459 | 1018 | AC_SUBST(CFLAGS_JDKEXE) |
erikj@459 | 1019 | |
erikj@459 | 1020 | AC_SUBST(CXXFLAGS_JDKLIB) |
erikj@459 | 1021 | AC_SUBST(CXXFLAGS_JDKEXE) |
erikj@459 | 1022 | |
erikj@459 | 1023 | AC_SUBST(LDFLAGS_JDKLIB) |
erikj@459 | 1024 | AC_SUBST(LDFLAGS_JDKEXE) |
erikj@459 | 1025 | AC_SUBST(LDFLAGS_JDKLIB_SUFFIX) |
erikj@459 | 1026 | AC_SUBST(LDFLAGS_JDKEXE_SUFFIX) |
ohair@478 | 1027 | AC_SUBST(LDFLAGS_CXX_JDK) |
erikj@459 | 1028 | ]) |