basics.m4 revision 457:3156dff953b1
1139825Simp#
21541Srgrimes# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
31541Srgrimes# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41541Srgrimes#
51541Srgrimes# This code is free software; you can redistribute it and/or modify it
61541Srgrimes# under the terms of the GNU General Public License version 2 only, as
71541Srgrimes# published by the Free Software Foundation.  Oracle designates this
81541Srgrimes# particular file as subject to the "Classpath" exception as provided
91541Srgrimes# by Oracle in the LICENSE file that accompanied this code.
101541Srgrimes#
111541Srgrimes# This code is distributed in the hope that it will be useful, but WITHOUT
121541Srgrimes# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
131541Srgrimes# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
141541Srgrimes# version 2 for more details (a copy is included in the LICENSE file that
151541Srgrimes# accompanied this code).
161541Srgrimes#
171541Srgrimes# You should have received a copy of the GNU General Public License version
181541Srgrimes# 2 along with this work; if not, write to the Free Software Foundation,
191541Srgrimes# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
201541Srgrimes#
211541Srgrimes# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
221541Srgrimes# or visit www.oracle.com if you need additional information or have any
231541Srgrimes# questions.
241541Srgrimes#
251541Srgrimes
261541SrgrimesAC_DEFUN([ADD_JVM_ARG_IF_OK],
271541Srgrimes[
281541Srgrimes    # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
291541Srgrimes    # If so, then append $1 to $2
301541Srgrimes    FOUND_WARN=`$3 $1 -version 2>&1 | grep -i warn`
311541Srgrimes    FOUND_VERSION=`$3 $1 -version 2>&1 | grep " version \""`
321817Sdg    if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
331541Srgrimes        $2="[$]$2 $1"
341541Srgrimes    fi
351541Srgrimes])
361541Srgrimes
371541SrgrimesAC_DEFUN([WHICHCMD],
381541Srgrimes[
395455Sdg    # Translate "gcc -E" into "`which gcc` -E" ie
401541Srgrimes    # extract the full path to the binary and at the
411541Srgrimes    # same time maintain any arguments passed to it.
421541Srgrimes    # The command MUST exist in the path, or else!
431541Srgrimes    tmp="[$]$1"
441541Srgrimes    car="${tmp%% *}"
455455Sdg    tmp="[$]$1 EOL"
465455Sdg    cdr="${tmp#* }"
475455Sdg    # On windows we want paths without spaces.
481541Srgrimes    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
495455Sdg        WHICHCMD_SPACESAFE(car)
501541Srgrimes    else
511541Srgrimes        # "which" is not portable, but is used here
521541Srgrimes        # because we know that the command exists!
531541Srgrimes        car=`which $car`
541541Srgrimes    fi
551541Srgrimes    if test "x$cdr" != xEOL; then
561541Srgrimes        $1="$car ${cdr% *}"
571541Srgrimes    else
581541Srgrimes        $1="$car"
591817Sdg    fi
6050477Speter])
611541Srgrimes
621541SrgrimesAC_DEFUN([SPACESAFE],
631541Srgrimes[
641541Srgrimes    # Fail with message $2 if var $1 contains a path with no spaces in it.
651541Srgrimes    # Unless on Windows, where we can rewrite the path.
661541Srgrimes    HAS_SPACE=`echo "[$]$1" | grep " "`
671541Srgrimes    if test "x$HAS_SPACE" != x; then
681541Srgrimes        if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
691541Srgrimes            $1=`$CYGPATH -s -m -a "[$]$1"`
706816Sdg            $1=`$CYGPATH -u "[$]$1"`            
7138517Sdfr        else
721541Srgrimes            AC_MSG_ERROR([You cannot have spaces in $2! "[$]$1"])
731541Srgrimes        fi
741541Srgrimes    fi
751541Srgrimes])
761541Srgrimes
771541SrgrimesAC_DEFUN([WHICHCMD_SPACESAFE],
781541Srgrimes[
791541Srgrimes    # Translate long cygdrive or C:\sdfsf path
801541Srgrimes    # into a short mixed mode path that has no
811541Srgrimes    # spaces in it.
821541Srgrimes    tmp="[$]$1"
831541Srgrimes    
841541Srgrimes    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
851541Srgrimes        tmp=`$CYGPATH -u "[$]$1"`
861541Srgrimes        tmp=`which "$tmp"`
871541Srgrimes        # If file exists with .exe appended, that's the real filename
881541Srgrimes        # and cygpath needs that to convert to short style path.
891541Srgrimes        if test -f "${tmp}.exe"; then
901541Srgrimes           tmp="${tmp}.exe"
911541Srgrimes        elif test -f "${tmp}.cmd"; then
921541Srgrimes           tmp="${tmp}.cmd"
931541Srgrimes        fi
941541Srgrimes        # Convert to C:/ mixed style path without spaces.
9546349Salc         tmp=`$CYGPATH -s -m "$tmp"`
9646349Salc    fi
9746349Salc    $1="$tmp"
9846349Salc])
991541Srgrimes
1001541SrgrimesAC_DEFUN([REMOVE_SYMBOLIC_LINKS],
10160938Sjake[
1021541Srgrimes    if test "x$OPENJDK_BUILD_OS" != xwindows; then
1031541Srgrimes        # Follow a chain of symbolic links. Use readlink
10460938Sjake        # where it exists, else fall back to horribly
10560938Sjake        # complicated shell code.
106105407Sdillon        AC_PATH_PROG(READLINK, readlink)
107105407Sdillon        if test "x$READLINK_TESTED" != yes; then
1081541Srgrimes            # On MacOSX there is a readlink tool with a different
10942957Sdillon            # purpose than the GNU readlink tool. Check the found readlink.
11012767Sdyson            ISGNU=`$READLINK --help 2>&1 | grep GNU`
111121511Salc            if test "x$ISGNU" = x; then
11260755Speter                 # A readlink that we do not know how to use.
11318169Sdyson                 # Are there other non-GNU readlinks out there?
11418169Sdyson                 READLINK_TESTED=yes
11518169Sdyson                 READLINK=
1165455Sdg            fi
117134184Smarcel        fi
1185455Sdg
119161125Salc        if test "x$READLINK" != x; then
12013490Sdyson            $1=`$READLINK -f [$]$1`
121139338Salc        else
12213490Sdyson            STARTDIR=$PWD
12313490Sdyson            COUNTER=0
12436735Sdfr            DIR=`dirname [$]$1`
125121511Salc            FIL=`basename [$]$1`
12613490Sdyson            while test $COUNTER -lt 20; do
12736735Sdfr                ISLINK=`ls -l $DIR/$FIL | grep '\->' | sed -e 's/.*-> \(.*\)/\1/'`
128121511Salc                if test "x$ISLINK" == x; then
12936735Sdfr                    # This is not a symbolic link! We are done!
130119354Smarcel                    break
131121511Salc                fi
132119354Smarcel                # The link might be relative! We have to use cd to travel safely.
133119354Smarcel                cd $DIR
134121511Salc                cd `dirname $ISLINK`
135119354Smarcel                DIR=`pwd`
13636735Sdfr                FIL=`basename $ISLINK`
1371541Srgrimes                let COUNTER=COUNTER+1
1381541Srgrimes            done
139161125Salc            cd $STARTDIR
140161125Salc            $1=$DIR/$FIL
141161125Salc        fi
142161125Salc    fi
143161125Salc])
144161125Salc
145161125SalcAC_DEFUN_ONCE([BASIC_INIT],
146161125Salc[
147161125Salc# Save the original command line. This is passed to us by the wrapper configure script.
148119468SmarcelAC_SUBST(CONFIGURE_COMMAND_LINE)
149119468SmarcelDATE_WHEN_CONFIGURED=`LANG=C date`
150119468SmarcelAC_SUBST(DATE_WHEN_CONFIGURED)
151119468Smarcel
152119468Smarcel# Locate the directory of this script.
153119468SmarcelSCRIPT="[$]0"
154119468SmarcelREMOVE_SYMBOLIC_LINKS(SCRIPT)        
155153940SnetchildAUTOCONF_DIR=`dirname [$]0`
156153940Snetchild])
157153940Snetchild
158153940SnetchildAC_DEFUN_ONCE([BASIC_SETUP_PATHS],
159153940Snetchild[
160153940Snetchild# Where is the source? It is located two levels above the configure script.
161153940SnetchildCURDIR="$PWD"
162153940Snetchildcd "$AUTOCONF_DIR/../.."
163153940SnetchildSRC_ROOT="`pwd`"
164153940Snetchildif test "x$OPENJDK_BUILD_OS" = "xwindows"; then
165153940Snetchild    SRC_ROOT_LENGTH=`pwd|wc -m`
166153940Snetchild    if test $SRC_ROOT_LENGTH -gt 100; then
167153940Snetchild        AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported])
168153940Snetchild    fi
169153940Snetchildfi
17018169SdysonAC_SUBST(SRC_ROOT)
171153940Snetchildcd "$CURDIR"
172153940Snetchild
17362568SjhbSPACESAFE(SRC_ROOT,[the path to the source root])
174153940SnetchildSPACESAFE(CURDIR,[the path to the current directory])
175153940Snetchild])
176153940Snetchild
17736326SdysonAC_DEFUN_ONCE([BASIC_SETUP_SEARCHPATH],
178153940Snetchild[
179153940Snetchildif test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
18018169Sdyson    # Add extra search paths on solaris for utilities like ar and as etc...
181153940Snetchild    PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
182153940Snetchildfi
183153940Snetchild])
18418169Sdyson
185153940SnetchildAC_DEFUN_ONCE([BASIC_SETUP_PATH_SEP],
186153940Snetchild[
187153940Snetchild# For cygwin we need cygpath first, since it is used everywhere.
18818169SdysonAC_PATH_PROG(CYGPATH, cygpath)
18952647SalcPATH_SEP=":"
19052647Salcif test "x$OPENJDK_BUILD_OS" = "xwindows"; then
19118169Sdyson    if test "x$CYGPATH" = x; then
19249326Salc        AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path])
19352647Salc    fi
19418169Sdyson    PATH_SEP=";"
195153940Snetchildfi
196153940SnetchildAC_SUBST(PATH_SEP)
197153940Snetchild])
198153940Snetchild
199153940SnetchildAC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
200153940Snetchild[
201153940Snetchild
202153940SnetchildAC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
203153940Snetchild	[use this as the name of the configuration, overriding the generated default])],
204153940Snetchild        [ CONF_NAME=${with_conf_name} ])
205153940Snetchild
206153940Snetchild# Test from where we are running configure, in or outside of src root.
207153940Snetchildif 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
208153940Snetchild    # We are running configure from the src root.
20999416Salc    # Create a default ./build/target-variant-debuglevel output root.
210153940Snetchild    if test "x${CONF_NAME}" = x; then
21152647Salc        CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
2121541Srgrimes    fi
2131541Srgrimes    OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}"
2141541Srgrimes    mkdir -p "$OUTPUT_ROOT"
21561081Sdillon    if test ! -d "$OUTPUT_ROOT"; then
21661081Sdillon        AC_MSG_ERROR([Could not create build directory $OUTPUT_ROOT])
21761081Sdillon    fi
21861081Sdillonelse
21961081Sdillon    # We are running configure from outside of the src dir.
22061081Sdillon    # Then use the current directory as output dir!
2211541Srgrimes    # If configuration is situated in normal build directory, just use the build
22242957Sdillon    # directory name as configuration name, otherwise use the complete path.
22370374Sdillon    if test "x${CONF_NAME}" = x; then
22442957Sdillon        CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"`
22542957Sdillon    fi
22642957Sdillon    OUTPUT_ROOT="$CURDIR"
22742957Sdillonfi
22842957Sdillon
22954467SdillonSPACESAFE(OUTPUT_ROOT,[the path to the output root])
23061081Sdillon
23168885SdillonAC_SUBST(SPEC, $OUTPUT_ROOT/spec.gmk)
232103531SjeffAC_SUBST(CONF_NAME, $CONF_NAME)
2331541SrgrimesAC_SUBST(OUTPUT_ROOT, $OUTPUT_ROOT)
2349507Sdg
2359507Sdg# Most of the probed defines are put into config.h
2369507SdgAC_CONFIG_HEADERS([$OUTPUT_ROOT/config.h:$AUTOCONF_DIR/config.h.in])
2379507Sdg# The spec.gmk file contains all variables for the make system.
2389507SdgAC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in])
23916750Sdyson# The spec.sh file contains variables for compare{images|-objects}.sh scrips.
24018169SdysonAC_CONFIG_FILES([$OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in])
2419507Sdg# The generated Makefile knows where the spec.gmk is and where the source is.
24255206Speter# You can run make from the OUTPUT_ROOT, or from the top-level Makefile
2431541Srgrimes# which will look for generated configurations
2449507SdgAC_CONFIG_FILES([$OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in])
2451541Srgrimes
2465455Sdg# Save the arguments given to us
2471541Srgrimesecho "$CONFIGURE_COMMAND_LINE" > $OUTPUT_ROOT/configure-arguments
2489507Sdg])
2499507Sdg
2509507SdgAC_DEFUN_ONCE([BASIC_SETUP_LOGGING],
2519507Sdg[
2529507Sdg# Setup default logging of stdout and stderr to build.log in the output root.
2539507SdgBUILD_LOG='$(OUTPUT_ROOT)/build.log'
2549507SdgBUILD_LOG_PREVIOUS='$(OUTPUT_ROOT)/build.log.old'
2559507SdgBUILD_LOG_WRAPPER='$(SH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)'
2561541SrgrimesAC_SUBST(BUILD_LOG)
25713765SmppAC_SUBST(BUILD_LOG_PREVIOUS)
2581541SrgrimesAC_SUBST(BUILD_LOG_WRAPPER)
2591541Srgrimes])
2609507Sdg
2611541Srgrimes
2629507Sdg#%%% Simple tools %%%
2639507Sdg
26410544SdysonAC_DEFUN([BASIC_CHECK_FIND_DELETE],
26510544Sdyson[
26610544Sdyson    # Test if find supports -delete
26710544Sdyson    AC_MSG_CHECKING([if find supports -delete])
2681541Srgrimes    FIND_DELETE="-delete"
2691541Srgrimes
27012767Sdyson    DELETEDIR=`mktemp -d tmp.XXXXXXXXXX` || (echo Could not create temporary directory!; exit $?)
27112767Sdyson
2725455Sdg    echo Hejsan > $DELETEDIR/TestIfFindSupportsDelete
27360755Speter
2745455Sdg    TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1`
2751541Srgrimes    if test -f $DELETEDIR/TestIfFindSupportsDelete; then
2761541Srgrimes        # No, it does not.
2771541Srgrimes        rm $DELETEDIR/TestIfFindSupportsDelete
2781541Srgrimes        FIND_DELETE="-exec rm \{\} \+"
2791541Srgrimes        AC_MSG_RESULT([no])    
2801541Srgrimes    else
28199927Salc        AC_MSG_RESULT([yes])    
28299927Salc    fi
28399927Salc    rmdir $DELETEDIR
2841541Srgrimes])
2855455Sdg
286119356SmarcelAC_DEFUN([CHECK_NONEMPTY],
287119356Smarcel[
288119356Smarcel    # Test that variable $1 is not empty.
289119356Smarcel    if test "" = "[$]$1"; then AC_MSG_ERROR(Could not find translit($1,A-Z,a-z) !); fi
290119356Smarcel])
291119356Smarcel
292119356SmarcelAC_DEFUN_ONCE([BASIC_SETUP_TOOLS],
2935455Sdg[
2941541Srgrimes# Start with tools that do not need have cross compilation support
295100276Salc# and can be expected to be found in the default PATH. These tools are
29633109Sdyson# used by configure. Nor are these tools expected to be found in the
29733109Sdyson# devkit from the builddeps server either, since they are
29833109Sdyson# needed to download the devkit. 
299100276SalcAC_PROG_AWK
300100276SalcCHECK_NONEMPTY(AWK)
301106276SjeffAC_PATH_PROG(CAT, cat)
302106276SjeffCHECK_NONEMPTY(CAT)
303106276SjeffAC_PATH_PROG(CHMOD, chmod)
304106276SjeffCHECK_NONEMPTY(CHMOD)
305136850SalcAC_PATH_PROG(CP, cp)
3065455SdgCHECK_NONEMPTY(CP)
30779248SdillonAC_PATH_PROG(CPIO, cpio)
30879248SdillonCHECK_NONEMPTY(CPIO)
30979248SdillonAC_PATH_PROG(CUT, cut)
31079248SdillonCHECK_NONEMPTY(CUT)
31179248SdillonAC_PATH_PROG(DATE, date)
31279248SdillonCHECK_NONEMPTY(DATE)
31379248SdillonAC_PATH_PROG(DF, df)
31479248SdillonCHECK_NONEMPTY(DF)
31579248SdillonAC_PATH_PROG(DIFF, diff)
31679248SdillonCHECK_NONEMPTY(DIFF)
317100889Salc# Warning echo is really, really unportable!!!!! Different
31879248Sdillon# behaviour in bash and dash and in a lot of other shells!
31979248Sdillon# Use printf for serious work! 
32079248SdillonAC_PATH_PROG(ECHO, echo)
32179263SdillonCHECK_NONEMPTY(ECHO)
322112569SjakeAC_PROG_EGREP
32391641SalcCHECK_NONEMPTY(EGREP)
32479263SdillonAC_PROG_FGREP
32579263SdillonCHECK_NONEMPTY(FGREP)
32679263Sdillon
32779263SdillonAC_PATH_PROG(FIND, find)
32879263SdillonCHECK_NONEMPTY(FIND)
32979248SdillonBASIC_CHECK_FIND_DELETE
33079248SdillonAC_SUBST(FIND_DELETE)
331132379Sgreen
332132379SgreenAC_PROG_GREP
333132379SgreenCHECK_NONEMPTY(GREP)
33479248SdillonAC_PATH_PROG(HEAD, head)
33579248SdillonCHECK_NONEMPTY(HEAD)
33679248SdillonAC_PATH_PROG(LN, ln)
33779248SdillonCHECK_NONEMPTY(LN)
33879248SdillonAC_PATH_PROG(LS, ls)
33979248SdillonCHECK_NONEMPTY(LS)
34079248SdillonAC_PATH_PROGS(MAKE, [gmake make])
34179248SdillonCHECK_NONEMPTY(MAKE)
34279248SdillonMAKE_VERSION=`$MAKE --version | head -n 1 | grep '3.8[[12346789]]'`
34379248Sdillonif test "x$MAKE_VERSION" = x; then
344121351Salc    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.])
345106422Salcfi
346127868SalcAC_PATH_PROG(MKDIR, mkdir)
34779248SdillonCHECK_NONEMPTY(MKDIR)
34879248SdillonAC_PATH_PROG(MV, mv)
34979248SdillonCHECK_NONEMPTY(MV)
35079248SdillonAC_PATH_PROGS(NAWK, [nawk gawk awk])
35179248SdillonCHECK_NONEMPTY(NAWK)
35279248SdillonAC_PATH_PROG(PRINTF, printf)
35379248SdillonCHECK_NONEMPTY(PRINTF)
35479248SdillonAC_PATH_PROG(THEPWDCMD, pwd)
35579248SdillonAC_PATH_PROG(RM, rm)
35645347SjulianCHECK_NONEMPTY(RM)
35743752SdillonRM="$RM -f"
35882314SpeterAC_PROG_SED
35998849SkenCHECK_NONEMPTY(SED)
36098849SkenAC_PATH_PROG(SH, sh)
36198849SkenCHECK_NONEMPTY(SH)
36298849SkenAC_PATH_PROG(SORT, sort)
363105549SalcCHECK_NONEMPTY(SORT)
364105549SalcAC_PATH_PROG(TAR, tar)
365105549SalcCHECK_NONEMPTY(TAR)
366105549SalcAC_PATH_PROG(TAIL, tail)
367105549SalcCHECK_NONEMPTY(TAIL)
368105549SalcAC_PATH_PROG(TEE, tee)
369105549SalcCHECK_NONEMPTY(TEE)
370105549SalcAC_PATH_PROG(TR, tr)
371105549SalcCHECK_NONEMPTY(TR)
372105549SalcAC_PATH_PROG(TOUCH, touch)
373105549SalcCHECK_NONEMPTY(TOUCH)
37455206SpeterAC_PATH_PROG(WC, wc)
3755455SdgCHECK_NONEMPTY(WC)
376AC_PATH_PROG(XARGS, xargs)
377CHECK_NONEMPTY(XARGS)
378AC_PATH_PROG(ZIP, zip)
379CHECK_NONEMPTY(ZIP)
380AC_PATH_PROG(UNZIP, unzip)
381CHECK_NONEMPTY(UNZIP)
382AC_PATH_PROG(LDD, ldd)
383if test "x$LDD" = "x"; then
384    # List shared lib dependencies is used for
385    # debug output and checking for forbidden dependencies.
386    # We can build without it.
387    LDD="true"
388fi
389AC_PATH_PROG(OTOOL, otool)
390if test "x$OTOOL" = "x"; then
391   OTOOL="true"
392fi
393AC_PATH_PROG(READELF, readelf)
394AC_PATH_PROG(EXPR, expr)
395CHECK_NONEMPTY(EXPR)
396AC_PATH_PROG(FILE, file)
397CHECK_NONEMPTY(FILE)
398AC_PATH_PROG(HG, hg)
399])
400
401
402
403AC_DEFUN_ONCE([BASIC_COMPILE_UNCYGDRIVE],
404[
405# When using cygwin, we need a wrapper binary that renames
406# /cygdrive/c/ arguments into c:/ arguments and peeks into
407# @files and rewrites these too! This wrapper binary is
408# called uncygdrive.exe.
409UNCYGDRIVE=
410if test "x$OPENJDK_BUILD_OS" = xwindows; then
411    AC_MSG_CHECKING([if uncygdrive can be created])
412    UNCYGDRIVE_SRC=`$CYGPATH -m $SRC_ROOT/common/src/uncygdrive.c`
413    rm -f $OUTPUT_ROOT/uncygdrive*
414    UNCYGDRIVE=`$CYGPATH -m $OUTPUT_ROOT/uncygdrive.exe`
415    cd $OUTPUT_ROOT
416    $CC $UNCYGDRIVE_SRC /Fe$UNCYGDRIVE > $OUTPUT_ROOT/uncygdrive1.log 2>&1
417    cd $CURDIR
418
419    if test ! -x $OUTPUT_ROOT/uncygdrive.exe; then 
420        AC_MSG_RESULT([no])
421        cat $OUTPUT_ROOT/uncygdrive1.log
422        AC_MSG_ERROR([Could not create $OUTPUT_ROOT/uncygdrive.exe])
423    fi
424    AC_MSG_RESULT([$UNCYGDRIVE])
425    AC_MSG_CHECKING([if uncygdrive.exe works])
426    cd $OUTPUT_ROOT
427    $UNCYGDRIVE $CC $SRC_ROOT/common/src/uncygdrive.c /Fe$OUTPUT_ROOT/uncygdrive2.exe > $OUTPUT_ROOT/uncygdrive2.log 2>&1 
428    cd $CURDIR
429    if test ! -x $OUTPUT_ROOT/uncygdrive2.exe; then 
430        AC_MSG_RESULT([no])
431        cat $OUTPUT_ROOT/uncygdrive2.log
432        AC_MSG_ERROR([Uncygdrive did not work!])
433    fi
434    AC_MSG_RESULT([yes])
435    rm -f $OUTPUT_ROOT/uncygdrive?.??? $OUTPUT_ROOT/uncygdrive.obj
436fi
437
438AC_SUBST(UNCYGDRIVE)
439])
440
441
442# Check if build directory is on local disk.
443# Argument 1: directory to test
444# Argument 2: what to do if it is on local disk
445# Argument 3: what to do otherwise (remote disk or failure)
446AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
447[
448	# df -l lists only local disks; if the given directory is not found then
449	# a non-zero exit code is given
450	if $DF -l $1 > /dev/null 2>&1; then
451          $2
452        else
453          $3
454        fi
455])
456
457AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
458[
459
460AC_MSG_CHECKING([if build directory is on local disk])
461BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUT_ROOT,
462  [OUTPUT_DIR_IS_LOCAL="yes"],
463  [OUTPUT_DIR_IS_LOCAL="no"])
464AC_MSG_RESULT($OUTPUT_DIR_IS_LOCAL)
465
466# Check if the user has any old-style ALT_ variables set.
467FOUND_ALT_VARIABLES=`env | grep ^ALT_`
468
469# Before generating output files, test if they exist. If they do, this is a reconfigure.
470# Since we can't properly handle the dependencies for this, warn the user about the situation
471if test -e $OUTPUT_ROOT/spec.gmk; then
472  IS_RECONFIGURE=yes
473else
474  IS_RECONFIGURE=no
475fi
476
477if test -e $SRC_ROOT/build/.hide-configure-performance-hints; then
478  HIDE_PERFORMANCE_HINTS=yes
479else
480  HIDE_PERFORMANCE_HINTS=no
481  # Hide it the next time around...
482  $TOUCH $SRC_ROOT/build/.hide-configure-performance-hints > /dev/null 2>&1
483fi
484
485])
486