annotate common/autoconf/flags.m4 @ 22730:c6ac76f2c90c

8019729: JDK build HIGHEST compiler optimisation setting isn't valid for Sun C++ compiler Reviewed-by: tbell
author erikj
date Wed, 05 Mar 2014 10:21:38 +0100
parents 63761da45392
children 85635b5bf0a6
rev   line source
erikj@13133 1 #
ihse@22721 2 # Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
erikj@13133 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@13133 4 #
erikj@13133 5 # This code is free software; you can redistribute it and/or modify it
erikj@13133 6 # under the terms of the GNU General Public License version 2 only, as
erikj@13133 7 # published by the Free Software Foundation. Oracle designates this
erikj@13133 8 # particular file as subject to the "Classpath" exception as provided
erikj@13133 9 # by Oracle in the LICENSE file that accompanied this code.
erikj@13133 10 #
erikj@13133 11 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@13133 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@13133 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@13133 14 # version 2 for more details (a copy is included in the LICENSE file that
erikj@13133 15 # accompanied this code).
erikj@13133 16 #
erikj@13133 17 # You should have received a copy of the GNU General Public License version
erikj@13133 18 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@13133 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@13133 20 #
erikj@13133 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@13133 22 # or visit www.oracle.com if you need additional information or have any
erikj@13133 23 # questions.
erikj@13133 24 #
erikj@13133 25
ihse@22721 26 AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
erikj@13133 27 [
ihse@22721 28 # Option used to tell the compiler whether to create 32- or 64-bit executables
ihse@22721 29 if test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@22721 30 COMPILER_TARGET_BITS_FLAG="-q"
ohair@14111 31 else
ihse@22721 32 COMPILER_TARGET_BITS_FLAG="-m"
ohair@14111 33 fi
kvn@22467 34 AC_SUBST(COMPILER_TARGET_BITS_FLAG)
simonis@22466 35
ihse@22721 36 # FIXME: figure out if we should select AR flags depending on OS or toolchain.
ihse@20363 37 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
erikj@13133 38 ARFLAGS="-r"
kvn@22467 39 elif test "x$OPENJDK_TARGET_OS" = xaix; then
simonis@22466 40 ARFLAGS="-X64"
ihse@22721 41 elif test "x$OPENJDK_TARGET_OS" = xwindows; then
ihse@22721 42 # lib.exe is used as AR to create static libraries.
ihse@22721 43 ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
ihse@20363 44 else
erikj@13133 45 ARFLAGS=""
ihse@20363 46 fi
ihse@20363 47 AC_SUBST(ARFLAGS)
erikj@13133 48
ihse@22721 49 ## Setup strip.
ihse@22721 50 # FIXME: should this really be per platform, or should it be per toolchain type?
ihse@22721 51 # strip is not provided by clang or solstudio; so guessing platform makes most sense.
ihse@22721 52 # FIXME: we should really only export STRIPFLAGS from here, not POST_STRIP_CMD.
ihse@22721 53 if test "x$OPENJDK_TARGET_OS" = xlinux; then
ihse@22721 54 STRIPFLAGS="-g"
ihse@22721 55 elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
ihse@22721 56 STRIPFLAGS="-x"
ihse@22721 57 elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
ihse@22721 58 STRIPFLAGS="-S"
ihse@22721 59 elif test "x$OPENJDK_TARGET_OS" = xaix; then
ihse@22721 60 STRIPFLAGS="-X32_64"
ihse@22721 61 fi
ohair@14111 62
ihse@22721 63 if test "x$OPENJDK_TARGET_OS" != xwindows; then
ihse@22721 64 POST_STRIP_CMD="$STRIP $STRIPFLAGS"
ihse@22721 65 fi
ihse@22721 66 AC_SUBST(POST_STRIP_CMD)
ihse@22721 67
ihse@22721 68 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
ihse@22721 69 # FIXME: break out into MCSFLAGS
ihse@22721 70 POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\""
ihse@22721 71 fi
ihse@22721 72 AC_SUBST(POST_MCS_CMD)
ihse@22721 73
ihse@22721 74 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
erikj@13133 75 CC_OUT_OPTION=-Fo
erikj@13133 76 EXE_OUT_OPTION=-out:
erikj@13133 77 LD_OUT_OPTION=-out:
erikj@13133 78 AR_OUT_OPTION=-out:
ihse@22721 79 else
ihse@22721 80 # The option used to specify the target .o,.a or .so file.
ihse@22721 81 # When compiling, how to specify the to be created object file.
ihse@22721 82 CC_OUT_OPTION='-o$(SPACE)'
ihse@22721 83 # When linking, how to specify the to be created executable.
ihse@22721 84 EXE_OUT_OPTION='-o$(SPACE)'
ihse@22721 85 # When linking, how to specify the to be created dynamically linkable library.
ihse@22721 86 LD_OUT_OPTION='-o$(SPACE)'
ihse@22721 87 # When archiving, how to specify the to be create static archive for object files.
ihse@22721 88 AR_OUT_OPTION='rcs$(SPACE)'
ihse@22721 89 fi
ihse@22721 90 AC_SUBST(CC_OUT_OPTION)
ihse@22721 91 AC_SUBST(EXE_OUT_OPTION)
ihse@22721 92 AC_SUBST(LD_OUT_OPTION)
ihse@22721 93 AC_SUBST(AR_OUT_OPTION)
ihse@22721 94
ihse@22721 95 # On Windows, we need to set RC flags.
ihse@22721 96 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@22721 97 RC_FLAGS="-nologo -l 0x409 -r"
ihse@22721 98 if test "x$VARIANT" = xOPT; then
ihse@22721 99 RC_FLAGS="$RC_FLAGS -d NDEBUG"
ohair@13697 100 fi
erikj@13133 101
ihse@22721 102 # The version variables used to create RC_FLAGS may be overridden
ihse@22721 103 # in a custom configure script, or possibly the command line.
ihse@22721 104 # Let those variables be expanded at make time in spec.gmk.
ihse@22721 105 # The \$ are escaped to the shell, and the $(...) variables
ihse@22721 106 # are evaluated by make.
ihse@22721 107 RC_FLAGS="$RC_FLAGS \
ihse@22721 108 -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \
ihse@22721 109 -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \
ihse@22721 110 -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
ihse@22721 111 -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \
ihse@22721 112 -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
ihse@22721 113 -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \
ihse@22721 114 -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\""
ihse@22721 115 fi
ihse@22721 116 AC_SUBST(RC_FLAGS)
erikj@13133 117
ihse@22721 118 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@22721 119 # FIXME: likely bug, should be CCXXFLAGS_JDK? or one for C or CXX.
ihse@22721 120 CCXXFLAGS="$CCXXFLAGS -nologo"
ihse@20363 121 fi
erikj@13133 122 ])
erikj@13133 123
ihse@22721 124 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
erikj@13133 125 [
ihse@20363 126 ###############################################################################
ihse@20363 127 #
ihse@20363 128 # How to compile shared libraries.
ihse@20363 129 #
erikj@13133 130
ihse@22721 131 if test "x$TOOLCHAIN_TYPE" = xgcc; then
erikj@13133 132 PICFLAG="-fPIC"
erikj@13133 133 C_FLAG_REORDER=''
erikj@13133 134 CXX_FLAG_REORDER=''
erikj@13133 135
ohair@14111 136 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ihse@22721 137 # Linking is different on MacOSX
ihse@20363 138 SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
ihse@22721 139 SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
ihse@22721 140 SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
ihse@20363 141 SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1'
ihse@20363 142 SET_SHARED_LIBRARY_MAPFILE=''
ihse@22721 143 else
ihse@22721 144 # Default works for linux, might work on other platforms as well.
ihse@22721 145 SHARED_LIBRARY_FLAGS='-shared'
ihse@22721 146 SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1'
ihse@22721 147 SET_SHARED_LIBRARY_ORIGIN="-Xlinker -z -Xlinker origin $SET_EXECUTABLE_ORIGIN"
ihse@22721 148 SET_SHARED_LIBRARY_NAME='-Xlinker -soname=[$]1'
ihse@22721 149 SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=[$]1'
erikj@13133 150 fi
ihse@22721 151 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@22721 152 PICFLAG="-KPIC"
ihse@22721 153 C_FLAG_REORDER='-xF'
ihse@22721 154 CXX_FLAG_REORDER='-xF'
ihse@22721 155 SHARED_LIBRARY_FLAGS="-G"
ihse@22721 156 SET_EXECUTABLE_ORIGIN='-R\$$$$ORIGIN[$]1'
ihse@22721 157 SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
ihse@22721 158 SET_SHARED_LIBRARY_NAME=''
ihse@22721 159 SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
ihse@22721 160 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@22721 161 PICFLAG="-qpic=large"
ihse@22721 162 C_FLAG_REORDER=''
ihse@22721 163 CXX_FLAG_REORDER=''
ihse@22721 164 SHARED_LIBRARY_FLAGS="-qmkshrobj"
ihse@22721 165 SET_EXECUTABLE_ORIGIN=""
ihse@22721 166 SET_SHARED_LIBRARY_ORIGIN=''
ihse@22721 167 SET_SHARED_LIBRARY_NAME=''
ihse@22721 168 SET_SHARED_LIBRARY_MAPFILE=''
ihse@22721 169 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@22721 170 PICFLAG=""
ihse@22721 171 C_FLAG_REORDER=''
ihse@22721 172 CXX_FLAG_REORDER=''
ihse@22721 173 SHARED_LIBRARY_FLAGS="-LD"
ihse@22721 174 SET_EXECUTABLE_ORIGIN=''
ihse@22721 175 SET_SHARED_LIBRARY_ORIGIN=''
ihse@22721 176 SET_SHARED_LIBRARY_NAME=''
ihse@22721 177 SET_SHARED_LIBRARY_MAPFILE=''
ihse@20363 178 fi
erikj@13133 179
ihse@22721 180 AC_SUBST(C_FLAG_REORDER)
ihse@22721 181 AC_SUBST(CXX_FLAG_REORDER)
ihse@20363 182 AC_SUBST(SHARED_LIBRARY_FLAGS)
ihse@22721 183 AC_SUBST(SET_EXECUTABLE_ORIGIN)
ihse@22721 184 AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
ihse@20363 185 AC_SUBST(SET_SHARED_LIBRARY_NAME)
ihse@20363 186 AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
erikj@13133 187
ihse@22721 188 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
ihse@22721 189 CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
ihse@22721 190 CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
ihse@22721 191 CFLAGS_JDKLIB_EXTRA='-xstrconst'
ihse@22721 192 fi
ihse@20363 193 # The (cross) compiler is now configured, we can now test capabilities
ihse@20363 194 # of the target platform.
erikj@13133 195 ])
erikj@13133 196
ihse@22721 197 # Documentation on common flags used for solstudio in HIGHEST.
ihse@22721 198 #
ihse@22721 199 # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
ihse@22721 200 # done with care, there are some assumptions below that need to
ihse@22721 201 # be understood about the use of pointers, and IEEE behavior.
ihse@22721 202 #
ihse@22721 203 # -fns: Use non-standard floating point mode (not IEEE 754)
ihse@22721 204 # -fsimple: Do some simplification of floating point arithmetic (not IEEE 754)
ihse@22721 205 # -fsingle: Use single precision floating point with 'float'
ihse@22721 206 # -xalias_level=basic: Assume memory references via basic pointer types do not alias
ihse@22721 207 # (Source with excessing pointer casting and data access with mixed
ihse@22721 208 # pointer types are not recommended)
ihse@22721 209 # -xbuiltin=%all: Use intrinsic or inline versions for math/std functions
ihse@22721 210 # (If you expect perfect errno behavior, do not use this)
ihse@22721 211 # -xdepend: Loop data dependency optimizations (need -xO3 or higher)
ihse@22721 212 # -xrestrict: Pointer parameters to functions do not overlap
ihse@22721 213 # (Similar to -xalias_level=basic usage, but less obvious sometimes.
ihse@22721 214 # If you pass in multiple pointers to the same data, do not use this)
ihse@22721 215 # -xlibmil: Inline some library routines
ihse@22721 216 # (If you expect perfect errno behavior, do not use this)
ihse@22721 217 # -xlibmopt: Use optimized math routines (CURRENTLY DISABLED)
ihse@22721 218 # (If you expect perfect errno behavior, do not use this)
ihse@22721 219 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
ihse@22721 220
ihse@22721 221 # FIXME: this will never happen since sparc != sparcv9, ie 32 bit, which we don't build anymore.
ihse@22721 222 # Bug?
ihse@22721 223 #if test "x$OPENJDK_TARGET_CPU" = xsparc; then
ihse@22721 224 # CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
ihse@22721 225 # CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
ihse@22721 226 #fi
ihse@22721 227
ihse@22721 228 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
erikj@13133 229 [
erikj@13133 230
ihse@20363 231 ###############################################################################
ihse@20363 232 #
ihse@20363 233 # Setup the opt flags for different compilers
ihse@20363 234 # and different operating systems.
ihse@20363 235 #
ohair@13697 236
ihse@22721 237 # FIXME: this was indirectly the old default, but just inherited.
ihse@22721 238 # if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@22721 239 # C_FLAG_DEPS="-MMD -MF"
ihse@22721 240 # fi
ihse@22721 241
ihse@22721 242 # Generate make dependency files
ihse@22721 243 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@22721 244 C_FLAG_DEPS="-MMD -MF"
ihse@22721 245 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@22721 246 C_FLAG_DEPS="-xMMD -xMF"
ihse@22721 247 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@22721 248 C_FLAG_DEPS="-qmakedep=gcc -MF"
ihse@20363 249 fi
ihse@22721 250 CXX_FLAG_DEPS="$C_FLAG_DEPS"
ihse@22721 251 AC_SUBST(C_FLAG_DEPS)
ihse@22721 252 AC_SUBST(CXX_FLAG_DEPS)
ohair@13697 253
ihse@22721 254 # Debug symbols
ihse@22721 255 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@22721 256 if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
ihse@22721 257 CFLAGS_DEBUG_SYMBOLS="-g1"
ihse@22721 258 CXXFLAGS_DEBUG_SYMBOLS="-g1"
ihse@22721 259 else
ihse@22721 260 CFLAGS_DEBUG_SYMBOLS="-g"
ihse@22721 261 CXXFLAGS_DEBUG_SYMBOLS="-g"
ihse@22721 262 fi
ihse@22721 263 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@22721 264 CFLAGS_DEBUG_SYMBOLS="-g -xs"
ihse@22721 265 CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
ihse@22721 266 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@22721 267 CFLAGS_DEBUG_SYMBOLS="-g"
ihse@22721 268 CXXFLAGS_DEBUG_SYMBOLS="-g"
ihse@22721 269 fi
ihse@22721 270 AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
ihse@22721 271 AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
erikj@13133 272
ihse@22721 273 # Optimization levels
ihse@22721 274 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
erikj@22730 275 CC_HIGHEST="$CC_HIGHEST -fns -fsimple -fsingle -xbuiltin=%all -xdepend -xrestrict -xlibmil"
erikj@13133 276
ihse@22721 277 if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
ihse@22721 278 # FIXME: seems we always set -xregs=no%frameptr; put it elsewhere more global?
erikj@22730 279 C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xalias_level=basic -xregs=no%frameptr"
ihse@22721 280 C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr"
ihse@22721 281 C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr"
ihse@22721 282 C_O_FLAG_NONE="-xregs=no%frameptr"
ihse@22721 283 CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xregs=no%frameptr"
ihse@22721 284 CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz -xregs=no%frameptr"
ihse@22721 285 CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz -xregs=no%frameptr"
ihse@22721 286 CXX_O_FLAG_NONE="-xregs=no%frameptr"
ihse@22721 287 if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then
ihse@22721 288 C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium"
ihse@22721 289 CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium"
ihse@22721 290 fi
ihse@22721 291 elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
erikj@22730 292 C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xalias_level=basic -xprefetch=auto,explicit -xchip=ultra"
ihse@22721 293 C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
ihse@22721 294 C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
ihse@22721 295 C_O_FLAG_NONE=""
ihse@22721 296 CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
ihse@22721 297 CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
ihse@22721 298 CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
ihse@22721 299 CXX_O_FLAG_NONE=""
ihse@22721 300 fi
ihse@22721 301 else
ihse@22721 302 # The remaining toolchains share opt flags between CC and CXX;
ihse@22721 303 # setup for C and duplicate afterwards.
ihse@22721 304 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@22721 305 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ihse@22721 306 # On MacOSX we optimize for size, something
ihse@22721 307 # we should do for all platforms?
ihse@22721 308 C_O_FLAG_HIGHEST="-Os"
ihse@22721 309 C_O_FLAG_HI="-Os"
ihse@22721 310 C_O_FLAG_NORM="-Os"
ihse@22721 311 C_O_FLAG_NONE=""
ihse@22721 312 else
ihse@22721 313 C_O_FLAG_HIGHEST="-O3"
ihse@22721 314 C_O_FLAG_HI="-O3"
ihse@22721 315 C_O_FLAG_NORM="-O2"
ihse@22721 316 C_O_FLAG_NONE="-O0"
ihse@22721 317 fi
ihse@22721 318 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@22721 319 C_O_FLAG_HIGHEST="-O3"
ihse@22721 320 C_O_FLAG_HI="-O3 -qstrict"
ihse@22721 321 C_O_FLAG_NORM="-O2"
ihse@22721 322 C_O_FLAG_NONE=""
ihse@22721 323 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@20363 324 C_O_FLAG_HIGHEST="-O2"
ihse@20363 325 C_O_FLAG_HI="-O1"
ihse@20363 326 C_O_FLAG_NORM="-O1"
ihse@20363 327 C_O_FLAG_NONE="-Od"
ihse@22721 328 fi
ihse@22721 329 CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
ihse@22721 330 CXX_O_FLAG_HI="$C_O_FLAG_HI"
ihse@22721 331 CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
ihse@22721 332 CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
ihse@20363 333 fi
erikj@13133 334
ihse@20363 335 AC_SUBST(C_O_FLAG_HIGHEST)
ihse@20363 336 AC_SUBST(C_O_FLAG_HI)
ihse@20363 337 AC_SUBST(C_O_FLAG_NORM)
ihse@20363 338 AC_SUBST(C_O_FLAG_NONE)
ihse@20363 339 AC_SUBST(CXX_O_FLAG_HIGHEST)
ihse@20363 340 AC_SUBST(CXX_O_FLAG_HI)
ihse@20363 341 AC_SUBST(CXX_O_FLAG_NORM)
ihse@20363 342 AC_SUBST(CXX_O_FLAG_NONE)
erikj@13133 343 ])
erikj@13133 344
ihse@22721 345 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
erikj@13133 346 [
ihse@22721 347 # Special extras...
ihse@22721 348 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@22721 349 if test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
ihse@22721 350 CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
ihse@22721 351 CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
ihse@22721 352 fi
ihse@22721 353 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@22721 354 LDFLAGS_JDK="${LDFLAGS_JDK} -q64 -brtl -bnolibpath -liconv -bexpall"
ihse@22721 355 CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
ihse@22721 356 CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
ihse@22721 357 fi
erikj@13133 358
ihse@20363 359 if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
ihse@20363 360 AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
ihse@20363 361 fi
erikj@13133 362
ihse@20363 363 if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then
ihse@20363 364 AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
ihse@20363 365 fi
erikj@13133 366
ihse@20363 367 if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
ihse@20363 368 AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
ihse@20363 369 fi
erikj@13133 370
ihse@20363 371 AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
ihse@20363 372 [extra flags to be used when compiling jdk c-files])])
erikj@13133 373
ihse@20363 374 AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
ihse@20363 375 [extra flags to be used when compiling jdk c++-files])])
erikj@13133 376
ihse@20363 377 AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
ihse@20363 378 [extra flags to be used when linking jdk])])
erikj@13133 379
ihse@20363 380 CFLAGS_JDK="${CFLAGS_JDK} $with_extra_cflags"
ihse@20363 381 CXXFLAGS_JDK="${CXXFLAGS_JDK} $with_extra_cxxflags"
ihse@20363 382 LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags"
erikj@13133 383
ihse@20363 384 # Hotspot needs these set in their legacy form
ihse@20363 385 LEGACY_EXTRA_CFLAGS=$with_extra_cflags
ihse@20363 386 LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags
ihse@20363 387 LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags
ohair@13697 388
ihse@20363 389 AC_SUBST(LEGACY_EXTRA_CFLAGS)
ihse@20363 390 AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
ihse@20363 391 AC_SUBST(LEGACY_EXTRA_LDFLAGS)
ohair@13697 392
ihse@20363 393 ###############################################################################
ihse@20363 394 #
ihse@20363 395 # Now setup the CFLAGS and LDFLAGS for the JDK build.
ihse@20363 396 # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
ihse@20363 397 #
ohair@13697 398
ihse@22721 399 # Setup compiler/platform specific flags to CFLAGS_JDK,
ihse@22721 400 # CXXFLAGS_JDK and CCXXFLAGS_JDK (common to C and CXX?)
ihse@22721 401 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@22721 402 # these options are used for both C and C++ compiles
ihse@22721 403 CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Wall -Wno-parentheses -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
ihse@22721 404 -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
ihse@22721 405 case $OPENJDK_TARGET_CPU_ARCH in
ihse@22721 406 arm )
ihse@22721 407 # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing
ihse@22721 408 CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
ihse@22721 409 ;;
ihse@22721 410 ppc )
ihse@22721 411 # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing
ihse@22721 412 ;;
ihse@22721 413 * )
ihse@22721 414 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fno-omit-frame-pointer"
ihse@22721 415 CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
ihse@22721 416 ;;
ihse@22721 417 esac
ihse@22721 418 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@22721 419 CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
ihse@22721 420 if test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then
ihse@22721 421 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
ihse@22721 422 CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
ihse@22721 423 fi
ihse@22721 424
ihse@22721 425 CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
ihse@22721 426 CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
ihse@22721 427 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@22721 428 CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
ihse@22721 429 CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
ihse@22721 430 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@22721 431 CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
ihse@22721 432 -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
ihse@22721 433 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
ihse@22721 434 -DWIN32 -DIAL"
ihse@22721 435 if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
ihse@22721 436 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64"
ihse@22721 437 else
ihse@22721 438 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86"
ihse@22721 439 fi
ihse@22721 440 fi
erikj@13133 441
ihse@20363 442 ###############################################################################
erikj@13133 443
ihse@20363 444 # Adjust flags according to debug level.
ihse@20363 445 case $DEBUG_LEVEL in
ihse@20363 446 fastdebug )
ihse@20363 447 CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS"
ihse@20363 448 CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS"
ihse@20363 449 C_O_FLAG_HI="$C_O_FLAG_NORM"
ihse@20363 450 C_O_FLAG_NORM="$C_O_FLAG_NORM"
ihse@20363 451 CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
ihse@20363 452 CXX_O_FLAG_NORM="$CXX_O_FLAG_NORM"
ihse@20363 453 JAVAC_FLAGS="$JAVAC_FLAGS -g"
ihse@20363 454 ;;
ihse@20363 455 slowdebug )
ihse@20363 456 CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS"
ihse@20363 457 CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS"
ihse@20363 458 C_O_FLAG_HI="$C_O_FLAG_NONE"
ihse@20363 459 C_O_FLAG_NORM="$C_O_FLAG_NONE"
ihse@20363 460 CXX_O_FLAG_HI="$CXX_O_FLAG_NONE"
ihse@20363 461 CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE"
ihse@20363 462 JAVAC_FLAGS="$JAVAC_FLAGS -g"
ihse@20363 463 ;;
ihse@20363 464 esac
erikj@18020 465
ihse@22721 466 # Setup LP64
ihse@20363 467 CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
erikj@13133 468
ihse@22721 469 # Set some common defines. These works for all compilers, but assume
ihse@22721 470 # -D is universally accepted.
erikj@13133 471
ihse@22721 472 # Setup endianness
ihse@20363 473 if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
ohair@13697 474 # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
ohair@13697 475 # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
ohair@13697 476 # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
ohair@13697 477 # Note: -Dmacro is the same as #define macro 1
ihse@20363 478 # -Dmacro= is the same as #define macro
ohair@13697 479 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
ihse@20363 480 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
ohair@13697 481 else
ihse@20363 482 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
ohair@13697 483 fi
ihse@20363 484 else
erikj@13133 485 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
ihse@20363 486 fi
ihse@22721 487
ihse@22721 488 # Setup target OS define. Use OS target name but in upper case.
ihse@22721 489 OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
ihse@22721 490 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
ihse@22721 491
ihse@22721 492 # Setup target CPU
ihse@22721 493 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
ihse@22721 494
ihse@22721 495 # Setup debug/release defines
ihse@20363 496 if test "x$DEBUG_LEVEL" = xrelease; then
erikj@13133 497 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"
ihse@22721 498 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
ihse@22721 499 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED"
ihse@22721 500 fi
ihse@20363 501 else
erikj@13133 502 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG"
ihse@20363 503 fi
erikj@13133 504
ihse@22721 505 # Setup release name
erikj@22035 506 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'"
erikj@13133 507
ihse@22721 508
ihse@22721 509 # Set some additional per-OS defines.
ihse@22721 510 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ihse@22721 511 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
ihse@22721 512 elif test "x$OPENJDK_TARGET_OS" = xaix; then
ihse@22721 513 # FIXME: PPC64 should not be here.
ihse@22721 514 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DPPC64"
ihse@22721 515 elif test "x$OPENJDK_TARGET_OS" = xbsd; then
ihse@22721 516 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_ALLBSD_SOURCE"
ihse@22721 517 fi
ihse@22721 518
ihse@22721 519 # Additional macosx handling
ihse@22721 520 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ihse@22721 521 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@22721 522 # FIXME: This needs to be exported in spec.gmk due to closed legacy code.
ihse@22721 523 # FIXME: clean this up, and/or move it elsewhere.
ihse@22721 524
ihse@22721 525 # Setting these parameters makes it an error to link to macosx APIs that are
ihse@22721 526 # newer than the given OS version and makes the linked binaries compatible
ihse@22721 527 # even if built on a newer version of the OS.
ihse@22721 528 # The expected format is X.Y.Z
ihse@22721 529 MACOSX_VERSION_MIN=10.7.0
ihse@22721 530 AC_SUBST(MACOSX_VERSION_MIN)
ihse@22721 531
ihse@22721 532 # The macro takes the version with no dots, ex: 1070
ihse@22721 533 # Let the flags variables get resolved in make for easier override on make
ihse@22721 534 # command line.
ihse@22721 535 CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
ihse@22721 536 LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
ihse@22721 537 fi
ihse@22721 538 fi
ihse@22721 539
ihse@22721 540 # Setup some hard coded includes
ihse@20363 541 CCXXFLAGS_JDK="$CCXXFLAGS_JDK \
ihse@20363 542 -I${JDK_OUTPUTDIR}/include \
ihse@20363 543 -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \
ihse@20363 544 -I${JDK_TOPDIR}/src/share/javavm/export \
dholmes@21055 545 -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_EXPORT_DIR/javavm/export \
ihse@20363 546 -I${JDK_TOPDIR}/src/share/native/common \
ihse@20363 547 -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common"
erikj@13133 548
ihse@20363 549 # The shared libraries are compiled using the picflag.
ihse@20363 550 CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
ihse@20363 551 CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA "
erikj@13133 552
ihse@20363 553 # Executable flags
ihse@20363 554 CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK"
ihse@20363 555 CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK"
erikj@13133 556
ihse@22721 557 AC_SUBST(CFLAGS_JDKLIB)
ihse@22721 558 AC_SUBST(CFLAGS_JDKEXE)
ihse@22721 559 AC_SUBST(CXXFLAGS_JDKLIB)
ihse@22721 560 AC_SUBST(CXXFLAGS_JDKEXE)
ihse@22721 561
ihse@22721 562 # Setup LDFLAGS et al.
ihse@22721 563 #
ihse@20363 564 # Now this is odd. The JDK native libraries have to link against libjvm.so
ihse@20363 565 # On 32-bit machines there is normally two distinct libjvm.so:s, client and server.
ihse@20363 566 # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library
ihse@20363 567 # is identical for client and server? Yes. Which is picked at runtime (client or server)?
ihse@20363 568 # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following
ihse@20363 569 # libraries will link to whatever is in memory. Yuck.
ihse@20363 570 #
ihse@20363 571 # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
ihse@22721 572 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
erikj@13133 573 LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
ihse@22721 574 if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then
ihse@20363 575 LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
erikj@13133 576 fi
erikj@13133 577 # TODO: make -debug optional "--disable-full-debug-symbols"
erikj@13133 578 LDFLAGS_JDK="$LDFLAGS_JDK -debug"
erikj@13133 579 LDFLAGS_JDKLIB="${LDFLAGS_JDK} -dll -libpath:${JDK_OUTPUTDIR}/lib"
erikj@13133 580 LDFLAGS_JDKLIB_SUFFIX=""
erikj@13133 581 if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
ihse@20363 582 LDFLAGS_STACK_SIZE=1048576
erikj@13133 583 else
ihse@20363 584 LDFLAGS_STACK_SIZE=327680
erikj@13133 585 fi
erikj@13133 586 LDFLAGS_JDKEXE="${LDFLAGS_JDK} /STACK:$LDFLAGS_STACK_SIZE"
ihse@20363 587 else
ihse@22721 588 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@20363 589 # If this is a --hash-style=gnu system, use --hash-style=both, why?
ihse@22721 590 # We have previously set HAS_GNU_HASH if this is the case
ihse@20363 591 if test -n "$HAS_GNU_HASH"; then
ihse@20363 592 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both "
ihse@20363 593 fi
ihse@20363 594 if test "x$OPENJDK_TARGET_OS" = xlinux; then
ihse@20363 595 # And since we now know that the linker is gnu, then add -z defs, to forbid
ihse@20363 596 # undefined symbols in object files.
ihse@20363 597 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs"
ihse@20363 598 if test "x$DEBUG_LEVEL" = "xrelease"; then
ihse@20363 599 # When building release libraries, tell the linker optimize them.
ihse@20363 600 # Should this be supplied to the OSS linker as well?
ihse@20363 601 LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1"
ohair@14111 602 fi
ihse@20363 603 fi
erikj@13133 604 fi
ihse@22721 605
ihse@22721 606 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@22721 607 LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext"
ihse@22721 608 LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib"
ihse@22721 609 fi
ihse@22721 610
erikj@13133 611 LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \
ihse@20363 612 -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
ohair@13697 613
erikj@14465 614 # On some platforms (mac) the linker warns about non existing -L dirs.
erikj@14467 615 # Add server first if available. Linking aginst client does not always produce the same results.
dholmes@14810 616 # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
dholmes@14810 617 # Default to server for other variants.
erikj@14467 618 if test "x$JVM_VARIANT_SERVER" = xtrue; then
ihse@20363 619 LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
erikj@14467 620 elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
ihse@20363 621 LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
dholmes@14810 622 elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
ihse@20363 623 LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
erikj@14465 624 else
ihse@20363 625 LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
erikj@14465 626 fi
erikj@14465 627
ohair@13697 628 LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
ihse@22721 629 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@20363 630 LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc"
erikj@13133 631 fi
erikj@13133 632
erikj@13133 633 LDFLAGS_JDKEXE="${LDFLAGS_JDK}"
ohair@13697 634 if test "x$OPENJDK_TARGET_OS" = xlinux; then
ihse@20363 635 LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Xlinker --allow-shlib-undefined"
erikj@13133 636 fi
ihse@20363 637 fi
ihse@20363 638 AC_SUBST(LDFLAGS_JDKLIB)
ihse@20363 639 AC_SUBST(LDFLAGS_JDKEXE)
ihse@20363 640 AC_SUBST(LDFLAGS_JDKLIB_SUFFIX)
ihse@20363 641 AC_SUBST(LDFLAGS_JDKEXE_SUFFIX)
ihse@20363 642 AC_SUBST(LDFLAGS_CXX_JDK)
erikj@13133 643 ])
erikj@16987 644
erikj@16987 645
ihse@22721 646 # FLAGS_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
erikj@16987 647 # [RUN-IF-FALSE])
erikj@16987 648 # ------------------------------------------------------------
erikj@16987 649 # Check that the c and c++ compilers support an argument
ihse@22721 650 AC_DEFUN([FLAGS_COMPILER_CHECK_ARGUMENTS],
erikj@16987 651 [
erikj@16987 652 AC_MSG_CHECKING([if compiler supports "$1"])
erikj@16987 653 supports=yes
erikj@16987 654
erikj@16987 655 saved_cflags="$CFLAGS"
erikj@16987 656 CFLAGS="$CFLAGS $1"
erikj@16987 657 AC_LANG_PUSH([C])
ihse@20363 658 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
ihse@20363 659 [supports=no])
erikj@16987 660 AC_LANG_POP([C])
erikj@16987 661 CFLAGS="$saved_cflags"
erikj@16987 662
erikj@16987 663 saved_cxxflags="$CXXFLAGS"
erikj@16987 664 CXXFLAGS="$CXXFLAG $1"
erikj@16987 665 AC_LANG_PUSH([C++])
ihse@20363 666 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
ihse@20363 667 [supports=no])
erikj@16987 668 AC_LANG_POP([C++])
erikj@16987 669 CXXFLAGS="$saved_cxxflags"
erikj@16987 670
erikj@16987 671 AC_MSG_RESULT([$supports])
erikj@16987 672 if test "x$supports" = "xyes" ; then
erikj@16987 673 m4_ifval([$2], [$2], [:])
erikj@16987 674 else
erikj@16987 675 m4_ifval([$3], [$3], [:])
erikj@16987 676 fi
erikj@16987 677 ])
erikj@16987 678
ihse@22721 679 AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
erikj@16987 680 [
erikj@16987 681 # Some Zero and Shark settings.
erikj@16987 682 # ZERO_ARCHFLAG tells the compiler which mode to build for
erikj@16987 683 case "${OPENJDK_TARGET_CPU}" in
erikj@16987 684 s390)
simonis@22466 685 ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}31"
erikj@16987 686 ;;
erikj@16987 687 *)
simonis@22466 688 ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
erikj@16987 689 esac
ihse@22721 690 FLAGS_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""])
erikj@16987 691 AC_SUBST(ZERO_ARCHFLAG)
erikj@16987 692
simonis@22466 693 # Check that the compiler supports -mX (or -qX on AIX) flags
erikj@16987 694 # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
ihse@22721 695 FLAGS_COMPILER_CHECK_ARGUMENTS([${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
ihse@20363 696 [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
ihse@20363 697 [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
erikj@16987 698 AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
erikj@16987 699 ])