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