common/autoconf/basics.m4

Thu, 05 Jul 2012 18:27:07 -0700

author
erikj
date
Thu, 05 Jul 2012 18:27:07 -0700
changeset 459
3156dff953b1
child 478
2ba6f4da4bf3
permissions
-rw-r--r--

7182051: Update of latest build-infra Makefiles (missing files)
Reviewed-by: ohair

erikj@459 1 #
erikj@459 2 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
erikj@459 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@459 4 #
erikj@459 5 # This code is free software; you can redistribute it and/or modify it
erikj@459 6 # under the terms of the GNU General Public License version 2 only, as
erikj@459 7 # published by the Free Software Foundation. Oracle designates this
erikj@459 8 # particular file as subject to the "Classpath" exception as provided
erikj@459 9 # by Oracle in the LICENSE file that accompanied this code.
erikj@459 10 #
erikj@459 11 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@459 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@459 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@459 14 # version 2 for more details (a copy is included in the LICENSE file that
erikj@459 15 # accompanied this code).
erikj@459 16 #
erikj@459 17 # You should have received a copy of the GNU General Public License version
erikj@459 18 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@459 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@459 20 #
erikj@459 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@459 22 # or visit www.oracle.com if you need additional information or have any
erikj@459 23 # questions.
erikj@459 24 #
erikj@459 25
erikj@459 26 AC_DEFUN([ADD_JVM_ARG_IF_OK],
erikj@459 27 [
erikj@459 28 # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
erikj@459 29 # If so, then append $1 to $2
erikj@459 30 FOUND_WARN=`$3 $1 -version 2>&1 | grep -i warn`
erikj@459 31 FOUND_VERSION=`$3 $1 -version 2>&1 | grep " version \""`
erikj@459 32 if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
erikj@459 33 $2="[$]$2 $1"
erikj@459 34 fi
erikj@459 35 ])
erikj@459 36
erikj@459 37 AC_DEFUN([WHICHCMD],
erikj@459 38 [
erikj@459 39 # Translate "gcc -E" into "`which gcc` -E" ie
erikj@459 40 # extract the full path to the binary and at the
erikj@459 41 # same time maintain any arguments passed to it.
erikj@459 42 # The command MUST exist in the path, or else!
erikj@459 43 tmp="[$]$1"
erikj@459 44 car="${tmp%% *}"
erikj@459 45 tmp="[$]$1 EOL"
erikj@459 46 cdr="${tmp#* }"
erikj@459 47 # On windows we want paths without spaces.
erikj@459 48 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
erikj@459 49 WHICHCMD_SPACESAFE(car)
erikj@459 50 else
erikj@459 51 # "which" is not portable, but is used here
erikj@459 52 # because we know that the command exists!
erikj@459 53 car=`which $car`
erikj@459 54 fi
erikj@459 55 if test "x$cdr" != xEOL; then
erikj@459 56 $1="$car ${cdr% *}"
erikj@459 57 else
erikj@459 58 $1="$car"
erikj@459 59 fi
erikj@459 60 ])
erikj@459 61
erikj@459 62 AC_DEFUN([SPACESAFE],
erikj@459 63 [
erikj@459 64 # Fail with message $2 if var $1 contains a path with no spaces in it.
erikj@459 65 # Unless on Windows, where we can rewrite the path.
erikj@459 66 HAS_SPACE=`echo "[$]$1" | grep " "`
erikj@459 67 if test "x$HAS_SPACE" != x; then
erikj@459 68 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
erikj@459 69 $1=`$CYGPATH -s -m -a "[$]$1"`
erikj@459 70 $1=`$CYGPATH -u "[$]$1"`
erikj@459 71 else
erikj@459 72 AC_MSG_ERROR([You cannot have spaces in $2! "[$]$1"])
erikj@459 73 fi
erikj@459 74 fi
erikj@459 75 ])
erikj@459 76
erikj@459 77 AC_DEFUN([WHICHCMD_SPACESAFE],
erikj@459 78 [
erikj@459 79 # Translate long cygdrive or C:\sdfsf path
erikj@459 80 # into a short mixed mode path that has no
erikj@459 81 # spaces in it.
erikj@459 82 tmp="[$]$1"
erikj@459 83
erikj@459 84 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
erikj@459 85 tmp=`$CYGPATH -u "[$]$1"`
erikj@459 86 tmp=`which "$tmp"`
erikj@459 87 # If file exists with .exe appended, that's the real filename
erikj@459 88 # and cygpath needs that to convert to short style path.
erikj@459 89 if test -f "${tmp}.exe"; then
erikj@459 90 tmp="${tmp}.exe"
erikj@459 91 elif test -f "${tmp}.cmd"; then
erikj@459 92 tmp="${tmp}.cmd"
erikj@459 93 fi
erikj@459 94 # Convert to C:/ mixed style path without spaces.
erikj@459 95 tmp=`$CYGPATH -s -m "$tmp"`
erikj@459 96 fi
erikj@459 97 $1="$tmp"
erikj@459 98 ])
erikj@459 99
erikj@459 100 AC_DEFUN([REMOVE_SYMBOLIC_LINKS],
erikj@459 101 [
erikj@459 102 if test "x$OPENJDK_BUILD_OS" != xwindows; then
erikj@459 103 # Follow a chain of symbolic links. Use readlink
erikj@459 104 # where it exists, else fall back to horribly
erikj@459 105 # complicated shell code.
erikj@459 106 AC_PATH_PROG(READLINK, readlink)
erikj@459 107 if test "x$READLINK_TESTED" != yes; then
erikj@459 108 # On MacOSX there is a readlink tool with a different
erikj@459 109 # purpose than the GNU readlink tool. Check the found readlink.
erikj@459 110 ISGNU=`$READLINK --help 2>&1 | grep GNU`
erikj@459 111 if test "x$ISGNU" = x; then
erikj@459 112 # A readlink that we do not know how to use.
erikj@459 113 # Are there other non-GNU readlinks out there?
erikj@459 114 READLINK_TESTED=yes
erikj@459 115 READLINK=
erikj@459 116 fi
erikj@459 117 fi
erikj@459 118
erikj@459 119 if test "x$READLINK" != x; then
erikj@459 120 $1=`$READLINK -f [$]$1`
erikj@459 121 else
erikj@459 122 STARTDIR=$PWD
erikj@459 123 COUNTER=0
erikj@459 124 DIR=`dirname [$]$1`
erikj@459 125 FIL=`basename [$]$1`
erikj@459 126 while test $COUNTER -lt 20; do
erikj@459 127 ISLINK=`ls -l $DIR/$FIL | grep '\->' | sed -e 's/.*-> \(.*\)/\1/'`
erikj@459 128 if test "x$ISLINK" == x; then
erikj@459 129 # This is not a symbolic link! We are done!
erikj@459 130 break
erikj@459 131 fi
erikj@459 132 # The link might be relative! We have to use cd to travel safely.
erikj@459 133 cd $DIR
erikj@459 134 cd `dirname $ISLINK`
erikj@459 135 DIR=`pwd`
erikj@459 136 FIL=`basename $ISLINK`
erikj@459 137 let COUNTER=COUNTER+1
erikj@459 138 done
erikj@459 139 cd $STARTDIR
erikj@459 140 $1=$DIR/$FIL
erikj@459 141 fi
erikj@459 142 fi
erikj@459 143 ])
erikj@459 144
erikj@459 145 AC_DEFUN_ONCE([BASIC_INIT],
erikj@459 146 [
erikj@459 147 # Save the original command line. This is passed to us by the wrapper configure script.
erikj@459 148 AC_SUBST(CONFIGURE_COMMAND_LINE)
erikj@459 149 DATE_WHEN_CONFIGURED=`LANG=C date`
erikj@459 150 AC_SUBST(DATE_WHEN_CONFIGURED)
erikj@459 151
erikj@459 152 # Locate the directory of this script.
erikj@459 153 SCRIPT="[$]0"
erikj@459 154 REMOVE_SYMBOLIC_LINKS(SCRIPT)
erikj@459 155 AUTOCONF_DIR=`dirname [$]0`
erikj@459 156 ])
erikj@459 157
erikj@459 158 AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
erikj@459 159 [
erikj@459 160 # Where is the source? It is located two levels above the configure script.
erikj@459 161 CURDIR="$PWD"
erikj@459 162 cd "$AUTOCONF_DIR/../.."
erikj@459 163 SRC_ROOT="`pwd`"
erikj@459 164 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
erikj@459 165 SRC_ROOT_LENGTH=`pwd|wc -m`
erikj@459 166 if test $SRC_ROOT_LENGTH -gt 100; then
erikj@459 167 AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported])
erikj@459 168 fi
erikj@459 169 fi
erikj@459 170 AC_SUBST(SRC_ROOT)
erikj@459 171 cd "$CURDIR"
erikj@459 172
erikj@459 173 SPACESAFE(SRC_ROOT,[the path to the source root])
erikj@459 174 SPACESAFE(CURDIR,[the path to the current directory])
erikj@459 175 ])
erikj@459 176
erikj@459 177 AC_DEFUN_ONCE([BASIC_SETUP_SEARCHPATH],
erikj@459 178 [
erikj@459 179 if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
erikj@459 180 # Add extra search paths on solaris for utilities like ar and as etc...
erikj@459 181 PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
erikj@459 182 fi
erikj@459 183 ])
erikj@459 184
erikj@459 185 AC_DEFUN_ONCE([BASIC_SETUP_PATH_SEP],
erikj@459 186 [
erikj@459 187 # For cygwin we need cygpath first, since it is used everywhere.
erikj@459 188 AC_PATH_PROG(CYGPATH, cygpath)
erikj@459 189 PATH_SEP=":"
erikj@459 190 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
erikj@459 191 if test "x$CYGPATH" = x; then
erikj@459 192 AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path])
erikj@459 193 fi
erikj@459 194 PATH_SEP=";"
erikj@459 195 fi
erikj@459 196 AC_SUBST(PATH_SEP)
erikj@459 197 ])
erikj@459 198
erikj@459 199 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
erikj@459 200 [
erikj@459 201
erikj@459 202 AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
erikj@459 203 [use this as the name of the configuration, overriding the generated default])],
erikj@459 204 [ CONF_NAME=${with_conf_name} ])
erikj@459 205
erikj@459 206 # Test from where we are running configure, in or outside of src root.
erikj@459 207 if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then
erikj@459 208 # We are running configure from the src root.
erikj@459 209 # Create a default ./build/target-variant-debuglevel output root.
erikj@459 210 if test "x${CONF_NAME}" = x; then
erikj@459 211 CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
erikj@459 212 fi
erikj@459 213 OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}"
erikj@459 214 mkdir -p "$OUTPUT_ROOT"
erikj@459 215 if test ! -d "$OUTPUT_ROOT"; then
erikj@459 216 AC_MSG_ERROR([Could not create build directory $OUTPUT_ROOT])
erikj@459 217 fi
erikj@459 218 else
erikj@459 219 # We are running configure from outside of the src dir.
erikj@459 220 # Then use the current directory as output dir!
erikj@459 221 # If configuration is situated in normal build directory, just use the build
erikj@459 222 # directory name as configuration name, otherwise use the complete path.
erikj@459 223 if test "x${CONF_NAME}" = x; then
erikj@459 224 CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"`
erikj@459 225 fi
erikj@459 226 OUTPUT_ROOT="$CURDIR"
erikj@459 227 fi
erikj@459 228
erikj@459 229 SPACESAFE(OUTPUT_ROOT,[the path to the output root])
erikj@459 230
erikj@459 231 AC_SUBST(SPEC, $OUTPUT_ROOT/spec.gmk)
erikj@459 232 AC_SUBST(CONF_NAME, $CONF_NAME)
erikj@459 233 AC_SUBST(OUTPUT_ROOT, $OUTPUT_ROOT)
erikj@459 234
erikj@459 235 # Most of the probed defines are put into config.h
erikj@459 236 AC_CONFIG_HEADERS([$OUTPUT_ROOT/config.h:$AUTOCONF_DIR/config.h.in])
erikj@459 237 # The spec.gmk file contains all variables for the make system.
erikj@459 238 AC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in])
erikj@459 239 # The spec.sh file contains variables for compare{images|-objects}.sh scrips.
erikj@459 240 AC_CONFIG_FILES([$OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in])
erikj@459 241 # The generated Makefile knows where the spec.gmk is and where the source is.
erikj@459 242 # You can run make from the OUTPUT_ROOT, or from the top-level Makefile
erikj@459 243 # which will look for generated configurations
erikj@459 244 AC_CONFIG_FILES([$OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in])
erikj@459 245
erikj@459 246 # Save the arguments given to us
erikj@459 247 echo "$CONFIGURE_COMMAND_LINE" > $OUTPUT_ROOT/configure-arguments
erikj@459 248 ])
erikj@459 249
erikj@459 250 AC_DEFUN_ONCE([BASIC_SETUP_LOGGING],
erikj@459 251 [
erikj@459 252 # Setup default logging of stdout and stderr to build.log in the output root.
erikj@459 253 BUILD_LOG='$(OUTPUT_ROOT)/build.log'
erikj@459 254 BUILD_LOG_PREVIOUS='$(OUTPUT_ROOT)/build.log.old'
erikj@459 255 BUILD_LOG_WRAPPER='$(SH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)'
erikj@459 256 AC_SUBST(BUILD_LOG)
erikj@459 257 AC_SUBST(BUILD_LOG_PREVIOUS)
erikj@459 258 AC_SUBST(BUILD_LOG_WRAPPER)
erikj@459 259 ])
erikj@459 260
erikj@459 261
erikj@459 262 #%%% Simple tools %%%
erikj@459 263
erikj@459 264 AC_DEFUN([BASIC_CHECK_FIND_DELETE],
erikj@459 265 [
erikj@459 266 # Test if find supports -delete
erikj@459 267 AC_MSG_CHECKING([if find supports -delete])
erikj@459 268 FIND_DELETE="-delete"
erikj@459 269
erikj@459 270 DELETEDIR=`mktemp -d tmp.XXXXXXXXXX` || (echo Could not create temporary directory!; exit $?)
erikj@459 271
erikj@459 272 echo Hejsan > $DELETEDIR/TestIfFindSupportsDelete
erikj@459 273
erikj@459 274 TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1`
erikj@459 275 if test -f $DELETEDIR/TestIfFindSupportsDelete; then
erikj@459 276 # No, it does not.
erikj@459 277 rm $DELETEDIR/TestIfFindSupportsDelete
erikj@459 278 FIND_DELETE="-exec rm \{\} \+"
erikj@459 279 AC_MSG_RESULT([no])
erikj@459 280 else
erikj@459 281 AC_MSG_RESULT([yes])
erikj@459 282 fi
erikj@459 283 rmdir $DELETEDIR
erikj@459 284 ])
erikj@459 285
erikj@459 286 AC_DEFUN([CHECK_NONEMPTY],
erikj@459 287 [
erikj@459 288 # Test that variable $1 is not empty.
erikj@459 289 if test "" = "[$]$1"; then AC_MSG_ERROR(Could not find translit($1,A-Z,a-z) !); fi
erikj@459 290 ])
erikj@459 291
erikj@459 292 AC_DEFUN_ONCE([BASIC_SETUP_TOOLS],
erikj@459 293 [
erikj@459 294 # Start with tools that do not need have cross compilation support
erikj@459 295 # and can be expected to be found in the default PATH. These tools are
erikj@459 296 # used by configure. Nor are these tools expected to be found in the
erikj@459 297 # devkit from the builddeps server either, since they are
erikj@459 298 # needed to download the devkit.
erikj@459 299 AC_PROG_AWK
erikj@459 300 CHECK_NONEMPTY(AWK)
erikj@459 301 AC_PATH_PROG(CAT, cat)
erikj@459 302 CHECK_NONEMPTY(CAT)
erikj@459 303 AC_PATH_PROG(CHMOD, chmod)
erikj@459 304 CHECK_NONEMPTY(CHMOD)
erikj@459 305 AC_PATH_PROG(CP, cp)
erikj@459 306 CHECK_NONEMPTY(CP)
erikj@459 307 AC_PATH_PROG(CPIO, cpio)
erikj@459 308 CHECK_NONEMPTY(CPIO)
erikj@459 309 AC_PATH_PROG(CUT, cut)
erikj@459 310 CHECK_NONEMPTY(CUT)
erikj@459 311 AC_PATH_PROG(DATE, date)
erikj@459 312 CHECK_NONEMPTY(DATE)
erikj@459 313 AC_PATH_PROG(DF, df)
erikj@459 314 CHECK_NONEMPTY(DF)
erikj@459 315 AC_PATH_PROG(DIFF, diff)
erikj@459 316 CHECK_NONEMPTY(DIFF)
erikj@459 317 # Warning echo is really, really unportable!!!!! Different
erikj@459 318 # behaviour in bash and dash and in a lot of other shells!
erikj@459 319 # Use printf for serious work!
erikj@459 320 AC_PATH_PROG(ECHO, echo)
erikj@459 321 CHECK_NONEMPTY(ECHO)
erikj@459 322 AC_PROG_EGREP
erikj@459 323 CHECK_NONEMPTY(EGREP)
erikj@459 324 AC_PROG_FGREP
erikj@459 325 CHECK_NONEMPTY(FGREP)
erikj@459 326
erikj@459 327 AC_PATH_PROG(FIND, find)
erikj@459 328 CHECK_NONEMPTY(FIND)
erikj@459 329 BASIC_CHECK_FIND_DELETE
erikj@459 330 AC_SUBST(FIND_DELETE)
erikj@459 331
erikj@459 332 AC_PROG_GREP
erikj@459 333 CHECK_NONEMPTY(GREP)
erikj@459 334 AC_PATH_PROG(HEAD, head)
erikj@459 335 CHECK_NONEMPTY(HEAD)
erikj@459 336 AC_PATH_PROG(LN, ln)
erikj@459 337 CHECK_NONEMPTY(LN)
erikj@459 338 AC_PATH_PROG(LS, ls)
erikj@459 339 CHECK_NONEMPTY(LS)
erikj@459 340 AC_PATH_PROGS(MAKE, [gmake make])
erikj@459 341 CHECK_NONEMPTY(MAKE)
erikj@459 342 MAKE_VERSION=`$MAKE --version | head -n 1 | grep '3.8[[12346789]]'`
erikj@459 343 if test "x$MAKE_VERSION" = x; then
erikj@459 344 AC_MSG_ERROR([You must use GNU make 3.81 or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure.])
erikj@459 345 fi
erikj@459 346 AC_PATH_PROG(MKDIR, mkdir)
erikj@459 347 CHECK_NONEMPTY(MKDIR)
erikj@459 348 AC_PATH_PROG(MV, mv)
erikj@459 349 CHECK_NONEMPTY(MV)
erikj@459 350 AC_PATH_PROGS(NAWK, [nawk gawk awk])
erikj@459 351 CHECK_NONEMPTY(NAWK)
erikj@459 352 AC_PATH_PROG(PRINTF, printf)
erikj@459 353 CHECK_NONEMPTY(PRINTF)
erikj@459 354 AC_PATH_PROG(THEPWDCMD, pwd)
erikj@459 355 AC_PATH_PROG(RM, rm)
erikj@459 356 CHECK_NONEMPTY(RM)
erikj@459 357 RM="$RM -f"
erikj@459 358 AC_PROG_SED
erikj@459 359 CHECK_NONEMPTY(SED)
erikj@459 360 AC_PATH_PROG(SH, sh)
erikj@459 361 CHECK_NONEMPTY(SH)
erikj@459 362 AC_PATH_PROG(SORT, sort)
erikj@459 363 CHECK_NONEMPTY(SORT)
erikj@459 364 AC_PATH_PROG(TAR, tar)
erikj@459 365 CHECK_NONEMPTY(TAR)
erikj@459 366 AC_PATH_PROG(TAIL, tail)
erikj@459 367 CHECK_NONEMPTY(TAIL)
erikj@459 368 AC_PATH_PROG(TEE, tee)
erikj@459 369 CHECK_NONEMPTY(TEE)
erikj@459 370 AC_PATH_PROG(TR, tr)
erikj@459 371 CHECK_NONEMPTY(TR)
erikj@459 372 AC_PATH_PROG(TOUCH, touch)
erikj@459 373 CHECK_NONEMPTY(TOUCH)
erikj@459 374 AC_PATH_PROG(WC, wc)
erikj@459 375 CHECK_NONEMPTY(WC)
erikj@459 376 AC_PATH_PROG(XARGS, xargs)
erikj@459 377 CHECK_NONEMPTY(XARGS)
erikj@459 378 AC_PATH_PROG(ZIP, zip)
erikj@459 379 CHECK_NONEMPTY(ZIP)
erikj@459 380 AC_PATH_PROG(UNZIP, unzip)
erikj@459 381 CHECK_NONEMPTY(UNZIP)
erikj@459 382 AC_PATH_PROG(LDD, ldd)
erikj@459 383 if test "x$LDD" = "x"; then
erikj@459 384 # List shared lib dependencies is used for
erikj@459 385 # debug output and checking for forbidden dependencies.
erikj@459 386 # We can build without it.
erikj@459 387 LDD="true"
erikj@459 388 fi
erikj@459 389 AC_PATH_PROG(OTOOL, otool)
erikj@459 390 if test "x$OTOOL" = "x"; then
erikj@459 391 OTOOL="true"
erikj@459 392 fi
erikj@459 393 AC_PATH_PROG(READELF, readelf)
erikj@459 394 AC_PATH_PROG(EXPR, expr)
erikj@459 395 CHECK_NONEMPTY(EXPR)
erikj@459 396 AC_PATH_PROG(FILE, file)
erikj@459 397 CHECK_NONEMPTY(FILE)
erikj@459 398 AC_PATH_PROG(HG, hg)
erikj@459 399 ])
erikj@459 400
erikj@459 401
erikj@459 402
erikj@459 403 AC_DEFUN_ONCE([BASIC_COMPILE_UNCYGDRIVE],
erikj@459 404 [
erikj@459 405 # When using cygwin, we need a wrapper binary that renames
erikj@459 406 # /cygdrive/c/ arguments into c:/ arguments and peeks into
erikj@459 407 # @files and rewrites these too! This wrapper binary is
erikj@459 408 # called uncygdrive.exe.
erikj@459 409 UNCYGDRIVE=
erikj@459 410 if test "x$OPENJDK_BUILD_OS" = xwindows; then
erikj@459 411 AC_MSG_CHECKING([if uncygdrive can be created])
erikj@459 412 UNCYGDRIVE_SRC=`$CYGPATH -m $SRC_ROOT/common/src/uncygdrive.c`
erikj@459 413 rm -f $OUTPUT_ROOT/uncygdrive*
erikj@459 414 UNCYGDRIVE=`$CYGPATH -m $OUTPUT_ROOT/uncygdrive.exe`
erikj@459 415 cd $OUTPUT_ROOT
erikj@459 416 $CC $UNCYGDRIVE_SRC /Fe$UNCYGDRIVE > $OUTPUT_ROOT/uncygdrive1.log 2>&1
erikj@459 417 cd $CURDIR
erikj@459 418
erikj@459 419 if test ! -x $OUTPUT_ROOT/uncygdrive.exe; then
erikj@459 420 AC_MSG_RESULT([no])
erikj@459 421 cat $OUTPUT_ROOT/uncygdrive1.log
erikj@459 422 AC_MSG_ERROR([Could not create $OUTPUT_ROOT/uncygdrive.exe])
erikj@459 423 fi
erikj@459 424 AC_MSG_RESULT([$UNCYGDRIVE])
erikj@459 425 AC_MSG_CHECKING([if uncygdrive.exe works])
erikj@459 426 cd $OUTPUT_ROOT
erikj@459 427 $UNCYGDRIVE $CC $SRC_ROOT/common/src/uncygdrive.c /Fe$OUTPUT_ROOT/uncygdrive2.exe > $OUTPUT_ROOT/uncygdrive2.log 2>&1
erikj@459 428 cd $CURDIR
erikj@459 429 if test ! -x $OUTPUT_ROOT/uncygdrive2.exe; then
erikj@459 430 AC_MSG_RESULT([no])
erikj@459 431 cat $OUTPUT_ROOT/uncygdrive2.log
erikj@459 432 AC_MSG_ERROR([Uncygdrive did not work!])
erikj@459 433 fi
erikj@459 434 AC_MSG_RESULT([yes])
erikj@459 435 rm -f $OUTPUT_ROOT/uncygdrive?.??? $OUTPUT_ROOT/uncygdrive.obj
erikj@459 436 fi
erikj@459 437
erikj@459 438 AC_SUBST(UNCYGDRIVE)
erikj@459 439 ])
erikj@459 440
erikj@459 441
erikj@459 442 # Check if build directory is on local disk.
erikj@459 443 # Argument 1: directory to test
erikj@459 444 # Argument 2: what to do if it is on local disk
erikj@459 445 # Argument 3: what to do otherwise (remote disk or failure)
erikj@459 446 AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
erikj@459 447 [
erikj@459 448 # df -l lists only local disks; if the given directory is not found then
erikj@459 449 # a non-zero exit code is given
erikj@459 450 if $DF -l $1 > /dev/null 2>&1; then
erikj@459 451 $2
erikj@459 452 else
erikj@459 453 $3
erikj@459 454 fi
erikj@459 455 ])
erikj@459 456
erikj@459 457 AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
erikj@459 458 [
erikj@459 459
erikj@459 460 AC_MSG_CHECKING([if build directory is on local disk])
erikj@459 461 BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUT_ROOT,
erikj@459 462 [OUTPUT_DIR_IS_LOCAL="yes"],
erikj@459 463 [OUTPUT_DIR_IS_LOCAL="no"])
erikj@459 464 AC_MSG_RESULT($OUTPUT_DIR_IS_LOCAL)
erikj@459 465
erikj@459 466 # Check if the user has any old-style ALT_ variables set.
erikj@459 467 FOUND_ALT_VARIABLES=`env | grep ^ALT_`
erikj@459 468
erikj@459 469 # Before generating output files, test if they exist. If they do, this is a reconfigure.
erikj@459 470 # Since we can't properly handle the dependencies for this, warn the user about the situation
erikj@459 471 if test -e $OUTPUT_ROOT/spec.gmk; then
erikj@459 472 IS_RECONFIGURE=yes
erikj@459 473 else
erikj@459 474 IS_RECONFIGURE=no
erikj@459 475 fi
erikj@459 476
erikj@459 477 if test -e $SRC_ROOT/build/.hide-configure-performance-hints; then
erikj@459 478 HIDE_PERFORMANCE_HINTS=yes
erikj@459 479 else
erikj@459 480 HIDE_PERFORMANCE_HINTS=no
erikj@459 481 # Hide it the next time around...
erikj@459 482 $TOUCH $SRC_ROOT/build/.hide-configure-performance-hints > /dev/null 2>&1
erikj@459 483 fi
erikj@459 484
erikj@459 485 ])

mercurial