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