From 2d4af2255feb2eaeca533424f8cba3ec0945d757 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Fri, 19 Nov 2021 20:24:17 +0000 Subject: [PATCH] 8277370: configure script cannot distinguish WSL version Reviewed-by: erikj --- make/autoconf/basic_windows.m4 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/make/autoconf/basic_windows.m4 b/make/autoconf/basic_windows.m4 index a8686e45d89..25d10d9b8fe 100644 --- a/make/autoconf/basic_windows.m4 +++ b/make/autoconf/basic_windows.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2021, 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 @@ -34,9 +34,10 @@ AC_DEFUN([BASIC_SETUP_PATHS_WINDOWS], 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 + # distinguishing between WSL1 and WSL2. + # Check whether "Hyper-V" appears in /proc/interrupts because WSL2 runs on Hyper-V. + $GREP -q Hyper-V /proc/interrupts + if test $? -eq 0; then OPENJDK_BUILD_OS_ENV=windows.wsl2 else OPENJDK_BUILD_OS_ENV=windows.wsl1