common/autoconf/toolchain.m4

changeset 494
e64f2cb57d05
parent 478
2ba6f4da4bf3
child 495
e3182741ade2
     1.1 --- a/common/autoconf/toolchain.m4	Wed Oct 24 13:11:42 2012 -0700
     1.2 +++ b/common/autoconf/toolchain.m4	Fri Oct 26 14:29:57 2012 -0700
     1.3 @@ -23,111 +23,67 @@
     1.4  # questions.
     1.5  #
     1.6  
     1.7 -AC_DEFUN_ONCE([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
     1.8 +# $1 = compiler to test (CC or CXX)
     1.9 +# $2 = human readable name of compiler (C or C++)
    1.10 +AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION],
    1.11  [
    1.12 +  COMPILER=[$]$1
    1.13 +  COMPILER_NAME=$2
    1.14  
    1.15 -# Check if the VS env variables were setup prior to running configure.
    1.16 -# If not, then find vcvarsall.bat and run it automatically, and integrate
    1.17 -# the set env variables into the spec file.
    1.18 -SETUPDEVENV="# No special vars"
    1.19 -if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
    1.20 -    # Store path to cygwin link.exe to help excluding it when searching for 
    1.21 -    # VS linker.
    1.22 -    AC_PATH_PROG(CYGWIN_LINK, link)
    1.23 -    AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
    1.24 -    "$CYGWIN_LINK" --version > /dev/null
    1.25 -    if test $? -eq 0 ; then
    1.26 -      AC_MSG_RESULT([yes])
    1.27 +  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
    1.28 +    # Make sure we use the Sun Studio compiler and not gcc on Solaris, which won't work
    1.29 +    COMPILER_VERSION_TEST=`$COMPILER -V 2>&1 | $HEAD -n 1`
    1.30 +    $ECHO $COMPILER_VERSION_TEST | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null
    1.31 +    if test $? -ne 0; then
    1.32 +      GCC_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
    1.33 +      
    1.34 +      AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required Sun Studio compiler.])
    1.35 +      AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_TEST" and with --version: "$GCC_VERSION_TEST"])
    1.36 +      AC_MSG_ERROR([Sun Studio compiler is required. Try setting --with-tools-dir.])
    1.37      else
    1.38 -      AC_MSG_RESULT([no])
    1.39 -      # This might be the VS linker. Don't exclude it later on.
    1.40 -      CYGWIN_LINK=""
    1.41 +      COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*@<:@ ,\t@:>@$COMPILER_NAME@<:@ ,\t@:>@\(@<:@1-9@:>@\.@<:@0-9@:>@@<:@0-9@:>@*\).*/\1/p"`
    1.42 +      COMPILER_VENDOR="Sun Studio"
    1.43 +    fi
    1.44 +  elif test  "x$OPENJDK_TARGET_OS" = xwindows; then
    1.45 +    # First line typically looks something like:
    1.46 +    # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
    1.47 +    COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1`
    1.48 +    COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*Version \(@<:@1-9@:>@@<:@0-9.@:>@*\) .*/\1/p"`
    1.49 +    COMPILER_VENDOR="Microsoft CL.EXE"
    1.50 +    COMPILER_CPU_TEST=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* for \(.*\)$/\1/p"`
    1.51 +    if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
    1.52 +      if test "x$COMPILER_CPU_TEST" != "x80x86"; then
    1.53 +        AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86".])
    1.54 +      fi
    1.55 +    elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
    1.56 +      if test "x$COMPILER_CPU_TEST" != "xx64"; then
    1.57 +        AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "x64".])
    1.58 +      fi
    1.59 +    fi
    1.60 +  else
    1.61 +    COMPILER_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
    1.62 +    # Check that this is likely to be GCC.
    1.63 +    $COMPILER --version 2>&1 | $GREP "Free Software Foundation" > /dev/null
    1.64 +    if test $? -ne 0; then
    1.65 +      AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required GCC compiler.])
    1.66 +      AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION_TEST"])
    1.67 +      AC_MSG_ERROR([GCC compiler is required. Try setting --with-tools-dir.])
    1.68      fi
    1.69      
    1.70 -    # If vcvarsall.bat has been run, then VCINSTALLDIR is set.
    1.71 -    if test "x$VCINSTALLDIR" != x; then
    1.72 -        # No further setup is needed. The build will happen from this kind
    1.73 -        # of shell.
    1.74 -        SETUPDEVENV="# This spec file expects that you are running bash from within a VS command prompt."
    1.75 -        # Make sure to remind you, if you forget to run make from a cygwin bash shell
    1.76 -        # that is spawned "bash -l" from a VS command prompt.
    1.77 -        CHECK_FOR_VCINSTALLDIR=yes
    1.78 -        AC_MSG_CHECKING([if you are running from within a VS command prompt])
    1.79 -        AC_MSG_RESULT([yes])
    1.80 -    else
    1.81 -        # Ah, we have not yet run vcvarsall.bat/vsvars32.bat/vsvars64.bat. Lets do that. First find it.
    1.82 -        if test "x$VS100COMNTOOLS" != x; then
    1.83 -            VARSBAT=`find "$VS100COMNTOOLS/../.." -name vcvarsall.bat`
    1.84 -	    SEARCH_ROOT="$VS100COMNTOOLS"
    1.85 -        else
    1.86 -            VARSBAT=`find "$PROGRAMFILES" -name vcvarsall.bat`
    1.87 -	    SEARCH_ROOT="$PROGRAMFILES"
    1.88 -        fi
    1.89 -        VCPATH=`dirname "$VARSBAT"`
    1.90 -        VCPATH=`cygpath -w "$VCPATH"`
    1.91 -	if test "x$VARSBAT" = x || test ! -d "$VCPATH"; then
    1.92 -            AC_MSG_CHECKING([if we can find the VS installation])
    1.93 -            AC_MSG_RESULT([no])
    1.94 -            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.])
    1.95 -        fi
    1.96 -        case "$OPENJDK_TARGET_CPU" in
    1.97 -          x86)
    1.98 -            VARSBAT_ARCH=x86
    1.99 -            ;;
   1.100 -          x86_64)
   1.101 -            VARSBAT_ARCH=amd64
   1.102 -            ;;
   1.103 -        esac
   1.104 -        # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
   1.105 -        cd $OUTPUT_ROOT
   1.106 -        bash $SRC_ROOT/common/bin/extractvcvars.sh "$VARSBAT" "$VARSBAT_ARCH"
   1.107 -	cd $CURDIR
   1.108 -	if test ! -s $OUTPUT_ROOT/localdevenv.sh || test ! -s $OUTPUT_ROOT/localdevenv.gmk; then
   1.109 -            AC_MSG_CHECKING([if we can extract the needed env variables])
   1.110 -            AC_MSG_RESULT([no])
   1.111 -            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.])
   1.112 -        fi 
   1.113 -        # Now set all paths and other env variables. This will allow the rest of 
   1.114 -        # the configure script to find and run the compiler in the proper way.
   1.115 -        . $OUTPUT_ROOT/localdevenv.sh
   1.116 -        AC_MSG_CHECKING([if we can find the VS installation])
   1.117 -	if test "x$VCINSTALLDIR" != x; then 
   1.118 -            AC_MSG_RESULT([$VCINSTALLDIR])
   1.119 -        else 
   1.120 -            AC_MSG_RESULT([no])
   1.121 -            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.])
   1.122 -        fi
   1.123 -        CHECK_FOR_VCINSTALLDIR=no
   1.124 -	SETUPDEVENV="include $OUTPUT_ROOT/localdevenv.gmk"
   1.125 +    # First line typically looks something like:
   1.126 +    # gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
   1.127 +    COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/p"`
   1.128 +    COMPILER_VENDOR=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^\(.*\) @<:@1-9@:>@@<:@0-9.@:>@*/\1/p"`
   1.129 +  fi
   1.130 +  # This sets CC_VERSION or CXX_VERSION. (This comment is a grep marker)
   1.131 +  $1_VERSION="$COMPILER_VERSION"
   1.132 +  # This sets CC_VENDOR or CXX_VENDOR. (This comment is a grep marker)
   1.133 +  $1_VENDOR="$COMPILER_VENDOR"
   1.134  
   1.135 -	AC_MSG_CHECKING([for msvcr100.dll])
   1.136 -        AC_ARG_WITH(msvcr100dll, [AS_HELP_STRING([--with-msvcr100dll],
   1.137 -            [copy this msvcr100.dll into the built JDK])])
   1.138 -        if test "x$with_msvcr100dll" != x; then
   1.139 -            MSVCR100DLL="$with_msvcr100dll"
   1.140 -        else
   1.141 -            if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   1.142 -                MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | grep x64 | head --lines 1`
   1.143 -            else
   1.144 -                MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | grep x86 | grep -v ia64 | grep -v x64 | head --lines 1`
   1.145 -                if test "x$MSVCR100DLL" = x; then
   1.146 -                    MSVCR100DLL=`find "$VCINSTALLDIR/.." -name msvcr100.dll | head --lines 1`
   1.147 -                fi
   1.148 -            fi
   1.149 -        fi
   1.150 -	if test "x$MSVCR100DLL" = x; then
   1.151 -           AC_MSG_RESULT([no])
   1.152 -	   AC_MSG_ERROR([Could not find msvcr100.dll !])
   1.153 -        fi
   1.154 -        AC_MSG_RESULT([$MSVCR100DLL])
   1.155 -	SPACESAFE(MSVCR100DLL,[the path to msvcr100.dll])
   1.156 -    fi
   1.157 -fi
   1.158 -AC_SUBST(SETUPDEVENV)
   1.159 -AC_SUBST(CHECK_FOR_VCINSTALLDIR)
   1.160 -AC_SUBST(MSVCR100DLL)
   1.161 +  AC_MSG_NOTICE([Using $COMPILER_VENDOR $COMPILER_NAME compiler version $COMPILER_VERSION (located at $COMPILER)])
   1.162  ])
   1.163  
   1.164 +
   1.165  AC_DEFUN_ONCE([TOOLCHAIN_SETUP_SYSROOT_AND_OUT_OPTIONS],
   1.166  [
   1.167  ###############################################################################
   1.168 @@ -151,8 +107,67 @@
   1.169  AC_SUBST(AR_OUT_OPTION)
   1.170  ])
   1.171  
   1.172 -AC_DEFUN_ONCE([TOOLCHAIN_SETUP_PATHS],
   1.173 +# $1 = compiler to test (CC or CXX)
   1.174 +# $2 = human readable name of compiler (C or C++)
   1.175 +# $3 = list of compiler names to search for
   1.176 +AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
   1.177  [
   1.178 +  COMPILER_NAME=$2
   1.179 +
   1.180 +  # Do a first initial attempt at searching the list of compiler names.
   1.181 +  # AC_PATH_PROGS can't be run multiple times with the same variable,
   1.182 +  # so create a new name for this run.
   1.183 +  AC_PATH_PROGS(POTENTIAL_$1, $3)
   1.184 +  $1=$POTENTIAL_$1
   1.185 +
   1.186 +  if test "x$[$]$1" = x; then
   1.187 +      HELP_MSG_MISSING_DEPENDENCY([devkit])
   1.188 +      AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
   1.189 +  fi
   1.190 +  BASIC_FIXUP_EXECUTABLE($1)
   1.191 +  AC_MSG_CHECKING([resolved symbolic links for $1])
   1.192 +  TEST_COMPILER="[$]$1"
   1.193 +  BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
   1.194 +  AC_MSG_RESULT([$TEST_COMPILER])
   1.195 +  AC_MSG_CHECKING([if $1 is disguised ccache])
   1.196 +  
   1.197 +  COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"`
   1.198 +  if test "x$COMPILER_BASENAME" = "xccache"; then
   1.199 +    AC_MSG_RESULT([yes, trying to find proper $COMPILER_NAME compiler])
   1.200 +    # We /usr/lib/ccache in the path, so cc is a symlink to /usr/bin/ccache.
   1.201 +    # We want to control ccache invocation ourselves, so ignore this cc and try
   1.202 +    # searching again.
   1.203 +
   1.204 +    # Remove the path to the fake ccache cc from the PATH
   1.205 +    RETRY_COMPILER_SAVED_PATH="$PATH"
   1.206 +    COMPILER_DIRNAME=`$DIRNAME [$]$1`
   1.207 +    PATH="`$ECHO $PATH | $SED -e "s,$COMPILER_DIRNAME,,g" -e "s,::,:,g" -e "s,^:,,g"`"
   1.208 +
   1.209 +    # Try again looking for our compiler
   1.210 +    AC_CHECK_TOOLS(PROPER_COMPILER_$1, $3)
   1.211 +    BASIC_FIXUP_EXECUTABLE(PROPER_COMPILER_$1)
   1.212 +    PATH="$RETRY_COMPILER_SAVED_PATH"
   1.213 +
   1.214 +    AC_MSG_CHECKING([for resolved symbolic links for $1])
   1.215 +    BASIC_REMOVE_SYMBOLIC_LINKS(PROPER_COMPILER_$1)
   1.216 +    AC_MSG_RESULT([$PROPER_COMPILER_$1])
   1.217 +    $1="$PROPER_COMPILER_$1"
   1.218 +  else
   1.219 +    AC_MSG_RESULT([no, keeping $1])
   1.220 +    $1="$TEST_COMPILER"
   1.221 +  fi
   1.222 +  TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME])
   1.223 +])
   1.224 +
   1.225 +
   1.226 +AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
   1.227 +[
   1.228 +if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   1.229 +  TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
   1.230 +fi
   1.231 +
   1.232 +AC_SUBST(MSVCR_DLL)
   1.233 +
   1.234  # If --build AND --host is set, then the configure script will find any
   1.235  # cross compilation tools in the PATH. Cross compilation tools
   1.236  # follows the cross compilation standard where they are prefixed with ${host}.
   1.237 @@ -171,11 +186,11 @@
   1.238      # Otherwise, we'll set the BUILD_tools to the native tools, but that'll have
   1.239      # to wait until they are properly discovered.
   1.240      AC_PATH_PROGS(BUILD_CC, [cl cc gcc])
   1.241 -    SET_FULL_PATH(BUILD_CC)
   1.242 +    BASIC_FIXUP_EXECUTABLE(BUILD_CC)
   1.243      AC_PATH_PROGS(BUILD_CXX, [cl CC g++])
   1.244 -    SET_FULL_PATH(BUILD_CXX)
   1.245 +    BASIC_FIXUP_EXECUTABLE(BUILD_CXX)
   1.246      AC_PATH_PROG(BUILD_LD, ld)
   1.247 -    SET_FULL_PATH(BUILD_LD)
   1.248 +    BASIC_FIXUP_EXECUTABLE(BUILD_LD)
   1.249  fi
   1.250  AC_SUBST(BUILD_CC)
   1.251  AC_SUBST(BUILD_CXX)
   1.252 @@ -218,36 +233,40 @@
   1.253    PATH=$TOOLS_DIR:$PATH
   1.254  fi
   1.255  
   1.256 +
   1.257 +### Locate C compiler (CC)
   1.258 +
   1.259  # gcc is almost always present, but on Windows we
   1.260  # prefer cl.exe and on Solaris we prefer CC.
   1.261  # Thus test for them in this order.
   1.262 -AC_PROG_CC([cl cc gcc])
   1.263 -if test "x$CC" = x; then
   1.264 -    HELP_MSG_MISSING_DEPENDENCY([devkit])
   1.265 -    AC_MSG_ERROR([Could not find a compiler. $HELP_MSG])
   1.266 -fi
   1.267 -if test "x$CC" = xcc && test "x$OPENJDK_BUILD_OS" = xmacosx; then
   1.268 -    # Do not use cc on MacOSX use gcc instead.
   1.269 -    CC="gcc"
   1.270 -fi
   1.271 -SET_FULL_PATH(CC)
   1.272 -
   1.273 -AC_PROG_CXX([cl CC g++])
   1.274 -if test "x$CXX" = xCC && test "x$OPENJDK_BUILD_OS" = xmacosx; then
   1.275 -    # The found CC, even though it seems to be a g++ derivate, cannot compile
   1.276 -    # c++ code. Override.
   1.277 -    CXX="g++"
   1.278 -fi
   1.279 -SET_FULL_PATH(CXX)
   1.280 -
   1.281 -if test "x$CXX" = x || test "x$CC" = x; then
   1.282 -    HELP_MSG_MISSING_DEPENDENCY([devkit])
   1.283 -    AC_MSG_ERROR([Could not find the needed compilers! $HELP_MSG ])
   1.284 +if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   1.285 +  # Do not probe for cc on MacOSX.
   1.286 +  COMPILER_CHECK_LIST="cl gcc"
   1.287 +else
   1.288 +  COMPILER_CHECK_LIST="cl cc gcc"
   1.289  fi
   1.290  
   1.291 -if test "x$OPENJDK_BUILD_OS" != xwindows; then
   1.292 +TOOLCHAIN_FIND_COMPILER([CC],[C],[$COMPILER_CHECK_LIST])
   1.293 +# Now that we have resolved CC ourself, let autoconf have it's go at it
   1.294 +AC_PROG_CC([$CC])
   1.295 +
   1.296 +### Locate C++ compiler (CXX)
   1.297 +
   1.298 +if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   1.299 +  # Do not probe for CC on MacOSX.
   1.300 +  COMPILER_CHECK_LIST="cl g++"
   1.301 +else
   1.302 +  COMPILER_CHECK_LIST="cl CC g++"
   1.303 +fi
   1.304 +TOOLCHAIN_FIND_COMPILER([CXX],[C++],[$COMPILER_CHECK_LIST])
   1.305 +# Now that we have resolved CXX ourself, let autoconf have it's go at it
   1.306 +AC_PROG_CXX([$CXX])
   1.307 +
   1.308 +### Locate other tools
   1.309 +
   1.310 +if test "x$OPENJDK_TARGET_OS" != xwindows; then
   1.311      AC_PROG_OBJC
   1.312 -    SET_FULL_PATH(OBJC)
   1.313 +    BASIC_FIXUP_EXECUTABLE(OBJC)
   1.314  else
   1.315      OBJC=
   1.316  fi
   1.317 @@ -270,20 +289,26 @@
   1.318  # Linking C++ executables.
   1.319  AC_SUBST(LDEXECXX)
   1.320  
   1.321 -if test "x$OPENJDK_BUILD_OS" != xwindows; then
   1.322 +if test "x$OPENJDK_TARGET_OS" != xwindows; then
   1.323      AC_CHECK_TOOL(AR, ar)
   1.324 -    SET_FULL_PATH(AR)
   1.325 +    BASIC_FIXUP_EXECUTABLE(AR)
   1.326  fi
   1.327 -if test "x$OPENJDK_BUILD_OS" = xmacosx; then
   1.328 +if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   1.329      ARFLAGS="-r"
   1.330  else
   1.331      ARFLAGS=""
   1.332  fi
   1.333  AC_SUBST(ARFLAGS)
   1.334  
   1.335 +# For hotspot, we need these in Windows mixed path; other platforms keep them the same
   1.336 +HOTSPOT_CXX="$CXX"
   1.337 +HOTSPOT_LD="$LD"
   1.338 +AC_SUBST(HOTSPOT_CXX)
   1.339 +AC_SUBST(HOTSPOT_LD)
   1.340 +
   1.341  COMPILER_NAME=gcc
   1.342  COMPILER_TYPE=CC
   1.343 -AS_IF([test "x$OPENJDK_BUILD_OS" = xwindows], [
   1.344 +AS_IF([test "x$OPENJDK_TARGET_OS" = xwindows], [
   1.345      # For now, assume that we are always compiling using cl.exe. 
   1.346      CC_OUT_OPTION=-Fo
   1.347      EXE_OUT_OPTION=-out:
   1.348 @@ -294,7 +319,7 @@
   1.349      AC_CHECK_PROG([WINLD], [link],[link],,, [$CYGWIN_LINK])
   1.350      # Since we must ignore the first found link, WINLD will contain
   1.351      # the full path to the link.exe program.
   1.352 -    SET_FULL_PATH_SPACESAFE([WINLD])
   1.353 +    BASIC_FIXUP_EXECUTABLE(WINLD)
   1.354      printf "Windows linker was found at $WINLD\n"
   1.355      AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
   1.356      "$WINLD" --version > /dev/null
   1.357 @@ -310,12 +335,25 @@
   1.358      LDEXECXX="$WINLD"
   1.359  
   1.360      AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt])
   1.361 -    SET_FULL_PATH_SPACESAFE([MT])
   1.362 +    BASIC_FIXUP_EXECUTABLE(MT)
   1.363      # The resource compiler
   1.364      AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc])
   1.365 -    SET_FULL_PATH_SPACESAFE([RC])
   1.366 +    BASIC_FIXUP_EXECUTABLE(RC)
   1.367  
   1.368 -    RC_FLAGS="-nologo /l 0x409 /r"
   1.369 +    # For hotspot, we need these in Windows mixed path,
   1.370 +    # so rewrite them all. Need added .exe suffix.
   1.371 +    HOTSPOT_CXX="$CXX.exe"
   1.372 +    HOTSPOT_LD="$LD.exe"
   1.373 +    HOTSPOT_MT="$MT.exe"
   1.374 +    HOTSPOT_RC="$RC.exe"
   1.375 +    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_CXX)
   1.376 +    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_LD)
   1.377 +    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_MT)
   1.378 +    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_RC)
   1.379 +    AC_SUBST(HOTSPOT_MT)
   1.380 +    AC_SUBST(HOTSPOT_RC)
   1.381 +
   1.382 +    RC_FLAGS="-nologo -l 0x409 -r"
   1.383      AS_IF([test "x$VARIANT" = xOPT], [
   1.384          RC_FLAGS="$RC_FLAGS -d NDEBUG"
   1.385      ])
   1.386 @@ -333,12 +371,12 @@
   1.387  
   1.388      # lib.exe is used to create static libraries.
   1.389      AC_CHECK_PROG([WINAR], [lib],[lib],,,)
   1.390 -    SET_FULL_PATH_SPACESAFE([WINAR])
   1.391 +    BASIC_FIXUP_EXECUTABLE(WINAR)
   1.392      AR="$WINAR"
   1.393      ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
   1.394  
   1.395      AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,)
   1.396 -    SET_FULL_PATH_SPACESAFE([DUMPBIN])
   1.397 +    BASIC_FIXUP_EXECUTABLE(DUMPBIN)
   1.398  
   1.399      COMPILER_TYPE=CL
   1.400      CCXXFLAGS="$CCXXFLAGS -nologo"
   1.401 @@ -347,10 +385,10 @@
   1.402  AC_SUBST(COMPILER_TYPE)
   1.403  
   1.404  AC_PROG_CPP
   1.405 -SET_FULL_PATH(CPP)
   1.406 +BASIC_FIXUP_EXECUTABLE(CPP)
   1.407  
   1.408  AC_PROG_CXXCPP
   1.409 -SET_FULL_PATH(CXXCPP)
   1.410 +BASIC_FIXUP_EXECUTABLE(CXXCPP)
   1.411  
   1.412  if test "x$COMPILE_TYPE" != "xcross"; then
   1.413      # If we are not cross compiling, use the same compilers for
   1.414 @@ -373,43 +411,44 @@
   1.415  fi
   1.416  
   1.417  # Find the right assembler.
   1.418 -if test "x$OPENJDK_BUILD_OS" = xsolaris; then
   1.419 +if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   1.420      AC_PATH_PROG(AS, as)
   1.421 -    SET_FULL_PATH(AS)
   1.422 +    BASIC_FIXUP_EXECUTABLE(AS)
   1.423  else
   1.424      AS="$CC -c"
   1.425  fi
   1.426  AC_SUBST(AS)
   1.427  
   1.428 -if test "x$OPENJDK_BUILD_OS" = xsolaris; then
   1.429 +if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   1.430      AC_PATH_PROGS(NM, [gnm nm])
   1.431 -    SET_FULL_PATH(NM)
   1.432 +    BASIC_FIXUP_EXECUTABLE(NM)
   1.433      AC_PATH_PROG(STRIP, strip)
   1.434 -    SET_FULL_PATH(STRIP)
   1.435 +    BASIC_FIXUP_EXECUTABLE(STRIP)
   1.436      AC_PATH_PROG(MCS, mcs)
   1.437 -    SET_FULL_PATH(MCS)
   1.438 -elif test "x$OPENJDK_BUILD_OS" != xwindows; then
   1.439 +    BASIC_FIXUP_EXECUTABLE(MCS)
   1.440 +elif test "x$OPENJDK_TARGET_OS" != xwindows; then
   1.441      AC_CHECK_TOOL(NM, nm)
   1.442 -    SET_FULL_PATH(NM)
   1.443 +    BASIC_FIXUP_EXECUTABLE(NM)
   1.444      AC_CHECK_TOOL(STRIP, strip)
   1.445 -    SET_FULL_PATH(STRIP)
   1.446 +    BASIC_FIXUP_EXECUTABLE(STRIP)
   1.447  fi
   1.448  
   1.449 -###
   1.450 -#
   1.451 -# Check for objcopy
   1.452 -#
   1.453 -#   but search for gobjcopy first...
   1.454 -#   since I on solaris found a broken objcopy...buhh
   1.455 -#
   1.456 -AC_PATH_TOOL(OBJCOPY, gobjcopy)
   1.457 -if test "x$OBJCOPY" = x; then
   1.458 -   AC_PATH_TOOL(OBJCOPY, objcopy)
   1.459 +# objcopy is used for moving debug symbols to separate files when
   1.460 +# full debug symbols are enabled.
   1.461 +if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
   1.462 +    AC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
   1.463 +    BASIC_FIXUP_EXECUTABLE(OBJCOPY)
   1.464 +fi
   1.465 +
   1.466 +AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
   1.467 +if test "x$OBJDUMP" != x; then
   1.468 +  # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing.
   1.469 +  BASIC_FIXUP_EXECUTABLE(OBJDUMP)
   1.470  fi
   1.471  
   1.472  if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
   1.473     AC_PATH_PROG(LIPO, lipo)
   1.474 -   SET_FULL_PATH(LIPO)
   1.475 +   BASIC_FIXUP_EXECUTABLE(LIPO)
   1.476  fi
   1.477  
   1.478  # Restore old path without tools dir
   1.479 @@ -449,7 +488,7 @@
   1.480      POST_STRIP_CMD="$STRIP -g"
   1.481  
   1.482      # Linking is different on MacOSX
   1.483 -    if test "x$OPENJDK_BUILD_OS" = xmacosx; then
   1.484 +    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   1.485          # Might change in the future to clang.
   1.486          COMPILER_NAME=gcc
   1.487          SHARED_LIBRARY='lib[$]1.dylib'
   1.488 @@ -463,7 +502,7 @@
   1.489          POST_STRIP_CMD="$STRIP -S"
   1.490      fi
   1.491  else
   1.492 -    if test "x$OPENJDK_BUILD_OS" = xsolaris; then
   1.493 +    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   1.494          # If it is not gcc, then assume it is the Oracle Solaris Studio Compiler
   1.495          COMPILER_NAME=ossc
   1.496          PICFLAG="-KPIC"
   1.497 @@ -487,7 +526,7 @@
   1.498          POST_STRIP_CMD="$STRIP -x"
   1.499          POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\""
   1.500      fi
   1.501 -    if test "x$OPENJDK_BUILD_OS" = xwindows; then
   1.502 +    if test "x$OPENJDK_TARGET_OS" = xwindows; then
   1.503          # If it is not gcc, then assume it is the MS Visual Studio compiler
   1.504          COMPILER_NAME=cl
   1.505          PICFLAG=""
   1.506 @@ -626,6 +665,11 @@
   1.507          #  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
   1.508          #CC_HIGHEST="$CC_HIGHEST -xlibmopt"
   1.509  
   1.510 +        if test "x$OPENJDK_TARGET_CPU" = xsparc; then
   1.511 +          CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
   1.512 +          CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
   1.513 +        fi
   1.514 +
   1.515          case $OPENJDK_TARGET_CPU_ARCH in
   1.516            x86)
   1.517              C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xregs=no%frameptr"
   1.518 @@ -642,8 +686,6 @@
   1.519              fi
   1.520              ;;
   1.521            sparc)
   1.522 -            CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
   1.523 -            CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
   1.524              CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
   1.525              CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
   1.526              C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
   1.527 @@ -759,7 +801,7 @@
   1.528            CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
   1.529            case $OPENJDK_TARGET_CPU_ARCH in
   1.530            x86 )
   1.531 -            CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -Di386"
   1.532 +            CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
   1.533         	    CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
   1.534            ;;
   1.535            esac
   1.536 @@ -859,7 +901,7 @@
   1.537  # libraries will link to whatever is in memory. Yuck. 
   1.538  #
   1.539  # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
   1.540 -if test "x$COMPILER_TYPE" = xCL; then
   1.541 +if test "x$COMPILER_NAME" = xcl; then
   1.542      LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
   1.543      if test "x$OPENJDK_TARGET_CPU" = xx86; then 
   1.544          LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
   1.545 @@ -875,19 +917,23 @@
   1.546      fi
   1.547      LDFLAGS_JDKEXE="${LDFLAGS_JDK} /STACK:$LDFLAGS_STACK_SIZE"
   1.548  else
   1.549 -    # If this is a --hash-style=gnu system, use --hash-style=both, why?
   1.550 -    HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
   1.551 -    if test -n "$HAS_GNU_HASH"; then
   1.552 -        # And since we now know that the linker is gnu, then add -z defs, to forbid
   1.553 -        # undefined symbols in object files.
   1.554 -        LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both -Xlinker -z -Xlinker defs"
   1.555 -        if test "x$DEBUG_LEVEL" == "xrelease"; then
   1.556 -            # When building release libraries, tell the linker optimize them.
   1.557 -            # Should this be supplied to the OSS linker as well?
   1.558 -            LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1"
   1.559 +    if test "x$COMPILER_NAME" = xgcc; then
   1.560 +        # If this is a --hash-style=gnu system, use --hash-style=both, why?
   1.561 +        HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
   1.562 +        if test -n "$HAS_GNU_HASH"; then
   1.563 +            LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both "
   1.564 +        fi
   1.565 +        if test "x$OPENJDK_TARGET_OS" = xlinux; then 
   1.566 +          # And since we now know that the linker is gnu, then add -z defs, to forbid
   1.567 +          # undefined symbols in object files.
   1.568 +          LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs"
   1.569 +          if test "x$DEBUG_LEVEL" = "xrelease"; then
   1.570 +              # When building release libraries, tell the linker optimize them.
   1.571 +              # Should this be supplied to the OSS linker as well?
   1.572 +              LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1"
   1.573 +          fi
   1.574          fi
   1.575      fi
   1.576 -
   1.577      LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \
   1.578                      -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server \
   1.579                      -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client \

mercurial