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