automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[automake-commit] 02/03: compile: Distinguish various MinGW, MSYS, MSYS2


From: Karl Berry
Subject: [automake-commit] 02/03: compile: Distinguish various MinGW, MSYS, MSYS2 environments correctly.
Date: Mon, 03 Feb 2025 17:18:32 -0500

karl pushed a commit to branch master
in repository automake.

View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=5b9821deadcf3aaf846c9d043efced56f2e3b59c

commit 5b9821deadcf3aaf846c9d043efced56f2e3b59c
Author: Bruno Haible <bruno@clisp.org>
AuthorDate: Mon Feb 3 14:16:42 2025 -0800

    compile: Distinguish various MinGW, MSYS, MSYS2 environments correctly.
    
    * lib/compile (func_file_conv): Use not only "uname -s", but also
    $MSYSTEM and the presence of cygpath, in order to distinguish the
    original MinGW and MSYS2.
    * lib/ar-lib (func_file_conv): Likewise.
---
 lib/ar-lib  | 15 +++++++++++++--
 lib/compile | 23 ++++++++++++++++++-----
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/lib/ar-lib b/lib/ar-lib
index 85761fbf1..f85f879d8 100755
--- a/lib/ar-lib
+++ b/lib/ar-lib
@@ -51,9 +51,20 @@ func_file_conv ()
        # lazily determine how to convert abs files
        case `uname -s` in
          MINGW*)
-           file_conv=mingw
+           if test -n "$MSYSTEM" && (cygpath --version) >/dev/null 2>&1; then
+             # MSYS2 environment.
+             file_conv=cygwin
+           else
+             # Original MinGW environment.
+             file_conv=mingw
+           fi
            ;;
-         CYGWIN* | MSYS*)
+         MSYS*)
+           # Old MSYS environment, or MSYS2 with 32-bit MSYS2 shell.
+           file_conv=cygwin
+           ;;
+         CYGWIN*)
+           # Cygwin environment.
            file_conv=cygwin
            ;;
          *)
diff --git a/lib/compile b/lib/compile
index e80b054a0..fc738d3d9 100755
--- a/lib/compile
+++ b/lib/compile
@@ -37,11 +37,11 @@ IFS=" ""    $nl"
 
 file_conv=
 
-# func_file_conv build_file lazy
+# func_file_conv build_file unneeded_conversions
 # Convert a $build file to $host form and store it in $file
 # Currently only supports Windows hosts. If the determined conversion
-# type is listed in (the comma separated) LAZY, no conversion will
-# take place.
+# type is listed in (the comma separated) UNNEEDED_CONVERSIONS, no
+# conversion will take place.
 func_file_conv ()
 {
   file=$1
@@ -51,9 +51,20 @@ func_file_conv ()
        # lazily determine how to convert abs files
        case `uname -s` in
          MINGW*)
-           file_conv=mingw
+           if test -n "$MSYSTEM" && (cygpath --version) >/dev/null 2>&1; then
+             # MSYS2 environment.
+             file_conv=cygwin
+           else
+             # Original MinGW environment.
+             file_conv=mingw
+           fi
            ;;
-         CYGWIN* | MSYS*)
+         MSYS*)
+           # Old MSYS environment, or MSYS2 with 32-bit MSYS2 shell.
+           file_conv=cygwin
+           ;;
+         CYGWIN*)
+           # Cygwin environment.
            file_conv=cygwin
            ;;
          *)
@@ -63,6 +74,8 @@ func_file_conv ()
       fi
       case $file_conv/,$2, in
        *,$file_conv,*)
+         # This is the optimization mentioned above:
+         # If UNNEEDED_CONVERSIONS contains $file_conv, don't convert.
          ;;
        mingw/*)
          file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`



reply via email to

[Prev in Thread] Current Thread [Next in Thread]