common/autoconf/toolchain.m4

Tue, 20 Mar 2018 09:19:10 -0700

author
kevinw
date
Tue, 20 Mar 2018 09:19:10 -0700
changeset 2204
0e87966d7ff1
parent 2172
a0101c7abbb9
child 2206
7ba4e17574e0
permissions
-rw-r--r--

8031759: Improved tool overriding in configure
Reviewed-by: ihse, tbell, mduigou, erikj

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

mercurial