This is an automated email from the git hooks/post-receive script.

ildumi pushed a commit to branch development
in repository libtool.

The following commit(s) were added to refs/heads/development by this push:
     new 9f4b6ade libtool: Support MSYS and MSYS2 file path conversions
9f4b6ade is described below

commit 9f4b6adea4403e38b0b1f75761563c103d7c0e03
Author: Ileana Dumitrescu <ileanadumitresc...@gmail.com>
AuthorDate: Mon Jun 16 21:06:51 2025 +0300

    libtool: Support MSYS and MSYS2 file path conversions
    
    MSYS does not have cygpath installed by default, so during configure,
    a check for cygpath is cached. If cygpath is not found, Window's command
    prompt will be used with a forward slash escape on the 'c' flag:
    "cmd //c".
    
    Reported: https://savannah.gnu.org/support/?110901
    
    * build-aux/ltmain.in: Choose file path conversion for MSYS(2) by
      whether cygpath is installed.
    * m4/libtool.m4: Cache whether cygpath is installed in user path.
---
 build-aux/ltmain.in | 56 ++++++++++++++++++++++++++++++++++++++++++++---------
 m4/libtool.m4       | 23 ++++++++++++++++++++++
 2 files changed, 70 insertions(+), 9 deletions(-)

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 7717c8d0..06207bc8 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -1029,6 +1029,24 @@ func_convert_core_msys_to_w32 ()
 {
   $debug_cmd
 
+  # Compatibility for original MSYS
+  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+    $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
+  if test "$?" -ne 0; then
+      # on failure, ensure result is empty
+      func_convert_core_msys_to_w32_result=
+  fi
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_core_msys_to_w32_with_cygpath ARG
+# Convert file name or path ARG with cygpath from MSYS format to w32
+# format. Return result in func_convert_core_msys_to_w32_with_cygpath_result.
+func_convert_core_msys_to_w32_with_cygpath ()
+{
+  $debug_cmd
+
   # Since MSYS2 is packaged with cygpath, call cygpath in $PATH; no need
   # to use LT_CYGPATH in this case.
   func_convert_core_msys_to_w32_result=`cygpath "$@" 2>/dev/null |
@@ -1038,7 +1056,7 @@ func_convert_core_msys_to_w32 ()
       func_convert_core_msys_to_w32_result=
   fi
 }
-#end: func_convert_core_msys_to_w32
+#end: func_convert_core_msys_to_w32_with_cygpath
 
 
 # func_convert_file_check ARG1 ARG2
@@ -1175,8 +1193,13 @@ func_convert_file_msys_to_w32 ()
 
   func_to_host_file_result=$1
   if test -n "$1"; then
-    func_convert_core_msys_to_w32 -w "$1"
-    func_to_host_file_result=$func_convert_core_msys_to_w32_result
+    if test "yes" = "$cygpath_installed"; then
+      func_convert_core_msys_to_w32_with_cygpath -w "$1"
+      
func_to_host_file_result=$func_convert_core_msys_to_w32_with_cygpath_result
+    else
+      func_convert_core_msys_to_w32 "$1"
+      func_to_host_file_result=$func_convert_core_msys_to_w32_result
+    fi
   fi
   func_convert_file_check "$1" "$func_to_host_file_result"
 }
@@ -1227,8 +1250,13 @@ func_convert_file_msys_to_cygwin ()
 
   func_to_host_file_result=$1
   if test -n "$1"; then
-    func_convert_core_msys_to_w32 -w "$1"
-    func_cygpath -u "$func_convert_core_msys_to_w32_result"
+    if test "yes" = "$cygpath_installed"; then
+      func_convert_core_msys_to_w32_with_cygpath -w "$1"
+      func_cygpath -u "$func_convert_core_msys_to_w32_with_cygpath_result"
+    else
+      func_convert_core_msys_to_w32 "$1"
+      func_cygpath -u "$func_convert_core_msys_to_w32_result"
+    fi
     func_to_host_file_result=$func_cygpath_result
   fi
   func_convert_file_check "$1" "$func_to_host_file_result"
@@ -1329,8 +1357,13 @@ func_convert_path_msys_to_w32 ()
     # and winepath ignores them completely.
     func_stripname : : "$1"
     func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_msys_to_w32 -w -p "$func_to_host_path_tmp1"
-    func_to_host_path_result=$func_convert_core_msys_to_w32_result
+    if test "yes" = "$cygpath_installed"; then
+      func_convert_core_msys_to_w32_with_cygpath -w -p 
"$func_to_host_path_tmp1"
+      
func_to_host_path_result=$func_convert_core_msys_to_w32_with_cygpath_result
+    else
+      func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+      func_to_host_path_result=$func_convert_core_msys_to_w32_result
+    fi
     func_convert_path_check : ";" \
       "$func_to_host_path_tmp1" "$func_to_host_path_result"
     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
@@ -1394,8 +1427,13 @@ func_convert_path_msys_to_cygwin ()
     # See func_convert_path_msys_to_w32:
     func_stripname : : "$1"
     func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_msys_to_w32 -w -p "$func_to_host_path_tmp1"
-    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+    if test "yes" = "$cygpath_installed"; then
+      func_convert_core_msys_to_w32_with_cygpath -w -p 
"$func_to_host_path_tmp1"
+      func_cygpath -u -p "$func_convert_core_msys_to_w32_with_cygpath_result"
+    else
+      func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+      func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+    fi
     func_to_host_path_result=$func_cygpath_result
     func_convert_path_check : : \
       "$func_to_host_path_tmp1" "$func_to_host_path_result"
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index f009a5db..4ef92f3e 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -8716,4 +8716,27 @@ to_tool_file_cmd=$lt_cv_to_tool_file_cmd
 AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
 _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
          [0], [convert $build files to toolchain format])dnl
+
+AC_MSG_CHECKING([whether cygpath is installed])
+AC_CACHE_VAL(lt_cv_cygpath_installed,
+[lt_cv_cygpath_installed=ignoring;
+case $host in
+  *-*-mingw* | *-*-windows* | *-*-cygwin*)
+    case $build in
+      *-*-mingw* | *-*-windows* | *-*-cygwin*)
+        cygpath --help &> /dev/null
+        _lt_result=$?
+        if test 0 = "$_lt_result"; then
+          lt_cv_cygpath_installed=yes;
+        else
+          lt_cv_cygpath_installed=no;
+        fi
+        ;;
+    esac
+    ;;
+esac
+])
+AC_MSG_RESULT([$lt_cv_cygpath_installed])
+_LT_DECL([cygpath_installed], [lt_cv_cygpath_installed],
+         [0], [whether cygpath is installed])dnl
 ])# _LT_PATH_CONVERSION_FUNCTIONS

Reply via email to