Tue, 10 Apr 2012 08:18:28 -0700
7074397: Build infrastructure changes (makefile re-write)
Summary: New makefiles transition, old and new living side by side for now.
Reviewed-by: ohair, jjg, dholmes, ohrstrom, erikj, ihse, tgranat, ykantser
Contributed-by: ohrstrom <fredrik.ohrstrom@oracle.com>, erikj <erik.joelsson@oracle.com>, ihse <magnus.ihse.bursie@oracle.com>, tgranat <torbjorn.granat@oracle.com>, ykantser <yekaterina.kantserova@oracle.com>
ohair@425 | 1 | # |
ohair@425 | 2 | # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
ohair@425 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@425 | 4 | # |
ohair@425 | 5 | # This code is free software; you can redistribute it and/or modify it |
ohair@425 | 6 | # under the terms of the GNU General Public License version 2 only, as |
ohair@425 | 7 | # published by the Free Software Foundation. Oracle designates this |
ohair@425 | 8 | # particular file as subject to the "Classpath" exception as provided |
ohair@425 | 9 | # by Oracle in the LICENSE file that accompanied this code. |
ohair@425 | 10 | # |
ohair@425 | 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@425 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@425 | 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@425 | 14 | # version 2 for more details (a copy is included in the LICENSE file that |
ohair@425 | 15 | # accompanied this code). |
ohair@425 | 16 | # |
ohair@425 | 17 | # You should have received a copy of the GNU General Public License version |
ohair@425 | 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
ohair@425 | 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@425 | 20 | # |
ohair@425 | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@425 | 22 | # or visit www.oracle.com if you need additional information or have any |
ohair@425 | 23 | # questions. |
ohair@425 | 24 | # |
ohair@425 | 25 | |
ohair@425 | 26 | AC_DEFUN([CHECK_FIND_DELETE], |
ohair@425 | 27 | [ |
ohair@425 | 28 | # Test if find supports -delete |
ohair@425 | 29 | AC_MSG_CHECKING([if find supports -delete]) |
ohair@425 | 30 | FIND_DELETE="-delete" |
ohair@425 | 31 | |
ohair@425 | 32 | DELETEDIR=`mktemp -d tmp.XXXXXXXXXX` || (echo Could not create temporary directory!; exit $?) |
ohair@425 | 33 | |
ohair@425 | 34 | echo Hejsan > $DELETEDIR/TestIfFindSupportsDelete |
ohair@425 | 35 | |
ohair@425 | 36 | TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1` |
ohair@425 | 37 | if test -f $DELETEDIR/TestIfFindSupportsDelete; then |
ohair@425 | 38 | # No, it does not. |
ohair@425 | 39 | rm $DELETEDIR/TestIfFindSupportsDelete |
ohair@425 | 40 | FIND_DELETE="-exec rm \{\} \+" |
ohair@425 | 41 | AC_MSG_RESULT([no]) |
ohair@425 | 42 | else |
ohair@425 | 43 | AC_MSG_RESULT([yes]) |
ohair@425 | 44 | fi |
ohair@425 | 45 | rmdir $DELETEDIR |
ohair@425 | 46 | ]) |
ohair@425 | 47 | |
ohair@425 | 48 | AC_DEFUN([CHECK_NONEMPTY], |
ohair@425 | 49 | [ |
ohair@425 | 50 | # Test that variable $1 is not empty. |
ohair@425 | 51 | if test "" = "[$]$1"; then AC_ERROR(Could not find translit($1,A-Z,a-z) !); fi |
ohair@425 | 52 | ]) |
ohair@425 | 53 | |
ohair@425 | 54 | AC_DEFUN([ADD_JVM_ARG_IF_OK], |
ohair@425 | 55 | [ |
ohair@425 | 56 | # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3) |
ohair@425 | 57 | # If so, then append $1 to $2 |
ohair@425 | 58 | FOUND_WARN=`$3 $1 -version 2>&1 | grep -i warn` |
ohair@425 | 59 | FOUND_VERSION=`$3 $1 -version 2>&1 | grep " version \""` |
ohair@425 | 60 | if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then |
ohair@425 | 61 | $2="[$]$2 $1" |
ohair@425 | 62 | fi |
ohair@425 | 63 | ]) |
ohair@425 | 64 | |
ohair@425 | 65 | AC_DEFUN([WHICHCMD], |
ohair@425 | 66 | [ |
ohair@425 | 67 | # Translate "gcc -E" into "`which gcc` -E" ie |
ohair@425 | 68 | # extract the full path to the binary and at the |
ohair@425 | 69 | # same time maintain any arguments passed to it. |
ohair@425 | 70 | # The command MUST exist in the path, or else! |
ohair@425 | 71 | tmp="[$]$1" |
ohair@425 | 72 | car="${tmp%% *}" |
ohair@425 | 73 | tmp="[$]$1 EOL" |
ohair@425 | 74 | cdr="${tmp#* }" |
ohair@425 | 75 | # On windows we want paths without spaces. |
ohair@425 | 76 | if test "x$BUILD_OS" = "xwindows"; then |
ohair@425 | 77 | WHICHCMD_SPACESAFE(car) |
ohair@425 | 78 | else |
ohair@425 | 79 | # "which" is not portable, but is used here |
ohair@425 | 80 | # because we know that the command exists! |
ohair@425 | 81 | car=`which $car` |
ohair@425 | 82 | fi |
ohair@425 | 83 | if test "x$cdr" != xEOL; then |
ohair@425 | 84 | $1="$car ${cdr% *}" |
ohair@425 | 85 | else |
ohair@425 | 86 | $1="$car" |
ohair@425 | 87 | fi |
ohair@425 | 88 | ]) |
ohair@425 | 89 | |
ohair@425 | 90 | AC_DEFUN([SPACESAFE], |
ohair@425 | 91 | [ |
ohair@425 | 92 | # Fail with message $2 if var $1 contains a path with no spaces in it. |
ohair@425 | 93 | # Unless on Windows, where we can rewrite the path. |
ohair@425 | 94 | HAS_SPACE=`echo "[$]$1" | grep " "` |
ohair@425 | 95 | if test "x$HAS_SPACE" != x; then |
ohair@425 | 96 | if test "x$BUILD_OS" = "xwindows"; then |
ohair@425 | 97 | $1=`$CYGPATH -s -m -a "[$]$1"` |
ohair@425 | 98 | $1=`$CYGPATH -u "[$]$1"` |
ohair@425 | 99 | else |
ohair@425 | 100 | AC_ERROR([You cannot have spaces in $2! "[$]$1"]) |
ohair@425 | 101 | fi |
ohair@425 | 102 | fi |
ohair@425 | 103 | ]) |
ohair@425 | 104 | |
ohair@425 | 105 | AC_DEFUN([WHICHCMD_SPACESAFE], |
ohair@425 | 106 | [ |
ohair@425 | 107 | # Translate long cygdrive or C:\sdfsf path |
ohair@425 | 108 | # into a short mixed mode path that has no |
ohair@425 | 109 | # spaces in it. |
ohair@425 | 110 | tmp="[$]$1" |
ohair@425 | 111 | if test "x$BUILD_OS" = "xwindows"; then |
ohair@425 | 112 | tmp=`$CYGPATH -u "[$]$1"` |
ohair@425 | 113 | tmp=`which "$tmp"` |
ohair@425 | 114 | # If file exists with .exe appended, that's the real filename |
ohair@425 | 115 | # and cygpath needs that to convert to short style path. |
ohair@425 | 116 | if test -f "${tmp}.exe"; then |
ohair@425 | 117 | tmp="${tmp}.exe" |
ohair@425 | 118 | elif test -f "${tmp}.cmd"; then |
ohair@425 | 119 | tmp="${tmp}.cmd" |
ohair@425 | 120 | fi |
ohair@425 | 121 | # Convert to C:/ mixed style path without spaces. |
ohair@425 | 122 | tmp=`$CYGPATH -s -m "$tmp"` |
ohair@425 | 123 | fi |
ohair@425 | 124 | $1="$tmp" |
ohair@425 | 125 | ]) |
ohair@425 | 126 | |
ohair@425 | 127 | AC_DEFUN([REMOVE_SYMBOLIC_LINKS], |
ohair@425 | 128 | [ |
ohair@425 | 129 | if test "x$BUILD_OS" != xwindows; then |
ohair@425 | 130 | # Follow a chain of symbolic links. Use readlink |
ohair@425 | 131 | # where it exists, else fall back to horribly |
ohair@425 | 132 | # complicated shell code. |
ohair@425 | 133 | AC_PATH_PROG(READLINK, readlink) |
ohair@425 | 134 | if test "x$READLINK_TESTED" != yes; then |
ohair@425 | 135 | # On MacOSX there is a readlink tool with a different |
ohair@425 | 136 | # purpose than the GNU readlink tool. Check the found readlink. |
ohair@425 | 137 | ISGNU=`$READLINK --help 2>&1 | grep GNU` |
ohair@425 | 138 | if test "x$ISGNU" = x; then |
ohair@425 | 139 | # A readlink that we do not know how to use. |
ohair@425 | 140 | # Are there other non-GNU readlinks out there? |
ohair@425 | 141 | READLINK_TESTED=yes |
ohair@425 | 142 | READLINK= |
ohair@425 | 143 | fi |
ohair@425 | 144 | fi |
ohair@425 | 145 | |
ohair@425 | 146 | if test "x$READLINK" != x; then |
ohair@425 | 147 | $1=`$READLINK -f [$]$1` |
ohair@425 | 148 | else |
ohair@425 | 149 | STARTDIR=$PWD |
ohair@425 | 150 | COUNTER=0 |
ohair@425 | 151 | DIR=`dirname [$]$1` |
ohair@425 | 152 | FIL=`basename [$]$1` |
ohair@425 | 153 | while test $COUNTER -lt 20; do |
ohair@425 | 154 | ISLINK=`ls -l $DIR/$FIL | grep '\->' | sed -e 's/.*-> \(.*\)/\1/'` |
ohair@425 | 155 | if test "x$ISLINK" == x; then |
ohair@425 | 156 | # This is not a symbolic link! We are done! |
ohair@425 | 157 | break |
ohair@425 | 158 | fi |
ohair@425 | 159 | # The link might be relative! We have to use cd to travel safely. |
ohair@425 | 160 | cd $DIR |
ohair@425 | 161 | cd `dirname $ISLINK` |
ohair@425 | 162 | DIR=`pwd` |
ohair@425 | 163 | FIL=`basename $ISLINK` |
ohair@425 | 164 | let COUNTER=COUNTER+1 |
ohair@425 | 165 | done |
ohair@425 | 166 | cd $STARTDIR |
ohair@425 | 167 | $1=$DIR/$FIL |
ohair@425 | 168 | fi |
ohair@425 | 169 | fi |
ohair@425 | 170 | ]) |
ohair@425 | 171 | |
ohair@425 | 172 | AC_DEFUN([TESTFOR_PROG_CCACHE], |
ohair@425 | 173 | [ |
ohair@425 | 174 | AC_ARG_ENABLE([ccache], |
ohair@425 | 175 | [AS_HELP_STRING([--disable-ccache], |
ohair@425 | 176 | [use ccache to speed up recompilations @<:@enabled@:>@])], |
ohair@425 | 177 | [ENABLE_CCACHE=${enable_ccache}], [ENABLE_CCACHE=yes]) |
ohair@425 | 178 | if test "x$ENABLE_CCACHE" = xyes; then |
ohair@425 | 179 | AC_PATH_PROG(CCACHE, ccache) |
ohair@425 | 180 | else |
ohair@425 | 181 | AC_MSG_CHECKING([for ccache]) |
ohair@425 | 182 | AC_MSG_RESULT([explicitly disabled]) |
ohair@425 | 183 | CCACHE= |
ohair@425 | 184 | fi |
ohair@425 | 185 | AC_SUBST(CCACHE) |
ohair@425 | 186 | |
ohair@425 | 187 | AC_ARG_WITH([ccache-dir], |
ohair@425 | 188 | [AS_HELP_STRING([--with-ccache-dir], |
ohair@425 | 189 | [where to store ccache files @<:@~/.ccache@:>@])]) |
ohair@425 | 190 | |
ohair@425 | 191 | if test "x$with_ccache_dir" != x; then |
ohair@425 | 192 | # When using a non home ccache directory, assume the use is to share ccache files |
ohair@425 | 193 | # with other users. Thus change the umask. |
ohair@425 | 194 | SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002" |
ohair@425 | 195 | fi |
ohair@425 | 196 | CCACHE_FOUND="" |
ohair@425 | 197 | if test "x$CCACHE" != x; then |
ohair@425 | 198 | SETUP_CCACHE_USAGE |
ohair@425 | 199 | fi |
ohair@425 | 200 | ]) |
ohair@425 | 201 | |
ohair@425 | 202 | AC_DEFUN([SETUP_CCACHE_USAGE], |
ohair@425 | 203 | [ |
ohair@425 | 204 | if test "x$CCACHE" != x; then |
ohair@425 | 205 | CCACHE_FOUND="true" |
ohair@425 | 206 | # Only use ccache if it is 3.1.4 or later, which supports |
ohair@425 | 207 | # precompiled headers. |
ohair@425 | 208 | AC_MSG_CHECKING([if ccache supports precompiled headers]) |
ohair@425 | 209 | HAS_GOOD_CCACHE=`($CCACHE --version | head -n 1 | grep -E 3.1.@<:@456789@:>@) 2> /dev/null` |
ohair@425 | 210 | if test "x$HAS_GOOD_CCACHE" = x; then |
ohair@425 | 211 | AC_MSG_RESULT([no, disabling ccache]) |
ohair@425 | 212 | CCACHE= |
ohair@425 | 213 | else |
ohair@425 | 214 | AC_MSG_RESULT([yes]) |
ohair@425 | 215 | AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers]) |
ohair@425 | 216 | PUSHED_FLAGS="$CXXFLAGS" |
ohair@425 | 217 | CXXFLAGS="-fpch-preprocess $CXXFLAGS" |
ohair@425 | 218 | AC_TRY_COMPILE([], [], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no]) |
ohair@425 | 219 | CXXFLAGS="$PUSHED_FLAGS" |
ohair@425 | 220 | if test "x$CC_KNOWS_CCACHE_TRICK" = xyes; then |
ohair@425 | 221 | AC_MSG_RESULT([yes]) |
ohair@425 | 222 | else |
ohair@425 | 223 | AC_MSG_RESULT([no, disabling ccaching of precompiled headers]) |
ohair@425 | 224 | CCACHE= |
ohair@425 | 225 | fi |
ohair@425 | 226 | fi |
ohair@425 | 227 | fi |
ohair@425 | 228 | |
ohair@425 | 229 | if test "x$CCACHE" != x; then |
ohair@425 | 230 | CCACHE_SLOPPINESS=time_macros |
ohair@425 | 231 | CCACHE="CCACHE_COMPRESS=1 $SET_CCACHE_DIR CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS $CCACHE" |
ohair@425 | 232 | CCACHE_FLAGS=-fpch-preprocess |
ohair@425 | 233 | |
ohair@425 | 234 | if test "x$SET_CCACHE_DIR" != x; then |
ohair@425 | 235 | mkdir -p $CCACHE_DIR > /dev/null 2>&1 |
ohair@425 | 236 | chmod a+rwxs $CCACHE_DIR > /dev/null 2>&1 |
ohair@425 | 237 | fi |
ohair@425 | 238 | fi |
ohair@425 | 239 | ]) |
ohair@425 | 240 | |
ohair@425 | 241 | AC_DEFUN([EXTRACT_HOST_AND_BUILD_AND_LEGACY_VARS], |
ohair@425 | 242 | [ |
ohair@425 | 243 | # Expects $host_os $host_cpu $build_os and $build_cpu |
ohair@425 | 244 | # and $with_data_model to have been setup! |
ohair@425 | 245 | # |
ohair@425 | 246 | # Translate the standard triplet(quadruplet) definition |
ohair@425 | 247 | # of the host/build system into |
ohair@425 | 248 | # HOST_OS=aix,bsd,hpux,linux,macosx,solaris,windows |
ohair@425 | 249 | # HOST_OS_FAMILY=bsd,gnu,sysv,win32,wince |
ohair@425 | 250 | # HOST_OS_API=posix,winapi |
ohair@425 | 251 | # |
ohair@425 | 252 | # HOST_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64 |
ohair@425 | 253 | # HOST_CPU_ARCH=x86,sparc,pcc,arm |
ohair@425 | 254 | # HOST_CPU_BITS=32,64 |
ohair@425 | 255 | # HOST_CPU_ENDIAN=big,little |
ohair@425 | 256 | # |
ohair@425 | 257 | # The same values are setup for BUILD_... |
ohair@425 | 258 | # |
ohair@425 | 259 | # And the legacy variables, for controlling the old makefiles. |
ohair@425 | 260 | # LEGACY_HOST_CPU1=i586,amd64,sparc,sparcv9,arm,arm64... |
ohair@425 | 261 | # LEGACY_HOST_CPU2=i386,amd64,sparc,sparcv9,arm,arm64... |
ohair@425 | 262 | # LEGACY_HOST_CPU3=sparcv9,amd64 (but only on solaris) |
ohair@425 | 263 | # LEGACY_HOST_OS_API=solaris,windows |
ohair@425 | 264 | # |
ohair@425 | 265 | # We also copy the autoconf trip/quadruplet |
ohair@425 | 266 | # verbatim to HOST and BUILD |
ohair@425 | 267 | AC_SUBST(HOST, ${host}) |
ohair@425 | 268 | AC_SUBST(BUILD, ${build}) |
ohair@425 | 269 | |
ohair@425 | 270 | EXTRACT_VARS_FROM_OS_TO(HOST,$host_os) |
ohair@425 | 271 | EXTRACT_VARS_FROM_CPU_TO(HOST,$host_cpu) |
ohair@425 | 272 | |
ohair@425 | 273 | EXTRACT_VARS_FROM_OS_TO(BUILD,$build_os) |
ohair@425 | 274 | EXTRACT_VARS_FROM_CPU_TO(BUILD,$build_cpu) |
ohair@425 | 275 | |
ohair@425 | 276 | if test "x$HOST_OS" != xsolaris; then |
ohair@425 | 277 | LEGACY_HOST_CPU3="" |
ohair@425 | 278 | LEGACY_BUILD_CPU3="" |
ohair@425 | 279 | fi |
ohair@425 | 280 | ]) |
ohair@425 | 281 | |
ohair@425 | 282 | AC_DEFUN([EXTRACT_VARS_FROM_OS_TO], |
ohair@425 | 283 | [ |
ohair@425 | 284 | EXTRACT_VARS_FROM_OS($2) |
ohair@425 | 285 | $1_OS="$VAR_OS" |
ohair@425 | 286 | $1_OS_FAMILY="$VAR_OS_FAMILY" |
ohair@425 | 287 | $1_OS_API="$VAR_OS_API" |
ohair@425 | 288 | |
ohair@425 | 289 | AC_SUBST($1_OS) |
ohair@425 | 290 | AC_SUBST($1_OS_FAMILY) |
ohair@425 | 291 | AC_SUBST($1_OS_API) |
ohair@425 | 292 | |
ohair@425 | 293 | if test "x$$1_OS_API" = xposix; then |
ohair@425 | 294 | LEGACY_$1_OS_API="solaris" |
ohair@425 | 295 | fi |
ohair@425 | 296 | if test "x$$1_OS_API" = xwinapi; then |
ohair@425 | 297 | LEGACY_$1_OS_API="windows" |
ohair@425 | 298 | fi |
ohair@425 | 299 | AC_SUBST(LEGACY_$1_OS_API) |
ohair@425 | 300 | ]) |
ohair@425 | 301 | |
ohair@425 | 302 | AC_DEFUN([EXTRACT_VARS_FROM_CPU_TO], |
ohair@425 | 303 | [ |
ohair@425 | 304 | EXTRACT_VARS_FROM_CPU($2) |
ohair@425 | 305 | $1_CPU="$VAR_CPU" |
ohair@425 | 306 | $1_CPU_ARCH="$VAR_CPU_ARCH" |
ohair@425 | 307 | $1_CPU_BITS="$VAR_CPU_BITS" |
ohair@425 | 308 | $1_CPU_ENDIAN="$VAR_CPU_ENDIAN" |
ohair@425 | 309 | |
ohair@425 | 310 | AC_SUBST($1_CPU) |
ohair@425 | 311 | AC_SUBST($1_CPU_ARCH) |
ohair@425 | 312 | AC_SUBST($1_CPU_BITS) |
ohair@425 | 313 | AC_SUBST($1_CPU_ENDIAN) |
ohair@425 | 314 | |
ohair@425 | 315 | # Also store the legacy naming of the cpu. |
ohair@425 | 316 | # Ie i586 and amd64 instead of ia32 and x64 |
ohair@425 | 317 | LEGACY_$1_CPU1="$VAR_LEGACY_CPU" |
ohair@425 | 318 | AC_SUBST(LEGACY_$1_CPU1) |
ohair@425 | 319 | |
ohair@425 | 320 | # And the second legacy naming of the cpu. |
ohair@425 | 321 | # Ie i386 and amd64 instead of ia32 and x64. |
ohair@425 | 322 | LEGACY_$1_CPU2="$LEGACY_$1_CPU1" |
ohair@425 | 323 | if test "x$LEGACY_$1_CPU1" = xi586; then |
ohair@425 | 324 | LEGACY_$1_CPU2=i386 |
ohair@425 | 325 | fi |
ohair@425 | 326 | AC_SUBST(LEGACY_$1_CPU2) |
ohair@425 | 327 | |
ohair@425 | 328 | # And the third legacy naming of the cpu. |
ohair@425 | 329 | # Ie only amd64 or sparcv9, used for the ISA_DIR on Solaris. |
ohair@425 | 330 | LEGACY_$1_CPU3="" |
ohair@425 | 331 | if test "x$$1_CPU" = xx64; then |
ohair@425 | 332 | LEGACY_$1_CPU3=amd64 |
ohair@425 | 333 | fi |
ohair@425 | 334 | if test "x$$1_CPU" = xsparcv9; then |
ohair@425 | 335 | LEGACY_$1_CPU3=sparvc9 |
ohair@425 | 336 | fi |
ohair@425 | 337 | AC_SUBST(LEGACY_$1_CPU3) |
ohair@425 | 338 | ]) |
ohair@425 | 339 | |
ohair@425 | 340 | AC_DEFUN([EXTRACT_VARS_FROM_CPU], |
ohair@425 | 341 | [ |
ohair@425 | 342 | # First argument is the cpu name from the trip/quad |
ohair@425 | 343 | case "$1" in |
ohair@425 | 344 | x86_64) |
ohair@425 | 345 | VAR_CPU=x64 |
ohair@425 | 346 | VAR_CPU_ARCH=x86 |
ohair@425 | 347 | VAR_CPU_BITS=64 |
ohair@425 | 348 | VAR_CPU_ENDIAN=little |
ohair@425 | 349 | VAR_LEGACY_CPU=amd64 |
ohair@425 | 350 | ;; |
ohair@425 | 351 | i?86) |
ohair@425 | 352 | VAR_CPU=ia32 |
ohair@425 | 353 | VAR_CPU_ARCH=x86 |
ohair@425 | 354 | VAR_CPU_BITS=32 |
ohair@425 | 355 | VAR_CPU_ENDIAN=little |
ohair@425 | 356 | VAR_LEGACY_CPU=i586 |
ohair@425 | 357 | ;; |
ohair@425 | 358 | alpha*) |
ohair@425 | 359 | VAR_CPU=alpha |
ohair@425 | 360 | VAR_CPU_ARCH=alpha |
ohair@425 | 361 | VAR_CPU_BITS=64 |
ohair@425 | 362 | VAR_CPU_ENDIAN=big |
ohair@425 | 363 | VAR_LEGACY_CPU=alpha |
ohair@425 | 364 | ;; |
ohair@425 | 365 | arm*) |
ohair@425 | 366 | VAR_CPU=arm |
ohair@425 | 367 | VAR_CPU_ARCH=arm |
ohair@425 | 368 | VAR_CPU_BITS=3264 |
ohair@425 | 369 | VAR_CPU_ENDIAN=big |
ohair@425 | 370 | VAR_LEGACY_CPU=arm |
ohair@425 | 371 | ;; |
ohair@425 | 372 | mips) |
ohair@425 | 373 | VAR_CPU=mips |
ohair@425 | 374 | VAR_CPU_ARCH=mips |
ohair@425 | 375 | VAR_CPU_BITS=woot |
ohair@425 | 376 | VAR_CPU_ENDIAN=woot |
ohair@425 | 377 | VAR_LEGACY_CPU=mips |
ohair@425 | 378 | ;; |
ohair@425 | 379 | mipsel) |
ohair@425 | 380 | VAR_CPU=mipsel |
ohair@425 | 381 | VAR_CPU_ARCH=mips |
ohair@425 | 382 | VAR_CPU_BITS=woot |
ohair@425 | 383 | VAR_CPU_ENDIAN=woot |
ohair@425 | 384 | VAR_LEGACY_CPU=mipsel |
ohair@425 | 385 | ;; |
ohair@425 | 386 | powerpc) |
ohair@425 | 387 | VAR_CPU=ppc |
ohair@425 | 388 | VAR_CPU_ARCH=ppc |
ohair@425 | 389 | VAR_CPU_BITS=32 |
ohair@425 | 390 | VAR_CPU_ENDIAN=big |
ohair@425 | 391 | VAR_LEGACY_CPU=ppc |
ohair@425 | 392 | ;; |
ohair@425 | 393 | powerpc64) |
ohair@425 | 394 | VAR_CPU=ppc64 |
ohair@425 | 395 | VAR_CPU_ARCH=ppc |
ohair@425 | 396 | VAR_CPU_BITS=64 |
ohair@425 | 397 | VAR_CPU_ENDIAN=32 |
ohair@425 | 398 | VAR_LEGACY_CPU=ppc64 |
ohair@425 | 399 | ;; |
ohair@425 | 400 | sparc) |
ohair@425 | 401 | VAR_CPU=sparc |
ohair@425 | 402 | VAR_CPU_ARCH=sparc |
ohair@425 | 403 | VAR_CPU_BITS=32 |
ohair@425 | 404 | VAR_CPU_ENDIAN=big |
ohair@425 | 405 | VAR_LEGACY_CPU=sparc |
ohair@425 | 406 | ;; |
ohair@425 | 407 | sparc64) |
ohair@425 | 408 | VAR_CPU=sparcv9 |
ohair@425 | 409 | VAR_CPU_ARCH=sparc |
ohair@425 | 410 | VAR_CPU_BITS=64 |
ohair@425 | 411 | VAR_CPU_ENDIAN=big |
ohair@425 | 412 | VAR_LEGACY_CPU=sparc_sparcv9 |
ohair@425 | 413 | ;; |
ohair@425 | 414 | s390) |
ohair@425 | 415 | VAR_CPU=s390 |
ohair@425 | 416 | VAR_CPU_ARCH=s390 |
ohair@425 | 417 | VAR_CPU_BITS=32 |
ohair@425 | 418 | VAR_CPU_ENDIAN=woot |
ohair@425 | 419 | VAR_LEGACY_CPU=s390 |
ohair@425 | 420 | VAR_LEGACY_CPU=s390 |
ohair@425 | 421 | ;; |
ohair@425 | 422 | s390x) |
ohair@425 | 423 | VAR_CPU=s390x |
ohair@425 | 424 | VAR_CPU_ARCH=s390 |
ohair@425 | 425 | VAR_CPU_BITS=64 |
ohair@425 | 426 | VAR_CPU_ENDIAN=woot |
ohair@425 | 427 | VAR_LEGACY_CPU=s390x |
ohair@425 | 428 | ;; |
ohair@425 | 429 | *) |
ohair@425 | 430 | AC_ERROR([unsupported cpu $1]) |
ohair@425 | 431 | ;; |
ohair@425 | 432 | esac |
ohair@425 | 433 | |
ohair@425 | 434 | # Workaround cygwin not knowing about 64 bit. |
ohair@425 | 435 | if test "x$VAR_OS" = "xwindows"; then |
ohair@425 | 436 | if test "x$PROCESSOR_IDENTIFIER" != "x"; then |
ohair@425 | 437 | PROC_ARCH=`echo $PROCESSOR_IDENTIFIER | $CUT -f1 -d' '` |
ohair@425 | 438 | case "$PROC_ARCH" in |
ohair@425 | 439 | intel64|Intel64|INTEL64|em64t|EM64T|amd64|AMD64|8664|x86_64) |
ohair@425 | 440 | VAR_CPU=x64 |
ohair@425 | 441 | VAR_CPU_BITS=64 |
ohair@425 | 442 | VAR_LEGACY_CPU=amd64 |
ohair@425 | 443 | ;; |
ohair@425 | 444 | esac |
ohair@425 | 445 | fi |
ohair@425 | 446 | fi |
ohair@425 | 447 | |
ohair@425 | 448 | if test "x$VAR_CPU_ARCH" = "xx86"; then |
ohair@425 | 449 | if test "x$with_data_model" = "x64"; then |
ohair@425 | 450 | VAR_CPU=x64 |
ohair@425 | 451 | VAR_CPU_BITS=64 |
ohair@425 | 452 | VAR_LEGACY_CPU=amd64 |
ohair@425 | 453 | fi |
ohair@425 | 454 | if test "x$with_data_model" = "x32"; then |
ohair@425 | 455 | VAR_CPU=ia32 |
ohair@425 | 456 | VAR_CPU_BITS=32 |
ohair@425 | 457 | VAR_LEGACY_CPU=i586 |
ohair@425 | 458 | fi |
ohair@425 | 459 | fi |
ohair@425 | 460 | ]) |
ohair@425 | 461 | |
ohair@425 | 462 | AC_DEFUN([EXTRACT_VARS_FROM_OS], |
ohair@425 | 463 | [ |
ohair@425 | 464 | case "$1" in |
ohair@425 | 465 | *linux*) |
ohair@425 | 466 | VAR_OS=linux |
ohair@425 | 467 | VAR_OS_API=posix |
ohair@425 | 468 | VAR_OS_FAMILY=gnu |
ohair@425 | 469 | ;; |
ohair@425 | 470 | *solaris*) |
ohair@425 | 471 | VAR_OS=solaris |
ohair@425 | 472 | VAR_OS_API=posix |
ohair@425 | 473 | VAR_OS_FAMILY=sysv |
ohair@425 | 474 | ;; |
ohair@425 | 475 | *darwin*) |
ohair@425 | 476 | VAR_OS=macosx |
ohair@425 | 477 | VAR_OS_API=posix |
ohair@425 | 478 | VAR_OS_FAMILY=bsd |
ohair@425 | 479 | ;; |
ohair@425 | 480 | *bsd*) |
ohair@425 | 481 | VAR_OS=bsd |
ohair@425 | 482 | VAR_OS_API=posix |
ohair@425 | 483 | VAR_OS_FAMILY=bsd |
ohair@425 | 484 | ;; |
ohair@425 | 485 | *cygwin*|*windows*) |
ohair@425 | 486 | VAR_OS=windows |
ohair@425 | 487 | VAR_OS_API=winapi |
ohair@425 | 488 | VAR_OS_FAMILY=windows |
ohair@425 | 489 | ;; |
ohair@425 | 490 | *) |
ohair@425 | 491 | AC_MSG_ERROR([unsupported host operating system $1]) |
ohair@425 | 492 | ;; |
ohair@425 | 493 | esac |
ohair@425 | 494 | ]) |
ohair@425 | 495 | |
ohair@425 | 496 | AC_DEFUN([CHECK_COMPILER_VERSION], |
ohair@425 | 497 | [ |
ohair@425 | 498 | # Test the compilers that their versions are new enough. |
ohair@425 | 499 | # AC_MSG_CHECKING([version of GCC]) |
ohair@425 | 500 | gcc_ver=`${CC} -dumpversion` |
ohair@425 | 501 | gcc_major_ver=`echo ${gcc_ver}|cut -d'.' -f1` |
ohair@425 | 502 | gcc_minor_ver=`echo ${gcc_ver}|cut -d'.' -f2` |
ohair@425 | 503 | # AM_CONDITIONAL(GCC_OLD, test ! ${gcc_major_ver} -ge 4 -a ${gcc_minor_ver} -ge 3) |
ohair@425 | 504 | # AC_MSG_RESULT([${gcc_ver} (major version ${gcc_major_ver}, minor version ${gcc_minor_ver})]) |
ohair@425 | 505 | ]) |
ohair@425 | 506 | |
ohair@425 | 507 | # Fixes paths on windows hosts to be mixed mode short. |
ohair@425 | 508 | AC_DEFUN([WIN_FIX_PATH], |
ohair@425 | 509 | [ |
ohair@425 | 510 | if test "x$BUILD_OS" = "xwindows"; then |
ohair@425 | 511 | AC_PATH_PROG(CYGPATH, cygpath) |
ohair@425 | 512 | tmp="[$]$1" |
ohair@425 | 513 | # Convert to C:/ mixed style path without spaces. |
ohair@425 | 514 | tmp=`$CYGPATH -s -m "$tmp"` |
ohair@425 | 515 | $1="$tmp" |
ohair@425 | 516 | fi |
ohair@425 | 517 | ]) |