common/autoconf/platform.m4

changeset 425
e1830598f0b7
child 445
efd26e051e50
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/common/autoconf/platform.m4	Tue Apr 10 08:18:28 2012 -0700
     1.3 @@ -0,0 +1,517 @@
     1.4 +#
     1.5 +# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.  Oracle designates this
    1.11 +# particular file as subject to the "Classpath" exception as provided
    1.12 +# by Oracle in the LICENSE file that accompanied this code.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 +# or visit www.oracle.com if you need additional information or have any
    1.26 +# questions.
    1.27 +#
    1.28 +
    1.29 +AC_DEFUN([CHECK_FIND_DELETE],
    1.30 +[
    1.31 +    # Test if find supports -delete
    1.32 +    AC_MSG_CHECKING([if find supports -delete])
    1.33 +    FIND_DELETE="-delete"
    1.34 +
    1.35 +    DELETEDIR=`mktemp -d tmp.XXXXXXXXXX` || (echo Could not create temporary directory!; exit $?)
    1.36 +
    1.37 +    echo Hejsan > $DELETEDIR/TestIfFindSupportsDelete
    1.38 +
    1.39 +    TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1`
    1.40 +    if test -f $DELETEDIR/TestIfFindSupportsDelete; then
    1.41 +        # No, it does not.
    1.42 +        rm $DELETEDIR/TestIfFindSupportsDelete
    1.43 +        FIND_DELETE="-exec rm \{\} \+"
    1.44 +        AC_MSG_RESULT([no])    
    1.45 +    else
    1.46 +        AC_MSG_RESULT([yes])    
    1.47 +    fi
    1.48 +    rmdir $DELETEDIR
    1.49 +])
    1.50 +
    1.51 +AC_DEFUN([CHECK_NONEMPTY],
    1.52 +[
    1.53 +    # Test that variable $1 is not empty.
    1.54 +    if test "" = "[$]$1"; then AC_ERROR(Could not find translit($1,A-Z,a-z) !); fi
    1.55 +])
    1.56 +
    1.57 +AC_DEFUN([ADD_JVM_ARG_IF_OK],
    1.58 +[
    1.59 +    # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
    1.60 +    # If so, then append $1 to $2
    1.61 +    FOUND_WARN=`$3 $1 -version 2>&1 | grep -i warn`
    1.62 +    FOUND_VERSION=`$3 $1 -version 2>&1 | grep " version \""`
    1.63 +    if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
    1.64 +        $2="[$]$2 $1"
    1.65 +    fi
    1.66 +])
    1.67 +
    1.68 +AC_DEFUN([WHICHCMD],
    1.69 +[
    1.70 +    # Translate "gcc -E" into "`which gcc` -E" ie
    1.71 +    # extract the full path to the binary and at the
    1.72 +    # same time maintain any arguments passed to it.
    1.73 +    # The command MUST exist in the path, or else!
    1.74 +    tmp="[$]$1"
    1.75 +    car="${tmp%% *}"
    1.76 +    tmp="[$]$1 EOL"
    1.77 +    cdr="${tmp#* }"
    1.78 +    # On windows we want paths without spaces.
    1.79 +    if test "x$BUILD_OS" = "xwindows"; then
    1.80 +        WHICHCMD_SPACESAFE(car)
    1.81 +    else
    1.82 +        # "which" is not portable, but is used here
    1.83 +        # because we know that the command exists!
    1.84 +        car=`which $car`
    1.85 +    fi
    1.86 +    if test "x$cdr" != xEOL; then
    1.87 +        $1="$car ${cdr% *}"
    1.88 +    else
    1.89 +        $1="$car"
    1.90 +    fi
    1.91 +])
    1.92 +
    1.93 +AC_DEFUN([SPACESAFE],
    1.94 +[
    1.95 +    # Fail with message $2 if var $1 contains a path with no spaces in it.
    1.96 +    # Unless on Windows, where we can rewrite the path.
    1.97 +    HAS_SPACE=`echo "[$]$1" | grep " "`
    1.98 +    if test "x$HAS_SPACE" != x; then
    1.99 +        if test "x$BUILD_OS" = "xwindows"; then
   1.100 +            $1=`$CYGPATH -s -m -a "[$]$1"`
   1.101 +            $1=`$CYGPATH -u "[$]$1"`            
   1.102 +        else
   1.103 +            AC_ERROR([You cannot have spaces in $2! "[$]$1"])
   1.104 +        fi
   1.105 +    fi
   1.106 +])
   1.107 +
   1.108 +AC_DEFUN([WHICHCMD_SPACESAFE],
   1.109 +[
   1.110 +    # Translate long cygdrive or C:\sdfsf path
   1.111 +    # into a short mixed mode path that has no
   1.112 +    # spaces in it.
   1.113 +    tmp="[$]$1"
   1.114 +    if test "x$BUILD_OS" = "xwindows"; then
   1.115 +        tmp=`$CYGPATH -u "[$]$1"`
   1.116 +        tmp=`which "$tmp"`
   1.117 +        # If file exists with .exe appended, that's the real filename
   1.118 +        # and cygpath needs that to convert to short style path.
   1.119 +        if test -f "${tmp}.exe"; then
   1.120 +           tmp="${tmp}.exe"
   1.121 +        elif test -f "${tmp}.cmd"; then
   1.122 +           tmp="${tmp}.cmd"
   1.123 +        fi
   1.124 +        # Convert to C:/ mixed style path without spaces.
   1.125 +         tmp=`$CYGPATH -s -m "$tmp"`
   1.126 +    fi
   1.127 +    $1="$tmp"
   1.128 +])
   1.129 +
   1.130 +AC_DEFUN([REMOVE_SYMBOLIC_LINKS],
   1.131 +[
   1.132 +    if test "x$BUILD_OS" != xwindows; then
   1.133 +        # Follow a chain of symbolic links. Use readlink
   1.134 +        # where it exists, else fall back to horribly
   1.135 +        # complicated shell code.
   1.136 +        AC_PATH_PROG(READLINK, readlink)
   1.137 +        if test "x$READLINK_TESTED" != yes; then
   1.138 +            # On MacOSX there is a readlink tool with a different
   1.139 +            # purpose than the GNU readlink tool. Check the found readlink.
   1.140 +            ISGNU=`$READLINK --help 2>&1 | grep GNU`
   1.141 +            if test "x$ISGNU" = x; then
   1.142 +                 # A readlink that we do not know how to use.
   1.143 +                 # Are there other non-GNU readlinks out there?
   1.144 +                 READLINK_TESTED=yes
   1.145 +                 READLINK=
   1.146 +            fi
   1.147 +        fi
   1.148 +
   1.149 +        if test "x$READLINK" != x; then
   1.150 +            $1=`$READLINK -f [$]$1`
   1.151 +        else
   1.152 +            STARTDIR=$PWD
   1.153 +            COUNTER=0
   1.154 +            DIR=`dirname [$]$1`
   1.155 +            FIL=`basename [$]$1`
   1.156 +            while test $COUNTER -lt 20; do
   1.157 +                ISLINK=`ls -l $DIR/$FIL | grep '\->' | sed -e 's/.*-> \(.*\)/\1/'`
   1.158 +                if test "x$ISLINK" == x; then
   1.159 +                    # This is not a symbolic link! We are done!
   1.160 +                    break
   1.161 +                fi
   1.162 +                # The link might be relative! We have to use cd to travel safely.
   1.163 +                cd $DIR
   1.164 +                cd `dirname $ISLINK`
   1.165 +                DIR=`pwd`
   1.166 +                FIL=`basename $ISLINK`
   1.167 +                let COUNTER=COUNTER+1
   1.168 +            done
   1.169 +            cd $STARTDIR
   1.170 +            $1=$DIR/$FIL
   1.171 +        fi
   1.172 +    fi
   1.173 +])
   1.174 +
   1.175 +AC_DEFUN([TESTFOR_PROG_CCACHE],
   1.176 +[
   1.177 +    AC_ARG_ENABLE([ccache],
   1.178 +	      [AS_HELP_STRING([--disable-ccache],
   1.179 +	      		      [use ccache to speed up recompilations @<:@enabled@:>@])],
   1.180 +              [ENABLE_CCACHE=${enable_ccache}], [ENABLE_CCACHE=yes])
   1.181 +    if test "x$ENABLE_CCACHE" = xyes; then
   1.182 +        AC_PATH_PROG(CCACHE, ccache)
   1.183 +    else
   1.184 +        AC_MSG_CHECKING([for ccache])
   1.185 +        AC_MSG_RESULT([explicitly disabled])    
   1.186 +        CCACHE=
   1.187 +    fi    
   1.188 +    AC_SUBST(CCACHE)
   1.189 +
   1.190 +    AC_ARG_WITH([ccache-dir],
   1.191 +	      [AS_HELP_STRING([--with-ccache-dir],
   1.192 +	      		      [where to store ccache files @<:@~/.ccache@:>@])])
   1.193 +
   1.194 +    if test "x$with_ccache_dir" != x; then
   1.195 +        # When using a non home ccache directory, assume the use is to share ccache files
   1.196 +        # with other users. Thus change the umask.
   1.197 +        SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002"
   1.198 +    fi
   1.199 +    CCACHE_FOUND=""
   1.200 +    if test "x$CCACHE" != x; then
   1.201 +        SETUP_CCACHE_USAGE
   1.202 +    fi    
   1.203 +])
   1.204 +
   1.205 +AC_DEFUN([SETUP_CCACHE_USAGE],
   1.206 +[
   1.207 +    if test "x$CCACHE" != x; then
   1.208 +        CCACHE_FOUND="true"
   1.209 +        # Only use ccache if it is 3.1.4 or later, which supports
   1.210 +        # precompiled headers.
   1.211 +        AC_MSG_CHECKING([if ccache supports precompiled headers])
   1.212 +        HAS_GOOD_CCACHE=`($CCACHE --version | head -n 1 | grep -E 3.1.@<:@456789@:>@) 2> /dev/null`
   1.213 +        if test "x$HAS_GOOD_CCACHE" = x; then
   1.214 +            AC_MSG_RESULT([no, disabling ccache])
   1.215 +            CCACHE=
   1.216 +        else
   1.217 +            AC_MSG_RESULT([yes])
   1.218 +            AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers])
   1.219 +            PUSHED_FLAGS="$CXXFLAGS"
   1.220 +            CXXFLAGS="-fpch-preprocess $CXXFLAGS"
   1.221 +            AC_TRY_COMPILE([], [], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no])
   1.222 +            CXXFLAGS="$PUSHED_FLAGS"
   1.223 +            if test "x$CC_KNOWS_CCACHE_TRICK" = xyes; then
   1.224 +                AC_MSG_RESULT([yes])
   1.225 +            else
   1.226 +                AC_MSG_RESULT([no, disabling ccaching of precompiled headers])
   1.227 +                CCACHE=
   1.228 +            fi
   1.229 +        fi
   1.230 +    fi
   1.231 +
   1.232 +    if test "x$CCACHE" != x; then
   1.233 +        CCACHE_SLOPPINESS=time_macros
   1.234 +        CCACHE="CCACHE_COMPRESS=1 $SET_CCACHE_DIR CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS $CCACHE"
   1.235 +        CCACHE_FLAGS=-fpch-preprocess
   1.236 +
   1.237 +        if test "x$SET_CCACHE_DIR" != x; then
   1.238 +            mkdir -p $CCACHE_DIR > /dev/null 2>&1
   1.239 +	    chmod a+rwxs $CCACHE_DIR > /dev/null 2>&1
   1.240 +        fi
   1.241 +    fi
   1.242 +])
   1.243 +
   1.244 +AC_DEFUN([EXTRACT_HOST_AND_BUILD_AND_LEGACY_VARS],
   1.245 +[
   1.246 +    # Expects $host_os $host_cpu $build_os and $build_cpu
   1.247 +    # and $with_data_model to have been setup!
   1.248 +    #
   1.249 +    # Translate the standard triplet(quadruplet) definition
   1.250 +    # of the host/build system into
   1.251 +    # HOST_OS=aix,bsd,hpux,linux,macosx,solaris,windows
   1.252 +    # HOST_OS_FAMILY=bsd,gnu,sysv,win32,wince
   1.253 +    # HOST_OS_API=posix,winapi
   1.254 +    # 
   1.255 +    # HOST_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64
   1.256 +    # HOST_CPU_ARCH=x86,sparc,pcc,arm
   1.257 +    # HOST_CPU_BITS=32,64
   1.258 +    # HOST_CPU_ENDIAN=big,little
   1.259 +    #
   1.260 +    # The same values are setup for BUILD_...
   1.261 +    # 
   1.262 +    # And the legacy variables, for controlling the old makefiles.
   1.263 +    # LEGACY_HOST_CPU1=i586,amd64,sparc,sparcv9,arm,arm64...
   1.264 +    # LEGACY_HOST_CPU2=i386,amd64,sparc,sparcv9,arm,arm64...
   1.265 +    # LEGACY_HOST_CPU3=sparcv9,amd64 (but only on solaris)
   1.266 +    # LEGACY_HOST_OS_API=solaris,windows
   1.267 +    #
   1.268 +    # We also copy the autoconf trip/quadruplet
   1.269 +    # verbatim to HOST and BUILD
   1.270 +    AC_SUBST(HOST, ${host})
   1.271 +    AC_SUBST(BUILD, ${build})
   1.272 +    
   1.273 +    EXTRACT_VARS_FROM_OS_TO(HOST,$host_os)
   1.274 +    EXTRACT_VARS_FROM_CPU_TO(HOST,$host_cpu)
   1.275 +
   1.276 +    EXTRACT_VARS_FROM_OS_TO(BUILD,$build_os)
   1.277 +    EXTRACT_VARS_FROM_CPU_TO(BUILD,$build_cpu)
   1.278 +
   1.279 +    if test "x$HOST_OS" != xsolaris; then
   1.280 +        LEGACY_HOST_CPU3=""
   1.281 +        LEGACY_BUILD_CPU3=""
   1.282 +    fi   
   1.283 +])
   1.284 +
   1.285 +AC_DEFUN([EXTRACT_VARS_FROM_OS_TO],
   1.286 +[
   1.287 +    EXTRACT_VARS_FROM_OS($2)
   1.288 +    $1_OS="$VAR_OS"
   1.289 +    $1_OS_FAMILY="$VAR_OS_FAMILY"
   1.290 +    $1_OS_API="$VAR_OS_API"
   1.291 +
   1.292 +    AC_SUBST($1_OS)
   1.293 +    AC_SUBST($1_OS_FAMILY)
   1.294 +    AC_SUBST($1_OS_API)
   1.295 +
   1.296 +    if test "x$$1_OS_API" = xposix; then
   1.297 +        LEGACY_$1_OS_API="solaris"
   1.298 +    fi
   1.299 +    if test "x$$1_OS_API" = xwinapi; then
   1.300 +        LEGACY_$1_OS_API="windows"
   1.301 +    fi
   1.302 +    AC_SUBST(LEGACY_$1_OS_API)    
   1.303 +])
   1.304 +
   1.305 +AC_DEFUN([EXTRACT_VARS_FROM_CPU_TO],
   1.306 +[
   1.307 +    EXTRACT_VARS_FROM_CPU($2)
   1.308 +    $1_CPU="$VAR_CPU"
   1.309 +    $1_CPU_ARCH="$VAR_CPU_ARCH"
   1.310 +    $1_CPU_BITS="$VAR_CPU_BITS"
   1.311 +    $1_CPU_ENDIAN="$VAR_CPU_ENDIAN"
   1.312 +
   1.313 +    AC_SUBST($1_CPU)
   1.314 +    AC_SUBST($1_CPU_ARCH)
   1.315 +    AC_SUBST($1_CPU_BITS)
   1.316 +    AC_SUBST($1_CPU_ENDIAN)
   1.317 +    
   1.318 +    # Also store the legacy naming of the cpu.
   1.319 +    # Ie i586 and amd64 instead of ia32 and x64
   1.320 +    LEGACY_$1_CPU1="$VAR_LEGACY_CPU"
   1.321 +    AC_SUBST(LEGACY_$1_CPU1)
   1.322 +
   1.323 +    # And the second legacy naming of the cpu.
   1.324 +    # Ie i386 and amd64 instead of ia32 and x64.
   1.325 +    LEGACY_$1_CPU2="$LEGACY_$1_CPU1"
   1.326 +    if test "x$LEGACY_$1_CPU1" = xi586; then 
   1.327 +        LEGACY_$1_CPU2=i386
   1.328 +    fi
   1.329 +    AC_SUBST(LEGACY_$1_CPU2)
   1.330 +
   1.331 +    # And the third legacy naming of the cpu.
   1.332 +    # Ie only amd64 or sparcv9, used for the ISA_DIR on Solaris.
   1.333 +    LEGACY_$1_CPU3=""
   1.334 +    if test "x$$1_CPU" = xx64; then 
   1.335 +        LEGACY_$1_CPU3=amd64
   1.336 +    fi
   1.337 +    if test "x$$1_CPU" = xsparcv9; then 
   1.338 +        LEGACY_$1_CPU3=sparvc9
   1.339 +    fi
   1.340 +    AC_SUBST(LEGACY_$1_CPU3)
   1.341 +])
   1.342 +
   1.343 +AC_DEFUN([EXTRACT_VARS_FROM_CPU],
   1.344 +[
   1.345 +  # First argument is the cpu name from the trip/quad
   1.346 +  case "$1" in
   1.347 +    x86_64)
   1.348 +      VAR_CPU=x64
   1.349 +      VAR_CPU_ARCH=x86
   1.350 +      VAR_CPU_BITS=64
   1.351 +      VAR_CPU_ENDIAN=little
   1.352 +      VAR_LEGACY_CPU=amd64
   1.353 +      ;;
   1.354 +    i?86)
   1.355 +      VAR_CPU=ia32
   1.356 +      VAR_CPU_ARCH=x86
   1.357 +      VAR_CPU_BITS=32
   1.358 +      VAR_CPU_ENDIAN=little
   1.359 +      VAR_LEGACY_CPU=i586
   1.360 +      ;;
   1.361 +    alpha*)
   1.362 +      VAR_CPU=alpha
   1.363 +      VAR_CPU_ARCH=alpha
   1.364 +      VAR_CPU_BITS=64
   1.365 +      VAR_CPU_ENDIAN=big
   1.366 +      VAR_LEGACY_CPU=alpha
   1.367 +      ;;
   1.368 +    arm*)
   1.369 +      VAR_CPU=arm
   1.370 +      VAR_CPU_ARCH=arm
   1.371 +      VAR_CPU_BITS=3264
   1.372 +      VAR_CPU_ENDIAN=big
   1.373 +      VAR_LEGACY_CPU=arm
   1.374 +      ;;
   1.375 +    mips)
   1.376 +      VAR_CPU=mips
   1.377 +      VAR_CPU_ARCH=mips
   1.378 +      VAR_CPU_BITS=woot
   1.379 +      VAR_CPU_ENDIAN=woot
   1.380 +      VAR_LEGACY_CPU=mips
   1.381 +       ;;
   1.382 +    mipsel)
   1.383 +      VAR_CPU=mipsel
   1.384 +      VAR_CPU_ARCH=mips
   1.385 +      VAR_CPU_BITS=woot
   1.386 +      VAR_CPU_ENDIAN=woot
   1.387 +      VAR_LEGACY_CPU=mipsel
   1.388 +       ;;
   1.389 +    powerpc)
   1.390 +      VAR_CPU=ppc
   1.391 +      VAR_CPU_ARCH=ppc
   1.392 +      VAR_CPU_BITS=32
   1.393 +      VAR_CPU_ENDIAN=big
   1.394 +      VAR_LEGACY_CPU=ppc
   1.395 +       ;;
   1.396 +    powerpc64)
   1.397 +      VAR_CPU=ppc64
   1.398 +      VAR_CPU_ARCH=ppc
   1.399 +      VAR_CPU_BITS=64
   1.400 +      VAR_CPU_ENDIAN=32
   1.401 +      VAR_LEGACY_CPU=ppc64
   1.402 +       ;;
   1.403 +    sparc)
   1.404 +      VAR_CPU=sparc
   1.405 +      VAR_CPU_ARCH=sparc
   1.406 +      VAR_CPU_BITS=32
   1.407 +      VAR_CPU_ENDIAN=big
   1.408 +      VAR_LEGACY_CPU=sparc
   1.409 +       ;;
   1.410 +    sparc64)
   1.411 +      VAR_CPU=sparcv9
   1.412 +      VAR_CPU_ARCH=sparc
   1.413 +      VAR_CPU_BITS=64
   1.414 +      VAR_CPU_ENDIAN=big
   1.415 +      VAR_LEGACY_CPU=sparc_sparcv9
   1.416 +       ;;
   1.417 +    s390)
   1.418 +      VAR_CPU=s390
   1.419 +      VAR_CPU_ARCH=s390
   1.420 +      VAR_CPU_BITS=32
   1.421 +      VAR_CPU_ENDIAN=woot
   1.422 +      VAR_LEGACY_CPU=s390
   1.423 +      VAR_LEGACY_CPU=s390
   1.424 +       ;;
   1.425 +    s390x)
   1.426 +      VAR_CPU=s390x
   1.427 +      VAR_CPU_ARCH=s390
   1.428 +      VAR_CPU_BITS=64
   1.429 +      VAR_CPU_ENDIAN=woot
   1.430 +      VAR_LEGACY_CPU=s390x
   1.431 +       ;;
   1.432 +    *)
   1.433 +      AC_ERROR([unsupported cpu $1])
   1.434 +      ;;
   1.435 +  esac
   1.436 +
   1.437 +  # Workaround cygwin not knowing about 64 bit.
   1.438 +  if test "x$VAR_OS" = "xwindows"; then
   1.439 +      if test "x$PROCESSOR_IDENTIFIER" != "x"; then
   1.440 +          PROC_ARCH=`echo $PROCESSOR_IDENTIFIER | $CUT -f1 -d' '`
   1.441 +          case "$PROC_ARCH" in
   1.442 +            intel64|Intel64|INTEL64|em64t|EM64T|amd64|AMD64|8664|x86_64)
   1.443 +              VAR_CPU=x64
   1.444 +              VAR_CPU_BITS=64
   1.445 +              VAR_LEGACY_CPU=amd64
   1.446 +              ;;
   1.447 +          esac
   1.448 +      fi
   1.449 +  fi
   1.450 +
   1.451 +  if test "x$VAR_CPU_ARCH" = "xx86"; then
   1.452 +      if test "x$with_data_model" = "x64"; then
   1.453 +          VAR_CPU=x64
   1.454 +          VAR_CPU_BITS=64
   1.455 +          VAR_LEGACY_CPU=amd64
   1.456 +      fi
   1.457 +      if test "x$with_data_model" = "x32"; then
   1.458 +          VAR_CPU=ia32
   1.459 +          VAR_CPU_BITS=32
   1.460 +          VAR_LEGACY_CPU=i586
   1.461 +      fi
   1.462 +  fi 
   1.463 +])
   1.464 +
   1.465 +AC_DEFUN([EXTRACT_VARS_FROM_OS],
   1.466 +[
   1.467 +  case "$1" in
   1.468 +    *linux*)
   1.469 +      VAR_OS=linux
   1.470 +      VAR_OS_API=posix
   1.471 +      VAR_OS_FAMILY=gnu
   1.472 +      ;;
   1.473 +    *solaris*)
   1.474 +      VAR_OS=solaris
   1.475 +      VAR_OS_API=posix
   1.476 +      VAR_OS_FAMILY=sysv
   1.477 +      ;;
   1.478 +    *darwin*)
   1.479 +      VAR_OS=macosx
   1.480 +      VAR_OS_API=posix
   1.481 +      VAR_OS_FAMILY=bsd
   1.482 +      ;;
   1.483 +    *bsd*)
   1.484 +      VAR_OS=bsd
   1.485 +      VAR_OS_API=posix
   1.486 +      VAR_OS_FAMILY=bsd
   1.487 +      ;;
   1.488 +    *cygwin*|*windows*)
   1.489 +      VAR_OS=windows
   1.490 +      VAR_OS_API=winapi
   1.491 +      VAR_OS_FAMILY=windows
   1.492 +      ;;
   1.493 +    *)
   1.494 +      AC_MSG_ERROR([unsupported host operating system $1])
   1.495 +      ;;
   1.496 +  esac
   1.497 +])
   1.498 +
   1.499 +AC_DEFUN([CHECK_COMPILER_VERSION],
   1.500 +[
   1.501 +    # Test the compilers that their versions are new enough.
   1.502 +#    AC_MSG_CHECKING([version of GCC])
   1.503 +    gcc_ver=`${CC} -dumpversion`
   1.504 +    gcc_major_ver=`echo ${gcc_ver}|cut -d'.' -f1`
   1.505 +    gcc_minor_ver=`echo ${gcc_ver}|cut -d'.' -f2`
   1.506 +#    AM_CONDITIONAL(GCC_OLD, test ! ${gcc_major_ver} -ge 4 -a ${gcc_minor_ver} -ge 3)
   1.507 +#    AC_MSG_RESULT([${gcc_ver} (major version ${gcc_major_ver}, minor version ${gcc_minor_ver})])
   1.508 +]) 
   1.509 +
   1.510 +# Fixes paths on windows hosts to be mixed mode short.
   1.511 +AC_DEFUN([WIN_FIX_PATH],
   1.512 +[
   1.513 +    if test "x$BUILD_OS" = "xwindows"; then
   1.514 +        AC_PATH_PROG(CYGPATH, cygpath)
   1.515 +        tmp="[$]$1"
   1.516 +        # Convert to C:/ mixed style path without spaces.
   1.517 +        tmp=`$CYGPATH -s -m "$tmp"`
   1.518 +        $1="$tmp"
   1.519 +    fi
   1.520 +])

mercurial