1 #
   2 # Copyright (c) 2011, 2020, 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 
  26 m4_include([basic_tools.m4])
  27 m4_include([basic_windows.m4])
  28 
  29 ###############################################################################
  30 AC_DEFUN_ONCE([BASIC_INIT],
  31 [
  32   # Save the original command line. This is passed to us by the wrapper configure script.
  33   AC_SUBST(CONFIGURE_COMMAND_LINE)
  34   # AUTOCONF might be set in the environment by the user. Preserve for "make reconfigure".
  35   AC_SUBST(AUTOCONF)
  36   # Save the path variable before it gets changed
  37   ORIGINAL_PATH="$PATH"
  38   AC_SUBST(ORIGINAL_PATH)
  39   DATE_WHEN_CONFIGURED=`date`
  40   AC_SUBST(DATE_WHEN_CONFIGURED)
  41   AC_MSG_NOTICE([Configuration created at $DATE_WHEN_CONFIGURED.])
  42 ])
  43 
  44 ###############################################################################
  45 # Check that there are no unprocessed overridden variables left.
  46 # If so, they are an incorrect argument and we will exit with an error.
  47 AC_DEFUN([BASIC_CHECK_LEFTOVER_OVERRIDDEN],
  48 [
  49   if test "x$CONFIGURE_OVERRIDDEN_VARIABLES" != x; then
  50     # Replace the separating ! with spaces before presenting for end user.
  51     unknown_variables=${CONFIGURE_OVERRIDDEN_VARIABLES//!/ }
  52     AC_MSG_WARN([The following variables might be unknown to configure: $unknown_variables])
  53   fi
  54 ])
  55 
  56 ###############################################################################
  57 # Setup basic configuration paths, and platform-specific stuff related to PATHs.
  58 AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
  59 [
  60   # Save the current directory this script was started from
  61   CONFIGURE_START_DIR="$PWD"
  62 
  63   # We might need to rewrite ORIGINAL_PATH, if it includes "#", to quote them
  64   # for make. We couldn't do this when we retrieved ORIGINAL_PATH, since SED
  65   # was not available at that time.
  66   REWRITTEN_PATH=`$ECHO "$ORIGINAL_PATH" | $SED -e 's/#/\\\\#/g'`
  67   if test "x$REWRITTEN_PATH" != "x$ORIGINAL_PATH"; then
  68     ORIGINAL_PATH="$REWRITTEN_PATH"
  69     AC_MSG_NOTICE([Rewriting ORIGINAL_PATH to $REWRITTEN_PATH])
  70   fi
  71 
  72   if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
  73     PATH_SEP=";"
  74     EXE_SUFFIX=".exe"
  75     BASIC_CHECK_PATHS_WINDOWS
  76   else
  77     PATH_SEP=":"
  78     EXE_SUFFIX=""
  79   fi
  80   AC_SUBST(PATH_SEP)
  81   AC_SUBST(EXE_SUFFIX)
  82 
  83   # We get the top-level directory from the supporting wrappers.
  84   AC_MSG_CHECKING([for top-level directory])
  85   AC_MSG_RESULT([$TOPDIR])
  86   AC_SUBST(TOPDIR)
  87   AC_SUBST(CONFIGURE_START_DIR)
  88 
  89   if test "x$CUSTOM_ROOT" != x; then
  90     WORKSPACE_ROOT="${CUSTOM_ROOT}"
  91   else
  92     WORKSPACE_ROOT="${TOPDIR}"
  93   fi
  94   AC_SUBST(WORKSPACE_ROOT)
  95 
  96   # We can only call UTIL_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS.
  97   UTIL_FIXUP_PATH(CONFIGURE_START_DIR)
  98   UTIL_FIXUP_PATH(TOPDIR)
  99 
 100   # Locate the directory of this script.
 101   AUTOCONF_DIR=$TOPDIR/make/autoconf
 102 
 103   # Setup username (for use in adhoc version strings etc)
 104   # Outer [ ] to quote m4.
 105   [ USERNAME=`$ECHO "$USER" | $TR -d -c '[a-z][A-Z][0-9]'` ]
 106   AC_SUBST(USERNAME)
 107 ])
 108 
 109 ###############################################################################
 110 # Evaluates platform specific overrides for devkit variables.
 111 # $1: Name of variable
 112 AC_DEFUN([BASIC_EVAL_DEVKIT_VARIABLE],
 113 [
 114   if test "x[$]$1" = x; then
 115     eval $1="\${$1_${OPENJDK_TARGET_CPU}}"
 116   fi
 117 ])
 118 
 119 ###############################################################################
 120 AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
 121 [
 122   AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
 123       [use this devkit for compilers, tools and resources])])
 124 
 125   if test "x$with_devkit" = xyes; then
 126     AC_MSG_ERROR([--with-devkit must have a value])
 127   elif test "x$with_devkit" != x && test "x$with_devkit" != xno; then
 128     UTIL_FIXUP_PATH([with_devkit])
 129     DEVKIT_ROOT="$with_devkit"
 130     # Check for a meta data info file in the root of the devkit
 131     if test -f "$DEVKIT_ROOT/devkit.info"; then
 132       . $DEVKIT_ROOT/devkit.info
 133       # This potentially sets the following:
 134       # A descriptive name of the devkit
 135       BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_NAME])
 136       # Corresponds to --with-extra-path
 137       BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_EXTRA_PATH])
 138       # Corresponds to --with-toolchain-path
 139       BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_TOOLCHAIN_PATH])
 140       # Corresponds to --with-sysroot
 141       BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_SYSROOT])
 142 
 143       # Identifies the Visual Studio version in the devkit
 144       BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_VERSION])
 145       # The Visual Studio include environment variable
 146       BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_INCLUDE])
 147       # The Visual Studio lib environment variable
 148       BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_LIB])
 149       # Corresponds to --with-msvcr-dll
 150       BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCR_DLL])
 151       # Corresponds to --with-vcruntime-1-dll
 152       BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VCRUNTIME_1_DLL])
 153       # Corresponds to --with-msvcp-dll
 154       BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCP_DLL])
 155       # Corresponds to --with-ucrt-dll-dir
 156       BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_UCRT_DLL_DIR])
 157     fi
 158 
 159     AC_MSG_CHECKING([for devkit])
 160     if test "x$DEVKIT_NAME" != x; then
 161       AC_MSG_RESULT([$DEVKIT_NAME in $DEVKIT_ROOT])
 162     else
 163       AC_MSG_RESULT([$DEVKIT_ROOT])
 164     fi
 165 
 166     UTIL_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH)
 167 
 168     # Fallback default of just /bin if DEVKIT_PATH is not defined
 169     if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then
 170       DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin"
 171     fi
 172     UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$DEVKIT_TOOLCHAIN_PATH)
 173 
 174     # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known
 175     # places for backwards compatiblity.
 176     if test "x$DEVKIT_SYSROOT" != x; then
 177       SYSROOT="$DEVKIT_SYSROOT"
 178     elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then
 179       SYSROOT="$DEVKIT_ROOT/$host_alias/libc"
 180     elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
 181       SYSROOT="$DEVKIT_ROOT/$host/sys-root"
 182     fi
 183 
 184     if test "x$DEVKIT_ROOT" != x; then
 185       DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib"
 186       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 187         DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib64"
 188       fi
 189       AC_SUBST(DEVKIT_LIB_DIR)
 190     fi
 191   fi
 192 
 193   # You can force the sysroot if the sysroot encoded into the compiler tools
 194   # is not correct.
 195   AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
 196       [alias for --with-sysroot for backwards compatability])],
 197       [SYSROOT=$with_sys_root]
 198   )
 199 
 200   AC_ARG_WITH(sysroot, [AS_HELP_STRING([--with-sysroot],
 201       [use this directory as sysroot])],
 202       [SYSROOT=$with_sysroot]
 203   )
 204 
 205   AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
 206       [alias for --with-toolchain-path for backwards compatibility])],
 207       [UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_tools_dir)]
 208   )
 209 
 210   AC_ARG_WITH([toolchain-path], [AS_HELP_STRING([--with-toolchain-path],
 211       [prepend these directories when searching for toolchain binaries (compilers etc)])],
 212       [UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_toolchain_path)]
 213   )
 214 
 215   AC_ARG_WITH([extra-path], [AS_HELP_STRING([--with-extra-path],
 216       [prepend these directories to the default path])],
 217       [UTIL_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)]
 218   )
 219 
 220   if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
 221     # If a devkit has been supplied, find xcodebuild in the toolchain_path.
 222     # If not, detect if Xcode is installed by running xcodebuild -version
 223     # if no Xcode installed, xcodebuild exits with 1
 224     # if Xcode is installed, even if xcode-select is misconfigured, then it exits with 0
 225     if test "x$DEVKIT_ROOT" != x || /usr/bin/xcodebuild -version >/dev/null 2>&1; then
 226       # We need to use xcodebuild in the toolchain dir provided by the user, this will
 227       # fall back on the stub binary in /usr/bin/xcodebuild
 228       AC_PATH_PROG([XCODEBUILD], [xcodebuild], [/usr/bin/xcodebuild], [$TOOLCHAIN_PATH])
 229     else
 230       # this should result in SYSROOT being empty, unless --with-sysroot is provided
 231       # when only the command line tools are installed there are no SDKs, so headers
 232       # are copied into the system frameworks
 233       XCODEBUILD=
 234       AC_SUBST(XCODEBUILD)
 235     fi
 236 
 237     AC_MSG_CHECKING([for sdk name])
 238     AC_ARG_WITH([sdk-name], [AS_HELP_STRING([--with-sdk-name],
 239         [use the platform SDK of the given name. @<:@macosx@:>@])],
 240         [SDKNAME=$with_sdk_name]
 241     )
 242     AC_MSG_RESULT([$SDKNAME])
 243 
 244     # if toolchain path is specified then don't rely on system headers, they may not compile
 245     HAVE_SYSTEM_FRAMEWORK_HEADERS=0
 246     test -z "$TOOLCHAIN_PATH" && \
 247       HAVE_SYSTEM_FRAMEWORK_HEADERS=`test ! -f /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h; echo $?`
 248 
 249     if test -z "$SYSROOT"; then
 250       if test -n "$XCODEBUILD"; then
 251         # if we don't have system headers, use default SDK name (last resort)
 252         if test -z "$SDKNAME" -a $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
 253           SDKNAME=${SDKNAME:-macosx}
 254         fi
 255 
 256         if test -n "$SDKNAME"; then
 257           # Call xcodebuild to determine SYSROOT
 258           SYSROOT=`"$XCODEBUILD" -sdk $SDKNAME -version | $GREP '^Path: ' | $SED 's/Path: //'`
 259         fi
 260       else
 261         if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
 262           AC_MSG_ERROR([No xcodebuild tool and no system framework headers found, use --with-sysroot or --with-sdk-name to provide a path to a valid SDK])
 263         fi
 264       fi
 265     else
 266       # warn user if --with-sdk-name was also set
 267       if test -n "$with_sdk_name"; then
 268         AC_MSG_WARN([Both SYSROOT and --with-sdk-name are set, only SYSROOT will be used])
 269       fi
 270     fi
 271 
 272     if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0 -a -z "$SYSROOT"; then
 273       # If no system framework headers, then SYSROOT must be set, or we won't build
 274       AC_MSG_ERROR([Unable to determine SYSROOT and no headers found in /System/Library/Frameworks. Check Xcode configuration, --with-sysroot or --with-sdk-name arguments.])
 275     fi
 276 
 277     # Perform a basic sanity test
 278     if test ! -f "$SYSROOT/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
 279       if test -z "$SYSROOT"; then
 280         AC_MSG_ERROR([Unable to find required framework headers, provide a path to an SDK via --with-sysroot or --with-sdk-name and be sure Xcode is installed properly])
 281       else
 282         AC_MSG_ERROR([Invalid SDK or SYSROOT path, dependent framework headers not found])
 283       fi
 284     fi
 285 
 286     # set SDKROOT too, Xcode tools will pick it up
 287     SDKROOT="$SYSROOT"
 288     AC_SUBST(SDKROOT)
 289   fi
 290 
 291   # Prepend the extra path to the global path
 292   UTIL_PREPEND_TO_PATH([PATH],$EXTRA_PATH)
 293 
 294   AC_MSG_CHECKING([for sysroot])
 295   AC_MSG_RESULT([$SYSROOT])
 296   AC_MSG_CHECKING([for toolchain path])
 297   AC_MSG_RESULT([$TOOLCHAIN_PATH])
 298   AC_MSG_CHECKING([for extra path])
 299   AC_MSG_RESULT([$EXTRA_PATH])
 300 ])
 301 
 302 ###############################################################################
 303 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
 304 [
 305 
 306   AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
 307       [use this as the name of the configuration @<:@generated from important configuration options@:>@])],
 308       [ CONF_NAME=${with_conf_name} ])
 309 
 310   # Test from where we are running configure, in or outside of src root.
 311   AC_MSG_CHECKING([where to store configuration])
 312   if test "x$CONFIGURE_START_DIR" = "x$TOPDIR" \
 313       || test "x$CONFIGURE_START_DIR" = "x$CUSTOM_ROOT" \
 314       || test "x$CONFIGURE_START_DIR" = "x$TOPDIR/make/autoconf" \
 315       || test "x$CONFIGURE_START_DIR" = "x$TOPDIR/make" ; then
 316     # We are running configure from the src root.
 317     # Create a default ./build/target-variant-debuglevel output root.
 318     if test "x${CONF_NAME}" = x; then
 319       AC_MSG_RESULT([in default location])
 320       CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JVM_VARIANTS_WITH_AND}-${DEBUG_LEVEL}"
 321     else
 322       AC_MSG_RESULT([in build directory with custom name])
 323     fi
 324 
 325     OUTPUTDIR="${WORKSPACE_ROOT}/build/${CONF_NAME}"
 326     $MKDIR -p "$OUTPUTDIR"
 327     if test ! -d "$OUTPUTDIR"; then
 328       AC_MSG_ERROR([Could not create build directory $OUTPUTDIR])
 329     fi
 330   else
 331     # We are running configure from outside of the src dir.
 332     # Then use the current directory as output dir!
 333     # If configuration is situated in normal build directory, just use the build
 334     # directory name as configuration name, otherwise use the complete path.
 335     if test "x${CONF_NAME}" = x; then
 336       CONF_NAME=`$ECHO $CONFIGURE_START_DIR | $SED -e "s!^${TOPDIR}/build/!!"`
 337     fi
 338     OUTPUTDIR="$CONFIGURE_START_DIR"
 339     AC_MSG_RESULT([in current directory])
 340 
 341     # WARNING: This might be a bad thing to do. You need to be sure you want to
 342     # have a configuration in this directory. Do some sanity checks!
 343 
 344     if test ! -e "$OUTPUTDIR/spec.gmk"; then
 345       # If we have a spec.gmk, we have run here before and we are OK. Otherwise, check for
 346       # other files
 347       files_present=`$LS $OUTPUTDIR`
 348       # Configure has already touched config.log and confdefs.h in the current dir when this check
 349       # is performed.
 350       filtered_files=`$ECHO "$files_present" \
 351           | $SED -e 's/config.log//g' \
 352               -e 's/configure.log//g' \
 353               -e 's/confdefs.h//g' \
 354               -e 's/configure-support//g' \
 355               -e 's/ //g' \
 356           | $TR -d '\n'`
 357       if test "x$filtered_files" != x; then
 358         AC_MSG_NOTICE([Current directory is $CONFIGURE_START_DIR.])
 359         AC_MSG_NOTICE([Since this is not the source root, configure will output the configuration here])
 360         AC_MSG_NOTICE([(as opposed to creating a configuration in <src_root>/build/<conf-name>).])
 361         AC_MSG_NOTICE([However, this directory is not empty. This is not allowed, since it could])
 362         AC_MSG_NOTICE([seriously mess up just about everything.])
 363         AC_MSG_NOTICE([Try 'cd $TOPDIR' and restart configure])
 364         AC_MSG_NOTICE([(or create a new empty directory and cd to it).])
 365         AC_MSG_ERROR([Will not continue creating configuration in $CONFIGURE_START_DIR])
 366       fi
 367     fi
 368   fi
 369   AC_MSG_CHECKING([what configuration name to use])
 370   AC_MSG_RESULT([$CONF_NAME])
 371 
 372   UTIL_FIXUP_PATH(OUTPUTDIR)
 373 
 374   CONFIGURESUPPORT_OUTPUTDIR="$OUTPUTDIR/configure-support"
 375   $MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
 376 
 377   SPEC="$OUTPUTDIR/spec.gmk"
 378   AC_SUBST(SPEC)
 379   AC_SUBST(CONF_NAME)
 380   AC_SUBST(OUTPUTDIR)
 381   AC_SUBST(CONFIGURESUPPORT_OUTPUTDIR)
 382 
 383   # The spec.gmk file contains all variables for the make system.
 384   AC_CONFIG_FILES([$OUTPUTDIR/spec.gmk:$AUTOCONF_DIR/spec.gmk.in])
 385   # The bootcycle-spec.gmk file contains support for boot cycle builds.
 386   AC_CONFIG_FILES([$OUTPUTDIR/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in])
 387   # The buildjdk-spec.gmk file contains support for building a buildjdk when cross compiling.
 388   AC_CONFIG_FILES([$OUTPUTDIR/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in])
 389   # The compare.sh is used to compare the build output to other builds.
 390   AC_CONFIG_FILES([$OUTPUTDIR/compare.sh:$AUTOCONF_DIR/compare.sh.in])
 391   # The generated Makefile knows where the spec.gmk is and where the source is.
 392   # You can run make from the OUTPUTDIR, or from the top-level Makefile
 393   # which will look for generated configurations
 394   AC_CONFIG_FILES([$OUTPUTDIR/Makefile:$AUTOCONF_DIR/Makefile.in])
 395 ])
 396 
 397 ###############################################################################
 398 # Check if build directory is on local disk. If not possible to determine,
 399 # we prefer to claim it's local.
 400 # Argument 1: directory to test
 401 # Argument 2: what to do if it is on local disk
 402 # Argument 3: what to do otherwise (remote disk or failure)
 403 AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
 404 [
 405   # df -l lists only local disks; if the given directory is not found then
 406   # a non-zero exit code is given
 407   if test "x$DF" = x; then
 408     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
 409       # msys does not have df; use Windows "net use" instead.
 410       IS_NETWORK_DISK=`net use | grep \`pwd -W | cut -d ":" -f 1 | tr a-z A-Z\`:`
 411       if test "x$IS_NETWORK_DISK" = x; then
 412         $2
 413       else
 414         $3
 415       fi
 416     else
 417       # No df here, say it's local
 418       $2
 419     fi
 420   else
 421     # JDK-8189619
 422     # df on AIX does not understand -l. On modern AIXes it understands "-T local" which
 423     # is the same. On older AIXes we just continue to live with a "not local build" warning.
 424     if test "x$OPENJDK_TARGET_OS" = xaix; then
 425       DF_LOCAL_ONLY_OPTION='-T local'
 426     elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
 427       # In WSL, we can only build on a drvfs file system (that is, a mounted real Windows drive)
 428       DF_LOCAL_ONLY_OPTION='-t drvfs'
 429     else
 430       DF_LOCAL_ONLY_OPTION='-l'
 431     fi
 432     if $DF $DF_LOCAL_ONLY_OPTION $1 > /dev/null 2>&1; then
 433       $2
 434     else
 435       $3
 436     fi
 437   fi
 438 ])
 439 
 440 ###############################################################################
 441 # Check that source files have basic read permissions set. This might
 442 # not be the case in cygwin in certain conditions.
 443 AC_DEFUN_ONCE([BASIC_CHECK_SRC_PERMS],
 444 [
 445   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 446     file_to_test="$TOPDIR/LICENSE"
 447     if test `$STAT -c '%a' "$file_to_test"` -lt 400; then
 448       AC_MSG_ERROR([Bad file permissions on src files. This is usually caused by cloning the repositories with a non cygwin hg in a directory not created in cygwin.])
 449     fi
 450   fi
 451 ])
 452 
 453 ###############################################################################
 454 AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
 455 [
 456   AC_MSG_CHECKING([if build directory is on local disk])
 457   BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUTDIR,
 458       [OUTPUT_DIR_IS_LOCAL="yes"],
 459       [OUTPUT_DIR_IS_LOCAL="no"])
 460   AC_MSG_RESULT($OUTPUT_DIR_IS_LOCAL)
 461 
 462   BASIC_CHECK_SRC_PERMS
 463 
 464   # Check if the user has any old-style ALT_ variables set.
 465   FOUND_ALT_VARIABLES=`env | grep ^ALT_`
 466 
 467   # Before generating output files, test if they exist. If they do, this is a reconfigure.
 468   # Since we can't properly handle the dependencies for this, warn the user about the situation
 469   if test -e $OUTPUTDIR/spec.gmk; then
 470     IS_RECONFIGURE=yes
 471   else
 472     IS_RECONFIGURE=no
 473   fi
 474 ])
 475 
 476 ################################################################################
 477 #
 478 # Default make target
 479 #
 480 AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_MAKE_TARGET],
 481 [
 482   AC_ARG_WITH(default-make-target, [AS_HELP_STRING([--with-default-make-target],
 483       [set the default make target @<:@exploded-image@:>@])])
 484   if test "x$with_default_make_target" = "x" \
 485       || test "x$with_default_make_target" = "xyes"; then
 486     DEFAULT_MAKE_TARGET="exploded-image"
 487   elif test "x$with_default_make_target" = "xno"; then
 488     AC_MSG_ERROR([--without-default-make-target is not a valid option])
 489   else
 490     DEFAULT_MAKE_TARGET="$with_default_make_target"
 491   fi
 492 
 493   AC_SUBST(DEFAULT_MAKE_TARGET)
 494 ])
 495 
 496 ###############################################################################
 497 # Setup the default value for LOG=
 498 #
 499 AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_LOG],
 500 [
 501   AC_ARG_WITH(log, [AS_HELP_STRING([--with-log],
 502       [[default vaue for make LOG argument [warn]]])])
 503   AC_MSG_CHECKING([for default LOG value])
 504   if test "x$with_log" = x; then
 505     DEFAULT_LOG=""
 506   else
 507     # Syntax for valid LOG options is a bit too complex for it to be worth
 508     # implementing a test for correctness in configure. Just accept it.
 509     DEFAULT_LOG=$with_log
 510   fi
 511   AC_MSG_RESULT([$DEFAULT_LOG])
 512   AC_SUBST(DEFAULT_LOG)
 513 ])
 514 
 515 ###############################################################################
 516 # Code to run after AC_OUTPUT
 517 AC_DEFUN_ONCE([BASIC_POST_CONFIG_OUTPUT],
 518 [
 519   # Try to move config.log (generated by autoconf) to the configure-support directory.
 520   if test -e ./config.log; then
 521     $MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
 522   fi
 523 
 524   # Rotate our log file (configure.log)
 525   if test -e "$OUTPUTDIR/configure.log.old"; then
 526     $RM -f "$OUTPUTDIR/configure.log.old"
 527   fi
 528   if test -e "$OUTPUTDIR/configure.log"; then
 529     $MV -f "$OUTPUTDIR/configure.log" "$OUTPUTDIR/configure.log.old" 2> /dev/null
 530   fi
 531 
 532   # Move configure.log from current directory to the build output root
 533   if test -e ./configure.log; then
 534     $MV -f ./configure.log "$OUTPUTDIR/configure.log" 2> /dev/null
 535   fi
 536 
 537   # Make the compare script executable
 538   $CHMOD +x $OUTPUTDIR/compare.sh
 539 ])