8257679: Improved unix compatibility layer in Windows build (winenv)
Reviewed-by: erikj, jvernee, burban
This commit is contained in:
parent
74be819088
commit
d29c78da19
|
@ -938,15 +938,18 @@ jobs:
|
|||
run: >
|
||||
$env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ;
|
||||
$env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ;
|
||||
$env:BOOT_JDK = cygpath "$HOME/bootjdk/$env:BOOT_JDK_VERSION" ;
|
||||
$env:JT_HOME = cygpath "$HOME/jtreg" ;
|
||||
$env:GTEST = cygpath "$env:GITHUB_WORKSPACE/gtest" ;
|
||||
& bash configure
|
||||
--with-conf-name=windows-x64
|
||||
--with-msvc-toolset-version=14.27
|
||||
${{ matrix.flags }}
|
||||
--with-version-opt="$env:GITHUB_ACTOR-$env:GITHUB_SHA"
|
||||
--with-version-build=0
|
||||
--with-boot-jdk="$HOME/bootjdk/$env:BOOT_JDK_VERSION"
|
||||
--with-jtreg="$HOME/jtreg"
|
||||
--with-gtest="$env:GITHUB_WORKSPACE/gtest"
|
||||
--with-boot-jdk="$env:BOOT_JDK"
|
||||
--with-jtreg="$env:JT_HOME"
|
||||
--with-gtest="$env:GTEST"
|
||||
--with-default-make-target="product-bundles test-bundles"
|
||||
--enable-jtreg-failure-handler
|
||||
working-directory: jdk
|
||||
|
|
|
@ -61,7 +61,7 @@ endif
|
|||
|
||||
# Save the stderr output of the command and print it along with stdout in case
|
||||
# something goes wrong.
|
||||
$(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR)
|
||||
$(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST_JAR)
|
||||
$(call MakeDir, $(LINK_OPT_DIR))
|
||||
$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@))
|
||||
$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $(JLI_TRACE_FILE)))
|
||||
|
@ -94,7 +94,7 @@ $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR)
|
|||
# dependencies, make will correctly rebuild both jli trace and classlist
|
||||
# incrementally using the single recipe above.
|
||||
$(CLASSLIST_FILE): $(JLI_TRACE_FILE)
|
||||
$(JLI_TRACE_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR)
|
||||
$(JLI_TRACE_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST_JAR)
|
||||
|
||||
TARGETS += $(CLASSLIST_FILE) $(JLI_TRACE_FILE)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -32,7 +32,7 @@ include Modules.gmk
|
|||
################################################################################
|
||||
|
||||
# Use this file inside the image as target for make rule
|
||||
JIMAGE_TARGET_FILE := bin/java$(EXE_SUFFIX)
|
||||
JIMAGE_TARGET_FILE := bin/java$(EXECUTABLE_SUFFIX)
|
||||
|
||||
INTERIM_MODULES_LIST := $(call CommaList, $(INTERIM_IMAGE_MODULES))
|
||||
|
||||
|
|
|
@ -60,19 +60,14 @@ define SetTestOpt
|
|||
endif
|
||||
endef
|
||||
|
||||
# Setup _NT_SYMBOL_PATH on Windows
|
||||
# Setup _NT_SYMBOL_PATH on Windows, which points to our pdb files.
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
ifndef _NT_SYMBOL_PATH
|
||||
# Can't use PathList here as it adds quotes around the value.
|
||||
_NT_SYMBOL_PATH := \
|
||||
$(subst $(SPACE),;,$(strip \
|
||||
$(foreach p, $(sort $(dir $(wildcard \
|
||||
$(addprefix $(SYMBOLS_IMAGE_DIR)/bin/, *.pdb */*.pdb)))), \
|
||||
$(call FixPath, $p) \
|
||||
) \
|
||||
))
|
||||
export _NT_SYMBOL_PATH
|
||||
$(call LogDebug, Rewriting _NT_SYMBOL_PATH to $(_NT_SYMBOL_PATH))
|
||||
SYMBOL_PATH := $(call PathList, $(sort $(patsubst %/, %, $(dir $(wildcard \
|
||||
$(addprefix $(SYMBOLS_IMAGE_DIR)/bin/, *.pdb */*.pdb))))))
|
||||
export _NT_SYMBOL_PATH := $(subst \\,\, $(call FixPath, \
|
||||
$(subst $(DQUOTE),, $(SYMBOL_PATH))))
|
||||
$(call LogDebug, Setting _NT_SYMBOL_PATH to $(_NT_SYMBOL_PATH))
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -189,15 +189,9 @@ ifeq ($(OPENJDK_TARGET_CPU), x86_64)
|
|||
endif
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
ifeq ($(wildcard $(TEST_IMAGE_DIR)/bin/fixpath.exe), )
|
||||
$(info Error: fixpath is missing from test image '$(TEST_IMAGE_DIR)')
|
||||
$(error Cannot continue.)
|
||||
endif
|
||||
FIXPATH := $(TEST_IMAGE_DIR)/bin/fixpath.exe -c
|
||||
PATH_SEP:=;
|
||||
FIXPATH := $(BASH) $(TOPDIR)/make/scripts/fixpath.sh exec
|
||||
else
|
||||
FIXPATH :=
|
||||
PATH_SEP:=:
|
||||
endif
|
||||
|
||||
# Check number of cores and memory in MB
|
||||
|
@ -280,7 +274,6 @@ $(call CreateNewSpec, $(NEW_SPEC), \
|
|||
BASH := $(BASH), \
|
||||
JIB_JAR := $(JIB_JAR), \
|
||||
FIXPATH := $(FIXPATH), \
|
||||
PATH_SEP := $(PATH_SEP), \
|
||||
OPENJDK_TARGET_OS := $(OPENJDK_TARGET_OS), \
|
||||
OPENJDK_TARGET_OS_TYPE := $(OPENJDK_TARGET_OS_TYPE), \
|
||||
OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS_ENV), \
|
||||
|
|
|
@ -116,16 +116,13 @@ JAVAC_CMD := $(BOOT_JDK)/bin/javac
|
|||
JAR_CMD := $(BOOT_JDK)/bin/jar
|
||||
JLINK_CMD := $(JDK_OUTPUTDIR)/bin/jlink
|
||||
JMOD_CMD := $(JDK_OUTPUTDIR)/bin/jmod
|
||||
JARSIGNER_CMD := $(BOOT_JDK)/bin/jarsigner
|
||||
|
||||
JAVA := $(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
|
||||
JAVA_SMALL := $(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
|
||||
JAVA_DETACH := $(FIXPATH) $(FIXPATH_DETACH_FLAG) $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
|
||||
JAVAC := $(FIXPATH) $(JAVAC_CMD)
|
||||
JAR := $(FIXPATH) $(JAR_CMD)
|
||||
JLINK := $(FIXPATH) $(JLINK_CMD)
|
||||
JMOD := $(FIXPATH) $(JMOD_CMD)
|
||||
JARSIGNER := $(FIXPATH) $(JARSIGNER_CMD)
|
||||
|
||||
BUILD_JAVA := $(JDK_IMAGE_DIR)/bin/JAVA
|
||||
################################################################################
|
||||
|
@ -166,7 +163,6 @@ TAIL := tail
|
|||
TEE := tee
|
||||
TR := tr
|
||||
TOUCH := touch
|
||||
UNIQ := uniq
|
||||
WC := wc
|
||||
XARGS := xargs
|
||||
ZIPEXE := zip
|
||||
|
@ -177,7 +173,7 @@ HG := hg
|
|||
ULIMIT := ulimit
|
||||
|
||||
ifeq ($(OPENJDK_BUILD_OS), windows)
|
||||
CYGPATH := cygpath
|
||||
PATHTOOL := cygpath
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -30,29 +30,15 @@ include MakeBase.gmk
|
|||
|
||||
############################################################################
|
||||
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
FIXPATH_COPY := $(TEST_IMAGE_DIR)/bin/fixpath.exe
|
||||
|
||||
$(FIXPATH_COPY): $(firstword $(FIXPATH))
|
||||
$(call install-file)
|
||||
|
||||
FIXPATH_WORKSPACE_ROOT := $(call FixPath, $(WORKSPACE_ROOT))
|
||||
FIXPATH_OUTPUTDIR := $(call FixPath, $(OUTPUTDIR))
|
||||
else
|
||||
FIXPATH_WORKSPACE_ROOT := $(WORKSPACE_ROOT)
|
||||
FIXPATH_OUTPUTDIR := $(OUTPUTDIR)
|
||||
endif
|
||||
|
||||
|
||||
BUILD_INFO_PROPERTIES := $(TEST_IMAGE_DIR)/build-info.properties
|
||||
|
||||
$(BUILD_INFO_PROPERTIES):
|
||||
$(call MakeTargetDir)
|
||||
$(ECHO) "# Build info properties for JDK tests" > $@
|
||||
$(ECHO) "build.workspace.root=$(FIXPATH_WORKSPACE_ROOT)" >> $@
|
||||
$(ECHO) "build.output.root=$(FIXPATH_OUTPUTDIR)" >> $@
|
||||
$(ECHO) "build.workspace.root=$(call FixPath, $(WORKSPACE_ROOT))" >> $@
|
||||
$(ECHO) "build.output.root=$(call FixPath, $(OUTPUTDIR))" >> $@
|
||||
|
||||
prepare-test-image: $(FIXPATH_COPY) $(BUILD_INFO_PROPERTIES)
|
||||
prepare-test-image: $(BUILD_INFO_PROPERTIES)
|
||||
$(call MakeDir, $(TEST_IMAGE_DIR))
|
||||
$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
|
||||
|
||||
|
|
|
@ -70,27 +70,18 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
|
|||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
|
||||
PATH_SEP=";"
|
||||
EXE_SUFFIX=".exe"
|
||||
BASIC_CHECK_PATHS_WINDOWS
|
||||
else
|
||||
PATH_SEP=":"
|
||||
EXE_SUFFIX=""
|
||||
BASIC_SETUP_PATHS_WINDOWS
|
||||
fi
|
||||
AC_SUBST(PATH_SEP)
|
||||
AC_SUBST(EXE_SUFFIX)
|
||||
|
||||
# We get the top-level directory from the supporting wrappers.
|
||||
BASIC_WINDOWS_VERIFY_DIR($TOPDIR, source)
|
||||
UTIL_FIXUP_PATH(TOPDIR)
|
||||
AC_MSG_CHECKING([for top-level directory])
|
||||
AC_MSG_RESULT([$TOPDIR])
|
||||
AC_SUBST(TOPDIR)
|
||||
AC_SUBST(CONFIGURE_START_DIR)
|
||||
|
||||
# We can only call UTIL_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS.
|
||||
UTIL_FIXUP_PATH(TOPDIR)
|
||||
UTIL_FIXUP_PATH(CONFIGURE_START_DIR)
|
||||
|
||||
if test "x$CUSTOM_ROOT" != x; then
|
||||
BASIC_WINDOWS_VERIFY_DIR($CUSTOM_ROOT, custom root)
|
||||
UTIL_FIXUP_PATH(CUSTOM_ROOT)
|
||||
WORKSPACE_ROOT="${CUSTOM_ROOT}"
|
||||
else
|
||||
|
@ -98,6 +89,9 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
|
|||
fi
|
||||
AC_SUBST(WORKSPACE_ROOT)
|
||||
|
||||
UTIL_FIXUP_PATH(CONFIGURE_START_DIR)
|
||||
AC_SUBST(CONFIGURE_START_DIR)
|
||||
|
||||
# Locate the directory of this script.
|
||||
AUTOCONF_DIR=$TOPDIR/make/autoconf
|
||||
|
||||
|
@ -234,9 +228,12 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
|
|||
# if no Xcode installed, xcodebuild exits with 1
|
||||
# if Xcode is installed, even if xcode-select is misconfigured, then it exits with 0
|
||||
if test "x$DEVKIT_ROOT" != x || /usr/bin/xcodebuild -version >/dev/null 2>&1; then
|
||||
# We need to use xcodebuild in the toolchain dir provided by the user, this will
|
||||
# We need to use xcodebuild in the toolchain dir provided by the user
|
||||
UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild, $TOOLCHAIN_PATH)
|
||||
if test x$XCODEBUILD = x; then
|
||||
# fall back on the stub binary in /usr/bin/xcodebuild
|
||||
AC_PATH_PROG([XCODEBUILD], [xcodebuild], [/usr/bin/xcodebuild], [$TOOLCHAIN_PATH])
|
||||
XCODEBUILD=/usr/bin/xcodebuild
|
||||
fi
|
||||
else
|
||||
# this should result in SYSROOT being empty, unless --with-sysroot is provided
|
||||
# when only the command line tools are installed there are no SDKs, so headers
|
||||
|
@ -306,6 +303,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
|
|||
AC_MSG_RESULT([$SYSROOT])
|
||||
AC_MSG_CHECKING([for toolchain path])
|
||||
AC_MSG_RESULT([$TOOLCHAIN_PATH])
|
||||
AC_SUBST(TOOLCHAIN_PATH)
|
||||
AC_MSG_CHECKING([for extra path])
|
||||
AC_MSG_RESULT([$EXTRA_PATH])
|
||||
])
|
||||
|
@ -380,6 +378,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
|
|||
AC_MSG_CHECKING([what configuration name to use])
|
||||
AC_MSG_RESULT([$CONF_NAME])
|
||||
|
||||
BASIC_WINDOWS_VERIFY_DIR($OUTPUTDIR, output)
|
||||
UTIL_FIXUP_PATH(OUTPUTDIR)
|
||||
|
||||
CONFIGURESUPPORT_OUTPUTDIR="$OUTPUTDIR/configure-support"
|
||||
|
@ -416,26 +415,16 @@ AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
|
|||
# df -l lists only local disks; if the given directory is not found then
|
||||
# a non-zero exit code is given
|
||||
if test "x$DF" = x; then
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
|
||||
# msys does not have df; use Windows "net use" instead.
|
||||
IS_NETWORK_DISK=`net use | grep \`pwd -W | cut -d ":" -f 1 | tr a-z A-Z\`:`
|
||||
if test "x$IS_NETWORK_DISK" = x; then
|
||||
$2
|
||||
else
|
||||
$3
|
||||
fi
|
||||
else
|
||||
# No df here, say it's local
|
||||
$2
|
||||
fi
|
||||
else
|
||||
# JDK-8189619
|
||||
# df on AIX does not understand -l. On modern AIXes it understands "-T local" which
|
||||
# is the same. On older AIXes we just continue to live with a "not local build" warning.
|
||||
if test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
DF_LOCAL_ONLY_OPTION='-T local'
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
# In WSL, we can only build on a drvfs file system (that is, a mounted real Windows drive)
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1"; then
|
||||
# In WSL1, we can only build on a drvfs file system (that is, a mounted real Windows drive)
|
||||
DF_LOCAL_ONLY_OPTION='-t drvfs'
|
||||
else
|
||||
DF_LOCAL_ONLY_OPTION='-l'
|
||||
|
|
|
@ -28,38 +28,37 @@
|
|||
# but is used by much of the early bootstrap code.
|
||||
AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
|
||||
[
|
||||
# Start with tools that do not need have cross compilation support
|
||||
# and can be expected to be found in the default PATH. These tools are
|
||||
# used by configure.
|
||||
# Bootstrapping: These tools are needed by UTIL_LOOKUP_PROGS
|
||||
AC_PATH_PROGS(BASENAME, basename)
|
||||
UTIL_CHECK_NONEMPTY(BASENAME)
|
||||
AC_PATH_PROGS(DIRNAME, dirname)
|
||||
UTIL_CHECK_NONEMPTY(DIRNAME)
|
||||
AC_PATH_PROGS(FILE, file)
|
||||
UTIL_CHECK_NONEMPTY(FILE)
|
||||
AC_PATH_PROGS(LDD, ldd)
|
||||
|
||||
# First are all the simple required tools.
|
||||
UTIL_REQUIRE_PROGS(BASENAME, basename)
|
||||
# First are all the fundamental required tools.
|
||||
UTIL_REQUIRE_PROGS(BASH, bash)
|
||||
UTIL_REQUIRE_PROGS(CAT, cat)
|
||||
UTIL_REQUIRE_PROGS(CHMOD, chmod)
|
||||
UTIL_REQUIRE_PROGS(CMP, cmp)
|
||||
UTIL_REQUIRE_PROGS(COMM, comm)
|
||||
UTIL_REQUIRE_PROGS(CP, cp)
|
||||
UTIL_REQUIRE_PROGS(CUT, cut)
|
||||
UTIL_REQUIRE_PROGS(DATE, date)
|
||||
UTIL_REQUIRE_PROGS(DIFF, [gdiff diff])
|
||||
UTIL_REQUIRE_PROGS(DIRNAME, dirname)
|
||||
UTIL_REQUIRE_PROGS(DIFF, gdiff diff)
|
||||
UTIL_REQUIRE_PROGS(ECHO, echo)
|
||||
UTIL_REQUIRE_PROGS(EXPR, expr)
|
||||
UTIL_REQUIRE_PROGS(FILE, file)
|
||||
UTIL_REQUIRE_PROGS(FIND, find)
|
||||
UTIL_REQUIRE_PROGS(HEAD, head)
|
||||
UTIL_REQUIRE_PROGS(GUNZIP, gunzip)
|
||||
UTIL_REQUIRE_PROGS(GZIP, pigz gzip)
|
||||
UTIL_REQUIRE_PROGS(HEAD, head)
|
||||
UTIL_REQUIRE_PROGS(LN, ln)
|
||||
UTIL_REQUIRE_PROGS(LS, ls)
|
||||
# gmkdir is known to be safe for concurrent invocations with -p flag.
|
||||
UTIL_REQUIRE_PROGS(MKDIR, [gmkdir mkdir])
|
||||
UTIL_REQUIRE_PROGS(MKDIR, gmkdir mkdir)
|
||||
UTIL_REQUIRE_PROGS(MKTEMP, mktemp)
|
||||
UTIL_REQUIRE_PROGS(MV, mv)
|
||||
UTIL_REQUIRE_PROGS(AWK, [gawk nawk awk])
|
||||
UTIL_REQUIRE_PROGS(AWK, gawk nawk awk)
|
||||
UTIL_REQUIRE_PROGS(PRINTF, printf)
|
||||
UTIL_REQUIRE_PROGS(READLINK, [greadlink readlink])
|
||||
UTIL_REQUIRE_PROGS(RM, rm)
|
||||
UTIL_REQUIRE_PROGS(RMDIR, rmdir)
|
||||
UTIL_REQUIRE_PROGS(SH, sh)
|
||||
|
@ -70,7 +69,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
|
|||
UTIL_REQUIRE_PROGS(TOUCH, touch)
|
||||
UTIL_REQUIRE_PROGS(TR, tr)
|
||||
UTIL_REQUIRE_PROGS(UNAME, uname)
|
||||
UTIL_REQUIRE_PROGS(UNIQ, uniq)
|
||||
UTIL_REQUIRE_PROGS(WC, wc)
|
||||
UTIL_REQUIRE_PROGS(XARGS, xargs)
|
||||
|
||||
|
@ -80,22 +78,22 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
|
|||
UTIL_REQUIRE_SPECIAL(FGREP, [AC_PROG_FGREP])
|
||||
UTIL_REQUIRE_SPECIAL(SED, [AC_PROG_SED])
|
||||
|
||||
# Optional tools, we can do without them
|
||||
UTIL_LOOKUP_PROGS(DF, df)
|
||||
UTIL_LOOKUP_PROGS(NICE, nice)
|
||||
UTIL_LOOKUP_PROGS(READLINK, greadlink readlink)
|
||||
|
||||
# These are only needed on some platforms
|
||||
UTIL_LOOKUP_PROGS(PATHTOOL, cygpath wslpath)
|
||||
UTIL_LOOKUP_PROGS(LSB_RELEASE, lsb_release)
|
||||
UTIL_LOOKUP_PROGS(CMD, cmd.exe, $PATH:/cygdrive/c/windows/system32:/mnt/c/windows/system32:/c/windows/system32)
|
||||
|
||||
# For compare.sh only
|
||||
UTIL_LOOKUP_PROGS(CMP, cmp)
|
||||
UTIL_LOOKUP_PROGS(UNIQ, uniq)
|
||||
|
||||
# Always force rm.
|
||||
RM="$RM -f"
|
||||
|
||||
# pwd behaves differently on various platforms and some don't support the -L flag.
|
||||
# Always use the bash builtin pwd to get uniform behavior.
|
||||
THEPWDCMD=pwd
|
||||
|
||||
# These are not required on all platforms
|
||||
UTIL_PATH_PROGS(CYGPATH, cygpath)
|
||||
UTIL_PATH_PROGS(WSLPATH, wslpath)
|
||||
UTIL_PATH_PROGS(DF, df)
|
||||
UTIL_PATH_PROGS(CPIO, [cpio bsdcpio])
|
||||
UTIL_PATH_PROGS(NICE, nice)
|
||||
|
||||
UTIL_PATH_PROGS(LSB_RELEASE, lsb_release)
|
||||
UTIL_PATH_PROGS(CMD, cmd.exe, $PATH /cygdrive/c/Windows/System32 /mnt/c/Windows/System32)
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
|
@ -130,10 +128,14 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION],
|
|||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
MAKE_EXPECTED_ENV='cygwin'
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then
|
||||
MAKE_EXPECTED_ENV='msys'
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1" || test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl2"; then
|
||||
if test "x$OPENJDK_BUILD_CPU" = "xaarch64"; then
|
||||
MAKE_EXPECTED_ENV='aarch64-.*-linux-gnu'
|
||||
else
|
||||
MAKE_EXPECTED_ENV='x86_64-.*-linux-gnu'
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([Unknown Windows environment])
|
||||
fi
|
||||
|
@ -185,14 +187,14 @@ AC_DEFUN([BASIC_CHECK_MAKE_OUTPUT_SYNC],
|
|||
# Goes looking for a usable version of GNU make.
|
||||
AC_DEFUN([BASIC_CHECK_GNU_MAKE],
|
||||
[
|
||||
UTIL_SETUP_TOOL([MAKE],
|
||||
UTIL_SETUP_TOOL(MAKE,
|
||||
[
|
||||
# Try our hardest to locate a correct version of GNU make
|
||||
AC_PATH_PROGS(CHECK_GMAKE, gmake)
|
||||
UTIL_LOOKUP_PROGS(CHECK_GMAKE, gmake)
|
||||
BASIC_CHECK_MAKE_VERSION("$CHECK_GMAKE", [gmake in PATH])
|
||||
|
||||
if test "x$FOUND_MAKE" = x; then
|
||||
AC_PATH_PROGS(CHECK_MAKE, make)
|
||||
UTIL_LOOKUP_PROGS(CHECK_MAKE, make)
|
||||
BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH])
|
||||
fi
|
||||
|
||||
|
@ -201,10 +203,10 @@ AC_DEFUN([BASIC_CHECK_GNU_MAKE],
|
|||
# We have a toolchain path, check that as well before giving up.
|
||||
OLD_PATH=$PATH
|
||||
PATH=$TOOLCHAIN_PATH:$PATH
|
||||
AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake)
|
||||
UTIL_LOOKUP_PROGS(CHECK_TOOLSDIR_GMAKE, gmake)
|
||||
BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir])
|
||||
if test "x$FOUND_MAKE" = x; then
|
||||
AC_PATH_PROGS(CHECK_TOOLSDIR_MAKE, make)
|
||||
UTIL_LOOKUP_PROGS(CHECK_TOOLSDIR_MAKE, make)
|
||||
BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_MAKE", [make in tools-dir])
|
||||
fi
|
||||
PATH=$OLD_PATH
|
||||
|
@ -334,24 +336,17 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
|
|||
|
||||
# Non-required basic tools
|
||||
|
||||
UTIL_PATH_PROGS(LDD, ldd)
|
||||
if test "x$LDD" = "x"; then
|
||||
# List shared lib dependencies is used for
|
||||
# debug output and checking for forbidden dependencies.
|
||||
# We can build without it.
|
||||
LDD="true"
|
||||
fi
|
||||
UTIL_PATH_PROGS(READELF, [greadelf readelf])
|
||||
UTIL_PATH_PROGS(DOT, dot)
|
||||
UTIL_PATH_PROGS(HG, hg)
|
||||
UTIL_PATH_PROGS(GIT, git)
|
||||
UTIL_PATH_PROGS(STAT, stat)
|
||||
UTIL_PATH_PROGS(TIME, time)
|
||||
UTIL_PATH_PROGS(FLOCK, flock)
|
||||
UTIL_LOOKUP_PROGS(READELF, greadelf readelf)
|
||||
UTIL_LOOKUP_PROGS(DOT, dot)
|
||||
UTIL_LOOKUP_PROGS(HG, hg)
|
||||
UTIL_LOOKUP_PROGS(GIT, git)
|
||||
UTIL_LOOKUP_PROGS(STAT, stat)
|
||||
UTIL_LOOKUP_PROGS(TIME, time)
|
||||
UTIL_LOOKUP_PROGS(FLOCK, flock)
|
||||
# Dtrace is usually found in /usr/sbin, but that directory may not
|
||||
# be in the user path.
|
||||
UTIL_PATH_PROGS(DTRACE, dtrace, $PATH:/usr/sbin)
|
||||
UTIL_PATH_PROGS(PATCH, [gpatch patch])
|
||||
UTIL_LOOKUP_PROGS(DTRACE, dtrace, $PATH:/usr/sbin)
|
||||
UTIL_LOOKUP_PROGS(PATCH, gpatch patch)
|
||||
# Check if it's GNU time
|
||||
IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU time'`
|
||||
if test "x$IS_GNU_TIME" != x; then
|
||||
|
@ -365,7 +360,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
|
|||
UTIL_REQUIRE_PROGS(DSYMUTIL, dsymutil)
|
||||
UTIL_REQUIRE_PROGS(MIG, mig)
|
||||
UTIL_REQUIRE_PROGS(XATTR, xattr)
|
||||
UTIL_PATH_PROGS(CODESIGN, codesign)
|
||||
UTIL_LOOKUP_PROGS(CODESIGN, codesign)
|
||||
|
||||
if test "x$CODESIGN" != "x"; then
|
||||
# Check for user provided code signing identity.
|
||||
|
@ -406,7 +401,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
|
|||
UTIL_REQUIRE_PROGS(SETFILE, SetFile)
|
||||
fi
|
||||
if ! test "x$OPENJDK_TARGET_OS" = "xwindows"; then
|
||||
UTIL_REQUIRE_BUILTIN_PROGS(ULIMIT, ulimit)
|
||||
UTIL_REQUIRE_PROGS(ULIMIT, ulimit)
|
||||
fi
|
||||
])
|
||||
|
||||
|
@ -452,7 +447,7 @@ AC_DEFUN_ONCE([BASIC_CHECK_BASH_OPTIONS],
|
|||
#
|
||||
AC_DEFUN_ONCE([BASIC_SETUP_PANDOC],
|
||||
[
|
||||
UTIL_PATH_PROGS(PANDOC, pandoc)
|
||||
UTIL_LOOKUP_PROGS(PANDOC, pandoc)
|
||||
|
||||
PANDOC_MARKDOWN_FLAG="markdown"
|
||||
if test -n "$PANDOC"; then
|
||||
|
|
|
@ -24,97 +24,160 @@
|
|||
#
|
||||
|
||||
# Setup basic configuration paths, and platform-specific stuff related to PATHs.
|
||||
AC_DEFUN([BASIC_CHECK_PATHS_WINDOWS],
|
||||
AC_DEFUN([BASIC_SETUP_PATHS_WINDOWS],
|
||||
[
|
||||
SRC_ROOT_LENGTH=`$THEPWDCMD -L|$WC -m`
|
||||
if test $SRC_ROOT_LENGTH -gt 100; then
|
||||
AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported])
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
# Clarify if it is wsl1 or wsl2, and use that as OS_ENV from this point forward
|
||||
$PATHTOOL -w / > /dev/null 2>&1
|
||||
if test $? -ne 0; then
|
||||
# Without Windows access to our root, it's definitely WSL1
|
||||
OPENJDK_BUILD_OS_ENV=windows.wsl1
|
||||
else
|
||||
# This test is not guaranteed, but there is no documented way of
|
||||
# distinguishing between WSL1 and WSL2. Assume only WSL2 has WSL_INTEROP
|
||||
# in /run/WSL
|
||||
if test -d "/run/WSL" ; then
|
||||
OPENJDK_BUILD_OS_ENV=windows.wsl2
|
||||
else
|
||||
OPENJDK_BUILD_OS_ENV=windows.wsl1
|
||||
fi
|
||||
fi
|
||||
# This is a bit silly since we really don't have a target env as such,
|
||||
# but do it to keep consistency.
|
||||
OPENJDK_TARGET_OS_ENV=$OPENJDK_BUILD_OS_ENV
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then
|
||||
# Must be done prior to calling any commands to avoid mangling of command line
|
||||
export MSYS2_ARG_CONV_EXCL="*"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([Windows environment type])
|
||||
WINENV_VENDOR=${OPENJDK_BUILD_OS_ENV#windows.}
|
||||
AC_MSG_RESULT([$WINENV_VENDOR])
|
||||
|
||||
if test "x$WINENV_VENDOR" = x; then
|
||||
AC_MSG_ERROR([Unknown Windows environment. Neither cygwin, msys2, wsl1 nor wsl2 was detected.])
|
||||
fi
|
||||
|
||||
if test "x$PATHTOOL" = x; then
|
||||
AC_MSG_ERROR([Incorrect $WINENV_VENDOR installation. Neither cygpath nor wslpath was found])
|
||||
fi
|
||||
|
||||
if test "x$CMD" = x; then
|
||||
AC_MSG_ERROR([Incorrect Windows/$WINENV_VENDOR setup. Could not locate cmd.exe])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([$WINENV_VENDOR drive prefix])
|
||||
WINENV_PREFIX=`$PATHTOOL -u c:/ | $SED -e 's!/c/!!'`
|
||||
AC_MSG_RESULT(['$WINENV_PREFIX'])
|
||||
AC_SUBST(WINENV_PREFIX)
|
||||
|
||||
AC_MSG_CHECKING([$WINENV_VENDOR root directory as Windows path])
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" != "xwindows.wsl1"; then
|
||||
WINENV_ROOT=`$PATHTOOL -w / 2> /dev/null`
|
||||
# msys2 has a trailing backslash; strip it
|
||||
WINENV_ROOT=${WINENV_ROOT%\\}
|
||||
else
|
||||
WINENV_ROOT='[[unavailable]]'
|
||||
fi
|
||||
AC_MSG_RESULT(['$WINENV_ROOT'])
|
||||
AC_SUBST(WINENV_ROOT)
|
||||
|
||||
AC_MSG_CHECKING([$WINENV_VENDOR temp directory])
|
||||
WINENV_TEMP_DIR=$($PATHTOOL -u $($CMD /q /c echo %TEMP% 2> /dev/null) | $TR -d '\r\n')
|
||||
AC_MSG_RESULT([$WINENV_TEMP_DIR])
|
||||
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl2"; then
|
||||
# Don't trust the current directory for WSL2, but change to an OK temp dir
|
||||
cd "$WINENV_TEMP_DIR"
|
||||
# Bring along confdefs.h or autoconf gets all confused
|
||||
cp "$CONFIGURE_START_DIR/confdefs.h" "$WINENV_TEMP_DIR"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([$WINENV_VENDOR release])
|
||||
WINENV_UNAME_RELEASE=`$UNAME -r`
|
||||
AC_MSG_RESULT([$WINENV_UNAME_RELEASE])
|
||||
|
||||
AC_MSG_CHECKING([$WINENV_VENDOR version])
|
||||
WINENV_UNAME_VERSION=`$UNAME -v`
|
||||
AC_MSG_RESULT([$WINENV_UNAME_VERSION])
|
||||
|
||||
WINENV_VERSION="$WINENV_UNAME_RELEASE, $WINENV_UNAME_VERSION"
|
||||
|
||||
AC_MSG_CHECKING([Windows version])
|
||||
|
||||
# We must change directory to one guaranteed to work, otherwise WSL1
|
||||
# can complain (since it does not have a WINENV_ROOT so it can't access
|
||||
# unix-style paths from Windows.
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
[ WINDOWS_VERSION=`$CMD /c ver.exe | $EGREP -o '([0-9]+\.)+[0-9]+'` ]
|
||||
[ WINDOWS_VERSION=`cd $WINENV_TEMP_DIR && $CMD /c ver | $EGREP -o '([0-9]+\.)+[0-9]+'` ]
|
||||
AC_MSG_RESULT([$WINDOWS_VERSION])
|
||||
|
||||
# Additional handling per specific env
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
AC_MSG_CHECKING([cygwin release])
|
||||
CYGWIN_RELEASE=`$UNAME -r`
|
||||
AC_MSG_RESULT([$CYGWIN_RELEASE])
|
||||
|
||||
AC_MSG_CHECKING([cygwin version])
|
||||
CYGWIN_VERSION=`$UNAME -v`
|
||||
AC_MSG_RESULT([$CYGWIN_VERSION])
|
||||
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
[ CYGWIN_VERSION_OLD=`$ECHO $CYGWIN_RELEASE | $GREP -e '^1\.[0-6]'` ]
|
||||
[ CYGWIN_VERSION_OLD=`$ECHO $WINENV_UNAME_RELEASE | $GREP -e '^1\.[0-6]'` ]
|
||||
if test "x$CYGWIN_VERSION_OLD" != x; then
|
||||
AC_MSG_NOTICE([Your cygwin is too old. You are running $CYGWIN_RELEASE, but at least cygwin 1.7 is required. Please upgrade.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
|
||||
WINDOWS_ENV_VENDOR='cygwin'
|
||||
WINDOWS_ENV_VERSION="$CYGWIN_RELEASE, $CYGWIN_VERSION"
|
||||
|
||||
if test "x$CYGPATH" = x; then
|
||||
AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path])
|
||||
if test "x$LDD" = x; then
|
||||
AC_MSG_ERROR([ldd is missing, which is needed on cygwin])
|
||||
fi
|
||||
AC_MSG_CHECKING([cygwin root directory as unix-style path])
|
||||
# The cmd output ends with Windows line endings (CR/LF)
|
||||
cygwin_winpath_root=`cd / ; cmd /c cd | $TR -d '\r\n'`
|
||||
# Force cygpath to report the proper root by including a trailing space, and then stripping it off again.
|
||||
CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "`
|
||||
AC_MSG_RESULT([$CYGWIN_ROOT_PATH])
|
||||
WINDOWS_ENV_ROOT_PATH="$CYGWIN_ROOT_PATH"
|
||||
test_cygdrive_prefix=`$ECHO $CYGWIN_ROOT_PATH | $GREP ^/cygdrive/`
|
||||
if test "x$test_cygdrive_prefix" = x; then
|
||||
AC_MSG_ERROR([Your cygdrive prefix is not /cygdrive. This is currently not supported. Change with mount -c.])
|
||||
WINENV_MARKER_DLL=cygwin1.dll
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then
|
||||
if test "x$LDD" = x; then
|
||||
AC_MSG_ERROR([ldd is missing, which is needed on msys2])
|
||||
fi
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
|
||||
AC_MSG_CHECKING([msys release])
|
||||
MSYS_RELEASE=`$UNAME -r`
|
||||
AC_MSG_RESULT([$MSYS_RELEASE])
|
||||
|
||||
AC_MSG_CHECKING([msys version])
|
||||
MSYS_VERSION=`$UNAME -v`
|
||||
AC_MSG_RESULT([$MSYS_VERSION])
|
||||
|
||||
WINDOWS_ENV_VENDOR='msys'
|
||||
WINDOWS_ENV_VERSION="$MSYS_RELEASE, $MSYS_VERSION"
|
||||
|
||||
AC_MSG_CHECKING([msys root directory as unix-style path])
|
||||
# The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
|
||||
MSYS_ROOT_PATH=`cd / ; cmd /c cd | $GREP ".*"`
|
||||
UTIL_REWRITE_AS_UNIX_PATH(MSYS_ROOT_PATH)
|
||||
AC_MSG_RESULT([$MSYS_ROOT_PATH])
|
||||
WINDOWS_ENV_ROOT_PATH="$MSYS_ROOT_PATH"
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
|
||||
AC_MSG_CHECKING([WSL kernel version])
|
||||
WSL_KERNEL_VERSION=`$UNAME -v`
|
||||
AC_MSG_RESULT([$WSL_KERNEL_VERSION])
|
||||
|
||||
AC_MSG_CHECKING([WSL kernel release])
|
||||
WSL_KERNEL_RELEASE=`$UNAME -r`
|
||||
AC_MSG_RESULT([$WSL_KERNEL_RELEASE])
|
||||
|
||||
AC_MSG_CHECKING([WSL distribution])
|
||||
WINENV_MARKER_DLL=msys-2.0.dll
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1" || test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl2"; then
|
||||
AC_MSG_CHECKING([wsl distribution])
|
||||
WSL_DISTRIBUTION=`$LSB_RELEASE -d | sed 's/Description:\t//'`
|
||||
AC_MSG_RESULT([$WSL_DISTRIBUTION])
|
||||
|
||||
WINDOWS_ENV_VENDOR='wsl'
|
||||
WINDOWS_ENV_VERSION="$WSL_KERNEL_RELEASE, $WSL_KERNEL_VERSION ($WSL_DISTRIBUTION)"
|
||||
else
|
||||
AC_MSG_ERROR([Unknown Windows environment. Neither cygwin, msys, nor wsl was detected.])
|
||||
WINENV_VERSION="$WINENV_VERSION ($WSL_DISTRIBUTION)"
|
||||
|
||||
# Tell WSL to automatically translate the PATH variable
|
||||
export WSLENV=PATH/l
|
||||
fi
|
||||
|
||||
# Test if windows or unix (cygwin/msys) find is first in path.
|
||||
# Chicken and egg: FIXPATH is needed for UTIL_FIXUP_PATH to work. So for the
|
||||
# first run we use the auto-detect abilities of fixpath.sh.
|
||||
FIXPATH_DIR="$TOPDIR/make/scripts"
|
||||
FIXPATH="$BASH $FIXPATH_DIR/fixpath.sh exec"
|
||||
FIXPATH_BASE="$BASH $FIXPATH_DIR/fixpath.sh"
|
||||
FIXPATH_SAVED_PATH="$PATH"
|
||||
UTIL_FIXUP_PATH(FIXPATH_DIR)
|
||||
|
||||
# Now we can use FIXPATH_DIR to rewrite path to fixpath.sh properly.
|
||||
if test "x$WINENV_PREFIX" = x; then
|
||||
# On msys the prefix is empty, but we need to pass something to have the
|
||||
# fixpath.sh options parser happy.
|
||||
WINENV_PREFIX_ARG="NONE"
|
||||
else
|
||||
WINENV_PREFIX_ARG="$WINENV_PREFIX"
|
||||
fi
|
||||
FIXPATH_ARGS="-e $PATHTOOL -p $WINENV_PREFIX_ARG -r ${WINENV_ROOT/\\/\\\\} -t $WINENV_TEMP_DIR -c $CMD -q"
|
||||
FIXPATH_BASE="$BASH $FIXPATH_DIR/fixpath.sh $FIXPATH_ARGS"
|
||||
FIXPATH="$FIXPATH_BASE exec"
|
||||
|
||||
AC_SUBST(FIXPATH_BASE)
|
||||
AC_SUBST(FIXPATH)
|
||||
|
||||
SRC_ROOT_LENGTH=`$ECHO "$TOPDIR" | $WC -m`
|
||||
if test $SRC_ROOT_LENGTH -gt 100; then
|
||||
AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported])
|
||||
fi
|
||||
|
||||
# Test if windows or unix "find" is first in path.
|
||||
AC_MSG_CHECKING([what kind of 'find' is first on the PATH])
|
||||
FIND_BINARY_OUTPUT=`find --version 2>&1`
|
||||
if test "x`echo $FIND_BINARY_OUTPUT | $GREP GNU`" != x; then
|
||||
AC_MSG_RESULT([unix style])
|
||||
elif test "x`echo $FIND_BINARY_OUTPUT | $GREP FIND`" != x; then
|
||||
AC_MSG_RESULT([Windows])
|
||||
AC_MSG_NOTICE([Your path contains Windows tools (C:\Windows\system32) before your unix (cygwin or msys) tools.])
|
||||
AC_MSG_NOTICE([Your path contains Windows tools (C:\Windows\system32) before your unix tools.])
|
||||
AC_MSG_NOTICE([This will not work. Please correct and make sure /usr/bin (or similar) is first in path.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
else
|
||||
|
@ -123,73 +186,39 @@ AC_DEFUN([BASIC_CHECK_PATHS_WINDOWS],
|
|||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH],
|
||||
# Verify that the directory is usable on Windows
|
||||
AC_DEFUN([BASIC_WINDOWS_VERIFY_DIR],
|
||||
[
|
||||
# When using cygwin or msys, we need a wrapper binary that renames
|
||||
# /cygdrive/c/ arguments into c:/ arguments and peeks into
|
||||
# @files and rewrites these too! This wrapper binary is
|
||||
# called fixpath.
|
||||
FIXPATH=
|
||||
if test "x$OPENJDK_BUILD_OS" = xwindows; then
|
||||
AC_MSG_CHECKING([if fixpath can be created])
|
||||
FIXPATH_SRC="$TOPDIR/make/src/native/fixpath.c"
|
||||
FIXPATH_BIN="$CONFIGURESUPPORT_OUTPUTDIR/bin/fixpath.exe"
|
||||
FIXPATH_DIR="$CONFIGURESUPPORT_OUTPUTDIR/fixpath"
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
|
||||
# Important to keep the .exe suffix on Cygwin for Hotspot makefiles
|
||||
FIXPATH="$FIXPATH_BIN -c"
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.msys; then
|
||||
# Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line
|
||||
# @ was chosen as separator to minimize risk of other tools messing around with it
|
||||
all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" \
|
||||
| tr ' ' '\n' | $GREP '^/./' | $SORT | $UNIQ`
|
||||
fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'`
|
||||
FIXPATH="$FIXPATH_BIN -m$fixpath_argument_list"
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.wsl; then
|
||||
FIXPATH="$FIXPATH_BIN -w"
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1"; then
|
||||
OUTPUTDIR_WIN=`$FIXPATH_BASE print $1`
|
||||
if test "x$OUTPUTDIR_WIN" = x; then
|
||||
AC_MSG_NOTICE([For wsl1, the $2 dir must be located on a Windows drive. Please see doc/building.md for details.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
FIXPATH_SRC_W="$FIXPATH_SRC"
|
||||
FIXPATH_BIN_W="$FIXPATH_BIN"
|
||||
$RM -rf $FIXPATH_BIN $FIXPATH_DIR
|
||||
$MKDIR -p $FIXPATH_DIR $CONFIGURESUPPORT_OUTPUTDIR/bin
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_SRC_W])
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_BIN_W])
|
||||
cd $FIXPATH_DIR
|
||||
$CC $FIXPATH_SRC_W -Fe$FIXPATH_BIN_W > $FIXPATH_DIR/fixpath1.log 2>&1
|
||||
cd $CONFIGURE_START_DIR
|
||||
|
||||
if test ! -x $FIXPATH_BIN; then
|
||||
AC_MSG_RESULT([no])
|
||||
cat $FIXPATH_DIR/fixpath1.log
|
||||
AC_MSG_ERROR([Could not create $FIXPATH_BIN])
|
||||
fi
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
OLD_WSLENV="$WSLENV"
|
||||
WSLENV=`$ECHO $WSLENV | $SED 's/PATH\/l://'`
|
||||
UTIL_APPEND_TO_PATH(WSLENV, "FIXPATH_PATH")
|
||||
export WSLENV
|
||||
export FIXPATH_PATH=$VS_PATH_WINDOWS
|
||||
AC_MSG_NOTICE([FIXPATH_PATH is $FIXPATH_PATH])
|
||||
AC_MSG_NOTICE([Rewriting WSLENV from $OLD_WSLENV to $WSLENV])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if fixpath.exe works])
|
||||
cd $FIXPATH_DIR
|
||||
$FIXPATH $CC $FIXPATH_SRC -Fe$FIXPATH_DIR/fixpath2.exe \
|
||||
> $FIXPATH_DIR/fixpath2.log 2>&1
|
||||
cd $CONFIGURE_START_DIR
|
||||
if test ! -x $FIXPATH_DIR/fixpath2.exe; then
|
||||
AC_MSG_RESULT([no])
|
||||
cat $FIXPATH_DIR/fixpath2.log
|
||||
AC_MSG_ERROR([fixpath did not work!])
|
||||
fi
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
FIXPATH_DETACH_FLAG="--detach"
|
||||
fi
|
||||
|
||||
AC_SUBST(FIXPATH)
|
||||
AC_SUBST(FIXPATH_DETACH_FLAG)
|
||||
])
|
||||
|
||||
# Create fixpath wrapper
|
||||
AC_DEFUN([BASIC_WINDOWS_FINALIZE_FIXPATH],
|
||||
[
|
||||
if test "x$OPENJDK_BUILD_OS" = xwindows; then
|
||||
FIXPATH_CMDLINE=". $TOPDIR/make/scripts/fixpath.sh -e $PATHTOOL \
|
||||
-p $WINENV_PREFIX_ARG -r ${WINENV_ROOT/\\/\\\\} -t $WINENV_TEMP_DIR \
|
||||
-c $CMD -q"
|
||||
$ECHO > $OUTPUTDIR/fixpath '#!/bin/bash'
|
||||
$ECHO >> $OUTPUTDIR/fixpath export PATH='"[$]PATH:'$PATH'"'
|
||||
$ECHO >> $OUTPUTDIR/fixpath $FIXPATH_CMDLINE '"[$]@"'
|
||||
$CHMOD +x $OUTPUTDIR/fixpath
|
||||
FIXPATH_BASE="$OUTPUTDIR/fixpath"
|
||||
FIXPATH="$FIXPATH_BASE exec"
|
||||
fi
|
||||
])
|
||||
|
||||
# Platform-specific finalization
|
||||
AC_DEFUN([BASIC_WINDOWS_FINALIZE],
|
||||
[
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl2"; then
|
||||
# Change back from temp dir
|
||||
cd $CONFIGURE_START_DIR
|
||||
fi
|
||||
])
|
||||
|
|
|
@ -63,19 +63,23 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
|
|||
# If previous step claimed to have found a JDK, check it to see if it seems to be valid.
|
||||
if test "x$BOOT_JDK_FOUND" = xmaybe; then
|
||||
# Do we have a bin/java?
|
||||
if test ! -x "$BOOT_JDK/bin/java$EXE_SUFFIX"; then
|
||||
if test ! -x "$BOOT_JDK/bin/java" && test ! -x "$BOOT_JDK/bin/java.exe"; then
|
||||
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring])
|
||||
BOOT_JDK_FOUND=no
|
||||
else
|
||||
# Do we have a bin/javac?
|
||||
if test ! -x "$BOOT_JDK/bin/javac$EXE_SUFFIX"; then
|
||||
if test ! -x "$BOOT_JDK/bin/javac" && test ! -x "$BOOT_JDK/bin/javac.exe"; then
|
||||
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring])
|
||||
AC_MSG_NOTICE([(This might be an JRE instead of an JDK)])
|
||||
BOOT_JDK_FOUND=no
|
||||
else
|
||||
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
|
||||
java_to_test="$BOOT_JDK/bin/java"
|
||||
UTIL_FIXUP_EXECUTABLE(java_to_test)
|
||||
BOOT_JDK_VERSION_OUTPUT=`$java_to_test $USER_BOOT_JDK_OPTIONS -version 2>&1`
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
[ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXE_SUFFIX" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $AWK '/version "[0-9a-zA-Z\._\-]+"/ {print $ 0; exit;}'` ]
|
||||
[ BOOT_JDK_VERSION=`echo $BOOT_JDK_VERSION_OUTPUT | $AWK '/version "[0-9a-zA-Z\._\-]+"/ {print $ 0; exit;}'` ]
|
||||
|
||||
if [ [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ]; then
|
||||
AC_MSG_NOTICE([You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead.])
|
||||
AC_MSG_NOTICE([Java reports: "$BOOT_JDK_VERSION".])
|
||||
|
@ -91,7 +95,12 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
|
|||
# Extra M4 quote needed to protect [] in grep expression.
|
||||
[FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION \
|
||||
| $EGREP "\"(${DEFAULT_ACCEPTABLE_BOOT_VERSIONS// /|})([\.+-].*)?\""`]
|
||||
if test "x$FOUND_CORRECT_VERSION" = x; then
|
||||
|
||||
if test "x$BOOT_JDK_VERSION" = x; then
|
||||
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is not a working JDK; ignoring])
|
||||
AC_MSG_NOTICE([Output from java -version was: $BOOT_JDK_VERSION_OUTPUT])
|
||||
BOOT_JDK_FOUND=no
|
||||
elif test "x$FOUND_CORRECT_VERSION" = x; then
|
||||
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
|
||||
AC_MSG_NOTICE([(Your Boot JDK version must be one of: $DEFAULT_ACCEPTABLE_BOOT_VERSIONS)])
|
||||
BOOT_JDK_FOUND=no
|
||||
|
@ -102,7 +111,9 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
|
|||
AC_MSG_CHECKING([for Boot JDK])
|
||||
AC_MSG_RESULT([$BOOT_JDK])
|
||||
AC_MSG_CHECKING([Boot JDK version])
|
||||
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXE_SUFFIX" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' ' '`
|
||||
BOOT_JDK_VERSION=`$java_to_test $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR -d '\r'`
|
||||
# This is not a no-op; it will portably convert newline to space
|
||||
BOOT_JDK_VERSION=`$ECHO $BOOT_JDK_VERSION`
|
||||
AC_MSG_RESULT([$BOOT_JDK_VERSION])
|
||||
fi # end check jdk version
|
||||
fi # end check javac
|
||||
|
@ -151,8 +162,8 @@ AC_DEFUN([BOOTJDK_CHECK_JAVA_HOME],
|
|||
[
|
||||
if test "x$JAVA_HOME" != x; then
|
||||
JAVA_HOME_PROCESSED="$JAVA_HOME"
|
||||
UTIL_FIXUP_PATH(JAVA_HOME_PROCESSED)
|
||||
if test ! -d "$JAVA_HOME_PROCESSED"; then
|
||||
UTIL_FIXUP_PATH(JAVA_HOME_PROCESSED, NOFAIL)
|
||||
if test "x$JAVA_HOME_PROCESSED" = x || test ! -d "$JAVA_HOME_PROCESSED"; then
|
||||
AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!])
|
||||
else
|
||||
# Aha, the user has set a JAVA_HOME
|
||||
|
@ -167,8 +178,8 @@ AC_DEFUN([BOOTJDK_CHECK_JAVA_HOME],
|
|||
# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
|
||||
AC_DEFUN([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK],
|
||||
[
|
||||
AC_PATH_PROG(JAVAC_CHECK, javac)
|
||||
AC_PATH_PROG(JAVA_CHECK, java)
|
||||
UTIL_LOOKUP_PROGS(JAVAC_CHECK, javac, , NOFIXPATH)
|
||||
UTIL_LOOKUP_PROGS(JAVA_CHECK, java, , NOFIXPATH)
|
||||
BINARY="$JAVAC_CHECK"
|
||||
if test "x$JAVAC_CHECK" = x; then
|
||||
BINARY="$JAVA_CHECK"
|
||||
|
@ -207,9 +218,9 @@ AC_DEFUN([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR],
|
|||
# First check at user selected default
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME()])
|
||||
# If that did not work out (e.g. too old), try explicit versions instead
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.9])])
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.8])])
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.7])])
|
||||
for ver in $DEFAULT_ACCEPTABLE_BOOT_VERSIONS ; do
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v $ver])])
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
|
@ -242,9 +253,11 @@ AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY],
|
|||
[
|
||||
if test "x[$]$1" != x; then
|
||||
VIRTUAL_DIR="[$]$1/Java"
|
||||
UTIL_REWRITE_AS_UNIX_PATH(VIRTUAL_DIR)
|
||||
UTIL_FIXUP_PATH(VIRTUAL_DIR, NOFAIL)
|
||||
if test "x$VIRTUAL_DIR" != x; then
|
||||
BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY($VIRTUAL_DIR)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
# Test: Is there a JDK installed in default, well-known locations?
|
||||
|
@ -270,16 +283,17 @@ AC_DEFUN([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS],
|
|||
AC_DEFUN([BOOTJDK_CHECK_TOOL_IN_BOOTJDK],
|
||||
[
|
||||
# Use user overridden value if available, otherwise locate tool in the Boot JDK.
|
||||
UTIL_SETUP_TOOL($1,
|
||||
UTIL_REQUIRE_SPECIAL($1,
|
||||
[
|
||||
AC_MSG_CHECKING([for $2 in Boot JDK])
|
||||
AC_MSG_CHECKING([for $2 [[Boot JDK]]])
|
||||
$1=$BOOT_JDK/bin/$2
|
||||
if test ! -x [$]$1; then
|
||||
if test ! -x [$]$1 && test ! -x [$]$1.exe; then
|
||||
AC_MSG_RESULT(not found)
|
||||
AC_MSG_NOTICE([Your Boot JDK seems broken. This might be fixed by explicitly setting --with-boot-jdk])
|
||||
AC_MSG_ERROR([Could not find $2 in the Boot JDK])
|
||||
fi
|
||||
AC_MSG_RESULT(ok)
|
||||
AC_MSG_RESULT(\[$]BOOT_JDK/bin/$2)
|
||||
UTIL_FIXUP_EXECUTABLE($1)
|
||||
AC_SUBST($1)
|
||||
])
|
||||
])
|
||||
|
@ -313,12 +327,12 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
|
|||
AC_MSG_ERROR([The path given by --with-boot-jdk does not contain a valid Boot JDK])
|
||||
fi
|
||||
|
||||
# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR])
|
||||
|
||||
# Test: Is $JAVA_HOME set?
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_HOME])
|
||||
|
||||
# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR])
|
||||
|
||||
# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK])
|
||||
|
||||
|
@ -336,11 +350,10 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
|
|||
AC_SUBST(BOOT_JDK)
|
||||
|
||||
# Setup tools from the Boot JDK.
|
||||
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, java$EXE_SUFFIX)
|
||||
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, javac$EXE_SUFFIX)
|
||||
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVADOC, javadoc$EXE_SUFFIX)
|
||||
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, jar$EXE_SUFFIX)
|
||||
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JARSIGNER, jarsigner$EXE_SUFFIX)
|
||||
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, java)
|
||||
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, javac)
|
||||
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVADOC, javadoc)
|
||||
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, jar)
|
||||
|
||||
# Finally, set some other options...
|
||||
|
||||
|
@ -353,7 +366,7 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
|
|||
AC_SUBST(BOOT_JDK_SOURCETARGET)
|
||||
|
||||
# Check if the boot jdk is 32 or 64 bit
|
||||
if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then
|
||||
if $JAVA -version 2>&1 | $GREP -q "64-Bit"; then
|
||||
BOOT_JDK_BITS="64"
|
||||
else
|
||||
BOOT_JDK_BITS="32"
|
||||
|
@ -368,7 +381,7 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
|
|||
|
||||
if test "x$boot_jdk_cds_args" != x; then
|
||||
# Try creating a CDS archive
|
||||
"$JAVA" $boot_jdk_cds_args -Xshare:dump > /dev/null 2>&1
|
||||
$JAVA $boot_jdk_cds_args -Xshare:dump > /dev/null 2>&1
|
||||
if test $? -eq 0; then
|
||||
BOOTJDK_USE_LOCAL_CDS=true
|
||||
AC_MSG_RESULT([yes, created])
|
||||
|
@ -574,8 +587,12 @@ AC_DEFUN([BOOTJDK_SETUP_BUILD_JDK],
|
|||
fi
|
||||
fi
|
||||
|
||||
# Since these tools do not yet exist, we cannot use UTIL_FIXUP_EXECUTABLE to
|
||||
# detect the need of fixpath
|
||||
JMOD="$BUILD_JDK/bin/jmod"
|
||||
UTIL_ADD_FIXPATH(JMOD)
|
||||
JLINK="$BUILD_JDK/bin/jlink"
|
||||
UTIL_ADD_FIXPATH(JLINK)
|
||||
AC_SUBST(JMOD)
|
||||
AC_SUBST(JLINK)
|
||||
|
||||
|
|
|
@ -28,14 +28,6 @@
|
|||
# First include the real base spec.gmk file
|
||||
include @SPEC@
|
||||
|
||||
# Check that the user did not try to specify a different java to use for compiling.
|
||||
# On windows we need to account for fixpath being first word.
|
||||
ifeq ($(firstword $(JAVA)),$(FIXPATH))
|
||||
JAVA_EXEC_POS=2
|
||||
else
|
||||
JAVA_EXEC_POS=1
|
||||
endif
|
||||
|
||||
# Override specific values to do a boot cycle build
|
||||
|
||||
# Use a different Boot JDK
|
||||
|
@ -47,10 +39,9 @@ OUTPUTDIR:=$(OLD_OUTPUTDIR)/bootcycle-build
|
|||
# No spaces in patsubst to avoid leading space in variable
|
||||
JAVAC_SERVER_DIR:=$(patsubst $(OLD_OUTPUTDIR)%,$(OUTPUTDIR)%,$(JAVAC_SERVER_DIR))
|
||||
|
||||
JAVA_CMD:=$(BOOT_JDK)/bin/java
|
||||
JAVAC_CMD:=$(BOOT_JDK)/bin/javac
|
||||
JAR_CMD:=$(BOOT_JDK)/bin/jar
|
||||
JARSIGNER_CMD:=$(BOOT_JDK)/bin/jarsigner
|
||||
JAVA_CMD := $(FIXPATH) $(BOOT_JDK)/bin/java
|
||||
JAVAC_CMD := $(FIXPATH) $(BOOT_JDK)/bin/javac
|
||||
JAR_CMD := $(FIXPATH) $(BOOT_JDK)/bin/jar
|
||||
# The bootcycle JVM arguments may differ from the original boot jdk.
|
||||
JAVA_FLAGS_BIG := @BOOTCYCLE_JVM_ARGS_BIG@
|
||||
# Any CDS settings generated for the bootjdk are invalid in the bootcycle build.
|
||||
|
@ -58,5 +49,3 @@ JAVA_FLAGS_BIG := @BOOTCYCLE_JVM_ARGS_BIG@
|
|||
# settings for CDS.
|
||||
JAVA_FLAGS := $(filter-out -XX:SharedArchiveFile% -Xshare%, $(JAVA_FLAGS))
|
||||
|
||||
# Pandoc cannot be used without the jjs plugin, which was removed with Nashorn.
|
||||
ENABLE_PANDOC := false
|
||||
|
|
|
@ -56,11 +56,11 @@ if test $? = 0; then
|
|||
fi
|
||||
|
||||
# Test and fix wsl
|
||||
echo $OUT | grep x86_64-unknown-linux-gnu > /dev/null 2> /dev/null
|
||||
echo $OUT | grep unknown-linux-gnu > /dev/null 2> /dev/null
|
||||
if test $? = 0; then
|
||||
uname -r | grep -i microsoft > /dev/null 2> /dev/null
|
||||
if test $? = 0; then
|
||||
OUT="x86_64-pc-wsl"
|
||||
OUT=`echo $OUT | sed -e 's/unknown-linux-gnu/pc-wsl/'`
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -35,7 +35,13 @@ if echo $* | grep linux-musl >/dev/null ; then
|
|||
fi
|
||||
|
||||
# Allow wsl
|
||||
if echo $* | grep x86_64-pc-wsl >/dev/null ; then
|
||||
if echo $* | grep pc-wsl >/dev/null ; then
|
||||
echo $*
|
||||
exit
|
||||
fi
|
||||
|
||||
# Allow msys2
|
||||
if echo $* | grep pc-msys >/dev/null ; then
|
||||
echo $*
|
||||
exit
|
||||
fi
|
||||
|
|
|
@ -175,7 +175,7 @@ AC_DEFUN([BPERF_SETUP_CCACHE],
|
|||
if test "x$TOOLCHAIN_PATH" != x; then
|
||||
PATH=$TOOLCHAIN_PATH:$PATH
|
||||
fi
|
||||
UTIL_PATH_PROGS(CCACHE, ccache)
|
||||
UTIL_LOOKUP_PROGS(CCACHE, ccache)
|
||||
PATH="$OLD_PATH"
|
||||
|
||||
AC_MSG_CHECKING([if ccache is available])
|
||||
|
|
|
@ -43,7 +43,7 @@ export CMP="@CMP@"
|
|||
export CP="@CP@"
|
||||
export CUT="@CUT@"
|
||||
export DIFF="@DIFF@"
|
||||
export DUMPBIN="@FIXPATH@ @DUMPBIN@"
|
||||
export DUMPBIN="@DUMPBIN@"
|
||||
export EXPR="@EXPR@"
|
||||
export FILE="@FILE@"
|
||||
export FIND="@FIND@"
|
||||
|
@ -86,12 +86,10 @@ else
|
|||
fi
|
||||
|
||||
if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
|
||||
if [ "$OPENJDK_BUILD_OS_ENV" = "windows.wsl" ]; then
|
||||
export FIXPATH_PATH="@VS_PATH_WINDOWS@"
|
||||
export WSLENV="$WSLENV:FIXPATH_PATH:DEBUG_FIXPATH"
|
||||
else
|
||||
export PATH="@VS_PATH@"
|
||||
if [[ $OPENJDK_BUILD_OS_ENV =~ ^windows.wsl ]]; then
|
||||
export WSLENV=PATH/l
|
||||
fi
|
||||
export PATH="$PATH:@TOOLCHAIN_PATH@"
|
||||
fi
|
||||
|
||||
export HOTSPOT_BUILD_TIME="@HOTSPOT_BUILD_TIME@"
|
||||
|
|
|
@ -106,6 +106,8 @@ BASIC_SETUP_DEVKIT
|
|||
# To properly create a configuration name, we need to have the OpenJDK target
|
||||
# and options (variants and debug level) parsed.
|
||||
BASIC_SETUP_OUTPUT_DIR
|
||||
# After we have the output dir we can finalize the fixpath wrapper
|
||||
BASIC_WINDOWS_FINALIZE_FIXPATH
|
||||
|
||||
# Must be done before we can call HELP_MSG_MISSING_DEPENDENCY.
|
||||
HELP_SETUP_DEPENDENCY_HELP
|
||||
|
@ -220,9 +222,6 @@ JDKOPT_SETUP_ADDRESS_SANITIZER
|
|||
#
|
||||
###############################################################################
|
||||
|
||||
# After we have toolchain, we can compile fixpath. It's needed by the lib checks.
|
||||
BASIC_COMPILE_FIXPATH
|
||||
|
||||
LIB_DETERMINE_DEPENDENCIES
|
||||
LIB_SETUP_LIBRARIES
|
||||
|
||||
|
@ -294,6 +293,7 @@ BASIC_CHECK_LEFTOVER_OVERRIDDEN
|
|||
CONFIG_STATUS="$CONFIGURESUPPORT_OUTPUTDIR/config.status"
|
||||
|
||||
# Create the actual output files. Now the main work of configure is done.
|
||||
BASIC_WINDOWS_FINALIZE
|
||||
AC_OUTPUT
|
||||
|
||||
# After AC_OUTPUT, we need to do final work
|
||||
|
|
|
@ -130,6 +130,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
|
|||
case "${TOOLCHAIN_TYPE}" in
|
||||
microsoft)
|
||||
DISABLE_WARNING_PREFIX="-wd"
|
||||
BUILD_CC_DISABLE_WARNING_PREFIX="-wd"
|
||||
CFLAGS_WARNINGS_ARE_ERRORS="-WX"
|
||||
|
||||
WARNINGS_ENABLE_ALL="-W3"
|
||||
|
@ -142,6 +143,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
|
|||
|
||||
gcc)
|
||||
DISABLE_WARNING_PREFIX="-Wno-"
|
||||
BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
|
||||
CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
|
||||
|
||||
# Additional warnings that are not activated by -Wall and -Wextra
|
||||
|
@ -153,7 +155,6 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
|
|||
WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ALL_CFLAGS $WARNINGS_ENABLE_ADDITIONAL_CXX"
|
||||
|
||||
DISABLED_WARNINGS="unused-parameter unused"
|
||||
BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
|
||||
;;
|
||||
|
||||
clang)
|
||||
|
@ -784,8 +785,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
|
|||
test "x$ENABLE_REPRODUCIBLE_BUILD" = xtrue; then
|
||||
# There is a known issue with the pathmap if the mapping is made to the
|
||||
# empty string. Add a minimal string "s" as prefix to work around this.
|
||||
workspace_root_win="${WORKSPACE_ROOT%/}"
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([workspace_root_win])
|
||||
workspace_root_win=`$FIXPATH_BASE print "${WORKSPACE_ROOT%/}"`
|
||||
# PATHMAP_FLAGS is also added to LDFLAGS in flags-ldflags.m4.
|
||||
PATHMAP_FLAGS="-pathmap:${workspace_root_win//\//\\\\}=s \
|
||||
-pathmap:${workspace_root_win}=s"
|
||||
|
|
|
@ -195,7 +195,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP],
|
|||
|
||||
# JVM_VARIANT_PATH depends on if this is build or target...
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
$1_LDFLAGS_JDK_LIBPATH="-libpath:${OUTPUTDIR}/support/modules_libs/java.base"
|
||||
$1_LDFLAGS_JDK_LIBPATH="-libpath:\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base"
|
||||
else
|
||||
$1_LDFLAGS_JDK_LIBPATH="-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \
|
||||
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/${$1_JVM_VARIANT_PATH}"
|
||||
|
|
|
@ -226,6 +226,14 @@ AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
|
|||
fi
|
||||
fi
|
||||
|
||||
# For the microsoft toolchain, we need to get the SYSROOT flags from the
|
||||
# Visual Studio environment. Currently we cannot handle this as a separate
|
||||
# build toolchain.
|
||||
if test "x$1" = x && test "x$OPENJDK_BUILD_OS" = "xwindows" \
|
||||
&& test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
|
||||
TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
|
||||
fi
|
||||
|
||||
AC_SUBST($1SYSROOT_CFLAGS)
|
||||
AC_SUBST($1SYSROOT_LDFLAGS)
|
||||
])
|
||||
|
@ -234,6 +242,7 @@ AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
|
|||
[
|
||||
# We should always include user supplied flags
|
||||
FLAGS_SETUP_USER_SUPPLIED_FLAGS
|
||||
|
||||
# The sysroot flags are needed for configure to be able to run the compilers
|
||||
FLAGS_SETUP_SYSROOT_FLAGS
|
||||
|
||||
|
@ -258,10 +267,6 @@ AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
|
|||
GLOBAL_LDFLAGS="$MACHINE_FLAG $SYSROOT_LDFLAGS $USER_LDFLAGS"
|
||||
# FIXME: Don't really know how to do with this, but this was the old behavior
|
||||
GLOBAL_CPPFLAGS="$SYSROOT_CFLAGS"
|
||||
AC_SUBST(GLOBAL_CFLAGS)
|
||||
AC_SUBST(GLOBAL_CXXFLAGS)
|
||||
AC_SUBST(GLOBAL_LDFLAGS)
|
||||
AC_SUBST(GLOBAL_CPPFLAGS)
|
||||
|
||||
# FIXME: For compatilibity, export this as EXTRA_CFLAGS for now.
|
||||
EXTRA_CFLAGS="$MACHINE_FLAG $USER_CFLAGS"
|
||||
|
@ -280,6 +285,14 @@ AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
|
|||
CXXFLAGS="$GLOBAL_CXXFLAGS"
|
||||
LDFLAGS="$GLOBAL_LDFLAGS"
|
||||
CPPFLAGS="$GLOBAL_CPPFLAGS"
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# When autoconf sends both compiler and linker flags to cl.exe at the same
|
||||
# time, linker flags must be last at the command line. Achieve this by
|
||||
# moving them to LIBS.
|
||||
LIBS="$LIBS -link $LDFLAGS"
|
||||
LDFLAGS=""
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL],
|
||||
|
@ -370,9 +383,6 @@ AC_DEFUN_ONCE([FLAGS_POST_TOOLCHAIN],
|
|||
BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(BUILD_SYSROOT_CFLAGS)
|
||||
AC_SUBST(BUILD_SYSROOT_LDFLAGS)
|
||||
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_FLAGS],
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
AC_DEFUN_ONCE([HELP_SETUP_DEPENDENCY_HELP],
|
||||
[
|
||||
AC_CHECK_PROGS(PKGHANDLER, zypper apt-get yum brew port pkgutil pkgadd)
|
||||
UTIL_LOOKUP_PROGS(PKGHANDLER, zypper apt-get yum brew port pkgutil pkgadd pacman)
|
||||
])
|
||||
|
||||
AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
|
||||
|
@ -38,8 +38,6 @@ AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
|
|||
HELP_MSG="OpenJDK distributions are available at http://jdk.java.net/."
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
cygwin_help $MISSING_DEPENDENCY
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
|
||||
msys_help $MISSING_DEPENDENCY
|
||||
else
|
||||
PKGHANDLER_COMMAND=
|
||||
|
||||
|
@ -58,6 +56,8 @@ AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
|
|||
pkgadd_help $MISSING_DEPENDENCY ;;
|
||||
zypper)
|
||||
zypper_help $MISSING_DEPENDENCY ;;
|
||||
pacman)
|
||||
pacman_help $MISSING_DEPENDENCY ;;
|
||||
esac
|
||||
|
||||
if test "x$PKGHANDLER_COMMAND" != x; then
|
||||
|
@ -83,10 +83,6 @@ cygwin_help() {
|
|||
esac
|
||||
}
|
||||
|
||||
msys_help() {
|
||||
PKGHANDLER_COMMAND=""
|
||||
}
|
||||
|
||||
apt_help() {
|
||||
case $1 in
|
||||
reduced)
|
||||
|
@ -165,6 +161,17 @@ brew_help() {
|
|||
esac
|
||||
}
|
||||
|
||||
pacman_help() {
|
||||
case $1 in
|
||||
unzip)
|
||||
PKGHANDLER_COMMAND="sudo pacman -S unzip" ;;
|
||||
zip)
|
||||
PKGHANDLER_COMMAND="sudo pacman -S zip" ;;
|
||||
make)
|
||||
PKGHANDLER_COMMAND="sudo pacman -S make" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
port_help() {
|
||||
PKGHANDLER_COMMAND=""
|
||||
}
|
||||
|
@ -257,16 +264,13 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
|
|||
printf "\n"
|
||||
printf "Tools summary:\n"
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
printf "* Environment: $WINDOWS_ENV_VENDOR version $WINDOWS_ENV_VERSION. Windows version $WINDOWS_VERSION"
|
||||
if test "x$WINDOWS_ENV_ROOT_PATH" != "x"; then
|
||||
printf ". Root at $WINDOWS_ENV_ROOT_PATH"
|
||||
fi
|
||||
printf "\n"
|
||||
printf "* Environment: %s version %s; windows version %s; prefix \"%s\"; root \"%s\"\n" \
|
||||
"$WINENV_VENDOR" "$WINENV_VERSION" "$WINDOWS_VERSION" "$WINENV_PREFIX" "$WINENV_ROOT"
|
||||
fi
|
||||
printf "* Boot JDK: $BOOT_JDK_VERSION (at $BOOT_JDK)\n"
|
||||
printf "* Toolchain: $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)\n"
|
||||
printf "* C Compiler: Version $CC_VERSION_NUMBER (at $CC)\n"
|
||||
printf "* C++ Compiler: Version $CXX_VERSION_NUMBER (at $CXX)\n"
|
||||
printf "* C Compiler: Version $CC_VERSION_NUMBER (at ${CC#"$FIXPATH "})\n"
|
||||
printf "* C++ Compiler: Version $CXX_VERSION_NUMBER (at ${CXX#"$FIXPATH "})\n"
|
||||
|
||||
printf "\n"
|
||||
printf "Build performance summary:\n"
|
||||
|
|
|
@ -388,9 +388,9 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
|
|||
UTIL_FIXUP_PATH(JCOV_HOME)
|
||||
if test "x$with_jcov_input_jdk" != "x" ; then
|
||||
JCOV_INPUT_JDK="$with_jcov_input_jdk"
|
||||
if test ! -f "$JCOV_INPUT_JDK/bin/java$EXE_SUFFIX"; then
|
||||
if test ! -f "$JCOV_INPUT_JDK/bin/java" && test ! -f "$JCOV_INPUT_JDK/bin/java.exe"; then
|
||||
AC_MSG_RESULT([fail])
|
||||
AC_MSG_ERROR([Invalid JDK bundle: "$JCOV_INPUT_JDK/bin/java$EXE_SUFFIX" does not exist])
|
||||
AC_MSG_ERROR([Invalid JDK bundle: "$JCOV_INPUT_JDK/bin/java" does not exist])
|
||||
fi
|
||||
UTIL_FIXUP_PATH(JCOV_INPUT_JDK)
|
||||
fi
|
||||
|
@ -664,10 +664,27 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_REPRODUCIBLE_BUILD],
|
|||
fi
|
||||
fi
|
||||
|
||||
UTIL_ARG_ENABLE(NAME: reproducible-build, DEFAULT: $with_source_date_present,
|
||||
REPRODUCIBLE_BUILD_DEFAULT=$with_source_date_present
|
||||
|
||||
if test "x$OPENJDK_BUILD_OS" = xwindows && \
|
||||
test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = xfalse; then
|
||||
# To support banning absolute paths on Windows, we must use the -pathmap
|
||||
# method, which requires reproducible builds.
|
||||
REPRODUCIBLE_BUILD_DEFAULT=true
|
||||
fi
|
||||
|
||||
UTIL_ARG_ENABLE(NAME: reproducible-build, DEFAULT: $REPRODUCIBLE_BUILD_DEFAULT,
|
||||
RESULT: ENABLE_REPRODUCIBLE_BUILD,
|
||||
DESC: [enable reproducible builds (not yet fully functional)],
|
||||
DEFAULT_DESC: [enabled if --with-source-date is given])
|
||||
DEFAULT_DESC: [enabled if --with-source-date is given or on Windows without absolute paths])
|
||||
|
||||
if test "x$OPENJDK_BUILD_OS" = xwindows && \
|
||||
test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = xfalse && \
|
||||
test "x$ENABLE_REPRODUCIBLE_BUILD" = xfalse; then
|
||||
AC_MSG_NOTICE([On Windows it is not possible to combine --disable-reproducible-builds])
|
||||
AC_MSG_NOTICE([with --disable-absolute-paths-in-output.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
|
||||
AC_SUBST(SOURCE_DATE)
|
||||
AC_SUBST(ENABLE_REPRODUCIBLE_BUILD)
|
||||
|
|
|
@ -206,9 +206,9 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
|
|||
VAR_OS=windows
|
||||
VAR_OS_ENV=windows.wsl
|
||||
;;
|
||||
*mingw*)
|
||||
*msys*)
|
||||
VAR_OS=windows
|
||||
VAR_OS_ENV=windows.msys
|
||||
VAR_OS_ENV=windows.msys2
|
||||
;;
|
||||
*aix*)
|
||||
VAR_OS=aix
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -28,9 +28,6 @@ AC_DEFUN_ONCE([SRCDIRS_SETUP_DIRS],
|
|||
OUTPUTDIR="$OUTPUTDIR"
|
||||
AC_SUBST(OUTPUTDIR)
|
||||
JDK_OUTPUTDIR="$OUTPUTDIR/jdk"
|
||||
|
||||
# Where are the sources.
|
||||
AC_SUBST(TOPDIR)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -131,20 +131,24 @@ ENABLE_REPRODUCIBLE_BUILD := @ENABLE_REPRODUCIBLE_BUILD@
|
|||
LIBM:=@LIBM@
|
||||
LIBDL:=@LIBDL@
|
||||
|
||||
# colon or semicolon
|
||||
PATH_SEP:=@PATH_SEP@
|
||||
WINENV_ROOT := @WINENV_ROOT@
|
||||
WINENV_PREFIX := @WINENV_PREFIX@
|
||||
|
||||
ifneq ($(findstring windows.wsl, @OPENJDK_BUILD_OS_ENV@), )
|
||||
# Tell WSL to convert PATH between linux and windows
|
||||
export WSLENV := PATH/l
|
||||
else ifeq (@OPENJDK_BUILD_OS_ENV@, windows.msys2)
|
||||
# Prohibit msys2 from attemping any path wrangling
|
||||
export MSYS2_ARG_CONV_EXCL := "*"
|
||||
endif
|
||||
|
||||
# Save the original path before replacing it with the Visual Studio tools
|
||||
ORIGINAL_PATH := @ORIGINAL_PATH@
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
# On Windows, the Visual Studio toolchain needs the PATH to be adjusted
|
||||
# to include Visual Studio tools (this needs to be in cygwin/msys style).
|
||||
ifeq ($(OPENJDK_TARGET_OS_ENV), windows.wsl)
|
||||
export FIXPATH_PATH:=@VS_PATH_WINDOWS@
|
||||
export WSLENV:=$(WSLENV):FIXPATH_PATH:DEBUG_FIXPATH
|
||||
else
|
||||
export PATH:=@VS_PATH@
|
||||
endif
|
||||
|
||||
ifeq (@TOOLCHAIN_TYPE@, microsoft)
|
||||
# The Visual Studio toolchain needs the PATH to be adjusted to include
|
||||
# Visual Studio tools.
|
||||
export PATH := @TOOLCHAIN_PATH@:$(PATH)
|
||||
endif
|
||||
|
||||
SYSROOT_CFLAGS := @SYSROOT_CFLAGS@
|
||||
|
@ -488,7 +492,7 @@ ADLC_LANGSTD_CXXFLAGS=@ADLC_LANGSTD_CXXFLAGS@
|
|||
ADLC_LDFLAGS=@ADLC_LDFLAGS@
|
||||
|
||||
# Tools that potentially need to be cross compilation aware.
|
||||
CC:=@FIXPATH@ @CCACHE@ @ICECC@ @CC@
|
||||
CC := @CCACHE@ @ICECC@ @CC@
|
||||
|
||||
# CFLAGS used to compile the jdk native libraries (C-code)
|
||||
CFLAGS_JDKLIB:=@CFLAGS_JDKLIB@
|
||||
|
@ -510,12 +514,12 @@ EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@
|
|||
EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
|
||||
EXTRA_ASFLAGS = @EXTRA_ASFLAGS@
|
||||
|
||||
CXX:=@FIXPATH@ @CCACHE@ @ICECC@ @CXX@
|
||||
CXX := @CCACHE@ @ICECC@ @CXX@
|
||||
|
||||
CPP:=@FIXPATH@ @CPP@
|
||||
CPP := @CPP@
|
||||
|
||||
# The linker can be gcc or ld on unix systems, or link.exe on windows systems.
|
||||
LD:=@FIXPATH@ @LD@
|
||||
LD := @LD@
|
||||
|
||||
# Linker used by the jaotc tool for AOT compilation.
|
||||
LD_JAOTC:=@LD_JAOTC@
|
||||
|
@ -535,7 +539,7 @@ JDKEXE_LIBS:=@JDKEXE_LIBS@
|
|||
LDFLAGS_CXX_JDK:=@LDFLAGS_CXX_JDK@
|
||||
|
||||
# Sometimes a different linker is needed for c++ libs
|
||||
LDCXX:=@FIXPATH@ @LDCXX@
|
||||
LDCXX := @LDCXX@
|
||||
# The flags for linking libstdc++ linker.
|
||||
LIBCXX:=@LIBCXX@
|
||||
|
||||
|
@ -544,22 +548,22 @@ LDFLAGS_TESTEXE:=@LDFLAGS_TESTEXE@
|
|||
|
||||
# BUILD_CC/BUILD_LD is a compiler/linker that generates code that is runnable on the
|
||||
# build platform.
|
||||
BUILD_CC:=@FIXPATH@ @BUILD_ICECC@ @BUILD_CC@
|
||||
BUILD_CXX:=@FIXPATH@ @BUILD_ICECC@ @BUILD_CXX@
|
||||
BUILD_LD:=@FIXPATH@ @BUILD_LD@
|
||||
BUILD_LDCXX:=@FIXPATH@ @BUILD_LDCXX@
|
||||
BUILD_AS:=@FIXPATH@ @BUILD_AS@
|
||||
BUILD_AR:=@FIXPATH@ @BUILD_AR@
|
||||
BUILD_NM:=@FIXPATH@ @BUILD_NM@
|
||||
BUILD_CC := @BUILD_ICECC@ @BUILD_CC@
|
||||
BUILD_CXX := @BUILD_ICECC@ @BUILD_CXX@
|
||||
BUILD_LD := @BUILD_LD@
|
||||
BUILD_LDCXX := @BUILD_LDCXX@
|
||||
BUILD_AS := @BUILD_AS@
|
||||
BUILD_AR := @BUILD_AR@
|
||||
BUILD_NM := @BUILD_NM@
|
||||
BUILD_OBJCOPY:=@BUILD_OBJCOPY@
|
||||
BUILD_STRIP:=@BUILD_STRIP@
|
||||
BUILD_SYSROOT_CFLAGS:=@BUILD_SYSROOT_CFLAGS@
|
||||
BUILD_SYSROOT_LDFLAGS:=@BUILD_SYSROOT_LDFLAGS@
|
||||
|
||||
AS:=@FIXPATH@ @AS@
|
||||
AS := @AS@
|
||||
|
||||
# AR is used to create a static library (is ar in unix, lib.exe in windows)
|
||||
AR:=@FIXPATH@ @AR@
|
||||
AR := @AR@
|
||||
ARFLAGS:=@ARFLAGS@
|
||||
|
||||
NM:=@NM@
|
||||
|
@ -608,7 +612,7 @@ STATIC_LIBRARY=@STATIC_LIBRARY@
|
|||
LIBRARY_PREFIX:=@LIBRARY_PREFIX@
|
||||
SHARED_LIBRARY_SUFFIX:=@SHARED_LIBRARY_SUFFIX@
|
||||
STATIC_LIBRARY_SUFFIX:=@STATIC_LIBRARY_SUFFIX@
|
||||
EXE_SUFFIX:=@EXE_SUFFIX@
|
||||
EXECUTABLE_SUFFIX:=@EXECUTABLE_SUFFIX@
|
||||
OBJ_SUFFIX:=@OBJ_SUFFIX@
|
||||
STATIC_BUILD:=@STATIC_BUILD@
|
||||
|
||||
|
@ -629,18 +633,15 @@ JAVADOC_CMD:=@JAVADOC@
|
|||
JAR_CMD:=@JAR@
|
||||
JLINK_CMD := @JLINK@
|
||||
JMOD_CMD := @JMOD@
|
||||
JARSIGNER_CMD:=@JARSIGNER@
|
||||
# These variables are meant to be used. They are defined with = instead of := to make
|
||||
# it possible to override only the *_CMD variables.
|
||||
JAVA=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
|
||||
JAVA_SMALL=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
|
||||
JAVA_DETACH =@FIXPATH@ @FIXPATH_DETACH_FLAG@ $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
|
||||
JAVAC=@FIXPATH@ $(JAVAC_CMD)
|
||||
JAVADOC=@FIXPATH@ $(JAVADOC_CMD)
|
||||
JAR=@FIXPATH@ $(JAR_CMD)
|
||||
JLINK = @FIXPATH@ $(JLINK_CMD)
|
||||
JMOD = @FIXPATH@ $(JMOD_CMD) $(JAVA_TOOL_FLAGS_SMALL)
|
||||
JARSIGNER=@FIXPATH@ $(JARSIGNER_CMD)
|
||||
JAVA = $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
|
||||
JAVA_SMALL = $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
|
||||
JAVAC = $(JAVAC_CMD)
|
||||
JAVADOC = $(JAVADOC_CMD)
|
||||
JAR = $(JAR_CMD)
|
||||
JLINK = $(JLINK_CMD)
|
||||
JMOD = $(JMOD_CMD) $(JAVA_TOOL_FLAGS_SMALL)
|
||||
|
||||
BUILD_JAVA_FLAGS := @BOOTCYCLE_JVM_ARGS_BIG@
|
||||
BUILD_JAVA=@FIXPATH@ $(BUILD_JDK)/bin/java $(BUILD_JAVA_FLAGS)
|
||||
|
@ -685,9 +686,7 @@ CCACHE:=@CCACHE@
|
|||
CD:=cd
|
||||
CHMOD:=@CHMOD@
|
||||
CODESIGN:=@CODESIGN@
|
||||
COMM:=@COMM@
|
||||
CP:=@CP@
|
||||
CPIO:=@CPIO@
|
||||
CUT:=@CUT@
|
||||
DATE:=@DATE@
|
||||
DIFF:=@DIFF@
|
||||
|
@ -708,7 +707,7 @@ MIG:=@MIG@
|
|||
MKDIR:=@MKDIR@
|
||||
MV:=@MV@
|
||||
NICE:=@NICE@
|
||||
PANDOC:=@FIXPATH@ @PANDOC@
|
||||
PANDOC:=@PANDOC@
|
||||
PATCH:=@PATCH@
|
||||
PRINTF:=@PRINTF@
|
||||
READLINK:=@READLINK@
|
||||
|
@ -724,15 +723,14 @@ TIME:=@TIME@
|
|||
IS_GNU_TIME:=@IS_GNU_TIME@
|
||||
TR:=@TR@
|
||||
TOUCH:=@TOUCH@
|
||||
UNIQ:=@UNIQ@
|
||||
WC:=@WC@
|
||||
XARGS:=@XARGS@
|
||||
ZIPEXE:=@ZIPEXE@
|
||||
UNZIP:=@UNZIP@
|
||||
MT:=@FIXPATH@ @MT@
|
||||
RC:=@FIXPATH@ @RC@
|
||||
DUMPBIN:=@FIXPATH@ @DUMPBIN@
|
||||
CYGPATH:=@CYGPATH@
|
||||
MT:=@MT@
|
||||
RC:=@RC@
|
||||
DUMPBIN:=@DUMPBIN@
|
||||
PATHTOOL:=@PATHTOOL@
|
||||
WSLPATH:=@WSLPATH@
|
||||
LDD:=@LDD@
|
||||
OTOOL:=@OTOOL@
|
||||
|
@ -750,6 +748,7 @@ JIB_HOME:=@JIB_HOME@
|
|||
XCODEBUILD=@XCODEBUILD@
|
||||
DTRACE := @DTRACE@
|
||||
FIXPATH := @FIXPATH@
|
||||
FIXPATH_BASE := @FIXPATH_BASE@
|
||||
ULIMIT:=@ULIMIT@
|
||||
|
||||
TAR_TYPE:=@TAR_TYPE@
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
# compilers and related tools that are used.
|
||||
########################################################################
|
||||
|
||||
m4_include([toolchain_windows.m4])
|
||||
m4_include([toolchain_microsoft.m4])
|
||||
|
||||
# All valid toolchains, regardless of platform (used by help.m4)
|
||||
VALID_TOOLCHAINS_all="gcc clang xlc microsoft"
|
||||
|
@ -179,6 +179,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_FILENAME_PATTERNS],
|
|||
SHARED_LIBRARY='[$]1.dll'
|
||||
STATIC_LIBRARY='[$]1.lib'
|
||||
OBJ_SUFFIX='.obj'
|
||||
EXECUTABLE_SUFFIX='.exe'
|
||||
else
|
||||
LIBRARY_PREFIX=lib
|
||||
SHARED_LIBRARY_SUFFIX='.so'
|
||||
|
@ -186,6 +187,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_FILENAME_PATTERNS],
|
|||
SHARED_LIBRARY='lib[$]1.so'
|
||||
STATIC_LIBRARY='lib[$]1.a'
|
||||
OBJ_SUFFIX='.o'
|
||||
EXECUTABLE_SUFFIX=''
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
# For full static builds, we're overloading the SHARED_LIBRARY
|
||||
# variables in order to limit the amount of changes required.
|
||||
|
@ -209,6 +211,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_FILENAME_PATTERNS],
|
|||
AC_SUBST(SHARED_LIBRARY)
|
||||
AC_SUBST(STATIC_LIBRARY)
|
||||
AC_SUBST(OBJ_SUFFIX)
|
||||
AC_SUBST(EXECUTABLE_SUFFIX)
|
||||
])
|
||||
|
||||
# Determine which toolchain type to use, and make sure it is valid for this
|
||||
|
@ -292,12 +295,12 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE],
|
|||
|
||||
TOOLCHAIN_CC_BINARY_clang="clang"
|
||||
TOOLCHAIN_CC_BINARY_gcc="gcc"
|
||||
TOOLCHAIN_CC_BINARY_microsoft="cl$EXE_SUFFIX"
|
||||
TOOLCHAIN_CC_BINARY_microsoft="cl"
|
||||
TOOLCHAIN_CC_BINARY_xlc="xlclang"
|
||||
|
||||
TOOLCHAIN_CXX_BINARY_clang="clang++"
|
||||
TOOLCHAIN_CXX_BINARY_gcc="g++"
|
||||
TOOLCHAIN_CXX_BINARY_microsoft="cl$EXE_SUFFIX"
|
||||
TOOLCHAIN_CXX_BINARY_microsoft="cl"
|
||||
TOOLCHAIN_CXX_BINARY_xlc="xlclang++"
|
||||
|
||||
# Use indirect variable referencing
|
||||
|
@ -325,9 +328,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE],
|
|||
# special setup, e.g. additional paths etc.
|
||||
AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION],
|
||||
[
|
||||
# FIXME: Is this needed?
|
||||
AC_LANG(C++)
|
||||
|
||||
# Store the CFLAGS etc passed to the configure script.
|
||||
ORG_CFLAGS="$CFLAGS"
|
||||
ORG_CXXFLAGS="$CXXFLAGS"
|
||||
|
@ -335,52 +335,26 @@ AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION],
|
|||
# autoconf magic only relies on PATH, so update it if tools dir is specified
|
||||
OLD_PATH="$PATH"
|
||||
|
||||
# On Windows, we need to detect the visual studio installation first.
|
||||
# This will change the PATH, but we need to keep that new PATH even
|
||||
# after toolchain detection is done, since the compiler (on x86) uses
|
||||
# it for DLL resolution in runtime.
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows" \
|
||||
&& test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
|
||||
TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
# Append VS_PATH. In WSL, VS_PATH will not contain the WSL env path needed
|
||||
# for using basic Unix tools, so need to keep the original PATH.
|
||||
UTIL_APPEND_TO_PATH(PATH, $VS_PATH)
|
||||
UTIL_APPEND_TO_PATH(WSLENV, "PATH/l:LIB:INCLUDE")
|
||||
export WSLENV
|
||||
else
|
||||
# Reset path to VS_PATH. It will include everything that was on PATH at the time we
|
||||
# ran TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV.
|
||||
PATH="$VS_PATH"
|
||||
fi
|
||||
# The microsoft toolchain also requires INCLUDE and LIB to be set.
|
||||
export INCLUDE="$VS_INCLUDE"
|
||||
export LIB="$VS_LIB"
|
||||
else
|
||||
if test "x$XCODE_VERSION_OUTPUT" != x; then
|
||||
# For Xcode, we set the Xcode version as TOOLCHAIN_VERSION
|
||||
TOOLCHAIN_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | $CUT -f 2 -d ' '`
|
||||
TOOLCHAIN_DESCRIPTION="$TOOLCHAIN_DESCRIPTION from Xcode $TOOLCHAIN_VERSION"
|
||||
else
|
||||
# Currently we do not define this for other toolchains. This might change as the need arise.
|
||||
TOOLCHAIN_VERSION=
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(TOOLCHAIN_VERSION)
|
||||
|
||||
# Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to
|
||||
# Finally prepend TOOLCHAIN_PATH to the PATH, to allow --with-tools-dir to
|
||||
# override all other locations.
|
||||
if test "x$TOOLCHAIN_PATH" != x; then
|
||||
PATH=$TOOLCHAIN_PATH:$PATH
|
||||
export PATH=$TOOLCHAIN_PATH:$PATH
|
||||
fi
|
||||
])
|
||||
|
||||
# Restore path, etc
|
||||
AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION],
|
||||
[
|
||||
# Restore old path, except for the microsoft toolchain, which requires VS_PATH
|
||||
# to remain in place. Otherwise the compiler will not work in some siutations
|
||||
# in later configure checks.
|
||||
# Restore old path, except for the microsoft toolchain, which requires the
|
||||
# toolchain path to remain in place. Otherwise the compiler will not work in
|
||||
# some siutations in later configure checks.
|
||||
if test "x$TOOLCHAIN_TYPE" != "xmicrosoft"; then
|
||||
PATH="$OLD_PATH"
|
||||
fi
|
||||
|
@ -427,7 +401,7 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_COMPILER_VERSION],
|
|||
# First line typically looks something like:
|
||||
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
|
||||
# but the compiler name may vary depending on locale.
|
||||
COMPILER_VERSION_OUTPUT=`"$COMPILER" 2>&1 | $GREP -v 'ERROR.*UtilTranslatePathList' | $HEAD -n 1 | $TR -d '\r'`
|
||||
COMPILER_VERSION_OUTPUT=`$COMPILER 2>&1 1>/dev/null | $HEAD -n 1 | $TR -d '\r'`
|
||||
# Check that this is likely to be Microsoft CL.EXE.
|
||||
$ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Microsoft" > /dev/null
|
||||
if test $? -ne 0; then
|
||||
|
@ -506,7 +480,7 @@ AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
|
|||
if test "x`basename [$]$1`" = "x[$]$1"; then
|
||||
# A command without a complete path is provided, search $PATH.
|
||||
|
||||
AC_PATH_PROGS(POTENTIAL_$1, [$]$1)
|
||||
UTIL_LOOKUP_PROGS(POTENTIAL_$1, [$]$1)
|
||||
if test "x$POTENTIAL_$1" != x; then
|
||||
$1=$POTENTIAL_$1
|
||||
else
|
||||
|
@ -528,34 +502,16 @@ AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
|
|||
# If we are not cross compiling, then the default compiler name will be
|
||||
# used.
|
||||
|
||||
$1=
|
||||
# If TOOLCHAIN_PATH is set, check for all compiler names in there first
|
||||
# before checking the rest of the PATH.
|
||||
# FIXME: Now that we prefix the TOOLS_DIR to the PATH in the PRE_DETECTION
|
||||
# step, this should not be necessary.
|
||||
if test -n "$TOOLCHAIN_PATH"; then
|
||||
PATH_save="$PATH"
|
||||
PATH="$TOOLCHAIN_PATH"
|
||||
AC_PATH_TOOL(TOOLCHAIN_PATH_$1, $SEARCH_LIST)
|
||||
$1=$TOOLCHAIN_PATH_$1
|
||||
PATH="$PATH_save"
|
||||
fi
|
||||
|
||||
# AC_PATH_TOOL can't be run multiple times with the same variable,
|
||||
# so create a new name for this run.
|
||||
if test "x[$]$1" = x; then
|
||||
AC_PATH_TOOL(POTENTIAL_$1, $SEARCH_LIST)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(POTENTIAL_$1, $SEARCH_LIST)
|
||||
if test "x$POTENTIAL_$1" != x; then
|
||||
$1=$POTENTIAL_$1
|
||||
fi
|
||||
|
||||
if test "x[$]$1" = x; then
|
||||
else
|
||||
HELP_MSG_MISSING_DEPENDENCY([devkit])
|
||||
AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
|
||||
fi
|
||||
fi
|
||||
|
||||
# Now we have a compiler binary in $1. Make sure it's okay.
|
||||
UTIL_FIXUP_EXECUTABLE($1)
|
||||
TEST_COMPILER="[$]$1"
|
||||
|
||||
AC_MSG_CHECKING([resolved symbolic links for $1])
|
||||
|
@ -596,12 +552,7 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_LD_VERSION],
|
|||
# There is no specific version flag, but all output starts with a version string.
|
||||
# First line typically looks something like:
|
||||
# Microsoft (R) Incremental Linker Version 12.00.31101.0
|
||||
# Reset PATH since it can contain a mix of WSL/linux paths and Windows paths from VS,
|
||||
# which, in combination with WSLENV, will make the WSL layer complain
|
||||
old_path="$PATH"
|
||||
PATH=
|
||||
LINKER_VERSION_STRING=`$LD 2>&1 | $HEAD -n 1 | $TR -d '\r'`
|
||||
PATH="$old_path"
|
||||
LINKER_VERSION_STRING=`$LINKER 2>&1 | $HEAD -n 1 | $TR -d '\r'`
|
||||
# Extract version number
|
||||
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
|
||||
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*/\1/'` ]
|
||||
|
@ -612,7 +563,7 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_LD_VERSION],
|
|||
# This program is free software; [...]
|
||||
# If using gold it will look like:
|
||||
# GNU gold (GNU Binutils 2.30) 1.15
|
||||
LINKER_VERSION_STRING=`$LD -Wl,--version 2> /dev/null | $HEAD -n 1`
|
||||
LINKER_VERSION_STRING=`$LINKER -Wl,--version 2> /dev/null | $HEAD -n 1`
|
||||
# Extract version number
|
||||
if [ [[ "$LINKER_VERSION_STRING" == *gold* ]] ]; then
|
||||
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
|
||||
|
@ -629,7 +580,7 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_LD_VERSION],
|
|||
# or
|
||||
# GNU ld (GNU Binutils for Ubuntu) 2.26.1
|
||||
|
||||
LINKER_VERSION_STRING=`$LD -Wl,-v 2>&1 | $HEAD -n 1`
|
||||
LINKER_VERSION_STRING=`$LINKER -Wl,-v 2>&1 | $HEAD -n 1`
|
||||
# Check if we're using the GNU ld
|
||||
$ECHO "$LINKER_VERSION_STRING" | $GREP "GNU" > /dev/null
|
||||
if test $? -eq 0; then
|
||||
|
@ -649,6 +600,23 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_LD_VERSION],
|
|||
AC_MSG_NOTICE([Using $TOOLCHAIN_TYPE $LINKER_NAME version $LINKER_VERSION_NUMBER @<:@$LINKER_VERSION_STRING@:>@])
|
||||
])
|
||||
|
||||
# Make sure we did not pick up /usr/bin/link, which is the unix-style link
|
||||
# executable.
|
||||
#
|
||||
# $1 = linker to test (LD or BUILD_LD)
|
||||
AC_DEFUN(TOOLCHAIN_VERIFY_LINK_BINARY,
|
||||
[
|
||||
LINKER=[$]$1
|
||||
|
||||
AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
|
||||
$LINKER --version > /dev/null
|
||||
if test $? -eq 0 ; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([$LINKER is the winenv link tool. Please check your PATH and rerun configure.])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
])
|
||||
# Detect the core components of the toolchain, i.e. the compilers (CC and CXX),
|
||||
# preprocessor (CPP and CXXCPP), the linker (LD), the assembler (AS) and the
|
||||
# archiver (AR). Verify that the compilers are correct according to the
|
||||
|
@ -693,39 +661,18 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE],
|
|||
#
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# In the Microsoft toolchain we have a separate LD command "link".
|
||||
# Make sure we reject /usr/bin/link (as determined in CYGWIN_LINK), which is
|
||||
# a cygwin program for something completely different.
|
||||
AC_CHECK_PROG([LD], [link$EXE_SUFFIX],[link$EXE_SUFFIX],,, [$CYGWIN_LINK])
|
||||
UTIL_FIXUP_EXECUTABLE(LD)
|
||||
# Verify that we indeed succeeded with this trick.
|
||||
AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
|
||||
|
||||
# Reset PATH since it can contain a mix of WSL/linux paths and Windows paths from VS,
|
||||
# which, in combination with WSLENV, will make the WSL layer complain
|
||||
old_path="$PATH"
|
||||
PATH=
|
||||
|
||||
"$LD" --version > /dev/null
|
||||
|
||||
if test $? -eq 0 ; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
|
||||
PATH="$old_path"
|
||||
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(LD, link)
|
||||
TOOLCHAIN_VERIFY_LINK_BINARY(LD)
|
||||
LDCXX="$LD"
|
||||
# jaotc being a windows program expects the linker to be supplied with exe suffix.
|
||||
LD_JAOTC="$LD$EXE_SUFFIX"
|
||||
# jaotc being a windows program expects the linker to be supplied with exe suffix.but without
|
||||
# fixpath
|
||||
LD_JAOTC="${LD##$FIXPATH }"
|
||||
else
|
||||
# All other toolchains use the compiler to link.
|
||||
LD="$CC"
|
||||
LDCXX="$CXX"
|
||||
# jaotc expects 'ld' as the linker rather than the compiler.
|
||||
UTIL_CHECK_TOOLS([LD_JAOTC], ld)
|
||||
UTIL_FIXUP_EXECUTABLE(LD_JAOTC)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(LD_JAOTC, ld)
|
||||
fi
|
||||
AC_SUBST(LD)
|
||||
AC_SUBST(LD_JAOTC)
|
||||
|
@ -746,8 +693,12 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE],
|
|||
#
|
||||
# Setup the assembler (AS)
|
||||
#
|
||||
# FIXME: is this correct for microsoft?
|
||||
if test "x$TOOLCHAIN_TYPE" != xmicrosoft; then
|
||||
AS="$CC -c"
|
||||
else
|
||||
# On windows, the assember is "ml.exe"
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(AS, ml)
|
||||
fi
|
||||
AC_SUBST(AS)
|
||||
|
||||
#
|
||||
|
@ -755,13 +706,12 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE],
|
|||
#
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# The corresponding ar tool is lib.exe (used to create static libraries)
|
||||
AC_CHECK_PROG([AR], [lib$EXE_SUFFIX],[lib$EXE_SUFFIX],,,)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(AR, lib)
|
||||
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
UTIL_CHECK_TOOLS(AR, ar gcc-ar)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(AR, ar gcc-ar)
|
||||
else
|
||||
UTIL_CHECK_TOOLS(AR, ar)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(AR, ar)
|
||||
fi
|
||||
UTIL_FIXUP_EXECUTABLE(AR)
|
||||
])
|
||||
|
||||
# Setup additional tools that is considered a part of the toolchain, but not the
|
||||
|
@ -770,41 +720,26 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE],
|
|||
AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA],
|
||||
[
|
||||
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
|
||||
UTIL_PATH_PROGS(LIPO, lipo)
|
||||
UTIL_FIXUP_EXECUTABLE(LIPO)
|
||||
UTIL_LOOKUP_PROGS(LIPO, lipo)
|
||||
UTIL_REQUIRE_PROGS(OTOOL, otool)
|
||||
UTIL_FIXUP_EXECUTABLE(OTOOL)
|
||||
UTIL_REQUIRE_PROGS(INSTALL_NAME_TOOL, install_name_tool)
|
||||
UTIL_FIXUP_EXECUTABLE(INSTALL_NAME_TOOL)
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
AC_CHECK_PROG([MT], [mt$EXE_SUFFIX], [mt$EXE_SUFFIX],,, [/usr/bin/mt])
|
||||
UTIL_FIXUP_EXECUTABLE(MT)
|
||||
# Setup the manifest tool (MT)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(MT, mt)
|
||||
# Setup the resource compiler (RC)
|
||||
AC_CHECK_PROG([RC], [rc$EXE_SUFFIX], [rc$EXE_SUFFIX],,, [/usr/bin/rc])
|
||||
UTIL_FIXUP_EXECUTABLE(RC)
|
||||
AC_CHECK_PROG([DUMPBIN], [dumpbin$EXE_SUFFIX], [dumpbin$EXE_SUFFIX],,,)
|
||||
UTIL_FIXUP_EXECUTABLE(DUMPBIN)
|
||||
# We need to check for 'msbuild.exe' because at the place where we expect to
|
||||
# find 'msbuild.exe' there's also a directory called 'msbuild' and configure
|
||||
# won't find the 'msbuild.exe' executable in that case (and the
|
||||
# 'ac_executable_extensions' is unusable due to performance reasons).
|
||||
# Notice that we intentionally don't fix up the path to MSBUILD because we
|
||||
# will call it in a DOS shell during freetype detection on Windows (see
|
||||
# 'LIB_SETUP_FREETYPE' in "libraries.m4"
|
||||
AC_CHECK_PROG([MSBUILD], [msbuild$EXE_SUFFIX], [msbuild$EXE_SUFFIX],,,)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(RC, rc)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(DUMPBIN, dumpbin)
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" != xwindows; then
|
||||
UTIL_CHECK_TOOLS(STRIP, strip)
|
||||
UTIL_FIXUP_EXECUTABLE(STRIP)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(STRIP, strip)
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
UTIL_CHECK_TOOLS(NM, nm gcc-nm)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(NM, nm gcc-nm)
|
||||
else
|
||||
UTIL_CHECK_TOOLS(NM, nm)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(NM, nm)
|
||||
fi
|
||||
UTIL_FIXUP_EXECUTABLE(NM)
|
||||
GNM="$NM"
|
||||
AC_SUBST(GNM)
|
||||
fi
|
||||
|
@ -812,25 +747,14 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA],
|
|||
# objcopy is used for moving debug symbols to separate files when
|
||||
# full debug symbols are enabled.
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
UTIL_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
|
||||
# Only call fixup if objcopy was found.
|
||||
if test -n "$OBJCOPY"; then
|
||||
UTIL_FIXUP_EXECUTABLE(OBJCOPY)
|
||||
fi
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(OBJCOPY, gobjcopy objcopy)
|
||||
fi
|
||||
|
||||
UTIL_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
|
||||
if test "x$OBJDUMP" != x; then
|
||||
# Only used for compare.sh; we can live without it. UTIL_FIXUP_EXECUTABLE
|
||||
# bails if argument is missing.
|
||||
UTIL_FIXUP_EXECUTABLE(OBJDUMP)
|
||||
fi
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(OBJDUMP, gobjdump objdump)
|
||||
|
||||
case $TOOLCHAIN_TYPE in
|
||||
gcc|clang)
|
||||
UTIL_CHECK_TOOLS(CXXFILT, [c++filt])
|
||||
UTIL_CHECK_NONEMPTY(CXXFILT)
|
||||
UTIL_FIXUP_EXECUTABLE(CXXFILT)
|
||||
UTIL_REQUIRE_TOOLCHAIN_PROGS(CXXFILT, c++filt)
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
@ -902,63 +826,57 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
|
|||
BUILD_SYSROOT="$BUILD_DEVKIT_SYSROOT"
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
BUILD_VS_INCLUDE="$BUILD_DEVKIT_VS_INCLUDE"
|
||||
BUILD_VS_LIB="$BUILD_DEVKIT_VS_LIB"
|
||||
# For historical reasons, paths are separated by ; in devkit.info
|
||||
BUILD_VS_INCLUDE="${BUILD_DEVKIT_VS_INCLUDE//;/:}"
|
||||
BUILD_VS_LIB="${BUILD_DEVKIT_VS_LIB//;/:}"
|
||||
|
||||
TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS([BUILD_])
|
||||
TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS(BUILD_, BUILD_)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# FIXME: we should list the discovered compilers as an exclude pattern!
|
||||
# If we do that, we can do this detection before POST_DETECTION, and still
|
||||
# find the build compilers in the tools dir, if needed.
|
||||
if test "x$OPENJDK_BUILD_OS" = xmacosx; then
|
||||
UTIL_REQUIRE_PROGS(BUILD_CC, [clang cl cc gcc])
|
||||
UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++])
|
||||
else
|
||||
UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc])
|
||||
UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++])
|
||||
fi
|
||||
UTIL_FIXUP_EXECUTABLE(BUILD_CC)
|
||||
UTIL_FIXUP_EXECUTABLE(BUILD_CXX)
|
||||
UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm)
|
||||
UTIL_FIXUP_EXECUTABLE(BUILD_NM)
|
||||
UTIL_PATH_PROGS(BUILD_AR, ar gcc-ar)
|
||||
UTIL_FIXUP_EXECUTABLE(BUILD_AR)
|
||||
UTIL_PATH_PROGS(BUILD_OBJCOPY, objcopy)
|
||||
UTIL_FIXUP_EXECUTABLE(BUILD_OBJCOPY)
|
||||
UTIL_PATH_PROGS(BUILD_STRIP, strip)
|
||||
UTIL_FIXUP_EXECUTABLE(BUILD_STRIP)
|
||||
# Assume the C compiler is the assembler
|
||||
BUILD_AS="$BUILD_CC -c"
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# In the Microsoft toolchain we have a separate LD command "link".
|
||||
# Make sure we reject /usr/bin/link (as determined in CYGWIN_LINK), which is
|
||||
# a cygwin program for something completely different.
|
||||
AC_CHECK_PROG([BUILD_LD], [link$EXE_SUFFIX],[link$EXE_SUFFIX],,, [$CYGWIN_LINK])
|
||||
UTIL_FIXUP_EXECUTABLE(BUILD_LD)
|
||||
# Verify that we indeed succeeded with this trick.
|
||||
AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
|
||||
# If we got no devkit, we need to go hunting for the proper env
|
||||
TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE($OPENJDK_BUILD_CPU, [$TOOLCHAIN_VERSION])
|
||||
TOOLCHAIN_EXTRACT_VISUAL_STUDIO_ENV($OPENJDK_BUILD_CPU, BUILD_)
|
||||
|
||||
# Reset PATH since it can contain a mix of WSL/linux paths and Windows paths from VS,
|
||||
# which, in combination with WSLENV, will make the WSL layer complain
|
||||
old_path="$PATH"
|
||||
PATH=
|
||||
# We cannot currently export the VS_PATH to spec.gmk. This is probably
|
||||
# strictly not correct, but seems to work anyway.
|
||||
|
||||
"$BUILD_LD" --version > /dev/null
|
||||
|
||||
if test $? -eq 0 ; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
# Convert VS_INCLUDE and VS_LIB into sysroot flags
|
||||
TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS(BUILD_)
|
||||
fi
|
||||
fi
|
||||
|
||||
PATH="$old_path"
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
UTIL_REQUIRE_PROGS(BUILD_CC, cl, [$VS_PATH])
|
||||
UTIL_REQUIRE_PROGS(BUILD_CXX, cl, [$VS_PATH])
|
||||
|
||||
# On windows, the assember is "ml.exe". We currently don't need this so
|
||||
# do not require.
|
||||
UTIL_LOOKUP_PROGS(BUILD_AS, ml, [$VS_PATH])
|
||||
|
||||
# On windows, the ar tool is lib.exe (used to create static libraries).
|
||||
# We currently don't need this so do not require.
|
||||
UTIL_LOOKUP_PROGS(BUILD_AR, lib, [$VS_PATH])
|
||||
|
||||
# In the Microsoft toolchain we have a separate LD command "link".
|
||||
UTIL_REQUIRE_PROGS(BUILD_LD, link, [$VS_PATH])
|
||||
TOOLCHAIN_VERIFY_LINK_BINARY(BUILD_LD)
|
||||
BUILD_LDCXX="$BUILD_LD"
|
||||
else
|
||||
if test "x$OPENJDK_BUILD_OS" = xmacosx; then
|
||||
UTIL_REQUIRE_PROGS(BUILD_CC, clang cc gcc)
|
||||
UTIL_REQUIRE_PROGS(BUILD_CXX, clang++ CC g++)
|
||||
else
|
||||
UTIL_REQUIRE_PROGS(BUILD_CC, cc gcc)
|
||||
UTIL_REQUIRE_PROGS(BUILD_CXX, CC g++)
|
||||
fi
|
||||
UTIL_LOOKUP_PROGS(BUILD_NM, nm gcc-nm)
|
||||
UTIL_LOOKUP_PROGS(BUILD_AR, ar gcc-ar lib)
|
||||
UTIL_LOOKUP_PROGS(BUILD_OBJCOPY, objcopy)
|
||||
UTIL_LOOKUP_PROGS(BUILD_STRIP, strip)
|
||||
# Assume the C compiler is the assembler
|
||||
BUILD_AS="$BUILD_CC -c"
|
||||
# Just like for the target compiler, use the compiler as linker
|
||||
BUILD_LD="$BUILD_CC"
|
||||
BUILD_LDCXX="$BUILD_CXX"
|
||||
|
@ -1003,7 +921,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
|
|||
# Check for extra potential brokenness.
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# On Windows, double-check that we got the right compiler.
|
||||
CC_VERSION_OUTPUT=`$CC 2>&1 | $GREP -v 'ERROR.*UtilTranslatePathList' | $HEAD -n 1 | $TR -d '\r'`
|
||||
CC_VERSION_OUTPUT=`$CC 2>&1 1>/dev/null | $HEAD -n 1 | $TR -d '\r'`
|
||||
COMPILER_CPU_TEST=`$ECHO $CC_VERSION_OUTPUT | $SED -n "s/^.* \(.*\)$/\1/p"`
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
|
||||
if test "x$COMPILER_CPU_TEST" != "x80x86" -a "x$COMPILER_CPU_TEST" != "xx86"; then
|
||||
|
@ -1099,7 +1017,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG],
|
|||
if test "x$JT_HOME" = x; then
|
||||
# JT_HOME is not set in environment, or was deemed invalid.
|
||||
# Try to find jtreg on path
|
||||
UTIL_PATH_PROGS(JTREGEXE, jtreg)
|
||||
UTIL_LOOKUP_PROGS(JTREGEXE, jtreg)
|
||||
if test "x$JTREGEXE" != x; then
|
||||
# That's good, now try to derive JT_HOME
|
||||
JT_HOME=`(cd $($DIRNAME $JTREGEXE)/.. && pwd)`
|
||||
|
|
|
@ -61,11 +61,14 @@ VS_TOOLSET_SUPPORTED_2019=true
|
|||
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
|
||||
[
|
||||
if test "x$VS_ENV_CMD" = x; then
|
||||
VS_VERSION="$1"
|
||||
VS_BASE="$2"
|
||||
METHOD="$3"
|
||||
TARGET_CPU="$1"
|
||||
VS_VERSION="$2"
|
||||
VS_BASE="$3"
|
||||
METHOD="$4"
|
||||
|
||||
UTIL_REWRITE_AS_UNIX_PATH(VS_BASE)
|
||||
UTIL_FIXUP_PATH(VS_BASE, NOFAIL)
|
||||
|
||||
if test "x$VS_BASE" != x && test -d "$VS_BASE"; then
|
||||
# In VS 2017 and VS 2019, the default installation is in a subdir named after the edition.
|
||||
# Find the first one present and use that.
|
||||
if test "x$VS_EDITIONS" != x; then
|
||||
|
@ -77,14 +80,13 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
|
|||
done
|
||||
fi
|
||||
|
||||
if test -d "$VS_BASE"; then
|
||||
AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
|
||||
if test "x$OPENJDK_TARGET_CPU" = xx86; then
|
||||
if test "x$TARGET_CPU" = xx86; then
|
||||
VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
|
||||
elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
|
||||
elif test "x$TARGET_CPU" = xx86_64; then
|
||||
VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
|
||||
VC/Auxiliary/Build/vcvarsx86_amd64.bat VC/Auxiliary/Build/vcvars64.bat"
|
||||
elif test "x$OPENJDK_TARGET_CPU" = xaarch64; then
|
||||
vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat"
|
||||
elif test "x$TARGET_CPU" = xaarch64; then
|
||||
# for host x86-64, target aarch64
|
||||
VCVARSFILES="vc/auxiliary/build/vcvarsamd64_arm64.bat \
|
||||
vc/auxiliary/build/vcvarsx86_arm64.bat"
|
||||
|
@ -114,24 +116,27 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
|
|||
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
|
||||
[
|
||||
if test "x$VS_ENV_CMD" = x; then
|
||||
VS_VERSION="$1"
|
||||
WIN_SDK_BASE="$2"
|
||||
METHOD="$3"
|
||||
UTIL_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE)
|
||||
if test -d "$WIN_SDK_BASE"; then
|
||||
TARGET_CPU="$1"
|
||||
VS_VERSION="$2"
|
||||
WIN_SDK_BASE="$3"
|
||||
METHOD="$4"
|
||||
|
||||
UTIL_FIXUP_PATH(WIN_SDK_BASE, NOFAIL)
|
||||
|
||||
if test "x$WIN_SDK_BASE" != x && test -d "$WIN_SDK_BASE"; then
|
||||
# There have been cases of partial or broken SDK installations. A missing
|
||||
# lib dir is not going to work.
|
||||
if test ! -d "$WIN_SDK_BASE/lib"; then
|
||||
AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
|
||||
AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring])
|
||||
elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
|
||||
elif test -f "$WIN_SDK_BASE/bin/setenv.cmd"; then
|
||||
AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
|
||||
VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
|
||||
if test "x$OPENJDK_TARGET_CPU" = xx86; then
|
||||
VS_ENV_CMD="$WIN_SDK_BASE/bin/setenv.cmd"
|
||||
if test "x$TARGET_CPU" = xx86; then
|
||||
VS_ENV_ARGS="/x86"
|
||||
elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
|
||||
elif test "x$TARGET_CPU" = xx86_64; then
|
||||
VS_ENV_ARGS="/x64"
|
||||
elif test "x$OPENJDK_TARGET_CPU" = xaarch64; then
|
||||
elif test "x$TARGET_CPU" = xaarch64; then
|
||||
VS_ENV_ARGS="/arm64"
|
||||
fi
|
||||
# PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
|
||||
|
@ -160,7 +165,8 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
|
|||
[specific MSVC toolset version to use, passed as -vcvars_ver argument to
|
||||
pass to vcvarsall.bat (Windows only)])])
|
||||
|
||||
VS_VERSION="$1"
|
||||
TARGET_CPU="$1"
|
||||
VS_VERSION="$2"
|
||||
eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
|
||||
eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
|
||||
eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
|
||||
|
@ -174,9 +180,9 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
|
|||
# When using --with-tools-dir, assume it points to the correct and default
|
||||
# version of Visual Studio or that --with-toolchain-version was also set.
|
||||
if test "x$with_tools_dir" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$with_tools_dir/../..], [--with-tools-dir])
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$with_tools_dir/../../..], [--with-tools-dir])
|
||||
if test "x$VS_ENV_CMD" = x; then
|
||||
# Having specified an argument which is incorrect will produce an instant failure;
|
||||
|
@ -189,45 +195,46 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
|
|||
fi
|
||||
|
||||
if test "x$VS_COMNTOOLS" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$VS_COMNTOOLS/../..], [$VS_COMNTOOLS_VAR variable])
|
||||
fi
|
||||
if test "x$PROGRAMFILES" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$PROGRAMFILES/$VS_INSTALL_DIR], [well-known name])
|
||||
fi
|
||||
# Work around the insanely named ProgramFiles(x86) env variable
|
||||
PROGRAMFILES_X86="`env | $SED -n 's/^ProgramFiles(x86)=//p'`"
|
||||
if test "x$PROGRAMFILES_X86" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$PROGRAMFILES_X86/$VS_INSTALL_DIR], [well-known name])
|
||||
fi
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
|
||||
[C:/Program Files/$VS_INSTALL_DIR], [well-known name])
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
|
||||
[C:/Program Files (x86)/$VS_INSTALL_DIR], [well-known name])
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[c:/program files/$VS_INSTALL_DIR], [well-known name])
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[c:/program files (x86)/$VS_INSTALL_DIR], [well-known name])
|
||||
if test "x$SDK_INSTALL_DIR" != x; then
|
||||
if test "x$ProgramW6432" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$ProgramW6432/$SDK_INSTALL_DIR], [well-known name])
|
||||
fi
|
||||
if test "x$PROGRAMW6432" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$PROGRAMW6432/$SDK_INSTALL_DIR], [well-known name])
|
||||
fi
|
||||
if test "x$PROGRAMFILES" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$PROGRAMFILES/$SDK_INSTALL_DIR], [well-known name])
|
||||
fi
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
|
||||
[C:/Program Files/$SDK_INSTALL_DIR], [well-known name])
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
|
||||
[C:/Program Files (x86)/$SDK_INSTALL_DIR], [well-known name])
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[c:/program files/$SDK_INSTALL_DIR], [well-known name])
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[c:/program files (x86)/$SDK_INSTALL_DIR], [well-known name])
|
||||
fi
|
||||
|
||||
VCVARS_VER=auto
|
||||
if test "x$VS_TOOLSET_SUPPORTED" != x; then
|
||||
if test "x$with_msvc_toolset_version" != x; then
|
||||
VS_ENV_ARGS="$VS_ENV_ARGS -vcvars_ver=$with_msvc_toolset_version"
|
||||
VCVARS_VER="$with_msvc_toolset_version"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
@ -264,44 +271,9 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
|
|||
eval VS_SUPPORTED="\${VS_SUPPORTED_${VS_VERSION}}"
|
||||
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
|
||||
|
||||
# The TOOLCHAIN_PATH from a devkit is in Unix format. In WSL we need a
|
||||
# windows version of the complete VS_PATH as VS_PATH_WINDOWS
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
# Convert the toolchain path
|
||||
OLDIFS="$IFS"
|
||||
IFS=":"
|
||||
VS_PATH_WINDOWS=""
|
||||
for i in $TOOLCHAIN_PATH; do
|
||||
path=$i
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([path])
|
||||
VS_PATH_WINDOWS="$VS_PATH_WINDOWS;$path"
|
||||
done
|
||||
IFS="$OLDIFS"
|
||||
# Append the current path from Windows env
|
||||
WINDOWS_PATH="`$CMD /c echo %PATH%`"
|
||||
VS_PATH_WINDOWS="$VS_PATH_WINDOWS;$WINDOWS_PATH"
|
||||
else
|
||||
VS_PATH="$TOOLCHAIN_PATH:$PATH"
|
||||
fi
|
||||
|
||||
# Convert DEVKIT_VS_INCLUDE into windows style VS_INCLUDE so that it
|
||||
# can still be exported as INCLUDE for compiler invocations without
|
||||
# SYSROOT_CFLAGS
|
||||
OLDIFS="$IFS"
|
||||
IFS=";"
|
||||
for i in $DEVKIT_VS_INCLUDE; do
|
||||
ipath=$i
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([ipath])
|
||||
VS_INCLUDE="$VS_INCLUDE;$ipath"
|
||||
done
|
||||
# Convert DEVKIT_VS_LIB into VS_LIB so that it can still be exported
|
||||
# as LIB for compiler invocations without SYSROOT_LDFLAGS
|
||||
for i in $DEVKIT_VS_LIB; do
|
||||
libpath=$i
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([libpath])
|
||||
VS_LIB="$VS_LIB;$libpath"
|
||||
done
|
||||
IFS="$OLDIFS"
|
||||
# For historical reasons, paths are separated by ; in devkit.info
|
||||
VS_INCLUDE=${DEVKIT_VS_INCLUDE//;/:}
|
||||
VS_LIB=${DEVKIT_VS_LIB//;/:}
|
||||
|
||||
AC_MSG_NOTICE([Found devkit $VS_DESCRIPTION])
|
||||
|
||||
|
@ -319,7 +291,7 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
|
|||
fi
|
||||
|
||||
for VS_VERSION in $VS_VERSIONS_PROBE_LIST; do
|
||||
TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE([$VS_VERSION])
|
||||
TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE($OPENJDK_TARGET_CPU, [$VS_VERSION])
|
||||
if test "x$VS_ENV_CMD" != x; then
|
||||
TOOLCHAIN_VERSION=$VS_VERSION
|
||||
eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
|
||||
|
@ -341,206 +313,118 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
|
|||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check if the VS env variables were setup prior to running configure.
|
||||
# If not, then find vcvarsall.bat and run it automatically, and integrate
|
||||
# the set env variables into the spec file.
|
||||
AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
|
||||
AC_DEFUN([TOOLCHAIN_EXTRACT_VISUAL_STUDIO_ENV],
|
||||
[
|
||||
# Store path to cygwin link.exe to help excluding it when searching for
|
||||
# VS linker. This must be done before changing the PATH when looking for VS.
|
||||
AC_PATH_PROG(CYGWIN_LINK, link.exe)
|
||||
if test "x$CYGWIN_LINK" != x; then
|
||||
AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
|
||||
"$CYGWIN_LINK" --version > /dev/null
|
||||
if test $? -eq 0 ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
# This might be the VS linker. Don't exclude it later on.
|
||||
CYGWIN_LINK=""
|
||||
fi
|
||||
fi
|
||||
TARGET_CPU=$1
|
||||
|
||||
# First-hand choice is to locate and run the vsvars bat file.
|
||||
TOOLCHAIN_FIND_VISUAL_STUDIO
|
||||
AC_MSG_NOTICE([Trying to extract Visual Studio environment variables for $TARGET_CPU])
|
||||
AC_MSG_NOTICE([using $VS_ENV_CMD $VS_ENV_ARGS])
|
||||
|
||||
# If we have a devkit, skip all of the below.
|
||||
if test "x$DEVKIT_VS_VERSION" = x; then
|
||||
if test "x$VS_ENV_CMD" != x; then
|
||||
# We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
|
||||
UTIL_FIXUP_EXECUTABLE(VS_ENV_CMD)
|
||||
|
||||
# Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
|
||||
AC_MSG_NOTICE([Trying to extract Visual Studio environment variables])
|
||||
|
||||
# We need to create a couple of temporary files.
|
||||
VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env"
|
||||
VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env-$TARGET_CPU"
|
||||
$MKDIR -p $VS_ENV_TMP_DIR
|
||||
|
||||
# Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment).
|
||||
# Instead create a shell script which will set the relevant variables when run.
|
||||
WINPATH_VS_ENV_CMD="$VS_ENV_CMD"
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD])
|
||||
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
WINPATH_BASH="bash"
|
||||
else
|
||||
WINPATH_BASH="$BASH"
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH])
|
||||
fi
|
||||
|
||||
# Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell
|
||||
# script (executable by bash) that will setup the important variables.
|
||||
EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat"
|
||||
$ECHO "@echo off" > $EXTRACT_VC_ENV_BAT_FILE
|
||||
# This will end up something like:
|
||||
# call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat
|
||||
$ECHO "call \"$WINPATH_VS_ENV_CMD\" $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE
|
||||
# In some cases, the VS_ENV_CMD will change directory, change back so
|
||||
# the set-vs-env.sh ends up in the right place.
|
||||
$ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
# These will end up something like:
|
||||
# echo VS_PATH=\"$PATH\" > set-vs-env.sh
|
||||
# The trailing space for everyone except PATH is no typo, but is needed due
|
||||
# to trailing \ in the Windows paths. These will be stripped later.
|
||||
# Trying pure CMD extract. This results in windows paths that need to
|
||||
# be converted post extraction, but a simpler script.
|
||||
$ECHO 'echo VS_PATH="%PATH%" > set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
$ECHO 'echo VS_INCLUDE="%INCLUDE% " >> set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
$ECHO 'echo VS_LIB="%LIB% " >> set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
$ECHO 'echo VCINSTALLDIR="%VCINSTALLDIR% " >> set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
$ECHO 'echo VCToolsRedistDir="%VCToolsRedistDir% " >> set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
$ECHO 'echo WindowsSdkDir="%WindowsSdkDir% " >> set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
$ECHO 'echo WINDOWSSDKDIR="%WINDOWSSDKDIR% " >> set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
else
|
||||
# These will end up something like:
|
||||
# C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh
|
||||
# The trailing space for everyone except PATH is no typo, but is needed due
|
||||
# to trailing \ in the Windows paths. These will be stripped later.
|
||||
$ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
$ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
$ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
$ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
$ECHO "$WINPATH_BASH -c 'echo VCToolsRedistDir="'\"$VCToolsRedistDir \" >> set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
$ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
$ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \
|
||||
>> $EXTRACT_VC_ENV_BAT_FILE
|
||||
fi
|
||||
|
||||
# Now execute the newly created bat file.
|
||||
# Change directory so we don't need to mess with Windows paths in redirects.
|
||||
cd $VS_ENV_TMP_DIR
|
||||
$CMD /c extract-vs-env.bat > extract-vs-env.log 2>&1
|
||||
cd $CONFIGURE_START_DIR
|
||||
OLDPATH="$PATH"
|
||||
# Make sure we only capture additions to PATH needed by VS.
|
||||
# Clear out path, but need system dir present for vsvars cmd file to be able to run
|
||||
export PATH=$WINENV_PREFIX/c/windows/system32
|
||||
# The "| cat" is to stop SetEnv.Cmd to mess with system colors on some systems
|
||||
# We can't pass -vcvars_ver=$VCVARS_VER here because cmd.exe eats all '='
|
||||
# in bat file arguments. :-(
|
||||
$FIXPATH $CMD /c "$TOPDIR/make/scripts/extract-vs-env.cmd" "$VS_ENV_CMD" \
|
||||
"$VS_ENV_TMP_DIR/set-vs-env.sh" $VCVARS_VER $VS_ENV_ARGS \
|
||||
> $VS_ENV_TMP_DIR/extract-vs-env.log | $CAT 2>&1
|
||||
PATH="$OLDPATH"
|
||||
|
||||
if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
|
||||
AC_MSG_NOTICE([Could not succesfully extract the environment variables needed for the VS setup.])
|
||||
AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
|
||||
AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
|
||||
AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation.])
|
||||
AC_MSG_NOTICE([To analyze the problem, see extract-vs-env.log and extract-vs-env.bat in])
|
||||
AC_MSG_NOTICE([$VS_ENV_TMP_DIR.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
|
||||
# Remove windows line endings
|
||||
$SED -i -e 's|\r||g' $VS_ENV_TMP_DIR/set-vs-env.sh
|
||||
|
||||
# Now set all paths and other env variables. This will allow the rest of
|
||||
# the configure script to find and run the compiler in the proper way.
|
||||
AC_MSG_NOTICE([Setting extracted environment variables])
|
||||
# Now set all paths and other env variables by executing the generated
|
||||
# shell script. This will allow the rest of the configure script to find
|
||||
# and run the compiler in the proper way.
|
||||
AC_MSG_NOTICE([Setting extracted environment variables for $TARGET_CPU])
|
||||
. $VS_ENV_TMP_DIR/set-vs-env.sh
|
||||
# Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
|
||||
# also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR.
|
||||
|
||||
# In WSL, the extracted VS_PATH is Windows style. This needs to be
|
||||
# rewritten as Unix style and the Windows style version is saved
|
||||
# in VS_PATH_WINDOWS.
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
OLDIFS="$IFS"
|
||||
IFS=";"
|
||||
# Convert VS_PATH to unix style
|
||||
VS_PATH_WINDOWS="$VS_PATH"
|
||||
VS_PATH=""
|
||||
for i in $VS_PATH_WINDOWS; do
|
||||
path=$i
|
||||
# Only process non-empty elements
|
||||
if test "x$path" != x; then
|
||||
IFS="$OLDIFS"
|
||||
# Check that directory exists before calling fixup_path
|
||||
testpath=$path
|
||||
UTIL_REWRITE_AS_UNIX_PATH([testpath])
|
||||
if test -d "$testpath"; then
|
||||
UTIL_FIXUP_PATH([path])
|
||||
UTIL_APPEND_TO_PATH(VS_PATH, $path)
|
||||
fi
|
||||
IFS=";"
|
||||
fi
|
||||
done
|
||||
IFS="$OLDIFS"
|
||||
fi
|
||||
# Extract only what VS_ENV_CMD added to the PATH
|
||||
VS_PATH=${PATH_AFTER/"$PATH_BEFORE"}
|
||||
VS_PATH=${VS_PATH//::/:}
|
||||
|
||||
else
|
||||
# We did not find a vsvars bat file, let's hope we are run from a VS command prompt.
|
||||
AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment])
|
||||
fi
|
||||
fi
|
||||
# Remove any paths containing # (typically F#) as that messes up make. This
|
||||
# is needed if visual studio was installed with F# support.
|
||||
[ VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[^:#]*#[^:]*://g'` ]
|
||||
|
||||
# At this point, we should have correct variables in the environment, or we can't continue.
|
||||
AC_MSG_CHECKING([for Visual Studio variables])
|
||||
|
||||
if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x \
|
||||
|| test "x$WINDOWSSDKDIR" != x || test "x$DEVKIT_NAME" != x; then
|
||||
if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then
|
||||
AC_MSG_RESULT([present but broken])
|
||||
AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
|
||||
else
|
||||
AC_MSG_RESULT([ok])
|
||||
# Remove any trailing "\" ";" and " " from the variables.
|
||||
VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED -e 's/\\\\*;* *$//'`
|
||||
VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\*;* *$//'`
|
||||
VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'`
|
||||
VCToolsRedistDir=`$ECHO "$VCToolsRedistDir" | $SED 's/\\\\* *$//'`
|
||||
WindowsSdkDir=`$ECHO "$WindowsSdkDir" | $SED 's/\\\\* *$//'`
|
||||
WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'`
|
||||
# Sometimes case is off
|
||||
if test -z "$WINDOWSSDKDIR"; then
|
||||
WINDOWSSDKDIR="$WindowsSdkDir"
|
||||
fi
|
||||
# Remove any paths containing # (typically F#) as that messes up make. This
|
||||
# is needed if visual studio was installed with F# support.
|
||||
VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[[^:#]]*#[^:]*://g'`
|
||||
# Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
|
||||
# also define VCINSTALLDIR and WINDOWSSDKDIR. All are in
|
||||
# unix style.
|
||||
])
|
||||
|
||||
AC_SUBST(VS_PATH)
|
||||
AC_SUBST(VS_INCLUDE)
|
||||
AC_SUBST(VS_LIB)
|
||||
################################################################################
|
||||
# Check if the VS env variables were setup prior to running configure.
|
||||
# If not, then find vcvarsall.bat and run it automatically, and integrate
|
||||
# the set env variables into the spec file.
|
||||
AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
|
||||
[
|
||||
# Locate the vsvars bat file and save it as VS_ENV_CMD
|
||||
TOOLCHAIN_FIND_VISUAL_STUDIO
|
||||
|
||||
# If we have a devkit, we don't need to run VS_ENV_CMD
|
||||
if test "x$DEVKIT_VS_VERSION" = x; then
|
||||
if test "x$VS_ENV_CMD" != x; then
|
||||
# We have found a Visual Studio environment on disk, let's extract variables
|
||||
# from the vsvars bat file into shell variables in the configure script.
|
||||
TOOLCHAIN_EXTRACT_VISUAL_STUDIO_ENV($OPENJDK_TARGET_CPU)
|
||||
|
||||
# Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
|
||||
# also define VCINSTALLDIR and WINDOWSSDKDIR. All are in
|
||||
# unix style.
|
||||
else
|
||||
# We did not find a vsvars bat file.
|
||||
AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
|
||||
fi
|
||||
fi
|
||||
|
||||
# At this point, we should have correct variables in the environment
|
||||
AC_MSG_CHECKING([that Visual Studio variables have been correctly extracted])
|
||||
|
||||
if test "x$VCINSTALLDIR" != x || test "x$WINDOWSSDKDIR" != x \
|
||||
|| test "x$DEVKIT_NAME" != x; then
|
||||
if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then
|
||||
AC_MSG_RESULT([no; Visual Studio present but broken])
|
||||
AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
|
||||
else
|
||||
AC_MSG_RESULT([ok])
|
||||
|
||||
# Turn VS_PATH into TOOLCHAIN_PATH
|
||||
TOOLCHAIN_PATH="$TOOLCHAIN_PATH:$VS_PATH"
|
||||
|
||||
# Convert VS_INCLUDE and VS_LIB into sysroot flags
|
||||
TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS
|
||||
|
||||
AC_SUBST(VS_PATH_WINDOWS)
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([not found])
|
||||
|
||||
if test "x$VS_ENV_CMD" = x; then
|
||||
AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk,])
|
||||
AC_MSG_NOTICE([nor is this script run from a Visual Studio command prompt.])
|
||||
AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk])
|
||||
else
|
||||
AC_MSG_NOTICE([Running the extraction script failed.])
|
||||
AC_MSG_NOTICE([Running the extraction script failed])
|
||||
fi
|
||||
AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
|
||||
AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
|
||||
AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation.])
|
||||
AC_MSG_NOTICE([To analyze the problem, see extract-vs-env.log and extract-vs-env.bat in])
|
||||
AC_MSG_NOTICE([$VS_ENV_TMP_DIR.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
])
|
||||
|
@ -556,15 +440,6 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
|
|||
# Need to check if the found msvcr is correct architecture
|
||||
AC_MSG_CHECKING([found $DLL_NAME architecture])
|
||||
MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
|
||||
# The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
|
||||
# on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
|
||||
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
|
||||
CORRECT_MSVCR_ARCH="PE32 executable"
|
||||
else
|
||||
CORRECT_MSVCR_ARCH="PE32+ executable"
|
||||
fi
|
||||
else
|
||||
if test "x$OPENJDK_TARGET_CPU" = xx86; then
|
||||
CORRECT_MSVCR_ARCH=386
|
||||
elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
|
||||
|
@ -575,7 +450,6 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
|
|||
# https://github.com/file/file/commit/b849b1af098ddd530094bf779b58431395db2e10#diff-ff2eced09e6860de75057dd731d092aeR142
|
||||
CORRECT_MSVCR_ARCH="PE32+ executable"
|
||||
fi
|
||||
fi
|
||||
if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
|
||||
AC_MSG_RESULT([ok])
|
||||
MSVC_DLL="$POSSIBLE_MSVC_DLL"
|
||||
|
@ -603,20 +477,15 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
|
|||
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
if test "x$VCINSTALLDIR" != x; then
|
||||
CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
|
||||
UTIL_FIXUP_PATH(CYGWIN_VC_INSTALL_DIR)
|
||||
if test "$VS_VERSION" -lt 2017; then
|
||||
# Probe: Using well-known location from Visual Studio 12.0 and older
|
||||
POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/$vs_target_cpu/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
|
||||
POSSIBLE_MSVC_DLL="$VCINSTALLDIR/redist/$vs_target_cpu/microsoft.vc${VS_VERSION_INTERNAL}.crt/$DLL_NAME"
|
||||
else
|
||||
CYGWIN_VC_TOOLS_REDIST_DIR="$VCToolsRedistDir"
|
||||
UTIL_FIXUP_PATH(CYGWIN_VC_TOOLS_REDIST_DIR)
|
||||
# Probe: Using well-known location from VS 2017 and VS 2019
|
||||
POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_TOOLS_REDIST_DIR/$vs_target_cpu/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
|
||||
POSSIBLE_MSVC_DLL="`ls $VCToolsRedistDir/$vs_target_cpu/microsoft.vc${VS_VERSION_INTERNAL}.crt/$DLL_NAME 2> /dev/null`"
|
||||
fi
|
||||
# In case any of the above finds more than one file, loop over them.
|
||||
for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do
|
||||
$ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll"
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$possible_msvc_dll],
|
||||
[well-known location in VCINSTALLDIR])
|
||||
done
|
||||
|
@ -632,40 +501,44 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
|
|||
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
# Probe: Look in the Windows system32 directory
|
||||
CYGWIN_SYSTEMROOT="$SYSTEMROOT"
|
||||
UTIL_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
|
||||
POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME"
|
||||
WIN_SYSTEMROOT="$SYSTEMROOT"
|
||||
UTIL_FIXUP_PATH(WIN_SYSTEMROOT, NOFAIL)
|
||||
if test "x$WIN_SYSTEMROOT" != x; then
|
||||
POSSIBLE_MSVC_DLL="$WIN_SYSTEMROOT/system32/$DLL_NAME"
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
|
||||
[well-known location in SYSTEMROOT])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
# Probe: If Visual Studio Express is installed, there is usually one with the debugger
|
||||
if test "x$VS100COMNTOOLS" != x; then
|
||||
CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
|
||||
UTIL_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
|
||||
POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
|
||||
WIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
|
||||
UTIL_FIXUP_PATH(WIN_VS_TOOLS_DIR, NOFAIL)
|
||||
if test "x$WIN_VS_TOOLS_DIR" != x; then
|
||||
POSSIBLE_MSVC_DLL=`$FIND "$WIN_VS_TOOLS_DIR" -name $DLL_NAME \
|
||||
| $GREP -i /$vs_target_cpu/ | $HEAD --lines 1`
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
|
||||
[search of VS100COMNTOOLS])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
# Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
|
||||
# (This was the original behaviour; kept since it might turn something up)
|
||||
if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
|
||||
if test "x$VCINSTALLDIR" != x; then
|
||||
if test "x$OPENJDK_TARGET_CPU" = xx86; then
|
||||
POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
|
||||
POSSIBLE_MSVC_DLL=`$FIND "$VCINSTALLDIR" -name $DLL_NAME \
|
||||
| $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $GREP -v arm64 | $HEAD --lines 1`
|
||||
if test "x$POSSIBLE_MSVC_DLL" = x; then
|
||||
# We're grasping at straws now...
|
||||
POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
|
||||
POSSIBLE_MSVC_DLL=`$FIND "$VCINSTALLDIR" -name $DLL_NAME \
|
||||
| $HEAD --lines 1`
|
||||
fi
|
||||
else
|
||||
POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
|
||||
| $GREP $vs_target_cpu | $HEAD --lines 1`
|
||||
POSSIBLE_MSVC_DLL=`$FIND "$VCINSTALLDIR" -name $DLL_NAME \
|
||||
| $GREP x64 | $HEAD --lines 1`
|
||||
fi
|
||||
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
|
||||
|
@ -729,9 +602,9 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
|
|||
fi
|
||||
|
||||
AC_ARG_WITH(vcruntime-1-dll, [AS_HELP_STRING([--with-vcruntime-1-dll],
|
||||
[path to microsoft C++ runtime dll (vcruntime*_1.dll) (Windows 64-bits only) @<:@probed@:>@])])
|
||||
[path to microsoft C++ runtime dll (vcruntime*_1.dll) (Windows x64 only) @<:@probed@:>@])])
|
||||
|
||||
if test "x$VCRUNTIME_1_NAME" != "x" -a "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
if test "x$VCRUNTIME_1_NAME" != "x" && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
|
||||
if test "x$with_vcruntime_1_dll" != x; then
|
||||
# If given explicitly by user, do not probe. If not present, fail directly.
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($VCRUNTIME_1_NAME, [$with_vcruntime_1_dll],
|
||||
|
@ -750,13 +623,13 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
|
|||
TOOLCHAIN_SETUP_MSVC_DLL([${VCRUNTIME_1_NAME}])
|
||||
VCRUNTIME_1_DLL="$MSVC_DLL"
|
||||
fi
|
||||
AC_SUBST(VCRUNTIME_1_DLL)
|
||||
fi
|
||||
AC_SUBST(VCRUNTIME_1_DLL)
|
||||
|
||||
AC_ARG_WITH(ucrt-dll-dir, [AS_HELP_STRING([--with-ucrt-dll-dir],
|
||||
[path to Microsoft Windows Kit UCRT DLL dir (Windows only) @<:@probed@:>@])])
|
||||
|
||||
if test "x$USE_UCRT" = "xtrue"; then
|
||||
if test "x$USE_UCRT" = "xtrue" && test "x$OPENJDK_TARGET_CPU" != xaarch64; then
|
||||
AC_MSG_CHECKING([for UCRT DLL dir])
|
||||
if test "x$with_ucrt_dll_dir" != x; then
|
||||
if test -z "$(ls -d "$with_ucrt_dll_dir/"*.dll 2> /dev/null)"; then
|
||||
|
@ -771,19 +644,16 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
|
|||
UCRT_DLL_DIR="$DEVKIT_UCRT_DLL_DIR"
|
||||
AC_MSG_RESULT($UCRT_DLL_DIR)
|
||||
else
|
||||
CYGWIN_WINDOWSSDKDIR="${WINDOWSSDKDIR}"
|
||||
UTIL_FIXUP_PATH([CYGWIN_WINDOWSSDKDIR])
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
|
||||
dll_subdir=$OPENJDK_TARGET_CPU
|
||||
if test "x$dll_subdir" = "xaarch64"; then
|
||||
dll_subdir="arm64"
|
||||
elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
|
||||
elif test "x$dll_subdir" = "xx86_64"; then
|
||||
dll_subdir="x64"
|
||||
elif test "x$OPENJDK_TARGET_CPU" = "xx86"; then
|
||||
dll_subdir="x86"
|
||||
fi
|
||||
UCRT_DLL_DIR="$CYGWIN_WINDOWSSDKDIR/Redist/ucrt/DLLs/$dll_subdir"
|
||||
UCRT_DLL_DIR="$WINDOWSSDKDIR/redist/ucrt/dlls/$dll_subdir"
|
||||
if test -z "$(ls -d "$UCRT_DLL_DIR/"*.dll 2> /dev/null)"; then
|
||||
# Try with version subdir
|
||||
UCRT_DLL_DIR="`ls -d $CYGWIN_WINDOWSSDKDIR/Redist/*/ucrt/DLLs/$dll_subdir \
|
||||
UCRT_DLL_DIR="`ls -d $WINDOWSSDKDIR/redist/*/ucrt/dlls/$dll_subdir \
|
||||
2> /dev/null | $SORT -d | $HEAD -n1`"
|
||||
if test -z "$UCRT_DLL_DIR" \
|
||||
|| test -z "$(ls -d "$UCRT_DLL_DIR/"*.dll 2> /dev/null)"; then
|
||||
|
@ -805,43 +675,23 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
|
|||
# Setup the sysroot flags and add them to global CFLAGS and LDFLAGS so
|
||||
# that configure can use them while detecting compilers.
|
||||
# TOOLCHAIN_TYPE is available here.
|
||||
# Param 1 - Optional prefix to all variables. (e.g BUILD_)
|
||||
# Param 1 - Optional prefix to SYSROOT variables. (e.g BUILD_)
|
||||
# Param 2 - Optional prefix to VS variables. (e.g BUILD_)
|
||||
AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS],
|
||||
[
|
||||
OLDIFS="$IFS"
|
||||
IFS=";"
|
||||
# Convert $1VS_INCLUDE into $1SYSROOT_CFLAGS
|
||||
for i in [$]$1VS_INCLUDE; do
|
||||
ipath=$i
|
||||
# Only process non-empty elements
|
||||
if test "x$ipath" != x; then
|
||||
IFS="$OLDIFS"
|
||||
# Check that directory exists before calling fixup_path
|
||||
testpath=$ipath
|
||||
UTIL_REWRITE_AS_UNIX_PATH([testpath])
|
||||
if test -d "$testpath"; then
|
||||
UTIL_FIXUP_PATH([ipath])
|
||||
IFS=":"
|
||||
|
||||
# Convert VS_INCLUDE into SYSROOT_CFLAGS
|
||||
for ipath in [$]$2VS_INCLUDE; do
|
||||
$1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -I$ipath"
|
||||
fi
|
||||
IFS=";"
|
||||
fi
|
||||
done
|
||||
# Convert $1VS_LIB into $1SYSROOT_LDFLAGS
|
||||
for i in [$]$1VS_LIB; do
|
||||
libpath=$i
|
||||
# Only process non-empty elements
|
||||
if test "x$libpath" != x; then
|
||||
IFS="$OLDIFS"
|
||||
# Check that directory exists before calling fixup_path
|
||||
testpath=$libpath
|
||||
UTIL_REWRITE_AS_UNIX_PATH([testpath])
|
||||
if test -d "$testpath"; then
|
||||
UTIL_FIXUP_PATH([libpath])
|
||||
|
||||
# Convert VS_LIB into SYSROOT_LDFLAGS
|
||||
for libpath in [$]$2VS_LIB; do
|
||||
$1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -libpath:$libpath"
|
||||
fi
|
||||
IFS=";"
|
||||
fi
|
||||
done
|
||||
|
||||
IFS="$OLDIFS"
|
||||
|
||||
AC_SUBST($1SYSROOT_CFLAGS)
|
|
@ -24,7 +24,6 @@
|
|||
#
|
||||
|
||||
m4_include([util_paths.m4])
|
||||
m4_include([util_windows.m4])
|
||||
|
||||
###############################################################################
|
||||
# Create a function/macro that takes a series of named arguments. The call is
|
||||
|
@ -462,151 +461,3 @@ UTIL_DEFUN_NAMED([UTIL_ARG_ENABLE],
|
|||
fi
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Test that variable $1 denoting a program is not empty. If empty, exit with an error.
|
||||
# $1: variable to check
|
||||
AC_DEFUN([UTIL_CHECK_NONEMPTY],
|
||||
[
|
||||
if test "x[$]$1" = x; then
|
||||
AC_MSG_ERROR([Could not find required tool for $1])
|
||||
fi
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Setup a tool for the given variable. If correctly specified by the user,
|
||||
# use that value, otherwise search for the tool using the supplied code snippet.
|
||||
# $1: variable to set
|
||||
# $2: code snippet to call to look for the tool
|
||||
# $3: code snippet to call if variable was used to find tool
|
||||
AC_DEFUN([UTIL_SETUP_TOOL],
|
||||
[
|
||||
# Publish this variable in the help.
|
||||
AC_ARG_VAR($1, [Override default value for $1])
|
||||
|
||||
if [[ -z "${$1+x}" ]]; then
|
||||
# The variable is not set by user, try to locate tool using the code snippet
|
||||
$2
|
||||
else
|
||||
# The variable is set, but is it from the command line or the environment?
|
||||
|
||||
# Try to remove the string !$1! from our list.
|
||||
try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!$1!/}
|
||||
if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
|
||||
# If it failed, the variable was not from the command line. Ignore it,
|
||||
# but warn the user (except for BASH, which is always set by the calling BASH).
|
||||
if test "x$1" != xBASH; then
|
||||
AC_MSG_WARN([Ignoring value of $1 from the environment. Use command line variables instead.])
|
||||
fi
|
||||
# Try to locate tool using the code snippet
|
||||
$2
|
||||
else
|
||||
# If it succeeded, then it was overridden by the user. We will use it
|
||||
# for the tool.
|
||||
|
||||
# First remove it from the list of overridden variables, so we can test
|
||||
# for unknown variables in the end.
|
||||
CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
|
||||
|
||||
tool_override=[$]$1
|
||||
AC_MSG_NOTICE([User supplied override $1="$tool_override"])
|
||||
|
||||
# Check if we try to supply an empty value
|
||||
if test "x$tool_override" = x; then
|
||||
AC_MSG_CHECKING([for $1])
|
||||
AC_MSG_RESULT([disabled])
|
||||
else
|
||||
# Split up override in command part and argument part
|
||||
tool_and_args=($tool_override)
|
||||
[ tool_command=${tool_and_args[0]} ]
|
||||
[ unset 'tool_and_args[0]' ]
|
||||
[ tool_args=${tool_and_args[@]} ]
|
||||
|
||||
# Check if the provided tool contains a complete path.
|
||||
tool_basename="${tool_command##*/}"
|
||||
if test "x$tool_basename" = "x$tool_command"; then
|
||||
# A command without a complete path is provided, search $PATH.
|
||||
AC_MSG_NOTICE([Will search for user supplied tool "$tool_basename"])
|
||||
AC_PATH_PROG($1, $tool_basename)
|
||||
if test "x[$]$1" = x; then
|
||||
AC_MSG_ERROR([User supplied tool $1="$tool_basename" could not be found])
|
||||
fi
|
||||
else
|
||||
# Otherwise we believe it is a complete path. Use it as it is.
|
||||
AC_MSG_NOTICE([Will use user supplied tool "$tool_command"])
|
||||
AC_MSG_CHECKING([for $tool_command])
|
||||
if test ! -x "$tool_command" && test ! -x "$tool_command.exe"; then
|
||||
AC_MSG_RESULT([not found])
|
||||
AC_MSG_ERROR([User supplied tool $1="$tool_command" does not exist or is not executable])
|
||||
fi
|
||||
$1="$tool_command"
|
||||
AC_MSG_RESULT([found])
|
||||
fi
|
||||
if test "x$tool_args" != x; then
|
||||
# If we got arguments, re-append them to the command after the fixup.
|
||||
$1="[$]$1 $tool_args"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
$3
|
||||
fi
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Call UTIL_SETUP_TOOL with AC_PATH_PROGS to locate the tool
|
||||
# $1: variable to set
|
||||
# $2: executable name (or list of names) to look for
|
||||
# $3: [path]
|
||||
AC_DEFUN([UTIL_PATH_PROGS],
|
||||
[
|
||||
UTIL_SETUP_TOOL($1, [AC_PATH_PROGS($1, $2, , $3)])
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Call UTIL_SETUP_TOOL with AC_CHECK_TOOLS to locate the tool
|
||||
# $1: variable to set
|
||||
# $2: executable name (or list of names) to look for
|
||||
AC_DEFUN([UTIL_CHECK_TOOLS],
|
||||
[
|
||||
UTIL_SETUP_TOOL($1, [AC_CHECK_TOOLS($1, $2)])
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Like UTIL_PATH_PROGS but fails if no tool was found.
|
||||
# $1: variable to set
|
||||
# $2: executable name (or list of names) to look for
|
||||
# $3: [path]
|
||||
AC_DEFUN([UTIL_REQUIRE_PROGS],
|
||||
[
|
||||
UTIL_PATH_PROGS($1, $2, , $3)
|
||||
UTIL_CHECK_NONEMPTY($1)
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Like UTIL_SETUP_TOOL but fails if no tool was found.
|
||||
# $1: variable to set
|
||||
# $2: autoconf macro to call to look for the special tool
|
||||
AC_DEFUN([UTIL_REQUIRE_SPECIAL],
|
||||
[
|
||||
UTIL_SETUP_TOOL($1, [$2])
|
||||
UTIL_CHECK_NONEMPTY($1)
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Like UTIL_REQUIRE_PROGS but also allows for bash built-ins
|
||||
# $1: variable to set
|
||||
# $2: executable name (or list of names) to look for
|
||||
# $3: [path]
|
||||
AC_DEFUN([UTIL_REQUIRE_BUILTIN_PROGS],
|
||||
[
|
||||
UTIL_SETUP_TOOL($1, [AC_PATH_PROGS($1, $2, , $3)])
|
||||
if test "x[$]$1" = x; then
|
||||
AC_MSG_NOTICE([Required tool $2 not found in PATH, checking built-in])
|
||||
if type -p $2 > /dev/null 2>&1; then
|
||||
AC_MSG_NOTICE([Found $2 as shell built-in. Using it])
|
||||
$1="$2"
|
||||
else
|
||||
AC_MSG_ERROR([Required tool $2 also not found as built-in.])
|
||||
fi
|
||||
fi
|
||||
UTIL_CHECK_NONEMPTY($1)
|
||||
])
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
# questions.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# Appends a string to a path variable, only adding the : when needed.
|
||||
AC_DEFUN([UTIL_APPEND_TO_PATH],
|
||||
[
|
||||
|
@ -35,6 +36,7 @@ AC_DEFUN([UTIL_APPEND_TO_PATH],
|
|||
fi
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Prepends a string to a path variable, only adding the : when needed.
|
||||
AC_DEFUN([UTIL_PREPEND_TO_PATH],
|
||||
[
|
||||
|
@ -47,34 +49,6 @@ AC_DEFUN([UTIL_PREPEND_TO_PATH],
|
|||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# This will make a path absolute. Assumes it's already a unix path. Also
|
||||
# resolves ~ to homedir.
|
||||
AC_DEFUN([UTIL_ABSOLUTE_PATH],
|
||||
[
|
||||
if test "x[$]$1" != x; then
|
||||
new_path="[$]$1"
|
||||
|
||||
# Use eval to expand a potential ~. This technique does not work if there
|
||||
# are spaces in the path (which is valid at this point on Windows), so only
|
||||
# try to apply it if there is an actual ~ first in the path.
|
||||
if [ [[ "$new_path" = "~"* ]] ]; then
|
||||
eval new_path="$new_path"
|
||||
if test ! -f "$new_path" && test ! -d "$new_path"; then
|
||||
AC_MSG_ERROR([The new_path of $1, which resolves as "$new_path", is not found.])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -d "$new_path"; then
|
||||
$1="`cd "$new_path"; $THEPWDCMD -L`"
|
||||
else
|
||||
dir="`$DIRNAME "$new_path"`"
|
||||
base="`$BASENAME "$new_path"`"
|
||||
$1="`cd "$dir"; $THEPWDCMD -L`/$base"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# This will make sure the given variable points to a full and proper
|
||||
# path. This means:
|
||||
|
@ -84,31 +58,100 @@ AC_DEFUN([UTIL_ABSOLUTE_PATH],
|
|||
# 2) The path will be absolute, and it will be in unix-style (on
|
||||
# cygwin).
|
||||
# $1: The name of the variable to fix
|
||||
# $2: if NOFAIL, errors will be silently ignored
|
||||
AC_DEFUN([UTIL_FIXUP_PATH],
|
||||
[
|
||||
# Only process if variable expands to non-empty
|
||||
if test "x[$]$1" != x; then
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
UTIL_FIXUP_PATH_CYGWIN($1)
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
|
||||
UTIL_FIXUP_PATH_MSYS($1)
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
UTIL_FIXUP_PATH_WSL($1)
|
||||
else
|
||||
# We're on a unix platform. Hooray! :)
|
||||
path="[$]$1"
|
||||
has_space=`$ECHO "$path" | $GREP " "`
|
||||
if test "x$has_space" != x; then
|
||||
if test "x$path" != x; then
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
if test "x$2" = "xNOFAIL"; then
|
||||
quiet_option="-q"
|
||||
fi
|
||||
imported_path=`$FIXPATH_BASE $quiet_option import "$path"`
|
||||
$FIXPATH_BASE verify "$imported_path"
|
||||
if test $? -ne 0; then
|
||||
if test "x$2" != "xNOFAIL"; then
|
||||
AC_MSG_ERROR([The path of $1, which resolves as "$path", could not be imported.])
|
||||
else
|
||||
imported_path=""
|
||||
fi
|
||||
fi
|
||||
if test "x$imported_path" != "x$path"; then
|
||||
$1="$imported_path"
|
||||
fi
|
||||
else
|
||||
[ if [[ "$path" =~ " " ]]; then ]
|
||||
if test "x$2" != "xNOFAIL"; then
|
||||
AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.])
|
||||
AC_MSG_ERROR([Spaces are not allowed in this path.])
|
||||
else
|
||||
path=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# Use eval to expand a potential ~.
|
||||
eval new_path="$path"
|
||||
if test ! -e "$new_path"; then
|
||||
if test "x$2" != "xNOFAIL"; then
|
||||
AC_MSG_ERROR([The path of $1, which resolves as "$new_path", is not found.])
|
||||
else
|
||||
new_path=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# Make the path absolute
|
||||
if test "x$new_path" != x; then
|
||||
if test -d "$new_path"; then
|
||||
path="`cd "$new_path"; pwd -L`"
|
||||
else
|
||||
dir="`$DIRNAME "$new_path"`"
|
||||
base="`$BASENAME "$new_path"`"
|
||||
path="`cd "$dir"; pwd -L`/$base"
|
||||
fi
|
||||
else
|
||||
path=""
|
||||
fi
|
||||
|
||||
UTIL_ABSOLUTE_PATH(path)
|
||||
$1="$path"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Check if the given file is a unix-style or windows-style executable, that is,
|
||||
# if it expects paths in unix-style or windows-style.
|
||||
# Returns "windows" or "unix" in $RESULT.
|
||||
AC_DEFUN([UTIL_CHECK_WINENV_EXEC_TYPE],
|
||||
[
|
||||
# For cygwin and msys2, if it's linked with the correct helper lib, it
|
||||
# accept unix paths
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin" || \
|
||||
test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then
|
||||
linked_libs=`$LDD $1 2>&1`
|
||||
if test $? -ne 0; then
|
||||
# Non-binary files (e.g. shell scripts) are unix files
|
||||
RESULT=unix
|
||||
else
|
||||
[ if [[ "$linked_libs" =~ $WINENV_MARKER_DLL ]]; then ]
|
||||
RESULT=unix
|
||||
else
|
||||
RESULT=windows
|
||||
fi
|
||||
fi
|
||||
elif test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
# On WSL, we can check if it is a PE file
|
||||
file_type=`$FILE -b $1 2>&1`
|
||||
[ if [[ $file_type =~ PE.*Windows ]]; then ]
|
||||
RESULT=windows
|
||||
else
|
||||
RESULT=unix
|
||||
fi
|
||||
else
|
||||
RESULT=unix
|
||||
fi
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# This will make sure the given variable points to a executable
|
||||
# with a full and proper path. This means:
|
||||
|
@ -121,65 +164,331 @@ AC_DEFUN([UTIL_FIXUP_PATH],
|
|||
# If the input variable does not have a directory specification, then
|
||||
# it need to be in the PATH.
|
||||
# $1: The name of the variable to fix
|
||||
# $2: Where to look for the command (replaces $PATH)
|
||||
# $3: set to NOFIXPATH to skip prefixing FIXPATH, even if needed on platform
|
||||
AC_DEFUN([UTIL_FIXUP_EXECUTABLE],
|
||||
[
|
||||
# Only process if variable expands to non-empty
|
||||
input="[$]$1"
|
||||
|
||||
if test "x[$]$1" != x; then
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
UTIL_FIXUP_EXECUTABLE_CYGWIN($1)
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
|
||||
UTIL_FIXUP_EXECUTABLE_MSYS($1)
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
UTIL_FIXUP_EXECUTABLE_WSL($1)
|
||||
else
|
||||
# We're on a unix platform. Hooray! :)
|
||||
# Only process if variable expands to non-empty
|
||||
if test "x$input" != x; then
|
||||
# First separate the path from the arguments. This will split at the first
|
||||
# space.
|
||||
complete="[$]$1"
|
||||
path="${complete%% *}"
|
||||
tmp="$complete EOL"
|
||||
arguments="${tmp#* }"
|
||||
|
||||
# Cannot rely on the command "which" here since it doesn't always work.
|
||||
is_absolute_path=`$ECHO "$path" | $GREP ^/`
|
||||
if test -z "$is_absolute_path"; then
|
||||
# Path to executable is not absolute. Find it.
|
||||
IFS_save="$IFS"
|
||||
IFS=:
|
||||
for p in $PATH; do
|
||||
if test -f "$p/$path" && test -x "$p/$path"; then
|
||||
new_path="$p/$path"
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$IFS_save"
|
||||
[ if [[ "$OPENJDK_BUILD_OS" = "windows" && input =~ ^$FIXPATH ]]; then
|
||||
line="${input#$FIXPATH }"
|
||||
prefix="$FIXPATH "
|
||||
else
|
||||
# This is an absolute path, we can use it without further modifications.
|
||||
line="$input"
|
||||
prefix=""
|
||||
fi ]
|
||||
path="${line%% *}"
|
||||
arguments="${line#"$path"}"
|
||||
|
||||
[ if ! [[ "$path" =~ /|\\ ]]; then ]
|
||||
# This is a command without path (e.g. "gcc" or "echo")
|
||||
command_type=`type -t "$path"`
|
||||
if test "x$command_type" = xbuiltin || test "x$command_type" = xkeyword; then
|
||||
# Shell builtin or keyword; we're done here
|
||||
new_path="$path"
|
||||
else
|
||||
# Search in $PATH using bash built-in 'type -p'.
|
||||
saved_path="$PATH"
|
||||
if test "x$2" != x; then
|
||||
PATH="$2"
|
||||
fi
|
||||
new_path=`type -p "$path"`
|
||||
if test "x$new_path" = x && test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
# Try again with .exe
|
||||
new_path="`type -p "$path.exe"`"
|
||||
fi
|
||||
PATH="$saved_path"
|
||||
|
||||
if test "x$new_path" = x; then
|
||||
AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
|
||||
has_space=`$ECHO "$complete" | $GREP " "`
|
||||
if test "x$has_space" != x; then
|
||||
AC_MSG_NOTICE([The command for $1, which resolves as "$input", is not found in the PATH.])
|
||||
AC_MSG_ERROR([Cannot locate $path])
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# This is a path with slashes, don't look at $PATH
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
# fixpath.sh import will do all heavy lifting for us
|
||||
new_path=`$FIXPATH_BASE import "$path"`
|
||||
|
||||
if test ! -e $new_path; then
|
||||
# It failed, but maybe spaces were part of the path and not separating
|
||||
# the command and argument. Retry using that assumption.
|
||||
new_path=`$FIXPATH_BASE import "$input"`
|
||||
if test ! -e $new_path; then
|
||||
AC_MSG_NOTICE([The command for $1, which resolves as "$input", can not be found.])
|
||||
AC_MSG_ERROR([Cannot locate $input])
|
||||
fi
|
||||
# It worked, clear all "arguments"
|
||||
arguments=""
|
||||
fi
|
||||
else # on unix
|
||||
# Make absolute
|
||||
$1="$path"
|
||||
UTIL_FIXUP_PATH($1, NOFAIL)
|
||||
new_path="[$]$1"
|
||||
|
||||
if test ! -e $new_path; then
|
||||
AC_MSG_NOTICE([The command for $1, which resolves as "$input", is not found])
|
||||
[ if [[ "$path" =~ " " ]]; then ]
|
||||
AC_MSG_NOTICE([This might be caused by spaces in the path, which is not allowed.])
|
||||
fi
|
||||
AC_MSG_ERROR([Cannot locate the the path of $1])
|
||||
AC_MSG_ERROR([Cannot locate $path])
|
||||
fi
|
||||
if test ! -x $new_path; then
|
||||
AC_MSG_NOTICE([The command for $1, which resolves as "$input", is not executable.])
|
||||
AC_MSG_ERROR([Cannot execute command at $path])
|
||||
fi
|
||||
fi # end on unix
|
||||
fi # end with or without slashes
|
||||
|
||||
# Now we have a usable command as new_path, with arguments in arguments
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
if test "x$prefix" = x; then
|
||||
# Only mess around if prefix was not given
|
||||
UTIL_CHECK_WINENV_EXEC_TYPE("$new_path")
|
||||
if test "x$RESULT" = xwindows; then
|
||||
prefix="$FIXPATH "
|
||||
# make sure we have an .exe suffix (but not two)
|
||||
new_path="${new_path%.exe}.exe"
|
||||
else
|
||||
# If we have gotten a .exe suffix, remove it
|
||||
new_path="${new_path%.exe}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$3" = xNOFIXPATH; then
|
||||
prefix=""
|
||||
fi
|
||||
|
||||
# Now join together the path and the arguments once again
|
||||
if test "x$arguments" != xEOL; then
|
||||
new_complete="$new_path ${arguments% *}"
|
||||
new_complete="$prefix$new_path$arguments"
|
||||
$1="$new_complete"
|
||||
fi
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Setup a tool for the given variable. If correctly specified by the user,
|
||||
# use that value, otherwise search for the tool using the supplied code snippet.
|
||||
# $1: variable to set
|
||||
# $2: code snippet to call to look for the tool
|
||||
# $3: code snippet to call if variable was used to find tool
|
||||
AC_DEFUN([UTIL_SETUP_TOOL],
|
||||
[
|
||||
# Publish this variable in the help.
|
||||
AC_ARG_VAR($1, [Override default value for $1])
|
||||
|
||||
if [[ -z "${$1+x}" ]]; then
|
||||
# The variable is not set by user, try to locate tool using the code snippet
|
||||
$2
|
||||
else
|
||||
new_complete="$new_path"
|
||||
# The variable is set, but is it from the command line or the environment?
|
||||
|
||||
# Try to remove the string !$1! from our list.
|
||||
try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!$1!/}
|
||||
if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
|
||||
# If it failed, the variable was not from the command line. Ignore it,
|
||||
# but warn the user (except for BASH, which is always set by the calling BASH).
|
||||
if test "x$1" != xBASH; then
|
||||
AC_MSG_WARN([Ignoring value of $1 from the environment. Use command line variables instead.])
|
||||
fi
|
||||
# Try to locate tool using the code snippet
|
||||
$2
|
||||
else
|
||||
# If it succeeded, then it was overridden by the user. We will use it
|
||||
# for the tool.
|
||||
|
||||
# First remove it from the list of overridden variables, so we can test
|
||||
# for unknown variables in the end.
|
||||
CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
|
||||
|
||||
tool_override=[$]$1
|
||||
|
||||
# Check if we try to supply an empty value
|
||||
if test "x$tool_override" = x; then
|
||||
AC_MSG_CHECKING([for $1])
|
||||
AC_MSG_RESULT([[[disabled by user]]])
|
||||
else
|
||||
# Split up override in command part and argument part
|
||||
tool_and_args=($tool_override)
|
||||
[ tool_command=${tool_and_args[0]} ]
|
||||
[ unset 'tool_and_args[0]' ]
|
||||
[ tool_args=${tool_and_args[@]} ]
|
||||
|
||||
# Check if the provided tool contains a complete path.
|
||||
tool_basename="${tool_command##*/}"
|
||||
if test "x$tool_basename" = "x$tool_command"; then
|
||||
# A command without a complete path is provided, search $PATH.
|
||||
AC_MSG_NOTICE([Will search for user supplied tool "$tool_basename"])
|
||||
AC_PATH_PROGS($1, $tool_basename ${tool_basename}.exe)
|
||||
tool_command="[$]$1"
|
||||
if test "x$tool_command" = x; then
|
||||
AC_MSG_ERROR([User supplied tool $1="$tool_basename" could not be found in PATH])
|
||||
fi
|
||||
else
|
||||
# Otherwise we believe it is a complete path. Use it as it is.
|
||||
if test ! -x "$tool_command" && test ! -x "${tool_command}.exe"; then
|
||||
AC_MSG_ERROR([User supplied tool $1="$tool_command" does not exist or is not executable])
|
||||
fi
|
||||
if test ! -x "$tool_command"; then
|
||||
tool_command="${tool_command}.exe"
|
||||
fi
|
||||
$1="$tool_command"
|
||||
fi
|
||||
if test "x$tool_args" != x; then
|
||||
# If we got arguments, re-append them to the command after the fixup.
|
||||
$1="[$]$1 $tool_args"
|
||||
fi
|
||||
AC_MSG_CHECKING([for $1])
|
||||
AC_MSG_RESULT([[$]$1 [[user supplied]]])
|
||||
fi
|
||||
fi
|
||||
$3
|
||||
fi
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Locate a tool using proper methods.
|
||||
# $1: variable to set
|
||||
# $2: executable name (or list of names) to look for
|
||||
# $3: [path]
|
||||
# $4: set to NOFIXPATH to skip prefixing FIXPATH, even if needed on platform
|
||||
AC_DEFUN([UTIL_LOOKUP_PROGS],
|
||||
[
|
||||
UTIL_SETUP_TOOL($1, [
|
||||
$1=""
|
||||
|
||||
if test "x$3" != x; then
|
||||
old_path="$PATH"
|
||||
PATH="$3"
|
||||
fi
|
||||
|
||||
if test "x$complete" != "x$new_complete"; then
|
||||
$1="$new_complete"
|
||||
AC_MSG_NOTICE([Rewriting $1 to "$new_complete"])
|
||||
for name in $2; do
|
||||
AC_MSG_CHECKING(for $name)
|
||||
|
||||
command_type=`type -t "$name"`
|
||||
if test "x$command_type" = xbuiltin || test "x$command_type" = xkeyword; then
|
||||
# Shell builtin or keyword; we're done here
|
||||
full_path="$name"
|
||||
$1="$full_path"
|
||||
AC_MSG_RESULT([[$full_path [builtin]]])
|
||||
break
|
||||
else
|
||||
# Search in $PATH
|
||||
old_ifs="$IFS"
|
||||
IFS=":"
|
||||
for elem in $PATH; do
|
||||
IFS="$old_ifs"
|
||||
if test "x$elem" = x; then
|
||||
continue
|
||||
fi
|
||||
full_path="$elem/$name"
|
||||
if test ! -e "$full_path" && test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
# Try again with .exe
|
||||
full_path="$elem/$name.exe"
|
||||
fi
|
||||
if test -e "$full_path"; then
|
||||
$1="$full_path"
|
||||
UTIL_FIXUP_EXECUTABLE($1, $3, $4)
|
||||
result="[$]$1"
|
||||
|
||||
# If we have FIXPATH enabled, strip all instances of it and prepend
|
||||
# a single one, to avoid double fixpath prefixing.
|
||||
if test "x$4" != xNOFIXPATH; then
|
||||
[ if [[ $FIXPATH != "" && $result =~ ^"$FIXPATH " ]]; then ]
|
||||
result="\$FIXPATH ${result#"$FIXPATH "}"
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT([$result])
|
||||
break 2;
|
||||
fi
|
||||
done
|
||||
IFS="$old_ifs"
|
||||
fi
|
||||
AC_MSG_RESULT([[[not found]]])
|
||||
done
|
||||
|
||||
if test "x$3" != x; then
|
||||
PATH="$old_path"
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Call UTIL_SETUP_TOOL with AC_CHECK_TOOLS to locate the tool. This will look
|
||||
# first for cross-compilation tools.
|
||||
# $1: variable to set
|
||||
# $2: executable name (or list of names) to look for
|
||||
# $3: [path]
|
||||
AC_DEFUN([UTIL_LOOKUP_TOOLCHAIN_PROGS],
|
||||
[
|
||||
if test "x$ac_tool_prefix" = x; then
|
||||
UTIL_LOOKUP_PROGS($1, $2, $3)
|
||||
else
|
||||
prefixed_names=$(for name in $2; do echo ${ac_tool_prefix}${name} $name; done)
|
||||
UTIL_LOOKUP_PROGS($1, $prefixed_names, $3)
|
||||
fi
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Test that variable $1 denoting a program is not empty. If empty, exit with an error.
|
||||
# $1: variable to check
|
||||
AC_DEFUN([UTIL_CHECK_NONEMPTY],
|
||||
[
|
||||
if test "x[$]$1" = x; then
|
||||
AC_MSG_ERROR([Could not find required tool for $1])
|
||||
fi
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Like UTIL_LOOKUP_PROGS but fails if no tool was found.
|
||||
# $1: variable to set
|
||||
# $2: executable name (or list of names) to look for
|
||||
# $3: [path]
|
||||
AC_DEFUN([UTIL_REQUIRE_PROGS],
|
||||
[
|
||||
UTIL_LOOKUP_PROGS($1, $2, $3)
|
||||
UTIL_CHECK_NONEMPTY($1)
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Like UTIL_LOOKUP_PROGS but fails if no tool was found.
|
||||
# $1: variable to set
|
||||
# $2: executable name (or list of names) to look for
|
||||
# $3: [path]
|
||||
AC_DEFUN([UTIL_REQUIRE_TOOLCHAIN_PROGS],
|
||||
[
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS($1, $2, $3)
|
||||
UTIL_CHECK_NONEMPTY($1)
|
||||
])
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Like UTIL_SETUP_TOOL but fails if no tool was found.
|
||||
# $1: variable to set
|
||||
# $2: autoconf macro to call to look for the special tool
|
||||
AC_DEFUN([UTIL_REQUIRE_SPECIAL],
|
||||
[
|
||||
UTIL_SETUP_TOOL($1, [$2])
|
||||
UTIL_CHECK_NONEMPTY($1)
|
||||
# The special macro will return an absolute path, and is only used for
|
||||
# unix tools. No further processing needed.
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Add FIXPATH prefix to variable. Normally this is done by UTIL_LOOKUP_PROGS
|
||||
# or UTIL_FIXUP_EXECUTABLE, but in some circumstances this has to be done
|
||||
# explicitly, such as when the command in question does not exist yet.
|
||||
#
|
||||
# $1: variable to add fixpath to
|
||||
AC_DEFUN([UTIL_ADD_FIXPATH],
|
||||
[
|
||||
if test "x$FIXPATH" != x; then
|
||||
$1="$FIXPATH [$]$1"
|
||||
fi
|
||||
])
|
||||
|
||||
|
@ -208,8 +517,8 @@ AC_DEFUN([UTIL_REMOVE_SYMBOLIC_LINKS],
|
|||
sym_link_file=`$BASENAME [$]$1`
|
||||
cd $sym_link_dir
|
||||
# Use -P flag to resolve symlinks in directories.
|
||||
cd `$THEPWDCMD -P`
|
||||
sym_link_dir=`$THEPWDCMD -P`
|
||||
cd `pwd -P`
|
||||
sym_link_dir=`pwd -P`
|
||||
# Resolve file symlinks
|
||||
while test $COUNTER -lt 20; do
|
||||
ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
|
||||
|
@ -220,7 +529,7 @@ AC_DEFUN([UTIL_REMOVE_SYMBOLIC_LINKS],
|
|||
# Again resolve directory symlinks since the target of the just found
|
||||
# link could be in a different directory
|
||||
cd `$DIRNAME $ISLINK`
|
||||
sym_link_dir=`$THEPWDCMD -P`
|
||||
sym_link_dir=`pwd -P`
|
||||
sym_link_file=`$BASENAME $ISLINK`
|
||||
let COUNTER=COUNTER+1
|
||||
done
|
||||
|
@ -229,4 +538,3 @@ AC_DEFUN([UTIL_REMOVE_SYMBOLIC_LINKS],
|
|||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
|
|
|
@ -1,451 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
AC_DEFUN([UTIL_REWRITE_AS_UNIX_PATH],
|
||||
[
|
||||
windows_path="[$]$1"
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
unix_path=`$CYGPATH -u "$windows_path"`
|
||||
$1="$unix_path"
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
|
||||
unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
|
||||
$1="$unix_path"
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
# wslpath does not check the input, only call if an actual windows path was
|
||||
# given.
|
||||
if $ECHO "$windows_path" | $GREP -q ["^[a-zA-Z]:[\\\\/]"]; then
|
||||
unix_path=`$WSLPATH -u "$windows_path"`
|
||||
$1="$unix_path"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_REWRITE_AS_WINDOWS_MIXED_PATH],
|
||||
[
|
||||
unix_path="[$]$1"
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
windows_path=`$CYGPATH -m "$unix_path"`
|
||||
$1="$windows_path"
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
|
||||
windows_path=`cmd //c echo $unix_path`
|
||||
$1="$windows_path"
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
windows_path=`$WSLPATH -m "$unix_path" 2>/dev/null`
|
||||
if test $? -ne 0; then
|
||||
dir=`dirname "$unix_path"`
|
||||
base=`basename "$unix_path"`
|
||||
windows_path=`$WSLPATH -m "$dir"`/"$base"
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_ERROR([Cannot convert "$unix_path" to Windows path])
|
||||
fi
|
||||
fi
|
||||
$1="$windows_path"
|
||||
fi
|
||||
])
|
||||
|
||||
# Helper function which possibly converts a path using DOS-style short mode.
|
||||
# If so, the updated path is stored in $new_path.
|
||||
# $1: The path to check
|
||||
AC_DEFUN([UTIL_MAKE_WINDOWS_SPACE_SAFE_CYGWIN],
|
||||
[
|
||||
input_path="$1"
|
||||
# Check if we need to convert this using DOS-style short mode. If the path
|
||||
# contains just simple characters, use it. Otherwise (spaces, weird characters),
|
||||
# take no chances and rewrite it.
|
||||
# Note: m4 eats our [], so we need to use @<:@ and @:>@ instead.
|
||||
has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-._/a-zA-Z0-9@:>@`
|
||||
if test "x$has_forbidden_chars" != x; then
|
||||
# Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
|
||||
shortmode_path=`$CYGPATH -s -m -a "$input_path"`
|
||||
path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
|
||||
if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
|
||||
# Going to short mode and back again did indeed matter. Since short mode is
|
||||
# case insensitive, let's make it lowercase to improve readability.
|
||||
shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
# Now convert it back to Unix-style (cygpath)
|
||||
input_path=`$CYGPATH -u "$shortmode_path"`
|
||||
new_path="$input_path"
|
||||
fi
|
||||
fi
|
||||
|
||||
test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
|
||||
if test "x$test_cygdrive_prefix" = x; then
|
||||
# As a simple fix, exclude /usr/bin since it's not a real path.
|
||||
if test "x`$ECHO $1 | $GREP ^/usr/bin/`" = x; then
|
||||
# The path is in a Cygwin special directory (e.g. /home). We need this converted to
|
||||
# a path prefixed by /cygdrive for fixpath to work.
|
||||
new_path="$CYGWIN_ROOT_PATH$input_path"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
# Helper function which possibly converts a path using DOS-style short mode.
|
||||
# If so, the updated path is stored in $new_path.
|
||||
# $1: The path to check
|
||||
AC_DEFUN([UTIL_MAKE_WINDOWS_SPACE_SAFE_MSYS],
|
||||
[
|
||||
input_path="$1"
|
||||
# Check if we need to convert this using DOS-style short mode. If the path
|
||||
# contains just simple characters, use it. Otherwise (spaces, weird characters),
|
||||
# take no chances and rewrite it.
|
||||
# Note: m4 eats our [], so we need to use @<:@ and @:>@ instead.
|
||||
has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-_/:a-zA-Z0-9@:>@`
|
||||
if test "x$has_forbidden_chars" != x; then
|
||||
# Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
|
||||
new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
fi
|
||||
])
|
||||
|
||||
# Helper function which possibly converts a path using DOS-style short mode.
|
||||
# If so, the updated path is stored in $new_path.
|
||||
# $1: The path to check
|
||||
AC_DEFUN([UTIL_MAKE_WINDOWS_SPACE_SAFE_WSL],
|
||||
[
|
||||
input_path="$1"
|
||||
# Check if we need to convert this using DOS-style short mode. If the path
|
||||
# contains just simple characters, use it. Otherwise (spaces, weird characters),
|
||||
# take no chances and rewrite it.
|
||||
# Note: m4 eats our [], so we need to use @<:@ and @:>@ instead.
|
||||
has_forbidden_chars=`$ECHO "$input_path" | $GREP [[^-_/:a-zA-Z0-9\\.]]`
|
||||
if test "x$has_forbidden_chars" != x; then
|
||||
# Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
|
||||
TOPDIR_windows="$TOPDIR"
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([TOPDIR_windows])
|
||||
# First convert to Windows path to make input valid for cmd
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([input_path])
|
||||
# Reset PATH since it can contain a mix of WSL/linux paths and Windows paths from VS,
|
||||
# which, in combination with WSLENV, will make the WSL layer complain
|
||||
old_path="$PATH"
|
||||
PATH=
|
||||
new_path=`$CMD /c $TOPDIR_windows/make/scripts/windowsShortName.bat "$input_path" \
|
||||
| $SED -e 's|\r||g' \
|
||||
| $TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
# Rewrite back to unix style
|
||||
PATH="$old_path"
|
||||
UTIL_REWRITE_AS_UNIX_PATH([new_path])
|
||||
fi
|
||||
])
|
||||
|
||||
# FIXME: The UTIL_FIXUP_*_CYGWIN/MSYS is most likely too convoluted
|
||||
# and could probably be heavily simplified. However, all changes in this
|
||||
# area tend to need lot of testing in different scenarios, and in lack of
|
||||
# proper unit testing, cleaning this up has not been deemed worth the effort
|
||||
# at the moment.
|
||||
|
||||
AC_DEFUN([UTIL_FIXUP_PATH_CYGWIN],
|
||||
[
|
||||
# Input might be given as Windows format, start by converting to
|
||||
# unix format.
|
||||
path="[$]$1"
|
||||
new_path=`$CYGPATH -u "$path"`
|
||||
|
||||
UTIL_ABSOLUTE_PATH(new_path)
|
||||
|
||||
# Cygwin tries to hide some aspects of the Windows file system, such that binaries are
|
||||
# named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
|
||||
# the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
|
||||
# "foo.exe" is OK but "foo" is an error.
|
||||
#
|
||||
# This test is therefore slightly more accurate than "test -f" to check for file precense.
|
||||
# It is also a way to make sure we got the proper file name for the real test later on.
|
||||
test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
|
||||
if test "x$test_shortpath" = x; then
|
||||
AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.])
|
||||
AC_MSG_ERROR([Cannot locate the the path of $1])
|
||||
fi
|
||||
|
||||
# Call helper function which possibly converts this using DOS-style short mode.
|
||||
# If so, the updated path is stored in $new_path.
|
||||
UTIL_MAKE_WINDOWS_SPACE_SAFE_CYGWIN([$new_path])
|
||||
|
||||
if test "x$path" != "x$new_path"; then
|
||||
$1="$new_path"
|
||||
AC_MSG_NOTICE([Rewriting $1 to "$new_path"])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_FIXUP_PATH_MSYS],
|
||||
[
|
||||
path="[$]$1"
|
||||
has_colon=`$ECHO $path | $GREP ^.:`
|
||||
new_path="$path"
|
||||
if test "x$has_colon" = x; then
|
||||
# Not in mixed or Windows style, start by that.
|
||||
new_path=`cmd //c echo $path`
|
||||
fi
|
||||
|
||||
UTIL_ABSOLUTE_PATH(new_path)
|
||||
|
||||
UTIL_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path])
|
||||
UTIL_REWRITE_AS_UNIX_PATH(new_path)
|
||||
if test "x$path" != "x$new_path"; then
|
||||
$1="$new_path"
|
||||
AC_MSG_NOTICE([Rewriting $1 to "$new_path"])
|
||||
fi
|
||||
|
||||
# Save the first 10 bytes of this path to the storage, so fixpath can work.
|
||||
all_fixpath_prefixes=("${all_fixpath_prefixes@<:@@@:>@}" "${new_path:0:10}")
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_FIXUP_PATH_WSL],
|
||||
[
|
||||
# Input might be given as Windows format, start by converting to
|
||||
# unix format.
|
||||
new_path="[$]$1"
|
||||
UTIL_REWRITE_AS_UNIX_PATH([new_path])
|
||||
|
||||
UTIL_ABSOLUTE_PATH(new_path)
|
||||
|
||||
# Call helper function which possibly converts this using DOS-style short mode.
|
||||
# If so, the updated path is stored in $new_path.
|
||||
UTIL_MAKE_WINDOWS_SPACE_SAFE_WSL([$new_path])
|
||||
|
||||
if test "x$path" != "x$new_path"; then
|
||||
$1="$new_path"
|
||||
AC_MSG_NOTICE([Rewriting $1 to "$new_path"])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_FIXUP_EXECUTABLE_CYGWIN],
|
||||
[
|
||||
# First separate the path from the arguments. This will split at the first
|
||||
# space.
|
||||
complete="[$]$1"
|
||||
path="${complete%% *}"
|
||||
tmp="$complete EOL"
|
||||
arguments="${tmp#* }"
|
||||
|
||||
# Input might be given as Windows format, start by converting to
|
||||
# unix format.
|
||||
new_path=`$CYGPATH -u "$path"`
|
||||
|
||||
# Now try to locate executable using which
|
||||
new_path=`type -p "$new_path" 2> /dev/null`
|
||||
# bat and cmd files are not always considered executable in cygwin causing which
|
||||
# to not find them
|
||||
if test "x$new_path" = x \
|
||||
&& test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
|
||||
&& test "x`$LS \"$path\" 2>/dev/null`" != x; then
|
||||
new_path=`$CYGPATH -u "$path"`
|
||||
fi
|
||||
if test "x$new_path" = x; then
|
||||
# Oops. Which didn't find the executable.
|
||||
# The splitting of arguments from the executable at a space might have been incorrect,
|
||||
# since paths with space are more likely in Windows. Give it another try with the whole
|
||||
# argument.
|
||||
path="$complete"
|
||||
arguments="EOL"
|
||||
new_path=`$CYGPATH -u "$path"`
|
||||
new_path=`type -p "$new_path" 2> /dev/null`
|
||||
# bat and cmd files are not always considered executable in cygwin causing which
|
||||
# to not find them
|
||||
if test "x$new_path" = x \
|
||||
&& test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
|
||||
&& test "x`$LS \"$path\" 2>/dev/null`" != x; then
|
||||
new_path=`$CYGPATH -u "$path"`
|
||||
fi
|
||||
if test "x$new_path" = x; then
|
||||
# It's still not found. Now this is an unrecoverable error.
|
||||
AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
|
||||
has_space=`$ECHO "$complete" | $GREP " "`
|
||||
if test "x$has_space" != x; then
|
||||
AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.])
|
||||
fi
|
||||
AC_MSG_ERROR([Cannot locate the the path of $1])
|
||||
fi
|
||||
fi
|
||||
|
||||
# Cygwin tries to hide some aspects of the Windows file system, such that binaries are
|
||||
# named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
|
||||
# the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
|
||||
# "foo.exe" is OK but "foo" is an error.
|
||||
#
|
||||
# This test is therefore slightly more accurate than "test -f" to check for file presence.
|
||||
# It is also a way to make sure we got the proper file name for the real test later on.
|
||||
test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
|
||||
if test "x$test_shortpath" = x; then
|
||||
# Short path failed, file does not exist as specified.
|
||||
# Try adding .exe or .cmd
|
||||
if test -f "${new_path}.exe"; then
|
||||
input_to_shortpath="${new_path}.exe"
|
||||
elif test -f "${new_path}.cmd"; then
|
||||
input_to_shortpath="${new_path}.cmd"
|
||||
else
|
||||
AC_MSG_NOTICE([The path of $1, which resolves as "$new_path", is invalid.])
|
||||
AC_MSG_NOTICE([Neither "$new_path" nor "$new_path.exe/cmd" can be found])
|
||||
AC_MSG_ERROR([Cannot locate the the path of $1])
|
||||
fi
|
||||
else
|
||||
input_to_shortpath="$new_path"
|
||||
fi
|
||||
|
||||
# Call helper function which possibly converts this using DOS-style short mode.
|
||||
# If so, the updated path is stored in $new_path.
|
||||
new_path="$input_to_shortpath"
|
||||
UTIL_MAKE_WINDOWS_SPACE_SAFE_CYGWIN([$input_to_shortpath])
|
||||
# remove trailing .exe if any
|
||||
new_path="${new_path/%.exe/}"
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_FIXUP_EXECUTABLE_MSYS],
|
||||
[
|
||||
# First separate the path from the arguments. This will split at the first
|
||||
# space.
|
||||
complete="[$]$1"
|
||||
path="${complete%% *}"
|
||||
tmp="$complete EOL"
|
||||
arguments="${tmp#* }"
|
||||
|
||||
# Input might be given as Windows format, start by converting to
|
||||
# unix format.
|
||||
new_path="$path"
|
||||
UTIL_REWRITE_AS_UNIX_PATH(new_path)
|
||||
|
||||
# Now try to locate executable using which
|
||||
new_path=`type -p "$new_path" 2> /dev/null`
|
||||
|
||||
if test "x$new_path" = x; then
|
||||
# Oops. Which didn't find the executable.
|
||||
# The splitting of arguments from the executable at a space might have been incorrect,
|
||||
# since paths with space are more likely in Windows. Give it another try with the whole
|
||||
# argument.
|
||||
path="$complete"
|
||||
arguments="EOL"
|
||||
new_path="$path"
|
||||
UTIL_REWRITE_AS_UNIX_PATH(new_path)
|
||||
|
||||
new_path=`type -p "$new_path" 2> /dev/null`
|
||||
# bat and cmd files are not always considered executable in MSYS causing which
|
||||
# to not find them
|
||||
if test "x$new_path" = x \
|
||||
&& test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
|
||||
&& test "x`$LS \"$path\" 2>/dev/null`" != x; then
|
||||
new_path="$path"
|
||||
UTIL_REWRITE_AS_UNIX_PATH(new_path)
|
||||
fi
|
||||
|
||||
if test "x$new_path" = x; then
|
||||
# It's still not found. Now this is an unrecoverable error.
|
||||
AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
|
||||
has_space=`$ECHO "$complete" | $GREP " "`
|
||||
if test "x$has_space" != x; then
|
||||
AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.])
|
||||
fi
|
||||
AC_MSG_ERROR([Cannot locate the the path of $1])
|
||||
fi
|
||||
fi
|
||||
|
||||
# Now new_path has a complete unix path to the binary
|
||||
if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then
|
||||
# Keep paths in /bin as-is, but remove trailing .exe if any
|
||||
new_path="${new_path/%.exe/}"
|
||||
# Do not save /bin paths to all_fixpath_prefixes!
|
||||
else
|
||||
# Not in mixed or Windows style, start by that.
|
||||
new_path=`cmd //c echo $new_path`
|
||||
UTIL_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path])
|
||||
# Output is in $new_path
|
||||
UTIL_REWRITE_AS_UNIX_PATH(new_path)
|
||||
# remove trailing .exe if any
|
||||
new_path="${new_path/%.exe/}"
|
||||
|
||||
# Save the first 10 bytes of this path to the storage, so fixpath can work.
|
||||
all_fixpath_prefixes=("${all_fixpath_prefixes@<:@@@:>@}" "${new_path:0:10}")
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_FIXUP_EXECUTABLE_WSL],
|
||||
[
|
||||
# First separate the path from the arguments. This will split at the first
|
||||
# space.
|
||||
complete="[$]$1"
|
||||
path="${complete%% *}"
|
||||
tmp="$complete EOL"
|
||||
arguments="${tmp#* }"
|
||||
|
||||
# Input might be given as Windows format, start by converting to
|
||||
# unix format.
|
||||
new_path="$path"
|
||||
UTIL_REWRITE_AS_UNIX_PATH([new_path])
|
||||
|
||||
# Now try to locate executable using which
|
||||
new_path_bak="$new_path"
|
||||
new_path=`type -p "$new_path" 2> /dev/null`
|
||||
# bat and cmd files are not considered executable in WSL
|
||||
if test "x$new_path" = x \
|
||||
&& test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
|
||||
&& test "x`$LS \"$path\" 2>/dev/null`" != x; then
|
||||
new_path="$new_path_back"
|
||||
fi
|
||||
if test "x$new_path" = x; then
|
||||
# Oops. Which didn't find the executable.
|
||||
# The splitting of arguments from the executable at a space might have been incorrect,
|
||||
# since paths with space are more likely in Windows. Give it another try with the whole
|
||||
# argument.
|
||||
path="$complete"
|
||||
arguments="EOL"
|
||||
new_path="$path"
|
||||
UTIL_REWRITE_AS_UNIX_PATH([new_path])
|
||||
new_path_bak="$new_path"
|
||||
new_path=`type -p "$new_path" 2> /dev/null`
|
||||
# bat and cmd files are not considered executable in WSL
|
||||
if test "x$new_path" = x \
|
||||
&& test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
|
||||
&& test "x`$LS \"$path\" 2>/dev/null`" != x; then
|
||||
new_path="$new_path_bak"
|
||||
fi
|
||||
if test "x$new_path" = x; then
|
||||
# It's still not found. Now this is an unrecoverable error.
|
||||
AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
|
||||
has_space=`$ECHO "$complete" | $GREP " "`
|
||||
if test "x$has_space" != x; then
|
||||
AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.])
|
||||
fi
|
||||
AC_MSG_ERROR([Cannot locate the the path of $1])
|
||||
fi
|
||||
fi
|
||||
|
||||
# In WSL, suffixes must be present for Windows executables
|
||||
if test ! -f "$new_path"; then
|
||||
# Try adding .exe or .cmd
|
||||
if test -f "${new_path}.exe"; then
|
||||
input_to_shortpath="${new_path}.exe"
|
||||
elif test -f "${new_path}.cmd"; then
|
||||
input_to_shortpath="${new_path}.cmd"
|
||||
else
|
||||
AC_MSG_NOTICE([The path of $1, which resolves as "$new_path", is invalid.])
|
||||
AC_MSG_NOTICE([Neither "$new_path" nor "$new_path.exe/cmd" can be found])
|
||||
AC_MSG_ERROR([Cannot locate the the path of $1])
|
||||
fi
|
||||
else
|
||||
input_to_shortpath="$new_path"
|
||||
fi
|
||||
|
||||
# Call helper function which possibly converts this using DOS-style short mode.
|
||||
# If so, the updated path is stored in $new_path.
|
||||
new_path="$input_to_shortpath"
|
||||
UTIL_MAKE_WINDOWS_SPACE_SAFE_WSL([$input_to_shortpath])
|
||||
])
|
||||
|
|
@ -227,25 +227,19 @@ define SetupJavaCompilationBody
|
|||
|
||||
# The portfile contains the tcp/ip on which the server listens
|
||||
# and the cookie necessary to talk to the server.
|
||||
$1_JAVAC_PORT_FILE := $$(JAVAC_SERVER_DIR)/server.port
|
||||
$1_JAVAC_PORT_FILE := $$(call FixPath, $$(JAVAC_SERVER_DIR)/server.port)
|
||||
|
||||
# The servercmd specified how to launch the server. This must use
|
||||
# JAVA_DETACH, which is the "big" java with an ability to detach from
|
||||
# fixpath (on Windows) This will be executed by the client, if needed.
|
||||
$1_JAVAC_SERVER_CMD := $$(JAVA_DETACH) $$($1_JAVA_FLAGS) $$($1_JAVAC)
|
||||
# The servercmd specifies how to launch the server. This will be executed
|
||||
# by the client, if needed.
|
||||
$1_JAVAC_SERVER_CMD := $$(call FixPath, $$(JAVA) $$($1_JAVA_FLAGS) $$($1_JAVAC))
|
||||
|
||||
$1_CONFIG_VARDEPS := $$($1_JAVAC_PORT_FILE) $$($1_JAVAC_SERVER_CMD)
|
||||
$1_CONFIG_VARDEPS_FILE := $$(call DependOnVariable, $1_CONFIG_VARDEPS, \
|
||||
$$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.config_vardeps)
|
||||
|
||||
ifeq ($(call isBuildOs, windows), true)
|
||||
$1_ECHO_COMMAND := $(FIXPATH) cmd /c echo
|
||||
else
|
||||
$1_ECHO_COMMAND := $(ECHO)
|
||||
endif
|
||||
$$($1_JAVAC_SERVER_CONFIG): $$($1_CONFIG_VARDEPS_FILE)
|
||||
$$($1_ECHO_COMMAND) portfile=$$($1_JAVAC_PORT_FILE) > $$@
|
||||
$$($1_ECHO_COMMAND) servercmd=$$($1_JAVAC_SERVER_CMD) >> $$@
|
||||
$(ECHO) portfile=$$($1_JAVAC_PORT_FILE) > $$@
|
||||
$(ECHO) servercmd=$$($1_JAVAC_SERVER_CMD) >> $$@
|
||||
|
||||
# Always use small java to launch client
|
||||
$1_JAVAC_CMD := $$(JAVA_SMALL) $$($1_JAVA_FLAGS) $$($1_JAVAC) \
|
||||
|
|
|
@ -64,6 +64,9 @@ define NEWLINE
|
|||
|
||||
endef
|
||||
|
||||
# Make sure we have a value (could be overridden on command line by caller)
|
||||
CREATING_BUILDJDK ?= false
|
||||
|
||||
# Certain features only work in newer version of GNU Make. The build will still
|
||||
# function in 3.81, but will be less performant.
|
||||
ifeq (4.0, $(firstword $(sort 4.0 $(MAKE_VERSION))))
|
||||
|
@ -436,38 +439,15 @@ endif
|
|||
# On Windows, converts a path from cygwin/unix style (e.g. /bin/foo) into
|
||||
# "mixed mode" (e.g. c:/cygwin/bin/foo). On other platforms, return the path
|
||||
# unchanged.
|
||||
# This also converts a colon-separated list of paths to a semicolon-separated
|
||||
# list.
|
||||
# This is normally not needed since we use the FIXPATH prefix for command lines,
|
||||
# but might be needed in certain circumstances.
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
FixPathArgs = \
|
||||
$(shell $(FIXPATH) cmd /c echo $1)
|
||||
ifeq ($(call isBuildOsEnv, windows.wsl), true)
|
||||
FixPath = \
|
||||
$(shell $(WSLPATH) -m $1)
|
||||
$(strip $(subst \,\\, $(shell $(FIXPATH_BASE) print $(patsubst $(FIXPATH), , $1))))
|
||||
else
|
||||
FixPath = \
|
||||
$(shell $(CYGPATH) -m $1)
|
||||
endif
|
||||
else
|
||||
FixPathArgs = \
|
||||
$1
|
||||
FixPath = \
|
||||
$1
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# FixPathList
|
||||
#
|
||||
# On Windows, converts a cygwin/unix style path list (colon-separated) into
|
||||
# the native format (mixed mode, semicolon-separated). On other platforms,
|
||||
# return the path list unchanged.
|
||||
################################################################################
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
FixPathList = \
|
||||
$(subst @,$(SPACE),$(subst $(SPACE),;,$(foreach entry,$(subst :,$(SPACE),\
|
||||
$(subst $(SPACE),@,$(strip $1))),$(call FixPath, $(entry)))))
|
||||
else
|
||||
FixPathList = \
|
||||
$1
|
||||
endif
|
||||
|
||||
|
|
|
@ -72,10 +72,10 @@ define WriteCompileCommandsFragment
|
|||
$(call LogInfo, Creating compile commands fragment for $(notdir $3))
|
||||
$(call MakeDir, $(dir $1))
|
||||
$(call WriteFile,{ \
|
||||
"directory": "$(strip $(call FixPathArgs, $2))"$(COMMA) \
|
||||
"file": "$(strip $(call FixPathArgs, $3))"$(COMMA) \
|
||||
"directory": "$(strip $(call FixPath, $2))"$(COMMA) \
|
||||
"file": "$(strip $(call FixPath, $3))"$(COMMA) \
|
||||
"command": "$(strip $(subst $(DQUOTE),\$(DQUOTE),$(subst \,\\,\
|
||||
$(subst $(FIXPATH),,$(call FixPathArgs, $4)))))" \
|
||||
$(subst $(FIXPATH),,$(call FixPath, $4)))))" \
|
||||
}$(COMMA), \
|
||||
$1)
|
||||
endef
|
||||
|
@ -175,12 +175,6 @@ $(strip \
|
|||
)
|
||||
endef
|
||||
|
||||
ifeq ($(call isBuildOsEnv, windows.cygwin), true)
|
||||
UNIX_PATH_PREFIX := /cygdrive
|
||||
else ifeq ($(call isBuildOsEnv, windows.msys), true)
|
||||
UNIX_PATH_PREFIX :=
|
||||
endif
|
||||
|
||||
# This pattern is used to transform the output of the microsoft CL compiler
|
||||
# into a make syntax dependency file (.d)
|
||||
WINDOWS_SHOWINCLUDE_SED_PATTERN := \
|
||||
|
@ -188,7 +182,7 @@ WINDOWS_SHOWINCLUDE_SED_PATTERN := \
|
|||
-e 's|Note: including file: *||' \
|
||||
-e 's|\r||g' \
|
||||
-e 's|\\|/|g' \
|
||||
-e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \
|
||||
-e 's|^\([a-zA-Z]\):|$(WINENV_PREFIX)/\1|g' \
|
||||
-e '\|$(TOPDIR)|I !d' \
|
||||
-e 's|$$$$| \\|g' \
|
||||
#
|
||||
|
@ -542,7 +536,7 @@ define SetupNativeCompilationBody
|
|||
ifeq ($$($1_TYPE), EXECUTABLE)
|
||||
$1_PREFIX :=
|
||||
ifeq ($$($1_SUFFIX), )
|
||||
$1_SUFFIX := $(EXE_SUFFIX)
|
||||
$1_SUFFIX := $(EXECUTABLE_SUFFIX)
|
||||
endif
|
||||
else
|
||||
$1_PREFIX := $(LIBRARY_PREFIX)
|
||||
|
@ -1163,6 +1157,9 @@ define SetupNativeCompilationBody
|
|||
test "$$$$?" = "1" ; \
|
||||
$$($1_CREATE_DEBUGINFO_CMDS)
|
||||
$$($1_STRIP_CMD)
|
||||
ifeq ($(call isBuildOsEnv, windows.wsl2), true)
|
||||
$$(CHMOD) +x $$($1_TARGET)
|
||||
endif
|
||||
else
|
||||
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \
|
||||
$$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \
|
||||
|
|
|
@ -278,7 +278,7 @@ FindExecutableDirForModule = \
|
|||
# param 1 : A space separated list of classpath entries
|
||||
# The surrounding strip is needed to keep additional whitespace out
|
||||
PathList = \
|
||||
"$(subst $(SPACE),$(PATH_SEP),$(strip $(subst $(DQUOTE),,$1)))"
|
||||
"$(subst $(SPACE),:,$(strip $(subst $(DQUOTE),,$1)))"
|
||||
|
||||
################################################################################
|
||||
# Check if a specified hotspot variant is being built, or at least one of a
|
||||
|
|
|
@ -85,14 +85,16 @@ define SetupCompileProperties
|
|||
$$(addprefix _SPACE_, $$(PROPJAVAS)))))
|
||||
|
||||
# Now setup the rule for the generation of the resource bundles.
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES)
|
||||
PROPS_BASE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props
|
||||
$$(PROPS_BASE): $$(PROPSOURCES)
|
||||
$$(call MakeDir, $$(@D) $$(PROPDIRS))
|
||||
$(FIND) $$(@D) -name "*.java" -a ! -name "*Properties.java" $(FIND_DELETE)
|
||||
$(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE)
|
||||
$(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE)
|
||||
$$(call ExecuteWithLog, $$(PROPS_BASE)_exec, \
|
||||
$(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE))
|
||||
$(TOUCH) $$@
|
||||
|
||||
$$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props
|
||||
$$(strip $1) += $$(PROPS_BASE)
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -240,7 +240,7 @@ var getJibProfilesCommon = function (input, data) {
|
|||
// List of the main profile names used for iteration
|
||||
common.main_profile_names = [
|
||||
"linux-x64", "linux-x86", "macosx-x64",
|
||||
"windows-x64", "windows-x86",
|
||||
"windows-x64", "windows-x86", "windows-aarch64",
|
||||
"linux-aarch64", "linux-arm32", "linux-ppc64le", "linux-s390x"
|
||||
];
|
||||
|
||||
|
@ -461,6 +461,15 @@ var getJibProfilesProfiles = function (input, common, data) {
|
|||
configure_args: concat(common.configure_args_32bit),
|
||||
},
|
||||
|
||||
"windows-aarch64": {
|
||||
target_os: "windows",
|
||||
target_cpu: "aarch64",
|
||||
dependencies: ["devkit", "gtest", "build_devkit"],
|
||||
configure_args: [
|
||||
"--openjdk-target=aarch64-unknown-cygwin",
|
||||
],
|
||||
},
|
||||
|
||||
"linux-aarch64": {
|
||||
target_os: "linux",
|
||||
target_cpu: "aarch64",
|
||||
|
@ -673,6 +682,10 @@ var getJibProfilesProfiles = function (input, common, data) {
|
|||
platform: "windows-x86",
|
||||
jdk_suffix: "zip",
|
||||
},
|
||||
"windows-aarch64": {
|
||||
platform: "windows-aarch64",
|
||||
jdk_suffix: "zip",
|
||||
},
|
||||
"linux-aarch64": {
|
||||
platform: "linux-aarch64",
|
||||
},
|
||||
|
@ -1014,7 +1027,7 @@ var getJibProfilesDependencies = function (input, common) {
|
|||
var devkit_platform_revisions = {
|
||||
linux_x64: "gcc10.2.0-OL6.4+1.0",
|
||||
macosx_x64: "Xcode11.3.1-MacOSX10.15+1.1",
|
||||
windows_x64: "VS2019-16.7.2+1.0",
|
||||
windows_x64: "VS2019-16.7.2+1.1",
|
||||
linux_aarch64: "gcc10.2.0-OL7.6+1.0",
|
||||
linux_arm: "gcc8.2.0-Fedora27+1.0",
|
||||
linux_ppc64le: "gcc8.2.0-Fedora27+1.0",
|
||||
|
@ -1024,9 +1037,11 @@ var getJibProfilesDependencies = function (input, common) {
|
|||
var devkit_platform = (input.target_cpu == "x86"
|
||||
? input.target_os + "_x64"
|
||||
: input.target_platform);
|
||||
|
||||
if (input.target_platform == "windows_aarch64") {
|
||||
devkit_platform = "windows_x64";
|
||||
}
|
||||
var devkit_cross_prefix = "";
|
||||
if (!(input.target_os == "windows" && isWsl(input))) {
|
||||
if (!(input.target_os == "windows")) {
|
||||
if (input.build_platform != input.target_platform
|
||||
&& input.build_platform != devkit_platform) {
|
||||
devkit_cross_prefix = input.build_platform + "-to-";
|
||||
|
|
|
@ -32,7 +32,7 @@ $(foreach v, $(JVM_VARIANTS), \
|
|||
$(eval $(call SetupCopyFiles, COPY_GTEST_$v, \
|
||||
SRC := $(HOTSPOT_OUTPUTDIR)/variant-$v/libjvm/gtest, \
|
||||
DEST := $(TEST_IMAGE_DIR)/hotspot/gtest/$v, \
|
||||
FILES := $(call SHARED_LIBRARY,jvm) gtestLauncher$(EXE_SUFFIX), \
|
||||
FILES := $(call SHARED_LIBRARY,jvm) gtestLauncher$(EXECUTABLE_SUFFIX), \
|
||||
)) \
|
||||
$(eval TARGETS += $$(COPY_GTEST_$v)) \
|
||||
)
|
||||
|
|
|
@ -51,7 +51,7 @@ else #with SPEC
|
|||
$(ECHO) "MODULE_NAMES=\"$(strip $(foreach mod, $(SEL_MODULES), $(mod)))\"" >> $(OUT)
|
||||
$(ECHO) "SEL_MODULES=\"$(SEL_MODULES)\"" >> $(OUT)
|
||||
$(ECHO) "BOOT_JDK=\"$(BOOT_JDK)\"" >> $(OUT)
|
||||
$(ECHO) "CYGPATH=\"$(CYGPATH)\"" >> $(OUT)
|
||||
$(ECHO) "CYGPATH=\"$(PATHTOOL)\"" >> $(OUT)
|
||||
$(ECHO) "SPEC=\"$(SPEC)\"" >> $(OUT)
|
||||
$(ECHO) "JT_HOME=\"$(JT_HOME)\"" >> $(OUT)
|
||||
|
||||
|
|
|
@ -44,18 +44,10 @@ ifeq ($(call isTargetOs, windows), true)
|
|||
# Reset targets so we don't build libjvm.
|
||||
TARGETS :=
|
||||
|
||||
# Helper macro to convert a unix path to a Windows path, suitable for
|
||||
# inclusion in a command line.
|
||||
ifeq ($(call isBuildOsEnv, windows.cygwin), true)
|
||||
FixPath = \
|
||||
$(strip $(subst \,\\,$(shell $(CYGPATH) -w $1)))
|
||||
FixLinuxExecutable = \
|
||||
$(call FixPath, $1)
|
||||
else ifeq ($(call isBuildOsEnv, windows.wsl), true)
|
||||
FixPath = \
|
||||
$(strip $(subst \,\\,$(shell $(WSLPATH) -w $1)))
|
||||
FixLinuxExecutable = \
|
||||
"%windir%\Sysnative\wsl.exe $1"
|
||||
ifeq ($(call isBuildOsEnv, windows.cygwin windows.msys2), true)
|
||||
FixLinuxExecutable = $(call FixPath, $1)
|
||||
else ifeq ($(call isBuildOsEnv, windows.wsl1 windows.wsl2), true)
|
||||
FixLinuxExecutable = "%windir%\Sysnative\wsl.exe $1"
|
||||
endif
|
||||
|
||||
JVM_DEFINES_client := $(patsubst -D%,%, $(filter -D%, $(JVM_CFLAGS)))
|
||||
|
|
|
@ -86,7 +86,7 @@ define CreateFromTemplate
|
|||
-e 's!{{CONF_NAME}}!$(CONF_NAME)!g' \
|
||||
-e 's!{{COMPILER}}!$(call FixPath,$(CXX)) $(SYSROOT_CFLAGS)!g' \
|
||||
-e 's!{{MAKE}}!$(call FixPath,$(MAKE))!g' \
|
||||
-e 's!{{PATH}}!$(call FixPathList,$(PATH))!g' \
|
||||
-e 's!{{PATH}}!$(call FixPath,$(PATH))!g' \
|
||||
-e 's!{{DEBUGENGINENAME}}!$(call DebugEngineName)!g' \
|
||||
-e '/{{INDEXER_EXTENSIONS}}/d' \
|
||||
-e '/{{INDEXER_SETTINGS}}/d' \
|
||||
|
|
|
@ -1841,7 +1841,7 @@ OUTER: for (int i = 0; i < n; i += m) {
|
|||
}
|
||||
commentStart = (Csyntax ? "/*" : "//");
|
||||
commentEnd = (Csyntax ? " */" : "");
|
||||
commandLineDescription = desc.toString();
|
||||
commandLineDescription = desc.toString().replace("\\", "\\\\");
|
||||
}
|
||||
|
||||
private static void searchBins(long[] map, int binsOccupied) throws Exception {
|
||||
|
|
|
@ -44,8 +44,11 @@ ifeq ($(call isTargetOs, aix), true)
|
|||
endif
|
||||
|
||||
################################################################################
|
||||
# Copy the microsoft runtime libraries on windows
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
# Copy the microsoft runtime libraries on windows, but only if we are not
|
||||
# creating a buildjdk. If we are, the provided runtime librareis are made for
|
||||
# the target platform, not the build platform (and we should not need to bundle
|
||||
# anything with the minimalistic, locally-only buildjdk.)
|
||||
ifeq ($(call isTargetOs, windows)+$(CREATING_BUILDJDK), true+false)
|
||||
|
||||
# Chmod to avoid permission issues if bundles are unpacked on unix platforms.
|
||||
define copy-and-chmod
|
||||
|
|
|
@ -32,13 +32,18 @@ GENSRC_CHARACTERDATA :=
|
|||
CHARACTERDATA = $(TOPDIR)/make/data/characterdata
|
||||
UNICODEDATA = $(TOPDIR)/make/data/unicodedata
|
||||
|
||||
ifneq ($(DEBUG_LEVEL), release)
|
||||
ifeq ($(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT), true)
|
||||
DEBUG_OPTION := -d
|
||||
endif
|
||||
endif
|
||||
|
||||
define SetupCharacterData
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java: \
|
||||
$(CHARACTERDATA)/$1.java.template
|
||||
$$(call LogInfo, Generating $1.java)
|
||||
$$(call MakeDir, $$(@D))
|
||||
$(TOOL_GENERATECHARACTER) $2 \
|
||||
$(if $(call equals, $(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT), true), -d) \
|
||||
$(TOOL_GENERATECHARACTER) $2 $(DEBUG_OPTION) \
|
||||
-template $(CHARACTERDATA)/$1.java.template \
|
||||
-spec $(UNICODEDATA)/UnicodeData.txt \
|
||||
-specialcasing $(UNICODEDATA)/SpecialCasing.txt \
|
||||
|
|
|
@ -36,6 +36,7 @@ GENSRC_CHARSETCODER_TEMPLATE := $(GENSRC_CHARSETCODER_SRC)/charset/Charset-X-Cod
|
|||
$(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
|
||||
$(call MakeTargetDir)
|
||||
$(RM) $@.tmp
|
||||
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_charset_decoder, \
|
||||
$(TOOL_SPP) -i$< -o$@.tmp \
|
||||
-Kdecoder \
|
||||
-DA='A' \
|
||||
|
@ -61,7 +62,7 @@ $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
|
|||
-DItypesPerOtype='CharsPerByte' \
|
||||
-DnotLegal='not legal for this charset' \
|
||||
-Dotypes-per-itype='chars-per-byte' \
|
||||
-DoutSequence='Unicode character'
|
||||
-DoutSequence='Unicode character')
|
||||
$(MV) $@.tmp $@
|
||||
|
||||
GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java
|
||||
|
@ -71,6 +72,7 @@ GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java
|
|||
$(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
|
||||
$(call MakeTargetDir)
|
||||
$(RM) $@.tmp
|
||||
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_charset_encoder, \
|
||||
$(TOOL_SPP) -i$< -o$@.tmp \
|
||||
-Kencoder \
|
||||
-DA='An' \
|
||||
|
@ -96,7 +98,7 @@ $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
|
|||
-DItypesPerOtype='BytesPerChar' \
|
||||
-DnotLegal='not a legal sixteen-bit Unicode sequence' \
|
||||
-Dotypes-per-itype='bytes-per-char' \
|
||||
-DoutSequence='byte sequence in the given charset'
|
||||
-DoutSequence='byte sequence in the given charset')
|
||||
$(MV) $@.tmp $@
|
||||
|
||||
GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@echo off
|
||||
REM
|
||||
REM Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
REM Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
REM
|
||||
REM This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -21,4 +21,27 @@ REM Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|||
REM or visit www.oracle.com if you need additional information or have any
|
||||
REM questions.
|
||||
REM
|
||||
if '%1' NEQ '' echo %~s1
|
||||
|
||||
set vcvarscmd=%1
|
||||
set output=%2
|
||||
if not "%3" == "auto" set version=-vcvars_ver=%3
|
||||
|
||||
set PATH_BEFORE=%PATH%
|
||||
|
||||
call %vcvarscmd% %version% %4 %5 %6 %7 %8 %9
|
||||
if exist %output% del %output%
|
||||
|
||||
call :extract "%PATH_BEFORE%", PATH_BEFORE
|
||||
call :extract "%PATH%", PATH_AFTER
|
||||
call :extract "%INCLUDE%", VS_INCLUDE
|
||||
call :extract "%LIB%", VS_LIB
|
||||
call :extract "%VCINSTALLDIR%", VCINSTALLDIR
|
||||
call :extract "%VCToolsRedistDir%", VCToolsRedistDir
|
||||
call :extract "%WindowsSdkDir%", WindowsSdkDir
|
||||
call :extract "%WINDOWSSDKDIR%", WINDOWSSDKDIR
|
||||
|
||||
exit /b 0
|
||||
|
||||
:extract
|
||||
echo %~2=$($BASH $TOPDIR/make/scripts/fixpath.sh -i import '%~1 ') >> %output%
|
||||
exit /b 0
|
|
@ -0,0 +1,498 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
# Setup the environment fixpath assumes. Read from command line options if
|
||||
# available, or extract values automatically from the environment if missing.
|
||||
# This is robust, but slower.
|
||||
function setup() {
|
||||
while getopts "e:p:r:t:c:qmi" opt; do
|
||||
case "$opt" in
|
||||
e) PATHTOOL="$OPTARG" ;;
|
||||
p) DRIVEPREFIX="$OPTARG" ;;
|
||||
r) ENVROOT="$OPTARG" ;;
|
||||
t) WINTEMP="$OPTARG" ;;
|
||||
c) CMD="$OPTARG" ;;
|
||||
q) QUIET=true ;;
|
||||
m) MIXEDMODE=true ;;
|
||||
i) IGNOREFAILURES=true ;;
|
||||
?)
|
||||
# optargs found argument error
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND-1))
|
||||
ACTION="$1"
|
||||
|
||||
# Locate variables ourself if not giving from caller
|
||||
if [[ -z ${PATHTOOL+x} ]]; then
|
||||
PATHTOOL="$(type -p cygpath)"
|
||||
if [[ $PATHTOOL == "" ]]; then
|
||||
PATHTOOL="$(type -p wslpath)"
|
||||
if [[ $PATHTOOL == "" ]]; then
|
||||
if [[ $QUIET != true ]]; then
|
||||
echo fixpath: failure: Cannot locate cygpath or wslpath >&2
|
||||
fi
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z ${DRIVEPREFIX+x} ]]; then
|
||||
winroot="$($PATHTOOL -u c:/)"
|
||||
DRIVEPREFIX="${winroot%/c/}"
|
||||
else
|
||||
if [[ $DRIVEPREFIX == "NONE" ]]; then
|
||||
DRIVEPREFIX=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z ${ENVROOT+x} ]]; then
|
||||
unixroot="$($PATHTOOL -w / 2> /dev/null)"
|
||||
# Remove trailing backslash
|
||||
ENVROOT="${unixroot%\\}"
|
||||
elif [[ "$ENVROOT" == "[unavailable]" ]]; then
|
||||
ENVROOT=""
|
||||
fi
|
||||
|
||||
if [[ -z ${CMD+x} ]]; then
|
||||
CMD="$DRIVEPREFIX/c/windows/system32/cmd.exe"
|
||||
fi
|
||||
|
||||
if [[ -z ${WINTEMP+x} ]]; then
|
||||
wintemp_win="$($CMD /q /c echo %TEMP% 2>/dev/null | tr -d \\n\\r)"
|
||||
WINTEMP="$($PATHTOOL -u "$wintemp_win")"
|
||||
fi
|
||||
|
||||
# Make regexp tests case insensitive
|
||||
shopt -s nocasematch
|
||||
# Prohibit msys2 from meddling with paths
|
||||
export MSYS2_ARG_CONV_EXCL="*"
|
||||
# Make sure WSL gets a copy of the path
|
||||
export WSLENV=PATH/l
|
||||
}
|
||||
|
||||
# Cleanup handling
|
||||
TEMPDIRS=""
|
||||
trap "cleanup" EXIT
|
||||
function cleanup() {
|
||||
if [[ "$TEMPDIRS" != "" ]]; then
|
||||
rm -rf $TEMPDIRS
|
||||
fi
|
||||
}
|
||||
|
||||
# Import a single path
|
||||
# Result: imported path returned in $result
|
||||
function import_path() {
|
||||
path="$1"
|
||||
# Strip trailing and leading space
|
||||
path="${path#"${path%%[![:space:]]*}"}"
|
||||
path="${path%"${path##*[![:space:]]}"}"
|
||||
|
||||
if [[ $path =~ ^.:[/\\].*$ ]] || [[ "$path" =~ ^"$ENVROOT"\\.*$ ]] ; then
|
||||
# We got a Windows path as input; use pathtool to convert to unix path
|
||||
path="$($PATHTOOL -u "$path")"
|
||||
# Path will now be absolute
|
||||
else
|
||||
# Make path absolute, and resolve embedded '..' in path
|
||||
dirpart="$(dirname "$path")"
|
||||
dirpart="$(cd "$dirpart" 2>&1 > /dev/null && pwd)"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
if [[ $QUIET != true ]]; then
|
||||
echo fixpath: failure: Directory containing path "'"$path"'" does not exist >&2
|
||||
fi
|
||||
if [[ $IGNOREFAILURES != true ]]; then
|
||||
exit 1
|
||||
else
|
||||
path=""
|
||||
fi
|
||||
else
|
||||
basepart="$(basename "$path")"
|
||||
if [[ $dirpart == / ]]; then
|
||||
# Avoid double leading /
|
||||
dirpart=""
|
||||
fi
|
||||
if [[ $basepart == / ]]; then
|
||||
# Avoid trailing /
|
||||
basepart=""
|
||||
fi
|
||||
path="$dirpart/$basepart"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$path" != "" ]]; then
|
||||
# Now turn it into a windows path
|
||||
winpath="$($PATHTOOL -w "$path" 2>/dev/null)"
|
||||
# If it fails, try again with an added .exe (needed on WSL)
|
||||
if [[ $? -ne 0 ]]; then
|
||||
winpath="$($PATHTOOL -w "$path.exe" 2>/dev/null)"
|
||||
fi
|
||||
if [[ $? -eq 0 ]]; then
|
||||
if [[ ! "$winpath" =~ ^"$ENVROOT"\\.*$ ]] ; then
|
||||
# If it is not in envroot, it's a generic windows path
|
||||
if [[ ! $winpath =~ ^[-_.:\\a-zA-Z0-9]*$ ]] ; then
|
||||
# Path has forbidden characters, rewrite as short name
|
||||
# This monster of a command uses the %~s support from cmd.exe to
|
||||
# reliably convert to short paths on all winenvs.
|
||||
shortpath="$($CMD /q /c for %I in \( "$winpath" \) do echo %~sI 2>/dev/null | tr -d \\n\\r)"
|
||||
path="$($PATHTOOL -u "$shortpath")"
|
||||
# Path is now unix style, based on short name
|
||||
fi
|
||||
# Make it lower case
|
||||
path="$(echo "$path" | tr [:upper:] [:lower:])"
|
||||
fi
|
||||
else
|
||||
# On WSL1, PATHTOOL will fail for files in envroot. If the unix path
|
||||
# exists, we assume that $path is a valid unix path.
|
||||
|
||||
if [[ ! -e $path ]]; then
|
||||
if [[ -e $path.exe ]]; then
|
||||
path="$path.exe"
|
||||
else
|
||||
if [[ $QUIET != true ]]; then
|
||||
echo fixpath: warning: Path "'"$path"'" does not exist >&2
|
||||
fi
|
||||
# This is not a fatal error, maybe the path will be created later on
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$path" =~ " " ]]; then
|
||||
# Our conversion attempts failed. Perhaps the path did not exists, and thus
|
||||
# we could not convert it to short name.
|
||||
if [[ $QUIET != true ]]; then
|
||||
echo fixpath: failure: Path "'"$path"'" contains space >&2
|
||||
fi
|
||||
if [[ $IGNOREFAILURES != true ]]; then
|
||||
exit 1
|
||||
else
|
||||
path=""
|
||||
fi
|
||||
fi
|
||||
|
||||
result="$path"
|
||||
}
|
||||
|
||||
# Import a single path, or a pathlist in Windows style (i.e. ; separated)
|
||||
# Incoming paths can be in Windows or unix style.
|
||||
# Returns in $result a converted path or path list
|
||||
function import_command_line() {
|
||||
imported=""
|
||||
|
||||
old_ifs="$IFS"
|
||||
IFS=";"
|
||||
for arg in $1; do
|
||||
if ! [[ $arg =~ ^" "+$ ]]; then
|
||||
import_path "$arg"
|
||||
|
||||
if [[ "$result" != "" && "$imported" = "" ]]; then
|
||||
imported="$result"
|
||||
else
|
||||
imported="$imported:$result"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$old_ifs"
|
||||
|
||||
result="$imported"
|
||||
}
|
||||
|
||||
# If argument seems to be colon separated path list, and all elements
|
||||
# are possible to convert to paths, make a windows path list
|
||||
# Return 0 if successful with converted path list in $result, or
|
||||
# 1 if it was not a path list.
|
||||
function convert_pathlist() {
|
||||
converted_list=""
|
||||
pathlist_args="$1"
|
||||
|
||||
IFS=':' read -r -a arg_array <<< "$pathlist_args"
|
||||
for arg in "${arg_array[@]}"; do
|
||||
winpath=""
|
||||
# Start looking for drive prefix
|
||||
if [[ $arg =~ ^($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then
|
||||
winpath="${BASH_REMATCH[2]}:${BASH_REMATCH[3]}"
|
||||
# Change slash to backslash (or vice versa if mixed mode)
|
||||
if [[ $MIXEDMODE != true ]]; then
|
||||
winpath="${winpath//'/'/'\'}"
|
||||
else
|
||||
winpath="${winpath//'\'/'/'}"
|
||||
fi
|
||||
elif [[ $arg =~ ^(/[-_.*a-zA-Z0-9]+(/[-_.*a-zA-Z0-9]+)+.*$) ]] ; then
|
||||
# This looks like a unix path, like /foo/bar
|
||||
pathmatch="${BASH_REMATCH[1]}"
|
||||
if [[ $ENVROOT == "" ]]; then
|
||||
if [[ $QUIET != true ]]; then
|
||||
echo fixpath: failure: Path "'"$pathmatch"'" cannot be converted to Windows path >&2
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
winpath="$ENVROOT$pathmatch"
|
||||
# Change slash to backslash (or vice versa if mixed mode)
|
||||
if [[ $MIXEDMODE != true ]]; then
|
||||
winpath="${winpath//'/'/'\'}"
|
||||
else
|
||||
winpath="${winpath//'\'/'/'}"
|
||||
fi
|
||||
else
|
||||
# This does not look like a path, so assume this is not a proper pathlist.
|
||||
# Flag this to caller.
|
||||
result=""
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$converted_list" = "" ]]; then
|
||||
converted_list="$winpath"
|
||||
else
|
||||
converted_list="$converted_list;$winpath"
|
||||
fi
|
||||
done
|
||||
|
||||
result="$converted_list"
|
||||
return 0
|
||||
}
|
||||
|
||||
# The central conversion function. Convert a single argument, so that any
|
||||
# contained paths are converted to Windows style paths. Result is returned
|
||||
# in $result. If it is a path list, convert it as one.
|
||||
function convert_path() {
|
||||
if [[ $1 =~ : ]]; then
|
||||
convert_pathlist "$1"
|
||||
if [[ $? -eq 0 ]]; then
|
||||
return 0
|
||||
fi
|
||||
# Not all elements was possible to convert to Windows paths, so we
|
||||
# presume it is not a pathlist. Continue using normal conversion.
|
||||
fi
|
||||
|
||||
arg="$1"
|
||||
winpath=""
|
||||
# Start looking for drive prefix. Also allow /xxxx prefixes (typically options
|
||||
# for Visual Studio tools), and embedded file:// URIs.
|
||||
if [[ $arg =~ ^([^/]*|.*file://|/[a-zA-Z:]{1,3}:?)($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then
|
||||
prefix="${BASH_REMATCH[1]}"
|
||||
winpath="${BASH_REMATCH[3]}:${BASH_REMATCH[4]}"
|
||||
# Change slash to backslash (or vice versa if mixed mode)
|
||||
if [[ $MIXEDMODE != true ]]; then
|
||||
winpath="${winpath//'/'/'\'}"
|
||||
else
|
||||
winpath="${winpath//'\'/'/'}"
|
||||
fi
|
||||
elif [[ $arg =~ ^([^/]*|(.*file://))(/([-_.a-zA-Z0-9]+)(/[-_.a-zA-Z0-9]+)+)(.*)?$ ]] ; then
|
||||
# This looks like a unix path, like /foo/bar. Also embedded file:// URIs.
|
||||
prefix="${BASH_REMATCH[1]}"
|
||||
pathmatch="${BASH_REMATCH[3]}"
|
||||
firstdir="${BASH_REMATCH[4]}"
|
||||
suffix="${BASH_REMATCH[6]}"
|
||||
|
||||
# We only believe this is a path if the first part is an existing directory
|
||||
if [[ -d "/$firstdir" ]]; then
|
||||
if [[ $ENVROOT == "" ]]; then
|
||||
if [[ $QUIET != true ]]; then
|
||||
echo fixpath: failure: Path "'"$pathmatch"'" cannot be converted to Windows path >&2
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
winpath="$ENVROOT$pathmatch"
|
||||
# Change slash to backslash (or vice versa if mixed mode)
|
||||
if [[ $MIXEDMODE != true ]]; then
|
||||
winpath="${winpath//'/'/'\'}"
|
||||
else
|
||||
winpath="${winpath//'\'/'/'}"
|
||||
fi
|
||||
winpath="$winpath$suffix"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $winpath != "" ]]; then
|
||||
result="$prefix$winpath"
|
||||
else
|
||||
# Return the arg unchanged
|
||||
result="$arg"
|
||||
fi
|
||||
}
|
||||
|
||||
# Treat $1 as name of a file containg paths. Convert those paths to Windows style,
|
||||
# in a new temporary file, and return a string "@<temp file>" pointing to that
|
||||
# new file.
|
||||
function convert_at_file() {
|
||||
infile="$1"
|
||||
if [[ -e $infile ]] ; then
|
||||
tempdir=$(mktemp -dt fixpath.XXXXXX -p "$WINTEMP")
|
||||
TEMPDIRS="$TEMPDIRS $tempdir"
|
||||
|
||||
while read line; do
|
||||
convert_path "$line"
|
||||
echo "$result" >> $tempdir/atfile
|
||||
done < $infile
|
||||
convert_path "$tempdir/atfile"
|
||||
result="@$result"
|
||||
else
|
||||
result="@$infile"
|
||||
fi
|
||||
}
|
||||
|
||||
# Convert an entire command line, replacing all unix paths with Windows paths,
|
||||
# and all unix-style path lists (colon separated) with Windows-style (semicolon
|
||||
# separated).
|
||||
function print_command_line() {
|
||||
converted_args=""
|
||||
for arg in "$@" ; do
|
||||
if [[ $arg =~ ^@(.*$) ]] ; then
|
||||
# This is an @-file with paths that need converting
|
||||
convert_at_file "${BASH_REMATCH[1]}"
|
||||
else
|
||||
convert_path "$arg"
|
||||
fi
|
||||
converted_args="$converted_args$result "
|
||||
done
|
||||
result="${converted_args% }"
|
||||
}
|
||||
|
||||
# Check if the winenv will allow us to start a Windows program when we are
|
||||
# standing in the current directory
|
||||
function verify_current_dir() {
|
||||
arg="$PWD"
|
||||
if [[ $arg =~ ^($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then
|
||||
return 0
|
||||
elif [[ $arg =~ ^(/[^/]+.*$) ]] ; then
|
||||
if [[ $ENVROOT == "" || $ENVROOT =~ ^\\\\.* ]]; then
|
||||
# This is a WSL1 or WSL2 environment
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
# This should not happen
|
||||
return 1
|
||||
}
|
||||
|
||||
# The core functionality of fixpath. Take the given command line, and convert
|
||||
# it and execute it, so that all paths are converted to Windows style.
|
||||
# The return code is the return code of the executed command.
|
||||
function exec_command_line() {
|
||||
# Check that Windows can handle our current directory (only an issue for WSL)
|
||||
verify_current_dir
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
# WSL1 will just forcefully put us in C:\Windows\System32 if we execute this from
|
||||
# a unix directory. WSL2 will do the same, and print a warning. In both cases,
|
||||
# we prefer to take control.
|
||||
cd "$WINTEMP"
|
||||
if [[ $QUIET != true ]]; then
|
||||
echo fixpath: warning: Changing directory to $WINTEMP >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
collected_args=()
|
||||
command=""
|
||||
for arg in "$@" ; do
|
||||
if [[ $command == "" ]]; then
|
||||
# We have not yet located the command to run
|
||||
if [[ $arg =~ ^(.*)=(.*)$ ]]; then
|
||||
# It's a leading env variable assignment (FOO=bar)
|
||||
key="${BASH_REMATCH[1]}"
|
||||
arg="${BASH_REMATCH[2]}"
|
||||
convert_path "$arg"
|
||||
# Set the variable to the converted result
|
||||
export $key="$result"
|
||||
# While this is only needed on WSL, it does not hurt to do everywhere
|
||||
export WSLENV=$WSLENV:$key/w
|
||||
else
|
||||
# The actual command will be executed by bash, so don't convert it
|
||||
command="$arg"
|
||||
fi
|
||||
else
|
||||
# Now we are collecting arguments; they all need converting
|
||||
if [[ $arg =~ ^@(.*$) ]] ; then
|
||||
# This is an @-file with paths that need converting
|
||||
convert_at_file "${BASH_REMATCH[1]}"
|
||||
else
|
||||
convert_path "$arg"
|
||||
fi
|
||||
collected_args=("${collected_args[@]}" "$result")
|
||||
fi
|
||||
done
|
||||
|
||||
# Now execute it
|
||||
if [[ -v DEBUG_FIXPATH ]]; then
|
||||
echo fixpath: debug: input: "$@" >&2
|
||||
echo fixpath: debug: output: "$command" "${collected_args[@]}" >&2
|
||||
fi
|
||||
|
||||
if [[ ! -e "$command" ]]; then
|
||||
if [[ -e "$command.exe" ]]; then
|
||||
command="$command.exe"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $ENVROOT != "" || ! -x /bin/grep ]]; then
|
||||
"$command" "${collected_args[@]}"
|
||||
else
|
||||
# For WSL1, automatically strip away warnings from WSLENV=PATH/l
|
||||
"$command" "${collected_args[@]}" 2> >(/bin/grep -v "ERROR: UtilTranslatePathList" 1>&2)
|
||||
fi
|
||||
}
|
||||
|
||||
# Check that the input represents a path that is reachable from Windows
|
||||
function verify_command_line() {
|
||||
arg="$1"
|
||||
if [[ $arg =~ ^($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then
|
||||
return 0
|
||||
elif [[ $arg =~ ^(/[^/]+/[^/]+.*$) ]] ; then
|
||||
if [[ $ENVROOT != "" ]]; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
#### MAIN FUNCTION
|
||||
|
||||
setup "$@"
|
||||
# Shift away the options processed in setup
|
||||
shift $((OPTIND))
|
||||
|
||||
if [[ "$ACTION" == "import" ]] ; then
|
||||
import_command_line "$@"
|
||||
echo "$result"
|
||||
elif [[ "$ACTION" == "print" ]] ; then
|
||||
print_command_line "$@"
|
||||
echo "$result"
|
||||
elif [[ "$ACTION" == "exec" ]] ; then
|
||||
exec_command_line "$@"
|
||||
# Propagate exit code
|
||||
exit $?
|
||||
elif [[ "$ACTION" == "verify" ]] ; then
|
||||
verify_command_line "$@"
|
||||
exit $?
|
||||
else
|
||||
if [[ $QUIET != true ]]; then
|
||||
echo Unknown operation: "$ACTION" >&2
|
||||
echo Supported operations: import print exec verify >&2
|
||||
fi
|
||||
exit 2
|
||||
fi
|
|
@ -1,594 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <Windows.h>
|
||||
#include <stdbool.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
|
||||
void report_error(char const * msg)
|
||||
{
|
||||
LPTSTR lpMsgBuf;
|
||||
DWORD dw = GetLastError();
|
||||
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
dw,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR) &lpMsgBuf,
|
||||
0,
|
||||
NULL);
|
||||
|
||||
fprintf(stderr,
|
||||
"%s Failed with error %d: %s\n",
|
||||
msg, dw, lpMsgBuf);
|
||||
|
||||
LocalFree(lpMsgBuf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test if pos points to /prefix/_/ where _ can
|
||||
* be any character.
|
||||
*/
|
||||
int is_prefix_here(int pos, char const *in, int len, const char* prefix)
|
||||
{
|
||||
// Length of c/ is 2
|
||||
int prefix_size = strlen(prefix);
|
||||
if (pos+prefix_size+2 > len) return 0;
|
||||
if (in[pos+prefix_size+1]=='/') {
|
||||
return strncmp(in + pos, prefix, prefix_size) == 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Replace /cygdrive/_/ with _:/
|
||||
* Works in place since drive letter is always
|
||||
* shorter than /cygdrive/
|
||||
*/
|
||||
char *replace_cygdrive_cygwin(char const *in)
|
||||
{
|
||||
size_t len = strlen(in);
|
||||
char *out = (char*) malloc(len+1);
|
||||
int i,j;
|
||||
|
||||
if (len < 12) {
|
||||
memmove(out, in, len + 1);
|
||||
return out;
|
||||
}
|
||||
|
||||
for (i = 0, j = 0; i<len;) {
|
||||
if (is_prefix_here(i, in, len, "/cygdrive/")) {
|
||||
out[j++] = in[i+10];
|
||||
out[j++] = ':';
|
||||
i+=11;
|
||||
} else {
|
||||
out[j] = in[i];
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
out[j] = '\0';
|
||||
return out;
|
||||
}
|
||||
|
||||
void append(char **b, size_t *bl, size_t *u, char *add, size_t addlen)
|
||||
{
|
||||
while ((addlen+*u+1) > *bl) {
|
||||
*bl *= 2;
|
||||
*b = (char*) realloc(*b, *bl);
|
||||
}
|
||||
memcpy(*b+*u, add, addlen);
|
||||
*u += addlen;
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a new string from in where the first occurrence of sub is
|
||||
* replaced by rep.
|
||||
*/
|
||||
char *replace_substring(char *in, char *sub, char *rep)
|
||||
{
|
||||
int in_len = strlen(in);
|
||||
int sub_len = strlen(sub);
|
||||
int rep_len = strlen(rep);
|
||||
char *out = (char *) malloc(in_len - sub_len + rep_len + 1);
|
||||
char *p;
|
||||
|
||||
if (!(p = strstr(in, sub))) {
|
||||
// If sub isn't a substring of in, just return in.
|
||||
return in;
|
||||
}
|
||||
|
||||
// Copy characters from beginning of in to start of sub.
|
||||
strncpy(out, in, p - in);
|
||||
out[p - in] = '\0';
|
||||
|
||||
sprintf(out + (p - in), "%s%s", rep, p + sub_len);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
char* msys_path_list; // @-separated list of paths prefix to look for
|
||||
char* msys_path_list_end; // Points to last \0 in msys_path_list.
|
||||
|
||||
void setup_msys_path_list(char const * argument)
|
||||
{
|
||||
char* p;
|
||||
char* drive_letter_pos;
|
||||
|
||||
msys_path_list = strdup(&argument[2]);
|
||||
msys_path_list_end = &msys_path_list[strlen(msys_path_list)];
|
||||
|
||||
// Convert all at-sign (@) in path list to \0.
|
||||
// @ was chosen as separator to minimize risk of other tools messing around with it
|
||||
p = msys_path_list;
|
||||
do {
|
||||
if (p[1] == ':') {
|
||||
// msys has mangled our path list, restore it from c:/... to /c/...
|
||||
drive_letter_pos = p+1;
|
||||
*drive_letter_pos = *p;
|
||||
*p = '/';
|
||||
}
|
||||
|
||||
// Look for an @ in the list
|
||||
p = strchr(p, '@');
|
||||
if (p != NULL) {
|
||||
*p = '\0';
|
||||
p++;
|
||||
}
|
||||
} while (p != NULL);
|
||||
}
|
||||
|
||||
char *replace_cygdrive_msys(char const *in)
|
||||
{
|
||||
char* str;
|
||||
char* prefix;
|
||||
char* p;
|
||||
|
||||
str = strdup(in);
|
||||
|
||||
// For each prefix in the path list, search for it and replace /c/... with c:/...
|
||||
for (prefix = msys_path_list; prefix < msys_path_list_end && prefix != NULL; prefix += strlen(prefix)+1) {
|
||||
p=str;
|
||||
while ((p = strstr(p, prefix))) {
|
||||
char* drive_letter = p+1;
|
||||
*p = *drive_letter;
|
||||
*drive_letter = ':';
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
* Replace /mnt/_/ with _:/
|
||||
* Works in place since drive letter is always
|
||||
* shorter than /mnt/
|
||||
*/
|
||||
char *replace_cygdrive_wsl(char const *in)
|
||||
{
|
||||
size_t len = strlen(in);
|
||||
char *out = (char*) malloc(len+1);
|
||||
int i,j;
|
||||
|
||||
if (len < 7) {
|
||||
memmove(out, in, len + 1);
|
||||
return out;
|
||||
}
|
||||
|
||||
for (i = 0, j = 0; i<len;) {
|
||||
if (is_prefix_here(i, in, len, "/mnt/")) {
|
||||
out[j++] = in[i+5];
|
||||
out[j++] = ':';
|
||||
i+=6;
|
||||
} else {
|
||||
out[j] = in[i];
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
out[j] = '\0';
|
||||
return out;
|
||||
}
|
||||
|
||||
char*(*replace_cygdrive)(char const *in) = NULL;
|
||||
bool debug_fixpath = false;
|
||||
|
||||
char *files_to_delete[1024];
|
||||
int num_files_to_delete = 0;
|
||||
|
||||
char *fix_at_file(char const *in)
|
||||
{
|
||||
char *tmpdir;
|
||||
char name[2048];
|
||||
char *atname;
|
||||
char *buffer;
|
||||
size_t buflen=65536;
|
||||
size_t used=0;
|
||||
size_t len;
|
||||
int rc;
|
||||
FILE *atout;
|
||||
FILE *atin;
|
||||
char block[2048];
|
||||
size_t blocklen;
|
||||
char *fixed;
|
||||
|
||||
atin = fopen(in+1, "r");
|
||||
if (atin == NULL) {
|
||||
fprintf(stderr, "Could not read at file %s\n", in+1);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
tmpdir = getenv("TEMP");
|
||||
if (tmpdir == NULL) {
|
||||
#if _WIN64
|
||||
tmpdir = "c:/cygwin64/tmp";
|
||||
#else
|
||||
tmpdir = "c:/cygwin/tmp";
|
||||
#endif
|
||||
}
|
||||
_snprintf(name, sizeof(name), "%s\\atfile_XXXXXX", tmpdir);
|
||||
|
||||
rc = _mktemp_s(name, strlen(name)+1);
|
||||
if (rc) {
|
||||
fprintf(stderr, "Could not create temporary file name for at file!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
atout = fopen(name, "w");
|
||||
if (atout == NULL) {
|
||||
fprintf(stderr, "Could not open temporary file for writing! %s\n", name);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
buffer = (char*) malloc(buflen);
|
||||
while ((blocklen = fread(block, 1, sizeof(block), atin)) > 0) {
|
||||
append(&buffer, &buflen, &used, block, blocklen);
|
||||
}
|
||||
buffer[used] = 0;
|
||||
if (debug_fixpath) {
|
||||
fprintf(stderr, "fixpath input from @-file %s: %s\n", &in[1], buffer);
|
||||
}
|
||||
fixed = replace_cygdrive(buffer);
|
||||
if (debug_fixpath) {
|
||||
fprintf(stderr, "fixpath converted to @-file %s is: %s\n", name, fixed);
|
||||
}
|
||||
fwrite(fixed, strlen(fixed), 1, atout);
|
||||
fclose(atin);
|
||||
fclose(atout);
|
||||
free(fixed);
|
||||
free(buffer);
|
||||
files_to_delete[num_files_to_delete] = (char*) malloc(strlen(name)+1);
|
||||
strcpy(files_to_delete[num_files_to_delete], name);
|
||||
num_files_to_delete++;
|
||||
atname = (char*) malloc(strlen(name)+2);
|
||||
atname[0] = '@';
|
||||
strcpy(atname+1, name);
|
||||
return atname;
|
||||
}
|
||||
|
||||
// given an argument, convert it to the windows command line safe quoted version
|
||||
// using rules from:
|
||||
// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
|
||||
// caller is responsible for freeing both input and output.
|
||||
char * quote_arg(char const * in_arg) {
|
||||
char *quoted = NULL;
|
||||
char *current = quoted;
|
||||
int pass;
|
||||
|
||||
if (strlen(in_arg) == 0) {
|
||||
// empty string? explicitly quote it.
|
||||
return _strdup("\"\"");
|
||||
}
|
||||
|
||||
if (strpbrk(in_arg, " \t\n\v\r\\\"") == NULL) {
|
||||
return _strdup(in_arg);
|
||||
}
|
||||
|
||||
// process the arg twice. Once to calculate the size and then to copy it.
|
||||
for (pass=1; pass<=2; pass++) {
|
||||
char const *arg = in_arg;
|
||||
|
||||
// initial "
|
||||
if (pass == 2) {
|
||||
*current = '\"';
|
||||
}
|
||||
current++;
|
||||
|
||||
// process string to be quoted until NUL
|
||||
do {
|
||||
int escapes = 0;
|
||||
|
||||
while (*arg == '\\') {
|
||||
// count escapes.
|
||||
escapes++;
|
||||
arg++;
|
||||
}
|
||||
|
||||
if (*arg == '\0') {
|
||||
// escape the escapes before final "
|
||||
escapes *= 2;
|
||||
} else if (*arg == '"') {
|
||||
// escape the escapes and the "
|
||||
escapes = escapes * 2 + 1;
|
||||
} else {
|
||||
// escapes aren't special, just echo them.
|
||||
}
|
||||
|
||||
// emit some escapes
|
||||
while (escapes > 0) {
|
||||
if (pass == 2) {
|
||||
*current = '\\';
|
||||
}
|
||||
current++;
|
||||
escapes--;
|
||||
}
|
||||
|
||||
// and the current char
|
||||
if (pass == 2) {
|
||||
*current = *arg;
|
||||
}
|
||||
current++;
|
||||
} while (*arg++ != '\0');
|
||||
|
||||
// allocate the buffer
|
||||
if (pass == 1) {
|
||||
size_t alloc = (size_t) (current - quoted + (ptrdiff_t) 2);
|
||||
current = quoted = (char*) calloc(alloc, sizeof(char));
|
||||
}
|
||||
}
|
||||
|
||||
// final " and \0
|
||||
*(current - 1) = '"';
|
||||
*current = '\0';
|
||||
|
||||
return quoted;
|
||||
}
|
||||
|
||||
int main(int argc, char const ** argv)
|
||||
{
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
unsigned short rc;
|
||||
|
||||
char *line;
|
||||
char *current;
|
||||
int i, cmd;
|
||||
DWORD exitCode = 0;
|
||||
DWORD processFlags = 0;
|
||||
BOOL processInheritHandles = TRUE;
|
||||
BOOL waitForChild = TRUE;
|
||||
char* fixpathPath;
|
||||
|
||||
debug_fixpath = (getenv("DEBUG_FIXPATH") != NULL);
|
||||
|
||||
if (argc<2 || argv[1][0] != '-' || (argv[1][1] != 'c' && argv[1][1] != 'm' && argv[1][1] != 'w')) {
|
||||
fprintf(stderr, "Usage: fixpath -c|m|w<path@path@...> [--detach] /cygdrive/c/WINDOWS/notepad.exe [/cygdrive/c/x/test.txt|@/cygdrive/c/x/atfile]\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (debug_fixpath) {
|
||||
char const * cmdline = GetCommandLine();
|
||||
fprintf(stderr, "fixpath input line >%s<\n", strstr(cmdline, argv[1]));
|
||||
}
|
||||
|
||||
if (argv[1][1] == 'c' && argv[1][2] == '\0') {
|
||||
if (debug_fixpath) {
|
||||
fprintf(stderr, "fixpath using cygwin mode\n");
|
||||
}
|
||||
replace_cygdrive = replace_cygdrive_cygwin;
|
||||
} else if (argv[1][1] == 'm') {
|
||||
if (debug_fixpath) {
|
||||
fprintf(stderr, "fixpath using msys mode, with path list: %s\n", &argv[1][2]);
|
||||
}
|
||||
setup_msys_path_list(argv[1]);
|
||||
replace_cygdrive = replace_cygdrive_msys;
|
||||
} else if (argv[1][1] == 'w') {
|
||||
if (debug_fixpath) {
|
||||
fprintf(stderr, "fixpath using wsl mode, with path list: %s\n", &argv[1][2]);
|
||||
}
|
||||
replace_cygdrive = replace_cygdrive_wsl;
|
||||
} else {
|
||||
fprintf(stderr, "fixpath Unknown mode: %s\n", argv[1]);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (argv[2][0] == '-') {
|
||||
if (strcmp(argv[2], "--detach") == 0) {
|
||||
if (debug_fixpath) {
|
||||
fprintf(stderr, "fixpath in detached mode\n");
|
||||
}
|
||||
processFlags |= DETACHED_PROCESS;
|
||||
processInheritHandles = FALSE;
|
||||
waitForChild = FALSE;
|
||||
} else {
|
||||
fprintf(stderr, "fixpath Unknown argument: %s\n", argv[2]);
|
||||
exit(-1);
|
||||
}
|
||||
i = 3;
|
||||
} else {
|
||||
i = 2;
|
||||
}
|
||||
|
||||
// handle assignments
|
||||
while (i < argc) {
|
||||
char const * assignment = strchr(argv[i], '=');
|
||||
if (assignment != NULL && assignment != argv[i]) {
|
||||
size_t var_len = (size_t) (assignment - argv[i] + (ptrdiff_t) 1);
|
||||
char *var = (char *) calloc(var_len, sizeof(char));
|
||||
char *val = replace_cygdrive(assignment + 1);
|
||||
memmove(var, argv[i], var_len);
|
||||
var[var_len - 1] = '\0';
|
||||
strupr(var);
|
||||
|
||||
if (debug_fixpath) {
|
||||
fprintf(stderr, "fixpath setting var >%s< to >%s<\n", var, val);
|
||||
}
|
||||
|
||||
rc = SetEnvironmentVariable(var, val);
|
||||
if (!rc) {
|
||||
// Could not set var for some reason. Try to report why.
|
||||
const int msg_len = 80 + var_len + strlen(val);
|
||||
char * msg = (char *) alloca(msg_len);
|
||||
_snprintf_s(msg, msg_len, _TRUNCATE, "Could not set environment variable [%s=%s]", var, val);
|
||||
report_error(msg);
|
||||
exit(1);
|
||||
}
|
||||
free(var);
|
||||
free(val);
|
||||
} else {
|
||||
// no more assignments;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
// remember index of the command
|
||||
cmd = i;
|
||||
|
||||
// handle command and it's args.
|
||||
while (i < argc) {
|
||||
char const *replaced = replace_cygdrive(argv[i]);
|
||||
if (replaced[0] == '@') {
|
||||
if (waitForChild == FALSE) {
|
||||
fprintf(stderr, "fixpath Cannot use @-files in detached mode: %s\n", replaced);
|
||||
exit(1);
|
||||
}
|
||||
// Found at-file! Fix it!
|
||||
replaced = fix_at_file(replaced);
|
||||
}
|
||||
argv[i] = quote_arg(replaced);
|
||||
i++;
|
||||
}
|
||||
|
||||
// determine the length of the line
|
||||
line = NULL;
|
||||
// args
|
||||
for (i = cmd; i < argc; i++) {
|
||||
line += (ptrdiff_t) strlen(argv[i]);
|
||||
}
|
||||
// spaces and null
|
||||
line += (ptrdiff_t) (argc - cmd + 1);
|
||||
// allocate
|
||||
line = (char*) calloc(line - (char*) NULL, sizeof(char));
|
||||
|
||||
// copy in args.
|
||||
current = line;
|
||||
for (i = cmd; i < argc; i++) {
|
||||
ptrdiff_t len = strlen(argv[i]);
|
||||
if (i != cmd) {
|
||||
*current++ = ' ';
|
||||
}
|
||||
memmove(current, argv[i], len);
|
||||
current += len;
|
||||
}
|
||||
*current = '\0';
|
||||
|
||||
if (debug_fixpath) {
|
||||
fprintf(stderr, "fixpath converted line >%s<\n", line);
|
||||
}
|
||||
|
||||
if (cmd == argc) {
|
||||
if (debug_fixpath) {
|
||||
fprintf(stderr, "fixpath no command provided!\n");
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
ZeroMemory(&si, sizeof(si));
|
||||
si.cb=sizeof(si);
|
||||
ZeroMemory(&pi, sizeof(pi));
|
||||
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
|
||||
fixpathPath = calloc(32767, sizeof(char));
|
||||
rc = GetEnvironmentVariable("FIXPATH_PATH", fixpathPath, 32767);
|
||||
if (rc) {
|
||||
if (debug_fixpath) {
|
||||
fprintf(stderr, "Setting Path to FIXPATH_PATH: %s\n", fixpathPath);
|
||||
}
|
||||
rc = SetEnvironmentVariable("Path", fixpathPath);
|
||||
if (!rc) {
|
||||
// Could not set Path for some reason. Try to report why.
|
||||
const int msg_len = 80 + strlen(fixpathPath);
|
||||
char * msg = (char *)alloca(msg_len);
|
||||
_snprintf_s(msg, msg_len, _TRUNCATE, "Could not set environment variable [Path=%s]", fixpathPath);
|
||||
report_error(msg);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
rc = CreateProcess(NULL,
|
||||
line,
|
||||
0,
|
||||
0,
|
||||
processInheritHandles,
|
||||
processFlags,
|
||||
NULL,
|
||||
NULL,
|
||||
&si,
|
||||
&pi);
|
||||
if (!rc) {
|
||||
// Could not start process for some reason. Try to report why:
|
||||
report_error("Could not start process!");
|
||||
exit(126);
|
||||
}
|
||||
|
||||
if (waitForChild == TRUE) {
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
GetExitCodeProcess(pi.hProcess, &exitCode);
|
||||
|
||||
if (debug_fixpath) {
|
||||
for (i=0; i<num_files_to_delete; ++i) {
|
||||
fprintf(stderr, "fixpath Not deleting temporary file %s\n",
|
||||
files_to_delete[i]);
|
||||
}
|
||||
} else {
|
||||
for (i=0; i<num_files_to_delete; ++i) {
|
||||
remove(files_to_delete[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (exitCode != 0) {
|
||||
if (debug_fixpath) {
|
||||
fprintf(stderr, "fixpath exit code %d\n",
|
||||
exitCode);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (debug_fixpath) {
|
||||
fprintf(stderr, "fixpath Not waiting for child process");
|
||||
}
|
||||
}
|
||||
|
||||
exit(exitCode);
|
||||
}
|
|
@ -37,7 +37,7 @@ const char* get_basename(const char* filename) {
|
|||
const char *basename = filename;
|
||||
const char *cp;
|
||||
for (cp = basename; *cp; cp++) {
|
||||
if (*cp == '/') {
|
||||
if (*cp == '/' || *cp == '\\') {
|
||||
basename = cp+1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue