common/autoconf/platform.m4

changeset 458
c8d320b48626
parent 445
efd26e051e50
child 478
2ba6f4da4bf3
     1.1 --- a/common/autoconf/platform.m4	Mon Jun 25 21:37:09 2012 -0700
     1.2 +++ b/common/autoconf/platform.m4	Tue Jul 03 16:11:12 2012 -0700
     1.3 @@ -23,272 +23,59 @@
     1.4  # questions.
     1.5  #
     1.6  
     1.7 -AC_DEFUN([CHECK_FIND_DELETE],
     1.8 -[
     1.9 -    # Test if find supports -delete
    1.10 -    AC_MSG_CHECKING([if find supports -delete])
    1.11 -    FIND_DELETE="-delete"
    1.12 -
    1.13 -    DELETEDIR=`mktemp -d tmp.XXXXXXXXXX` || (echo Could not create temporary directory!; exit $?)
    1.14 -
    1.15 -    echo Hejsan > $DELETEDIR/TestIfFindSupportsDelete
    1.16 -
    1.17 -    TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1`
    1.18 -    if test -f $DELETEDIR/TestIfFindSupportsDelete; then
    1.19 -        # No, it does not.
    1.20 -        rm $DELETEDIR/TestIfFindSupportsDelete
    1.21 -        FIND_DELETE="-exec rm \{\} \+"
    1.22 -        AC_MSG_RESULT([no])    
    1.23 -    else
    1.24 -        AC_MSG_RESULT([yes])    
    1.25 -    fi
    1.26 -    rmdir $DELETEDIR
    1.27 -])
    1.28 -
    1.29 -AC_DEFUN([CHECK_NONEMPTY],
    1.30 -[
    1.31 -    # Test that variable $1 is not empty.
    1.32 -    if test "" = "[$]$1"; then AC_MSG_ERROR(Could not find translit($1,A-Z,a-z) !); fi
    1.33 -])
    1.34 -
    1.35 -AC_DEFUN([ADD_JVM_ARG_IF_OK],
    1.36 -[
    1.37 -    # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
    1.38 -    # If so, then append $1 to $2
    1.39 -    FOUND_WARN=`$3 $1 -version 2>&1 | grep -i warn`
    1.40 -    FOUND_VERSION=`$3 $1 -version 2>&1 | grep " version \""`
    1.41 -    if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
    1.42 -        $2="[$]$2 $1"
    1.43 -    fi
    1.44 -])
    1.45 -
    1.46 -AC_DEFUN([WHICHCMD],
    1.47 -[
    1.48 -    # Translate "gcc -E" into "`which gcc` -E" ie
    1.49 -    # extract the full path to the binary and at the
    1.50 -    # same time maintain any arguments passed to it.
    1.51 -    # The command MUST exist in the path, or else!
    1.52 -    tmp="[$]$1"
    1.53 -    car="${tmp%% *}"
    1.54 -    tmp="[$]$1 EOL"
    1.55 -    cdr="${tmp#* }"
    1.56 -    # On windows we want paths without spaces.
    1.57 -    if test "x$BUILD_OS" = "xwindows"; then
    1.58 -        WHICHCMD_SPACESAFE(car)
    1.59 -    else
    1.60 -        # "which" is not portable, but is used here
    1.61 -        # because we know that the command exists!
    1.62 -        car=`which $car`
    1.63 -    fi
    1.64 -    if test "x$cdr" != xEOL; then
    1.65 -        $1="$car ${cdr% *}"
    1.66 -    else
    1.67 -        $1="$car"
    1.68 -    fi
    1.69 -])
    1.70 -
    1.71 -AC_DEFUN([SPACESAFE],
    1.72 -[
    1.73 -    # Fail with message $2 if var $1 contains a path with no spaces in it.
    1.74 -    # Unless on Windows, where we can rewrite the path.
    1.75 -    HAS_SPACE=`echo "[$]$1" | grep " "`
    1.76 -    if test "x$HAS_SPACE" != x; then
    1.77 -        if test "x$BUILD_OS" = "xwindows"; then
    1.78 -            $1=`$CYGPATH -s -m -a "[$]$1"`
    1.79 -            $1=`$CYGPATH -u "[$]$1"`            
    1.80 -        else
    1.81 -            AC_MSG_ERROR([You cannot have spaces in $2! "[$]$1"])
    1.82 -        fi
    1.83 -    fi
    1.84 -])
    1.85 -
    1.86 -AC_DEFUN([WHICHCMD_SPACESAFE],
    1.87 -[
    1.88 -    # Translate long cygdrive or C:\sdfsf path
    1.89 -    # into a short mixed mode path that has no
    1.90 -    # spaces in it.
    1.91 -    tmp="[$]$1"
    1.92 -    if test "x$BUILD_OS" = "xwindows"; then
    1.93 -        tmp=`$CYGPATH -u "[$]$1"`
    1.94 -        tmp=`which "$tmp"`
    1.95 -        # If file exists with .exe appended, that's the real filename
    1.96 -        # and cygpath needs that to convert to short style path.
    1.97 -        if test -f "${tmp}.exe"; then
    1.98 -           tmp="${tmp}.exe"
    1.99 -        elif test -f "${tmp}.cmd"; then
   1.100 -           tmp="${tmp}.cmd"
   1.101 -        fi
   1.102 -        # Convert to C:/ mixed style path without spaces.
   1.103 -         tmp=`$CYGPATH -s -m "$tmp"`
   1.104 -    fi
   1.105 -    $1="$tmp"
   1.106 -])
   1.107 -
   1.108 -AC_DEFUN([REMOVE_SYMBOLIC_LINKS],
   1.109 -[
   1.110 -    if test "x$BUILD_OS" != xwindows; then
   1.111 -        # Follow a chain of symbolic links. Use readlink
   1.112 -        # where it exists, else fall back to horribly
   1.113 -        # complicated shell code.
   1.114 -        AC_PATH_PROG(READLINK, readlink)
   1.115 -        if test "x$READLINK_TESTED" != yes; then
   1.116 -            # On MacOSX there is a readlink tool with a different
   1.117 -            # purpose than the GNU readlink tool. Check the found readlink.
   1.118 -            ISGNU=`$READLINK --help 2>&1 | grep GNU`
   1.119 -            if test "x$ISGNU" = x; then
   1.120 -                 # A readlink that we do not know how to use.
   1.121 -                 # Are there other non-GNU readlinks out there?
   1.122 -                 READLINK_TESTED=yes
   1.123 -                 READLINK=
   1.124 -            fi
   1.125 -        fi
   1.126 -
   1.127 -        if test "x$READLINK" != x; then
   1.128 -            $1=`$READLINK -f [$]$1`
   1.129 -        else
   1.130 -            STARTDIR=$PWD
   1.131 -            COUNTER=0
   1.132 -            DIR=`dirname [$]$1`
   1.133 -            FIL=`basename [$]$1`
   1.134 -            while test $COUNTER -lt 20; do
   1.135 -                ISLINK=`ls -l $DIR/$FIL | grep '\->' | sed -e 's/.*-> \(.*\)/\1/'`
   1.136 -                if test "x$ISLINK" == x; then
   1.137 -                    # This is not a symbolic link! We are done!
   1.138 -                    break
   1.139 -                fi
   1.140 -                # The link might be relative! We have to use cd to travel safely.
   1.141 -                cd $DIR
   1.142 -                cd `dirname $ISLINK`
   1.143 -                DIR=`pwd`
   1.144 -                FIL=`basename $ISLINK`
   1.145 -                let COUNTER=COUNTER+1
   1.146 -            done
   1.147 -            cd $STARTDIR
   1.148 -            $1=$DIR/$FIL
   1.149 -        fi
   1.150 -    fi
   1.151 -])
   1.152 -
   1.153 -AC_DEFUN([TESTFOR_PROG_CCACHE],
   1.154 -[
   1.155 -    AC_ARG_ENABLE([ccache],
   1.156 -	      [AS_HELP_STRING([--disable-ccache],
   1.157 -	      		      [use ccache to speed up recompilations @<:@enabled@:>@])],
   1.158 -              [ENABLE_CCACHE=${enable_ccache}], [ENABLE_CCACHE=yes])
   1.159 -    if test "x$ENABLE_CCACHE" = xyes; then
   1.160 -        AC_PATH_PROG(CCACHE, ccache)
   1.161 -    else
   1.162 -        AC_MSG_CHECKING([for ccache])
   1.163 -        AC_MSG_RESULT([explicitly disabled])    
   1.164 -        CCACHE=
   1.165 -    fi    
   1.166 -    AC_SUBST(CCACHE)
   1.167 -
   1.168 -    AC_ARG_WITH([ccache-dir],
   1.169 -	      [AS_HELP_STRING([--with-ccache-dir],
   1.170 -	      		      [where to store ccache files @<:@~/.ccache@:>@])])
   1.171 -
   1.172 -    if test "x$with_ccache_dir" != x; then
   1.173 -        # When using a non home ccache directory, assume the use is to share ccache files
   1.174 -        # with other users. Thus change the umask.
   1.175 -        SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002"
   1.176 -    fi
   1.177 -    CCACHE_FOUND=""
   1.178 -    if test "x$CCACHE" != x; then
   1.179 -        SETUP_CCACHE_USAGE
   1.180 -    fi    
   1.181 -])
   1.182 -
   1.183 -AC_DEFUN([SETUP_CCACHE_USAGE],
   1.184 -[
   1.185 -    if test "x$CCACHE" != x; then
   1.186 -        CCACHE_FOUND="true"
   1.187 -        # Only use ccache if it is 3.1.4 or later, which supports
   1.188 -        # precompiled headers.
   1.189 -        AC_MSG_CHECKING([if ccache supports precompiled headers])
   1.190 -        HAS_GOOD_CCACHE=`($CCACHE --version | head -n 1 | grep -E 3.1.@<:@456789@:>@) 2> /dev/null`
   1.191 -        if test "x$HAS_GOOD_CCACHE" = x; then
   1.192 -            AC_MSG_RESULT([no, disabling ccache])
   1.193 -            CCACHE=
   1.194 -        else
   1.195 -            AC_MSG_RESULT([yes])
   1.196 -            AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers])
   1.197 -            PUSHED_FLAGS="$CXXFLAGS"
   1.198 -            CXXFLAGS="-fpch-preprocess $CXXFLAGS"
   1.199 -            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no])
   1.200 -            CXXFLAGS="$PUSHED_FLAGS"
   1.201 -            if test "x$CC_KNOWS_CCACHE_TRICK" = xyes; then
   1.202 -                AC_MSG_RESULT([yes])
   1.203 -            else
   1.204 -                AC_MSG_RESULT([no, disabling ccaching of precompiled headers])
   1.205 -                CCACHE=
   1.206 -            fi
   1.207 -        fi
   1.208 -    fi
   1.209 -
   1.210 -    if test "x$CCACHE" != x; then
   1.211 -        CCACHE_SLOPPINESS=time_macros
   1.212 -        CCACHE="CCACHE_COMPRESS=1 $SET_CCACHE_DIR CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS $CCACHE"
   1.213 -        CCACHE_FLAGS=-fpch-preprocess
   1.214 -
   1.215 -        if test "x$SET_CCACHE_DIR" != x; then
   1.216 -            mkdir -p $CCACHE_DIR > /dev/null 2>&1
   1.217 -	    chmod a+rwxs $CCACHE_DIR > /dev/null 2>&1
   1.218 -        fi
   1.219 -    fi
   1.220 -])
   1.221 -
   1.222 -AC_DEFUN([EXTRACT_HOST_AND_BUILD_AND_LEGACY_VARS],
   1.223 +AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD_AND_LEGACY_VARS],
   1.224  [
   1.225      # Expects $host_os $host_cpu $build_os and $build_cpu
   1.226 -    # and $with_data_model to have been setup!
   1.227 +    # and $with_target_bits to have been setup!
   1.228      #
   1.229      # Translate the standard triplet(quadruplet) definition
   1.230 -    # of the host/build system into
   1.231 -    # HOST_OS=aix,bsd,hpux,linux,macosx,solaris,windows
   1.232 -    # HOST_OS_FAMILY=bsd,gnu,sysv,win32,wince
   1.233 -    # HOST_OS_API=posix,winapi
   1.234 +    # of the target/build system into
   1.235 +    # OPENJDK_TARGET_OS=aix,bsd,hpux,linux,macosx,solaris,windows
   1.236 +    # OPENJDK_TARGET_OS_FAMILY=bsd,gnu,sysv,win32,wince
   1.237 +    # OPENJDK_TARGET_OS_API=posix,winapi
   1.238      # 
   1.239 -    # HOST_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64
   1.240 -    # HOST_CPU_ARCH=x86,sparc,pcc,arm
   1.241 -    # HOST_CPU_BITS=32,64
   1.242 -    # HOST_CPU_ENDIAN=big,little
   1.243 +    # OPENJDK_TARGET_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64
   1.244 +    # OPENJDK_TARGET_CPU_ARCH=x86,sparc,pcc,arm
   1.245 +    # OPENJDK_TARGET_CPU_BITS=32,64
   1.246 +    # OPENJDK_TARGET_CPU_ENDIAN=big,little
   1.247      #
   1.248      # The same values are setup for BUILD_...
   1.249      # 
   1.250      # And the legacy variables, for controlling the old makefiles.
   1.251 -    # LEGACY_HOST_CPU1=i586,amd64/x86_64,sparc,sparcv9,arm,arm64...
   1.252 -    # LEGACY_HOST_CPU2=i386,amd64,sparc,sparcv9,arm,arm64...
   1.253 -    # LEGACY_HOST_CPU3=sparcv9,amd64 (but only on solaris)
   1.254 -    # LEGACY_HOST_OS_API=solaris,windows
   1.255 +    # LEGACY_OPENJDK_TARGET_CPU1=i586,amd64/x86_64,sparc,sparcv9,arm,arm64...
   1.256 +    # LEGACY_OPENJDK_TARGET_CPU2=i386,amd64,sparc,sparcv9,arm,arm64...
   1.257 +    # LEGACY_OPENJDK_TARGET_CPU3=sparcv9,amd64 (but only on solaris)
   1.258 +    # LEGACY_OPENJDK_TARGET_OS_API=solaris,windows
   1.259      #
   1.260      # We also copy the autoconf trip/quadruplet
   1.261 -    # verbatim to HOST and BUILD
   1.262 -    AC_SUBST(HOST, ${host})
   1.263 -    AC_SUBST(BUILD, ${build})
   1.264 +    # verbatim to OPENJDK_TARGET_SYSTEM (from the autoconf "host") and OPENJDK_BUILD_SYSTEM
   1.265 +    OPENJDK_TARGET_SYSTEM="$host"
   1.266 +    OPENJDK_BUILD_SYSTEM="$build"
   1.267 +    AC_SUBST(OPENJDK_TARGET_SYSTEM)
   1.268 +    AC_SUBST(OPENJDK_BUILD_SYSTEM)
   1.269      
   1.270 -    EXTRACT_VARS_FROM_OS_TO(HOST,$host_os)
   1.271 -    EXTRACT_VARS_FROM_CPU_TO(HOST,$host_cpu)
   1.272 +    PLATFORM_EXTRACT_VARS_FROM_OS_TO(OPENJDK_TARGET,$host_os)
   1.273 +    PLATFORM_EXTRACT_VARS_FROM_CPU_TO(OPENJDK_TARGET,$host_cpu)
   1.274  
   1.275 -    EXTRACT_VARS_FROM_OS_TO(BUILD,$build_os)
   1.276 -    EXTRACT_VARS_FROM_CPU_TO(BUILD,$build_cpu)
   1.277 +    PLATFORM_EXTRACT_VARS_FROM_OS_TO(OPENJDK_BUILD,$build_os)
   1.278 +    PLATFORM_EXTRACT_VARS_FROM_CPU_TO(OPENJDK_BUILD,$build_cpu)
   1.279  
   1.280 -    if test "x$HOST_OS" != xsolaris; then
   1.281 -        LEGACY_HOST_CPU3=""
   1.282 -        LEGACY_BUILD_CPU3=""
   1.283 +    if test "x$OPENJDK_TARGET_OS" != xsolaris; then
   1.284 +        LEGACY_OPENJDK_TARGET_CPU3=""
   1.285 +        LEGACY_OPENJDK_BUILD_CPU3=""
   1.286      fi
   1.287  
   1.288 -    # On MacOSX and MacOSX only, we have a different name for the x64 CPU in ARCH (LEGACY_HOST_CPU1) ...
   1.289 -    if test "x$HOST_OS" = xmacosx && test "x$HOST_CPU" = xx64; then
   1.290 -        LEGACY_HOST_CPU1="x86_64"
   1.291 +    # On MacOSX and MacOSX only, we have a different name for the x64 CPU in ARCH (LEGACY_OPENJDK_TARGET_CPU1) ...
   1.292 +    if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$OPENJDK_TARGET_CPU" = xx64; then
   1.293 +        LEGACY_OPENJDK_TARGET_CPU1="x86_64"
   1.294      fi
   1.295  
   1.296 -    SET_RELEASE_FILE_OS_VALUES()
   1.297 +    PLATFORM_SET_RELEASE_FILE_OS_VALUES
   1.298  ])
   1.299  
   1.300 -AC_DEFUN([EXTRACT_VARS_FROM_OS_TO],
   1.301 +AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS_TO],
   1.302  [
   1.303 -    EXTRACT_VARS_FROM_OS($2)
   1.304 +    PLATFORM_EXTRACT_VARS_FROM_OS($2)
   1.305      $1_OS="$VAR_OS"
   1.306      $1_OS_FAMILY="$VAR_OS_FAMILY"
   1.307      $1_OS_API="$VAR_OS_API"
   1.308 @@ -306,9 +93,9 @@
   1.309      AC_SUBST(LEGACY_$1_OS_API)    
   1.310  ])
   1.311  
   1.312 -AC_DEFUN([EXTRACT_VARS_FROM_CPU_TO],
   1.313 +AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU_TO],
   1.314  [
   1.315 -    EXTRACT_VARS_FROM_CPU($2)
   1.316 +    PLATFORM_EXTRACT_VARS_FROM_CPU($2)
   1.317      $1_CPU="$VAR_CPU"
   1.318      $1_CPU_ARCH="$VAR_CPU_ARCH"
   1.319      $1_CPU_BITS="$VAR_CPU_BITS"
   1.320 @@ -339,12 +126,12 @@
   1.321          LEGACY_$1_CPU3=amd64
   1.322      fi
   1.323      if test "x$$1_CPU" = xsparcv9; then 
   1.324 -        LEGACY_$1_CPU3=sparvc9
   1.325 +        LEGACY_$1_CPU3=sparcv9
   1.326      fi
   1.327      AC_SUBST(LEGACY_$1_CPU3)
   1.328  ])
   1.329  
   1.330 -AC_DEFUN([EXTRACT_VARS_FROM_CPU],
   1.331 +AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
   1.332  [
   1.333    # First argument is the cpu name from the trip/quad
   1.334    case "$1" in
   1.335 @@ -372,8 +159,8 @@
   1.336      arm*)
   1.337        VAR_CPU=arm
   1.338        VAR_CPU_ARCH=arm
   1.339 -      VAR_CPU_BITS=3264
   1.340 -      VAR_CPU_ENDIAN=big
   1.341 +      VAR_CPU_BITS=32
   1.342 +      VAR_CPU_ENDIAN=little
   1.343        VAR_LEGACY_CPU=arm
   1.344        ;;
   1.345      mips)
   1.346 @@ -401,7 +188,7 @@
   1.347        VAR_CPU=ppc64
   1.348        VAR_CPU_ARCH=ppc
   1.349        VAR_CPU_BITS=64
   1.350 -      VAR_CPU_ENDIAN=32
   1.351 +      VAR_CPU_ENDIAN=big
   1.352        VAR_LEGACY_CPU=ppc64
   1.353         ;;
   1.354      sparc)
   1.355 @@ -416,7 +203,7 @@
   1.356        VAR_CPU_ARCH=sparc
   1.357        VAR_CPU_BITS=64
   1.358        VAR_CPU_ENDIAN=big
   1.359 -      VAR_LEGACY_CPU=sparc_sparcv9
   1.360 +      VAR_LEGACY_CPU=sparcv9
   1.361         ;;
   1.362      s390)
   1.363        VAR_CPU=s390
   1.364 @@ -452,21 +239,37 @@
   1.365        fi
   1.366    fi
   1.367  
   1.368 +  # on solaris x86...default seems to be 32-bit
   1.369 +  if test "x$VAR_OS" = "xsolaris" && \
   1.370 +     test "x$with_target_bits" = "x" && \
   1.371 +     test "x$VAR_CPU_ARCH" = "xx86"
   1.372 +  then
   1.373 +      with_target_bits=32
   1.374 +  fi
   1.375 +
   1.376    if test "x$VAR_CPU_ARCH" = "xx86"; then
   1.377 -      if test "x$with_data_model" = "x64"; then
   1.378 +      if test "x$with_target_bits" = "x64"; then
   1.379            VAR_CPU=x64
   1.380            VAR_CPU_BITS=64
   1.381            VAR_LEGACY_CPU=amd64
   1.382        fi
   1.383 -      if test "x$with_data_model" = "x32"; then
   1.384 +      if test "x$with_target_bits" = "x32"; then
   1.385            VAR_CPU=ia32
   1.386            VAR_CPU_BITS=32
   1.387            VAR_LEGACY_CPU=i586
   1.388        fi
   1.389    fi 
   1.390 +
   1.391 +  if test "x$VAR_CPU_ARCH" = "xsparc"; then
   1.392 +      if test "x$with_target_bits" = "x64"; then
   1.393 +          VAR_CPU=sparcv9
   1.394 +          VAR_CPU_BITS=64
   1.395 +          VAR_LEGACY_CPU=sparcv9
   1.396 +      fi
   1.397 +  fi 
   1.398  ])
   1.399  
   1.400 -AC_DEFUN([EXTRACT_VARS_FROM_OS],
   1.401 +AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
   1.402  [
   1.403    case "$1" in
   1.404      *linux*)
   1.405 @@ -495,49 +298,26 @@
   1.406        VAR_OS_FAMILY=windows
   1.407        ;;
   1.408      *)
   1.409 -      AC_MSG_ERROR([unsupported host operating system $1])
   1.410 +      AC_MSG_ERROR([unsupported operating system $1])
   1.411        ;;
   1.412    esac
   1.413  ])
   1.414  
   1.415 -AC_DEFUN([CHECK_COMPILER_VERSION],
   1.416 +AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
   1.417  [
   1.418 -    # Test the compilers that their versions are new enough.
   1.419 -#    AC_MSG_CHECKING([version of GCC])
   1.420 -    gcc_ver=`${CC} -dumpversion`
   1.421 -    gcc_major_ver=`echo ${gcc_ver}|cut -d'.' -f1`
   1.422 -    gcc_minor_ver=`echo ${gcc_ver}|cut -d'.' -f2`
   1.423 -#    AM_CONDITIONAL(GCC_OLD, test ! ${gcc_major_ver} -ge 4 -a ${gcc_minor_ver} -ge 3)
   1.424 -#    AC_MSG_RESULT([${gcc_ver} (major version ${gcc_major_ver}, minor version ${gcc_minor_ver})])
   1.425 -]) 
   1.426 -
   1.427 -# Fixes paths on windows hosts to be mixed mode short.
   1.428 -AC_DEFUN([WIN_FIX_PATH],
   1.429 -[
   1.430 -    if test "x$BUILD_OS" = "xwindows"; then
   1.431 -        AC_PATH_PROG(CYGPATH, cygpath)
   1.432 -        tmp="[$]$1"
   1.433 -        # Convert to C:/ mixed style path without spaces.
   1.434 -        tmp=`$CYGPATH -s -m "$tmp"`
   1.435 -        $1="$tmp"
   1.436 -    fi
   1.437 -])
   1.438 -
   1.439 -AC_DEFUN([SET_RELEASE_FILE_OS_VALUES],
   1.440 -[
   1.441 -    if test "x$HOST_OS" = "xsolaris"; then
   1.442 +    if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
   1.443         REQUIRED_OS_NAME=SunOS
   1.444         REQUIRED_OS_VERSION=5.10
   1.445      fi
   1.446 -    if test "x$HOST_OS" = "xlinux"; then
   1.447 +    if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
   1.448         REQUIRED_OS_NAME=Linux
   1.449         REQUIRED_OS_VERSION=2.6
   1.450      fi
   1.451 -    if test "x$HOST_OS" = "xwindows"; then
   1.452 +    if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   1.453          REQUIRED_OS_NAME=Windows
   1.454          REQUIRED_OS_VERSION=5.1
   1.455      fi
   1.456 -    if test "x$HOST_OS" = "xmacosx"; then
   1.457 +    if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
   1.458          REQUIRED_OS_NAME=Darwin
   1.459          REQUIRED_OS_VERSION=11.2
   1.460      fi
   1.461 @@ -545,3 +325,174 @@
   1.462      AC_SUBST(REQUIRED_OS_NAME)
   1.463      AC_SUBST(REQUIRED_OS_VERSION)
   1.464  ])
   1.465 +
   1.466 +#%%% Build and target systems %%%
   1.467 +AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET],
   1.468 +[
   1.469 +# Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target"
   1.470 +# is confusing; it assumes you are cross-compiling a cross-compiler (!)  and "target" is thus the target of the
   1.471 +# product you're building. The target of this build is called "host". Since this is confusing to most people, we
   1.472 +# have not adopted that system, but use "target" as the platform we are building for. In some places though we need
   1.473 +# to use the configure naming style.
   1.474 +AC_CANONICAL_BUILD
   1.475 +AC_CANONICAL_HOST
   1.476 +AC_CANONICAL_TARGET
   1.477 +
   1.478 +AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits],
   1.479 +   [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])])
   1.480 +
   1.481 +if test "x$with_target_bits" != x && \
   1.482 +   test "x$with_target_bits" != x32 && \
   1.483 +   test "x$with_target_bits" != x64 ; then
   1.484 +    AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!])
   1.485 +fi
   1.486 +# Translate the standard cpu-vendor-kernel-os quadruplets into
   1.487 +# the new TARGET_.... and BUILD_... and the legacy names used by
   1.488 +# the openjdk build.
   1.489 +# It uses $host_os $host_cpu $build_os $build_cpu and $with_target_bits
   1.490 +PLATFORM_EXTRACT_TARGET_AND_BUILD_AND_LEGACY_VARS
   1.491 +
   1.492 +# The LEGACY_OPENJDK_TARGET_CPU3 is the setting for ISA_DIR.
   1.493 +if test "x$LEGACY_OPENJDK_TARGET_CPU3" != x; then
   1.494 +   LEGACY_OPENJDK_TARGET_CPU3="/${LEGACY_OPENJDK_TARGET_CPU3}"
   1.495 +fi
   1.496 +
   1.497 +# Now the following vars are defined.
   1.498 +# OPENJDK_TARGET_OS=aix,bsd,hpux,linux,macosx,solaris,windows
   1.499 +# OPENJDK_TARGET_OS_FAMILY=bsd,gnu,sysv,win32,wince
   1.500 +# OPENJDK_TARGET_OS_API=posix,winapi
   1.501 +#
   1.502 +# OPENJDK_TARGET_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64
   1.503 +# OPENJDK_TARGET_CPU_ARCH=x86,sparc,pcc,arm
   1.504 +# OPENJDK_TARGET_CPU_BITS=32,64
   1.505 +# OPENJDK_TARGET_CPU_ENDIAN=big,little
   1.506 +#
   1.507 +# There is also a:
   1.508 +# LEGACY_OPENJDK_TARGET_CPU1=i586,amd64,....  # used to set the old var ARCH
   1.509 +# LEGACY_OPENJDK_TARGET_CPU2=i386,amd64,.... # used to set the old var LIBARCH
   1.510 +# LEGACY_OPENJDK_TARGET_CPU3=only sparcv9,amd64 # used to set the ISA_DIR on Solaris
   1.511 +# There was also a BUILDARCH that had i486,amd64,... but we do not use that
   1.512 +# in the new build.
   1.513 +# LEGACY_OPENJDK_TARGET_OS_API=solaris,windows # used to select source roots
   1.514 +])
   1.515 +
   1.516 +AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION],
   1.517 +[
   1.518 +###############################################################################
   1.519 +
   1.520 +# Note that this is the build platform OS version!
   1.521 +
   1.522 +OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`"
   1.523 +OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`"
   1.524 +OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`"
   1.525 +OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`"
   1.526 +AC_SUBST(OS_VERSION_MAJOR)
   1.527 +AC_SUBST(OS_VERSION_MINOR)
   1.528 +AC_SUBST(OS_VERSION_MICRO)
   1.529 +])
   1.530 +
   1.531 +AC_DEFUN_ONCE([PLATFORM_TEST_OPENJDK_TARGET_BITS],
   1.532 +[
   1.533 +###############################################################################
   1.534 +#
   1.535 +# Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code.
   1.536 +# (The JVM can use 32 or 64 bit Java pointers but that decision
   1.537 +# is made at runtime.)
   1.538 +#
   1.539 +AC_LANG_PUSH(C++)
   1.540 +OLD_CXXFLAGS="$CXXFLAGS"
   1.541 +if test "x$OPENJDK_TARGET_OS" != xwindows && test "x$with_target_bits" != x; then
   1.542 +	CXXFLAGS="-m${with_target_bits} $CXXFLAGS"
   1.543 +fi
   1.544 +AC_CHECK_SIZEOF([int *], [1111])
   1.545 +CXXFLAGS="$OLD_CXXFLAGS"
   1.546 +AC_LANG_POP(C++)
   1.547 +
   1.548 +# keep track of c/cxx flags that we added outselves...
   1.549 +#   to prevent emitting warning...
   1.550 +ADDED_CFLAGS=
   1.551 +ADDED_CXXFLAGS=
   1.552 +ADDED_LDFLAGS=
   1.553 +
   1.554 +if test "x$ac_cv_sizeof_int_p" = x0; then 
   1.555 +    # The test failed, lets pick the assumed value.
   1.556 +    ARCH_DATA_MODEL=$OPENJDK_TARGET_CPU_BITS
   1.557 +else
   1.558 +    ARCH_DATA_MODEL=`expr 8 \* $ac_cv_sizeof_int_p`
   1.559 +
   1.560 +    if test "x$OPENJDK_TARGET_OS" != xwindows && test "x$with_target_bits" != x; then
   1.561 +       ADDED_CFLAGS=" -m${with_target_bits}"
   1.562 +       ADDED_CXXFLAGS=" -m${with_target_bits}"
   1.563 +       ADDED_LDFLAGS=" -m${with_target_bits}"
   1.564 +
   1.565 +       CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
   1.566 +       CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
   1.567 +       LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
   1.568 +
   1.569 +       CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
   1.570 +       CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
   1.571 +       LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
   1.572 +    fi
   1.573 +fi
   1.574 +
   1.575 +if test "x$ARCH_DATA_MODEL" = x64; then
   1.576 +    A_LP64="LP64:="
   1.577 +    ADD_LP64="-D_LP64=1"
   1.578 +fi
   1.579 +AC_MSG_CHECKING([for target address size])
   1.580 +AC_MSG_RESULT([$ARCH_DATA_MODEL bits])
   1.581 +AC_SUBST(LP64,$A_LP64)
   1.582 +AC_SUBST(ARCH_DATA_MODEL)
   1.583 +
   1.584 +if test "x$ARCH_DATA_MODEL" != "x$OPENJDK_TARGET_CPU_BITS"; then
   1.585 +    AC_MSG_ERROR([The tested number of bits in the target ($ARCH_DATA_MODEL) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)])
   1.586 +fi
   1.587 +
   1.588 +#
   1.589 +# NOTE: check for -mstackrealign needs to be below potential addition of -m32
   1.590 +#
   1.591 +if test "x$OPENJDK_TARGET_CPU_BITS" = x32 && test "x$OPENJDK_TARGET_OS" = xmacosx; then
   1.592 +    # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned.
   1.593 +    # While waiting for a better solution, the current workaround is to use -mstackrealign.
   1.594 +    CFLAGS="$CFLAGS -mstackrealign"
   1.595 +    AC_MSG_CHECKING([if 32-bit compiler supports -mstackrealign])
   1.596 +    AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
   1.597 +                   [
   1.598 +		        AC_MSG_RESULT([yes])
   1.599 +                   ],
   1.600 +	           [
   1.601 +		        AC_MSG_RESULT([no])
   1.602 +	                AC_MSG_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.])
   1.603 +	           ])
   1.604 +fi
   1.605 +])
   1.606 +
   1.607 +AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS],
   1.608 +[
   1.609 +###############################################################################
   1.610 +#
   1.611 +# Is the target little of big endian?
   1.612 +#
   1.613 +AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"])
   1.614 +
   1.615 +if test "x$ENDIAN" = xuniversal_endianness; then
   1.616 +    AC_MSG_ERROR([Building with both big and little endianness is not supported])
   1.617 +fi
   1.618 +if test "x$ENDIAN" = xunknown; then
   1.619 +    ENDIAN="$OPENJDK_TARGET_CPU_ENDIAN"
   1.620 +fi
   1.621 +if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then
   1.622 +    AC_MSG_WARN([The tested endian in the target ($ENDIAN) differs from the endian expected to be found in the target ($OPENJDK_TARGET_CPU_ENDIAN)])
   1.623 +    ENDIAN="$OPENJDK_TARGET_CPU_ENDIAN"
   1.624 +fi
   1.625 +AC_SUBST(ENDIAN)
   1.626 +])
   1.627 +
   1.628 +AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ISADIR],
   1.629 +[
   1.630 +###############################################################################
   1.631 +#
   1.632 +# Could someone enlighten this configure script with a comment about libCrun?
   1.633 +#
   1.634 +#
   1.635 +])

mercurial