toolchain.m4 revision 514:ecf751a69f6a
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" = xmacosx; 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 # Only call fixup if objcopy was found. 441 if test -n "$OBJCOPY"; then 442 BASIC_FIXUP_EXECUTABLE(OBJCOPY) 443 fi 444fi 445 446AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump]) 447if test "x$OBJDUMP" != x; then 448 # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing. 449 BASIC_FIXUP_EXECUTABLE(OBJDUMP) 450fi 451 452if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then 453 AC_PATH_PROG(LIPO, lipo) 454 BASIC_FIXUP_EXECUTABLE(LIPO) 455fi 456 457# Restore old path without tools dir 458PATH="$OLD_PATH" 459]) 460 461 462AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_LIBS], 463[ 464 465############################################################################### 466# 467# How to compile shared libraries. 468# 469 470if test "x$GCC" = xyes; then 471 COMPILER_NAME=gcc 472 PICFLAG="-fPIC" 473 LIBRARY_PREFIX=lib 474 SHARED_LIBRARY='lib[$]1.so' 475 STATIC_LIBRARY='lib[$]1.a' 476 SHARED_LIBRARY_FLAGS="-shared" 477 SHARED_LIBRARY_SUFFIX='.so' 478 STATIC_LIBRARY_SUFFIX='.a' 479 OBJ_SUFFIX='.o' 480 EXE_SUFFIX='' 481 SET_SHARED_LIBRARY_NAME='-Xlinker -soname=[$]1' 482 SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=[$]1' 483 C_FLAG_REORDER='' 484 CXX_FLAG_REORDER='' 485 SET_SHARED_LIBRARY_ORIGIN='-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1' 486 SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1' 487 LD="$CC" 488 LDEXE="$CC" 489 LDCXX="$CXX" 490 LDEXECXX="$CXX" 491 POST_STRIP_CMD="$STRIP -g" 492 493 # Linking is different on MacOSX 494 if test "x$OPENJDK_TARGET_OS" = xmacosx; then 495 # Might change in the future to clang. 496 COMPILER_NAME=gcc 497 SHARED_LIBRARY='lib[$]1.dylib' 498 SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG" 499 SHARED_LIBRARY_SUFFIX='.dylib' 500 EXE_SUFFIX='' 501 SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1' 502 SET_SHARED_LIBRARY_MAPFILE='' 503 SET_SHARED_LIBRARY_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.' 504 SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN" 505 POST_STRIP_CMD="$STRIP -S" 506 fi 507else 508 if test "x$OPENJDK_TARGET_OS" = xsolaris; then 509 # If it is not gcc, then assume it is the Oracle Solaris Studio Compiler 510 COMPILER_NAME=ossc 511 PICFLAG="-KPIC" 512 LIBRARY_PREFIX=lib 513 SHARED_LIBRARY='lib[$]1.so' 514 STATIC_LIBRARY='lib[$]1.a' 515 SHARED_LIBRARY_FLAGS="-G" 516 SHARED_LIBRARY_SUFFIX='.so' 517 STATIC_LIBRARY_SUFFIX='.a' 518 OBJ_SUFFIX='.o' 519 EXE_SUFFIX='' 520 SET_SHARED_LIBRARY_NAME='' 521 SET_SHARED_LIBRARY_MAPFILE='-M[$]1' 522 C_FLAG_REORDER='-xF' 523 CXX_FLAG_REORDER='-xF' 524 SET_SHARED_LIBRARY_ORIGIN='-R\$$$$ORIGIN[$]1' 525 SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN" 526 CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__" 527 CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__" 528 CFLAGS_JDKLIB_EXTRA='-xstrconst' 529 POST_STRIP_CMD="$STRIP -x" 530 POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\"" 531 fi 532 if test "x$OPENJDK_TARGET_OS" = xwindows; then 533 # If it is not gcc, then assume it is the MS Visual Studio compiler 534 COMPILER_NAME=cl 535 PICFLAG="" 536 LIBRARY_PREFIX= 537 SHARED_LIBRARY='[$]1.dll' 538 STATIC_LIBRARY='[$]1.lib' 539 SHARED_LIBRARY_FLAGS="-LD" 540 SHARED_LIBRARY_SUFFIX='.dll' 541 STATIC_LIBRARY_SUFFIX='.lib' 542 OBJ_SUFFIX='.obj' 543 EXE_SUFFIX='.exe' 544 SET_SHARED_LIBRARY_NAME='' 545 SET_SHARED_LIBRARY_MAPFILE='' 546 SET_SHARED_LIBRARY_ORIGIN='' 547 SET_EXECUTABLE_ORIGIN='' 548 fi 549fi 550 551AC_SUBST(OBJ_SUFFIX) 552AC_SUBST(SHARED_LIBRARY) 553AC_SUBST(STATIC_LIBRARY) 554AC_SUBST(LIBRARY_PREFIX) 555AC_SUBST(SHARED_LIBRARY_SUFFIX) 556AC_SUBST(STATIC_LIBRARY_SUFFIX) 557AC_SUBST(EXE_SUFFIX) 558AC_SUBST(SHARED_LIBRARY_FLAGS) 559AC_SUBST(SET_SHARED_LIBRARY_NAME) 560AC_SUBST(SET_SHARED_LIBRARY_MAPFILE) 561AC_SUBST(C_FLAG_REORDER) 562AC_SUBST(CXX_FLAG_REORDER) 563AC_SUBST(SET_SHARED_LIBRARY_ORIGIN) 564AC_SUBST(SET_EXECUTABLE_ORIGIN) 565AC_SUBST(POST_STRIP_CMD) 566AC_SUBST(POST_MCS_CMD) 567 568# The (cross) compiler is now configured, we can now test capabilities 569# of the target platform. 570]) 571 572AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION], 573[ 574 575############################################################################### 576# 577# Setup the opt flags for different compilers 578# and different operating systems. 579# 580 581# 582# NOTE: check for -mstackrealign needs to be below potential addition of -m32 583# 584if test "x$OPENJDK_TARGET_CPU_BITS" = x32 && test "x$OPENJDK_TARGET_OS" = xmacosx; then 585 # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned. 586 # While waiting for a better solution, the current workaround is to use -mstackrealign. 587 CFLAGS="$CFLAGS -mstackrealign" 588 AC_MSG_CHECKING([if 32-bit compiler supports -mstackrealign]) 589 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])], 590 [ 591 AC_MSG_RESULT([yes]) 592 ], 593 [ 594 AC_MSG_RESULT([no]) 595 AC_MSG_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.]) 596 ]) 597fi 598 599C_FLAG_DEPS="-MMD -MF" 600CXX_FLAG_DEPS="-MMD -MF" 601 602case $COMPILER_TYPE in 603 CC ) 604 D_FLAG="-g" 605 case $COMPILER_NAME in 606 gcc ) 607 case $OPENJDK_TARGET_OS in 608 macosx ) 609 # On MacOSX we optimize for size, something 610 # we should do for all platforms? 611 C_O_FLAG_HI="-Os" 612 C_O_FLAG_NORM="-Os" 613 C_O_FLAG_NONE="" 614 ;; 615 *) 616 C_O_FLAG_HI="-O3" 617 C_O_FLAG_NORM="-O2" 618 C_O_FLAG_NONE="-O0" 619 CFLAGS_DEBUG_SYMBOLS="-g" 620 CXXFLAGS_DEBUG_SYMBOLS="-g" 621 if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then 622 CFLAGS_DEBUG_SYMBOLS="-g1" 623 CXXFLAGS_DEBUG_SYMBOLS="-g1" 624 fi 625 ;; 626 esac 627 CXX_O_FLAG_HI="$C_O_FLAG_HI" 628 CXX_O_FLAG_NORM="$C_O_FLAG_NORM" 629 CXX_O_FLAG_NONE="$C_O_FLAG_NONE" 630 ;; 631 ossc ) 632 # 633 # Forte has different names for this with their C++ compiler... 634 # 635 C_FLAG_DEPS="-xMMD -xMF" 636 CXX_FLAG_DEPS="-xMMD -xMF" 637 638 # Extra options used with HIGHEST 639 # 640 # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be 641 # done with care, there are some assumptions below that need to 642 # be understood about the use of pointers, and IEEE behavior. 643 # 644 # Use non-standard floating point mode (not IEEE 754) 645 CC_HIGHEST="$CC_HIGHEST -fns" 646 # Do some simplification of floating point arithmetic (not IEEE 754) 647 CC_HIGHEST="$CC_HIGHEST -fsimple" 648 # Use single precision floating point with 'float' 649 CC_HIGHEST="$CC_HIGHEST -fsingle" 650 # Assume memory references via basic pointer types do not alias 651 # (Source with excessing pointer casting and data access with mixed 652 # pointer types are not recommended) 653 CC_HIGHEST="$CC_HIGHEST -xalias_level=basic" 654 # Use intrinsic or inline versions for math/std functions 655 # (If you expect perfect errno behavior, do not use this) 656 CC_HIGHEST="$CC_HIGHEST -xbuiltin=%all" 657 # Loop data dependency optimizations (need -xO3 or higher) 658 CC_HIGHEST="$CC_HIGHEST -xdepend" 659 # Pointer parameters to functions do not overlap 660 # (Similar to -xalias_level=basic usage, but less obvious sometimes. 661 # If you pass in multiple pointers to the same data, do not use this) 662 CC_HIGHEST="$CC_HIGHEST -xrestrict" 663 # Inline some library routines 664 # (If you expect perfect errno behavior, do not use this) 665 CC_HIGHEST="$CC_HIGHEST -xlibmil" 666 # Use optimized math routines 667 # (If you expect perfect errno behavior, do not use this) 668 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now 669 #CC_HIGHEST="$CC_HIGHEST -xlibmopt" 670 671 if test "x$OPENJDK_TARGET_CPU" = xsparc; then 672 CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s" 673 CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s" 674 fi 675 676 case $OPENJDK_TARGET_CPU_ARCH in 677 x86) 678 C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xregs=no%frameptr" 679 C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr" 680 C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr" 681 C_O_FLAG_NONE="-xregs=no%frameptr" 682 CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xregs=no%frameptr" 683 CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz -xregs=no%frameptr" 684 CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz -xregs=no%frameptr" 685 CXX_O_FLAG_NONE="-xregs=no%frameptr" 686 if test "x$OPENJDK_TARGET_CPU" = xx86; then 687 C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium" 688 CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium" 689 fi 690 ;; 691 sparc) 692 CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl" 693 CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl" 694 C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra" 695 C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0" 696 C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0" 697 C_O_FLAG_NONE="" 698 CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra" 699 CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0" 700 CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0" 701 CXX_O_FLAG_NONE="" 702 ;; 703 esac 704 705 CFLAGS_DEBUG_SYMBOLS="-g -xs" 706 CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs" 707 esac 708 ;; 709 CL ) 710 D_FLAG= 711 C_O_FLAG_HIGHEST="-O2" 712 C_O_FLAG_HI="-O1" 713 C_O_FLAG_NORM="-O1" 714 C_O_FLAG_NONE="-Od" 715 CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST" 716 CXX_O_FLAG_HI="$C_O_FLAG_HI" 717 CXX_O_FLAG_NORM="$C_O_FLAG_NORM" 718 CXX_O_FLAG_NONE="$C_O_FLAG_NONE" 719 ;; 720esac 721 722if test -z "$C_O_FLAG_HIGHEST"; then 723 C_O_FLAG_HIGHEST="$C_O_FLAG_HI" 724fi 725 726if test -z "$CXX_O_FLAG_HIGHEST"; then 727 CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HI" 728fi 729 730AC_SUBST(C_O_FLAG_HIGHEST) 731AC_SUBST(C_O_FLAG_HI) 732AC_SUBST(C_O_FLAG_NORM) 733AC_SUBST(C_O_FLAG_NONE) 734AC_SUBST(CXX_O_FLAG_HIGHEST) 735AC_SUBST(CXX_O_FLAG_HI) 736AC_SUBST(CXX_O_FLAG_NORM) 737AC_SUBST(CXX_O_FLAG_NONE) 738AC_SUBST(C_FLAG_DEPS) 739AC_SUBST(CXX_FLAG_DEPS) 740]) 741 742AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_JDK], 743[ 744 745if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then 746 AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags]) 747fi 748 749if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then 750 AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags]) 751fi 752 753if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then 754 AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags]) 755fi 756 757AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags], 758 [extra flags to be used when compiling jdk c-files])]) 759 760AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags], 761 [extra flags to be used when compiling jdk c++-files])]) 762 763AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags], 764 [extra flags to be used when linking jdk])]) 765 766CFLAGS_JDK="${CFLAGS_JDK} $with_extra_cflags" 767CXXFLAGS_JDK="${CXXFLAGS_JDK} $with_extra_cxxflags" 768LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags" 769 770# Hotspot needs these set in their legacy form 771LEGACY_EXTRA_CFLAGS=$with_extra_cflags 772LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags 773LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags 774 775AC_SUBST(LEGACY_EXTRA_CFLAGS) 776AC_SUBST(LEGACY_EXTRA_CXXFLAGS) 777AC_SUBST(LEGACY_EXTRA_LDFLAGS) 778 779############################################################################### 780# 781# Now setup the CFLAGS and LDFLAGS for the JDK build. 782# Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build. 783# 784case $COMPILER_NAME in 785 gcc ) 786 CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \ 787 -pipe \ 788 -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" 789 case $OPENJDK_TARGET_CPU_ARCH in 790 arm ) 791 # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing 792 CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing" 793 ;; 794 ppc ) 795 # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing 796 ;; 797 * ) 798 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fno-omit-frame-pointer" 799 CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing" 800 ;; 801 esac 802 ;; 803 ossc ) 804 CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS" 805 case $OPENJDK_TARGET_CPU_ARCH in 806 x86 ) 807 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB" 808 CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE" 809 ;; 810 esac 811 812 CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal" 813 CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib" 814 815 LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext" 816 LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib" 817 ;; 818 cl ) 819 CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \ 820 -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \ 821 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \ 822 -DWIN32 -DIAL" 823 case $OPENJDK_TARGET_CPU in 824 x86 ) 825 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86" 826 ;; 827 x86_64 ) 828 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64" 829 ;; 830 esac 831 ;; 832esac 833 834############################################################################### 835 836CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64" 837 838# The package path is used only on macosx? 839PACKAGE_PATH=/opt/local 840AC_SUBST(PACKAGE_PATH) 841 842if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then 843 # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the 844 # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN 845 # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h). 846 # Note: -Dmacro is the same as #define macro 1 847 # -Dmacro= is the same as #define macro 848 if test "x$OPENJDK_TARGET_OS" = xsolaris; then 849 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN=" 850 else 851 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN" 852 fi 853else 854 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN" 855fi 856if test "x$OPENJDK_TARGET_OS" = xlinux; then 857 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DLINUX" 858fi 859if test "x$OPENJDK_TARGET_OS" = xwindows; then 860 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DWINDOWS" 861fi 862if test "x$OPENJDK_TARGET_OS" = xsolaris; then 863 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DSOLARIS" 864fi 865if test "x$OPENJDK_TARGET_OS" = xmacosx; then 866 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE" 867fi 868if test "x$OPENJDK_TARGET_OS" = xbsd; then 869 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE" 870fi 871if test "x$DEBUG_LEVEL" = xrelease; then 872 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG" 873 if test "x$OPENJDK_TARGET_OS" = xsolaris; then 874 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED" 875 fi 876else 877 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG" 878fi 879 880CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY" 881CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"$RELEASE\"'" 882 883CCXXFLAGS_JDK="$CCXXFLAGS_JDK \ 884 -I${JDK_OUTPUTDIR}/include \ 885 -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \ 886 -I${JDK_TOPDIR}/src/share/javavm/export \ 887 -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/javavm/export \ 888 -I${JDK_TOPDIR}/src/share/native/common \ 889 -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common" 890 891# The shared libraries are compiled using the picflag. 892CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA" 893CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA " 894 895# Executable flags 896CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK" 897CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK" 898 899# Now this is odd. The JDK native libraries have to link against libjvm.so 900# On 32-bit machines there is normally two distinct libjvm.so:s, client and server. 901# Which should we link to? Are we lucky enough that the binary api to the libjvm.so library 902# is identical for client and server? Yes. Which is picked at runtime (client or server)? 903# Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following 904# libraries will link to whatever is in memory. Yuck. 905# 906# Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh. 907if test "x$COMPILER_NAME" = xcl; then 908 LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no" 909 if test "x$OPENJDK_TARGET_CPU" = xx86; then 910 LDFLAGS_JDK="$LDFLAGS_JDK -safeseh" 911 fi 912 # TODO: make -debug optional "--disable-full-debug-symbols" 913 LDFLAGS_JDK="$LDFLAGS_JDK -debug" 914 LDFLAGS_JDKLIB="${LDFLAGS_JDK} -dll -libpath:${JDK_OUTPUTDIR}/lib" 915 LDFLAGS_JDKLIB_SUFFIX="" 916 if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then 917 LDFLAGS_STACK_SIZE=1048576 918 else 919 LDFLAGS_STACK_SIZE=327680 920 fi 921 LDFLAGS_JDKEXE="${LDFLAGS_JDK} /STACK:$LDFLAGS_STACK_SIZE" 922else 923 if test "x$COMPILER_NAME" = xgcc; then 924 # If this is a --hash-style=gnu system, use --hash-style=both, why? 925 HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'` 926 if test -n "$HAS_GNU_HASH"; then 927 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both " 928 fi 929 if test "x$OPENJDK_TARGET_OS" = xlinux; then 930 # And since we now know that the linker is gnu, then add -z defs, to forbid 931 # undefined symbols in object files. 932 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs" 933 if test "x$DEBUG_LEVEL" = "xrelease"; then 934 # When building release libraries, tell the linker optimize them. 935 # Should this be supplied to the OSS linker as well? 936 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1" 937 fi 938 fi 939 fi 940 LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \ 941 -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server \ 942 -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client \ 943 -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}" 944 945 LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm" 946 if test "x$COMPILER_NAME" = xossc; then 947 LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc" 948 fi 949 950 LDFLAGS_JDKEXE="${LDFLAGS_JDK}" 951 if test "x$OPENJDK_TARGET_OS" = xlinux; then 952 LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Xlinker --allow-shlib-undefined" 953 fi 954fi 955 956# Adjust flags according to debug level. 957case $DEBUG_LEVEL in 958 fastdebug ) 959 CFLAGS="$CFLAGS $D_FLAG" 960 JAVAC_FLAGS="$JAVAC_FLAGS -g" 961 ;; 962 slowdebug ) 963 CFLAGS="$CFLAGS $D_FLAG" 964 C_O_FLAG_HI="$C_O_FLAG_NONE" 965 C_O_FLAG_NORM="$C_O_FLAG_NONE" 966 CXX_O_FLAG_HI="$CXX_O_FLAG_NONE" 967 CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE" 968 JAVAC_FLAGS="$JAVAC_FLAGS -g" 969 ;; 970esac 971 972 973AC_SUBST(CFLAGS_JDKLIB) 974AC_SUBST(CFLAGS_JDKEXE) 975 976AC_SUBST(CXXFLAGS_JDKLIB) 977AC_SUBST(CXXFLAGS_JDKEXE) 978 979AC_SUBST(LDFLAGS_JDKLIB) 980AC_SUBST(LDFLAGS_JDKEXE) 981AC_SUBST(LDFLAGS_JDKLIB_SUFFIX) 982AC_SUBST(LDFLAGS_JDKEXE_SUFFIX) 983AC_SUBST(LDFLAGS_CXX_JDK) 984]) 985