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