From 8be8b508867864add7ba4793c6b856384ef8b873 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 4 Feb 2022 16:19:25 +0000 Subject: See [https://github.com/tcltk/tcl/pull/10] --- generic/tclTest.c | 6 +++--- tests/env.test | 4 +++- win/configure | 12 ++++++++++-- win/rules.vc | 9 +++++++++ win/tcl.m4 | 9 ++++++++- win/tclWin32Dll.c | 6 +++--- 6 files changed, 36 insertions(+), 10 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index 8d22edf..9c94f91 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -326,7 +326,7 @@ static Tcl_NRPostProc NREUnwind_callback; static Tcl_ObjCmdProc TestNREUnwind; static Tcl_ObjCmdProc TestNRELevels; static Tcl_ObjCmdProc TestInterpResolverCmd; -#if defined(HAVE_CPUID) || defined(_WIN32) +#if defined(HAVE_CPUID) static Tcl_ObjCmdProc TestcpuidCmd; #endif @@ -600,7 +600,7 @@ Tcltest_Init( NULL, NULL); Tcl_CreateCommand(interp, "testexitmainloop", TestexitmainloopCmd, NULL, NULL); -#if defined(HAVE_CPUID) || defined(_WIN32) +#if defined(HAVE_CPUID) Tcl_CreateObjCommand(interp, "testcpuid", TestcpuidCmd, NULL, NULL); #endif @@ -6955,7 +6955,7 @@ TestFindLastCmd( return TCL_OK; } -#if defined(HAVE_CPUID) || defined(_WIN32) +#if defined(HAVE_CPUID) /* *---------------------------------------------------------------------- * diff --git a/tests/env.test b/tests/env.test index e4e209f..905cdab 100644 --- a/tests/env.test +++ b/tests/env.test @@ -102,7 +102,9 @@ variable keep { SHLIB_PATH SYSTEMDRIVE SYSTEMROOT DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH DYLD_NEW_LOCAL_SHARED_REGIONS DYLD_NO_FIX_PREBINDING MSYSTEM __CF_USER_TEXT_ENCODING SECURITYSESSIONID LANG WINDIR TERM - CommonProgramFiles ProgramFiles CommonProgramW6432 ProgramW6432 + CommonProgramFiles CommonProgramFiles(x86) ProgramFiles + ProgramFiles(x86) CommonProgramW6432 ProgramW6432 + WINECONFIGDIR WINEDATADIR WINEDLLDIR0 WINEHOMEDIR PROCESSOR_ARCHITECTURE } variable printenvScript [makeFile [string map [list @keep@ [list $keep]] { diff --git a/win/configure b/win/configure index b4eeb4f..8abb3d3 100755 --- a/win/configure +++ b/win/configure @@ -3763,10 +3763,15 @@ echo "$as_me: error: ${CC} does not support the -shared option. echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5 echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 ;; + arm64) + MACHINE="ARM64" + echo "$as_me:$LINENO: result: Using ARM64 $MACHINE mode" >&5 +echo "${ECHO_T} Using ARM64 $MACHINE mode" >&6 + ;; ia64) MACHINE="IA64" - echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5 -echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 + echo "$as_me:$LINENO: result: Using IA64 $MACHINE mode" >&5 +echo "${ECHO_T} Using IA64 $MACHINE mode" >&6 ;; *) cat >conftest.$ac_ext <<_ACEOF @@ -3863,6 +3868,9 @@ echo "${ECHO_T}using shared flags" >&6 amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build ;; + arm64) + MACHINE="ARM64" + ;; ia64) MACHINE="IA64" ;; diff --git a/win/rules.vc b/win/rules.vc index 8a91b58..37723c8 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -435,6 +435,8 @@ VCVER=0 && ![echo ARCH=IX86 >> vercl.x] \ && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \ && ![echo ARCH=AMD64 >> vercl.x] \ + && ![echo $(_HASH)elif defined(_M_ARM64) >> vercl.x] \ + && ![echo ARCH=ARM64 >> vercl.x] \ && ![echo $(_HASH)endif >> vercl.x] \ && ![$(cc32) -nologo -TC -P vercl.x 2>NUL] !include vercl.i @@ -490,6 +492,8 @@ MULTIPLATFORM_INSTALL = 0 !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86] NATIVE_ARCH=IX86 +!if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i ARM | findstr /i 64-bit] +NATIVE_ARCH=ARM64 !else NATIVE_ARCH=AMD64 !endif @@ -1476,6 +1480,11 @@ carch = /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE carch = !endif +# cpuid is only available on intel machines +!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "AMD64" +carch = $(carch) /DHAVE_CPUID=1 +!endif + !if $(DEBUG) # Turn warnings into errors cwarn = $(cwarn) -WX diff --git a/win/tcl.m4 b/win/tcl.m4 index 00cd4d2..e2117d2 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -783,9 +783,13 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ MACHINE="AMD64" ; # assume AMD64 as default 64-bit build AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) ;; + arm64) + MACHINE="ARM64" + AC_MSG_RESULT([ Using ARM64 $MACHINE mode]) + ;; ia64) MACHINE="IA64" - AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) + AC_MSG_RESULT([ Using IA64 $MACHINE mode]) ;; *) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -837,6 +841,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build ;; + arm64) + MACHINE="ARM64" + ;; ia64) MACHINE="IA64" ;; diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 9061dd0..8620a08 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -661,12 +661,12 @@ TclWinCPUID( { int status = TCL_ERROR; -#if defined(HAVE_INTRIN_H) && defined(_WIN64) +#if defined(HAVE_INTRIN_H) && defined(_WIN64) && defined(HAVE_CPUID) __cpuid((int *)regsPtr, index); status = TCL_OK; -#elif defined(__GNUC__) +#elif defined(__GNUC__) && defined(HAVE_CPUID) # if defined(_WIN64) /* * Execute the CPUID instruction with the given index, and store results @@ -782,7 +782,7 @@ TclWinCPUID( status = registration.status; # endif /* !_WIN64 */ -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) && defined(HAVE_CPUID) # if defined(_WIN64) __cpuid(regsPtr, index); -- cgit v0.12