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