2
# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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.
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
26
m4_include([basic_tools.m4])
27
m4_include([basic_windows.m4])
29
###############################################################################
30
AC_DEFUN_ONCE([BASIC_INIT],
32
# Save the original command line. This is passed to us by the wrapper configure script.
33
AC_SUBST(CONFIGURE_COMMAND_LINE)
34
# We might have the original command line if the wrapper was called by some
36
AC_SUBST(REAL_CONFIGURE_COMMAND_EXEC_SHORT)
37
AC_SUBST(REAL_CONFIGURE_COMMAND_EXEC_FULL)
38
AC_SUBST(REAL_CONFIGURE_COMMAND_LINE)
39
# AUTOCONF might be set in the environment by the user. Preserve for "make reconfigure".
41
# Save the path variable before it gets changed
43
AC_SUBST(ORIGINAL_PATH)
44
DATE_WHEN_CONFIGURED=`date`
45
AC_SUBST(DATE_WHEN_CONFIGURED)
46
AC_MSG_NOTICE([Configuration created at $DATE_WHEN_CONFIGURED.])
49
###############################################################################
50
# Check that there are no unprocessed overridden variables left.
51
# If so, they are an incorrect argument and we will exit with an error.
52
AC_DEFUN([BASIC_CHECK_LEFTOVER_OVERRIDDEN],
54
if test "x$CONFIGURE_OVERRIDDEN_VARIABLES" != x; then
55
# Replace the separating ! with spaces before presenting for end user.
56
unknown_variables=${CONFIGURE_OVERRIDDEN_VARIABLES//!/ }
57
AC_MSG_WARN([The following variables might be unknown to configure: $unknown_variables])
61
###############################################################################
62
# Setup basic configuration paths, and platform-specific stuff related to PATHs.
63
# Make sure to only use tools set up in BASIC_SETUP_FUNDAMENTAL_TOOLS.
64
AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
66
# Save the current directory this script was started from
67
CONFIGURE_START_DIR="$PWD"
69
# We might need to rewrite ORIGINAL_PATH, if it includes "#", to quote them
70
# for make. We couldn't do this when we retrieved ORIGINAL_PATH, since SED
71
# was not available at that time.
72
REWRITTEN_PATH=`$ECHO "$ORIGINAL_PATH" | $SED -e 's/#/\\\\#/g'`
73
if test "x$REWRITTEN_PATH" != "x$ORIGINAL_PATH"; then
74
ORIGINAL_PATH="$REWRITTEN_PATH"
75
AC_MSG_NOTICE([Rewriting ORIGINAL_PATH to $REWRITTEN_PATH])
78
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
79
BASIC_SETUP_PATHS_WINDOWS
82
# We get the top-level directory from the supporting wrappers.
83
BASIC_WINDOWS_VERIFY_DIR($TOPDIR, source)
84
UTIL_FIXUP_PATH(TOPDIR)
85
AC_MSG_CHECKING([for top-level directory])
86
AC_MSG_RESULT([$TOPDIR])
89
if test "x$CUSTOM_ROOT" != x; then
90
BASIC_WINDOWS_VERIFY_DIR($CUSTOM_ROOT, custom root)
91
UTIL_FIXUP_PATH(CUSTOM_ROOT)
92
WORKSPACE_ROOT="${CUSTOM_ROOT}"
94
WORKSPACE_ROOT="${TOPDIR}"
96
AC_SUBST(WORKSPACE_ROOT)
98
UTIL_FIXUP_PATH(CONFIGURE_START_DIR)
99
AC_SUBST(CONFIGURE_START_DIR)
101
# Locate the directory of this script.
102
AUTOCONF_DIR=$TOPDIR/make/autoconf
105
###############################################################################
106
# Setup what kind of build environment type we have (CI or local developer)
107
AC_DEFUN_ONCE([BASIC_SETUP_BUILD_ENV],
109
if test "x$CI" = "xtrue"; then
110
DEFAULT_BUILD_ENV="ci"
111
AC_MSG_NOTICE([CI environment variable set to $CI])
113
DEFAULT_BUILD_ENV="dev"
116
UTIL_ARG_WITH(NAME: build-env, TYPE: literal,
118
VALID_VALUES: [auto dev ci], DEFAULT: auto,
119
CHECKING_MSG: [for build environment type],
120
DESC: [select build environment type (affects certain default values)],
122
RESULT=$DEFAULT_BUILD_ENV
127
if test "x$LOCALE" != x; then
128
# Check if we actually have C.UTF-8; if so, use it
129
if $LOCALE -a | $GREP -q -E "^C\.(utf8|UTF-8)$"; then
132
AC_MSG_WARN([C.UTF-8 locale not found, using C locale])
136
AC_MSG_WARN([locale command not not found, using C locale])
140
export LC_ALL=$LOCALE_USED
141
AC_SUBST(LOCALE_USED)
144
###############################################################################
145
# Evaluates platform specific overrides for devkit variables.
146
# $1: Name of variable
147
AC_DEFUN([BASIC_EVAL_DEVKIT_VARIABLE],
149
if test "x[$]$1" = x; then
150
eval $1="\${$1_${OPENJDK_TARGET_CPU}}"
154
###############################################################################
155
# Evaluates platform specific overrides for build devkit variables.
156
# $1: Name of variable
157
AC_DEFUN([BASIC_EVAL_BUILD_DEVKIT_VARIABLE],
159
if test "x[$]$1" = x; then
160
eval $1="\${$1_${OPENJDK_BUILD_CPU}}"
164
###############################################################################
165
AC_DEFUN([BASIC_SETUP_XCODE_SYSROOT],
167
AC_MSG_CHECKING([for sdk name])
168
AC_ARG_WITH([sdk-name], [AS_HELP_STRING([--with-sdk-name],
169
[use the Xcode platform SDK of the given name. @<:@macosx@:>@])],
170
[SDK_NAME=$with_sdk_name]
172
if test "x$SDK_NAME" = x; then
175
AC_MSG_RESULT([$SDK_NAME])
177
if test "x$DEVKIT_ROOT" != x; then
178
# We need to use xcodebuild from the devkit, if provided
179
UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild, $DEVKIT_TOOLCHAIN_PATH)
180
if test "x$XCODEBUILD" = x; then
181
AC_MSG_ERROR([No xcodebuild tool found in the provided devkit])
183
XCODEBUILD_OUTPUT=`"$XCODEBUILD" -version 2>&1`
184
if test $? -ne 0; then
185
AC_MSG_ERROR([The xcodebuild tool in the devkit reports an error: $XCODEBUILD_OUTPUT])
187
elif test "x$TOOLCHAIN_PATH" != x; then
188
UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild, $TOOLCHAIN_PATH)
189
if test "x$XCODEBUILD" != x; then
190
XCODEBUILD_OUTPUT=`"$XCODEBUILD" -version 2>&1`
191
if test $? -ne 0; then
192
AC_MSG_WARN([Ignoring the located xcodebuild tool $XCODEBUILD due to an error: $XCODEBUILD_OUTPUT])
197
UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild)
198
if test "x$XCODEBUILD" != x; then
199
XCODEBUILD_OUTPUT=`"$XCODEBUILD" -version 2>&1`
200
if test $? -ne 0; then
201
AC_MSG_WARN([Ignoring the located xcodebuild tool $XCODEBUILD due to an error: $XCODEBUILD_OUTPUT])
207
if test "x$SYSROOT" != x; then
208
if ! test -f "$SYSROOT/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
209
AC_MSG_ERROR([Invalid sysroot, framework headers not found])
211
if test "x$with_sdk_name" != x; then
212
AC_MSG_WARN([--with-sdk-name will be ignored since a sysroot or devkit is provided])
214
AC_MSG_NOTICE([Setting sysroot from devkit or --with-sysroot])
216
if test "x$XCODEBUILD" != x; then
217
SYSROOT=`"$XCODEBUILD" -sdk "$SDK_NAME" -version | $GREP '^Path: ' | $SED 's/Path: //'`
218
if test "x$SYSROOT" = x; then
219
AC_MSG_ERROR([No sysroot found for SDK $SDK_NAME from xcodebuild. Check your Xcode installation.])
221
if ! test -f "$SYSROOT/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
222
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])
224
AC_MSG_NOTICE([Setting sysroot from xcodebuild with SDK $SDK_NAME])
226
UTIL_LOOKUP_PROGS(XCRUN, xcrun)
227
if test "x$XCRUN" != x; then
228
XCRUN_SDK_PATH=`"$XCRUN" --show-sdk-path -sdk "$SDK_NAME"`
231
if test "x$XCRUN_SDK_PATH" != x && test -f "$XCRUN_SDK_PATH/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
232
AC_MSG_NOTICE([Setting sysroot from xcrun with SDK $SDK_NAME])
233
SYSROOT="$XCRUN_SDK_PATH"
234
elif test -f /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h; then
235
AC_MSG_WARN([No devkit provided and no xcodebuild found. Proceeding using system headers.])
236
if test "x$with_sdk_name" != x; then
237
AC_MSG_WARN([--with-sdk-name will be ignored since no xcodebuild could be found])
240
AC_MSG_NOTICE([No devkit provided, no xcodebuild tool and no system headers found in the system.])
241
AC_MSG_NOTICE([Check that Xcode is properly installed, or set a devkit with --with-devkit,])
242
AC_MSG_NOTICE([or override SDK selection using --with-sysroot or --with-sdk-name.])
243
AC_MSG_ERROR([Cannot continue])
249
###############################################################################
250
AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
252
AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
253
[use this devkit for compilers, tools and resources])])
255
if test "x$with_devkit" = xyes; then
256
AC_MSG_ERROR([--with-devkit must have a value])
257
elif test "x$with_devkit" != x && test "x$with_devkit" != xno; then
258
UTIL_FIXUP_PATH([with_devkit])
259
DEVKIT_ROOT="$with_devkit"
260
# Check for a meta data info file in the root of the devkit
261
if test -f "$DEVKIT_ROOT/devkit.info"; then
262
. $DEVKIT_ROOT/devkit.info
263
# This potentially sets the following:
264
# A descriptive name of the devkit
265
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_NAME])
266
# Corresponds to --with-extra-path
267
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_EXTRA_PATH])
268
# Corresponds to --with-toolchain-path
269
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_TOOLCHAIN_PATH])
270
# Corresponds to --with-sysroot
271
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_SYSROOT])
273
# Identifies the Visual Studio version in the devkit
274
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_VERSION])
275
# The Visual Studio include environment variable
276
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_INCLUDE])
277
# The Visual Studio lib environment variable
278
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_LIB])
279
# Corresponds to --with-msvcr-dll
280
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCR_DLL])
281
# Corresponds to --with-vcruntime-1-dll
282
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VCRUNTIME_1_DLL])
283
# Corresponds to --with-msvcp-dll
284
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCP_DLL])
285
# Corresponds to --with-ucrt-dll-dir
286
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_UCRT_DLL_DIR])
289
AC_MSG_CHECKING([for devkit])
290
if test "x$DEVKIT_NAME" != x; then
291
AC_MSG_RESULT([$DEVKIT_NAME in $DEVKIT_ROOT])
293
AC_MSG_RESULT([$DEVKIT_ROOT])
296
UTIL_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH)
298
# Fallback default of just /bin if DEVKIT_PATH is not defined
299
if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then
300
DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin"
302
UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$DEVKIT_TOOLCHAIN_PATH)
304
# If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known
305
# places for backwards compatibility.
306
if test "x$DEVKIT_SYSROOT" != x; then
307
SYSROOT="$DEVKIT_SYSROOT"
308
elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then
309
SYSROOT="$DEVKIT_ROOT/$host_alias/libc"
310
elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
311
SYSROOT="$DEVKIT_ROOT/$host/sys-root"
314
if test "x$DEVKIT_ROOT" != x; then
315
DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib"
316
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
317
DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib64"
319
AC_SUBST(DEVKIT_LIB_DIR)
323
# You can force the sysroot if the sysroot encoded into the compiler tools
325
AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
326
[alias for --with-sysroot for backwards compatibility])],
327
[SYSROOT=$with_sys_root]
330
AC_ARG_WITH(sysroot, [AS_HELP_STRING([--with-sysroot],
331
[use this directory as sysroot])],
332
[SYSROOT=$with_sysroot]
335
AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
336
[alias for --with-toolchain-path for backwards compatibility])],
337
[UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_tools_dir)]
340
AC_ARG_WITH([toolchain-path], [AS_HELP_STRING([--with-toolchain-path],
341
[prepend these directories when searching for toolchain binaries (compilers etc)])],
342
[UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_toolchain_path)]
345
AC_ARG_WITH([xcode-path], [AS_HELP_STRING([--with-xcode-path],
346
[set up toolchain on Mac OS using a path to an Xcode installation])])
348
if test "x$with_xcode_path" != x; then
349
if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
350
UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],
351
$with_xcode_path/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$with_xcode_path/Contents/Developer/usr/bin)
353
AC_MSG_WARN([Option --with-xcode-path is only valid on Mac OS, ignoring.])
357
AC_MSG_CHECKING([for toolchain path])
358
AC_MSG_RESULT([$TOOLCHAIN_PATH])
359
AC_SUBST(TOOLCHAIN_PATH)
361
AC_ARG_WITH([extra-path], [AS_HELP_STRING([--with-extra-path],
362
[prepend these directories to the default path])],
363
[UTIL_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)]
366
if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
367
BASIC_SETUP_XCODE_SYSROOT
370
# Prepend the extra path to the global path
371
UTIL_PREPEND_TO_PATH([PATH],$EXTRA_PATH)
373
UTIL_FIXUP_PATH([SYSROOT])
375
AC_MSG_CHECKING([for sysroot])
376
AC_MSG_RESULT([$SYSROOT])
379
AC_MSG_CHECKING([for extra path])
380
AC_MSG_RESULT([$EXTRA_PATH])
383
###############################################################################
384
AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
387
AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
388
[use this as the name of the configuration @<:@generated from important configuration options@:>@])],
389
[ CONF_NAME=${with_conf_name} ])
391
# Test from where we are running configure, in or outside of src root.
392
AC_MSG_CHECKING([where to store configuration])
393
if test "x$CONFIGURE_START_DIR" = "x$TOPDIR" \
394
|| test "x$CONFIGURE_START_DIR" = "x$CUSTOM_ROOT" \
395
|| test "x$CONFIGURE_START_DIR" = "x$TOPDIR/make/autoconf" \
396
|| test "x$CONFIGURE_START_DIR" = "x$TOPDIR/make" ; then
397
# We are running configure from the src root.
398
# Create a default ./build/target-variant-debuglevel output root.
399
if test "x${CONF_NAME}" = x; then
400
AC_MSG_RESULT([in default location])
401
CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JVM_VARIANTS_WITH_AND}-${DEBUG_LEVEL}"
403
AC_MSG_RESULT([in build directory with custom name])
406
OUTPUTDIR="${WORKSPACE_ROOT}/build/${CONF_NAME}"
407
$MKDIR -p "$OUTPUTDIR"
408
if test ! -d "$OUTPUTDIR"; then
409
AC_MSG_ERROR([Could not create build directory $OUTPUTDIR])
412
# We are running configure from outside of the src dir.
413
# Then use the current directory as output dir!
414
# If configuration is situated in normal build directory, just use the build
415
# directory name as configuration name, otherwise use the complete path.
416
if test "x${CONF_NAME}" = x; then
417
CONF_NAME=`$ECHO $CONFIGURE_START_DIR | $SED -e "s!^${TOPDIR}/build/!!"`
419
OUTPUTDIR="$CONFIGURE_START_DIR"
420
AC_MSG_RESULT([in current directory])
422
# WARNING: This might be a bad thing to do. You need to be sure you want to
423
# have a configuration in this directory. Do some sanity checks!
425
if test ! -e "$OUTPUTDIR/spec.gmk" && test ! -e "$OUTPUTDIR/configure-support/generated-configure.sh"; then
426
# If we have a spec.gmk or configure-support/generated-configure.sh,
427
# we have run here before and we are OK. Otherwise, check for other files
428
files_present=`$LS $OUTPUTDIR`
429
# Configure has already touched config.log and confdefs.h in the current dir when this check
431
filtered_files=`$ECHO "$files_present" \
432
| $SED -e 's/config.log//g' \
433
-e 's/configure.log//g' \
434
-e 's/confdefs.h//g' \
435
-e 's/configure-support//g' \
438
if test "x$filtered_files" != x; then
439
AC_MSG_NOTICE([Current directory is $CONFIGURE_START_DIR.])
440
AC_MSG_NOTICE([Since this is not the source root, configure will output the configuration here])
441
AC_MSG_NOTICE([(as opposed to creating a configuration in <src_root>/build/<conf-name>).])
442
AC_MSG_NOTICE([However, this directory is not empty, additionally to some allowed files])
443
AC_MSG_NOTICE([it contains $filtered_files.])
444
AC_MSG_NOTICE([This is not allowed, since it could seriously mess up just about everything.])
445
AC_MSG_NOTICE([Try 'cd $TOPDIR' and restart configure])
446
AC_MSG_NOTICE([(or create a new empty directory and cd to it).])
447
AC_MSG_ERROR([Will not continue creating configuration in $CONFIGURE_START_DIR])
451
AC_MSG_CHECKING([what configuration name to use])
452
AC_MSG_RESULT([$CONF_NAME])
454
BASIC_WINDOWS_VERIFY_DIR($OUTPUTDIR, output)
455
UTIL_FIXUP_PATH(OUTPUTDIR)
457
CONFIGURESUPPORT_OUTPUTDIR="$OUTPUTDIR/configure-support"
458
$MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
460
SPEC="$OUTPUTDIR/spec.gmk"
464
AC_SUBST(CONFIGURESUPPORT_OUTPUTDIR)
466
# The spec.gmk file contains all variables for the make system.
467
AC_CONFIG_FILES([$OUTPUTDIR/spec.gmk:$AUTOCONF_DIR/spec.gmk.template])
468
# The bootcycle-spec.gmk file contains support for boot cycle builds.
469
AC_CONFIG_FILES([$OUTPUTDIR/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.template])
470
# The buildjdk-spec.gmk file contains support for building a buildjdk when cross compiling.
471
AC_CONFIG_FILES([$OUTPUTDIR/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.template])
472
# The compare.sh is used to compare the build output to other builds.
473
AC_CONFIG_FILES([$OUTPUTDIR/compare.sh:$AUTOCONF_DIR/compare.sh.template])
474
# The generated Makefile knows where the spec.gmk is and where the source is.
475
# You can run make from the OUTPUTDIR, or from the top-level Makefile
476
# which will look for generated configurations
477
AC_CONFIG_FILES([$OUTPUTDIR/Makefile:$AUTOCONF_DIR/Makefile.template])
480
###############################################################################
481
# Check if build directory is on local disk. If not possible to determine,
482
# we prefer to claim it's local.
483
# Argument 1: directory to test
484
# Argument 2: what to do if it is on local disk
485
# Argument 3: what to do otherwise (remote disk or failure)
486
AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
488
# df -l lists only local disks; if the given directory is not found then
489
# a non-zero exit code is given
490
if test "x$DF" = x; then
491
# No df here, say it's local
495
# df on AIX does not understand -l. On modern AIXes it understands "-T local" which
496
# is the same. On older AIXes we just continue to live with a "not local build" warning.
497
if test "x$OPENJDK_TARGET_OS" = xaix; then
498
if $DF -T local > /dev/null 2>&1; then
499
DF_LOCAL_ONLY_OPTION='-T local'
500
else # AIX may use GNU-utils instead
501
DF_LOCAL_ONLY_OPTION='-l'
503
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1"; then
504
# In WSL1, we can only build on a drvfs file system (that is, a mounted real Windows drive)
505
DF_LOCAL_ONLY_OPTION='-t drvfs'
507
DF_LOCAL_ONLY_OPTION='-l'
509
if $DF $DF_LOCAL_ONLY_OPTION $1 > /dev/null 2>&1; then
517
###############################################################################
518
# Check that source files have basic read permissions set. This might
519
# not be the case in cygwin in certain conditions.
520
AC_DEFUN_ONCE([BASIC_CHECK_SRC_PERMS],
522
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
523
# The choice of file here is somewhat arbitrary, it just needs to be there
524
# in the source tree when configure runs
525
file_to_test="$TOPDIR/Makefile"
526
if test `$STAT -c '%a' "$file_to_test"` -lt 400; then
527
AC_MSG_ERROR([Bad file permissions on src files. This is usually caused by cloning the repositories with non cygwin tools in a directory not created in cygwin.])
532
###############################################################################
533
AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
535
AC_MSG_CHECKING([if build directory is on local disk])
536
BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUTDIR,
537
[OUTPUT_DIR_IS_LOCAL="yes"],
538
[OUTPUT_DIR_IS_LOCAL="no"])
539
AC_MSG_RESULT($OUTPUT_DIR_IS_LOCAL)
541
BASIC_CHECK_SRC_PERMS
543
# Check if the user has any old-style ALT_ variables set.
544
FOUND_ALT_VARIABLES=`env | grep ^ALT_`
546
# Before generating output files, test if they exist. If they do, this is a reconfigure.
547
# Since we can't properly handle the dependencies for this, warn the user about the situation
548
if test -e $OUTPUTDIR/spec.gmk; then
555
################################################################################
559
AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_MAKE_TARGET],
561
AC_ARG_WITH(default-make-target, [AS_HELP_STRING([--with-default-make-target],
562
[set the default make target @<:@exploded-image@:>@])])
563
if test "x$with_default_make_target" = "x" \
564
|| test "x$with_default_make_target" = "xyes"; then
565
DEFAULT_MAKE_TARGET="exploded-image"
566
elif test "x$with_default_make_target" = "xno"; then
567
AC_MSG_ERROR([--without-default-make-target is not a valid option])
569
DEFAULT_MAKE_TARGET="$with_default_make_target"
572
AC_SUBST(DEFAULT_MAKE_TARGET)
575
###############################################################################
576
# Setup the default value for LOG=
578
AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_LOG],
580
AC_ARG_WITH(log, [AS_HELP_STRING([--with-log],
581
[[default value for make LOG argument [warn]]])])
582
AC_MSG_CHECKING([for default LOG value])
583
if test "x$with_log" = x; then
586
# Syntax for valid LOG options is a bit too complex for it to be worth
587
# implementing a test for correctness in configure. Just accept it.
588
DEFAULT_LOG=$with_log
590
AC_MSG_RESULT([$DEFAULT_LOG])
591
AC_SUBST(DEFAULT_LOG)
594
###############################################################################
595
# Code to run after AC_OUTPUT
596
AC_DEFUN_ONCE([BASIC_POST_CONFIG_OUTPUT],
598
# Try to move config.log (generated by autoconf) to the configure-support directory.
599
if test -e ./config.log; then
600
$MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
603
# Rotate our log file (configure.log)
604
if test -e "$OUTPUTDIR/configure.log.old"; then
605
$RM -f "$OUTPUTDIR/configure.log.old"
607
if test -e "$OUTPUTDIR/configure.log"; then
608
$MV -f "$OUTPUTDIR/configure.log" "$OUTPUTDIR/configure.log.old" 2> /dev/null
611
# Move configure.log from current directory to the build output root
612
if test -e ./configure.log; then
613
$MV -f ./configure.log "$OUTPUTDIR/configure.log" 2> /dev/null
616
# Make the compare script executable
617
$CHMOD +x $OUTPUTDIR/compare.sh