branch: development
commit d27d17874b967335b16a7d7660adc900a7a3b937
Author: Ileana Dumitrescu <ileanadumitresc...@gmail.com>
AuthorDate: Wed Dec 11 18:43:47 2024 +0200

    libtoolize.in: Create symlinks with mklink for MSVC
    
    Symlink files are not generated properly with 'ln -s' for MSVC to
    process, so mklink is used, which swaps the argument order of target
    and link_name. This also requires absolute paths, generated with the
    use of cygpath.
    
    * libtoolize.in: Check if linking with mklink and update processing.
---
 libtoolize.in | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/libtoolize.in b/libtoolize.in
index 77d0c9ed..fe8abe74 100644
--- a/libtoolize.in
+++ b/libtoolize.in
@@ -437,6 +437,33 @@ func_copy ()
     else
       my_copycmd=$LN_S
       my_copy_type=linking
+
+      # The Windows linker, mklink, swaps link_name and target.
+      case $my_copycmd in
+      *mklink*)
+        my_temp=$my_destfile
+        my_destfile=$my_srcfile
+        my_srcfile=$my_temp
+
+        my_copy_msg="$my_copy_type file '$my_destfile'"
+        $opt_verbose && my_copy_msg="$my_copycmd $my_srcfile $my_destdir"
+
+        my_destfile=`cygpath -aw "$my_destfile"`
+        my_srcfile=`cygpath -aw "$my_srcfile"`
+
+        if test -d "$my_destfile"; then
+          case $host_os,$build_os in
+          mingw*,cygwin*)
+            my_copycmd="$my_copycmd /d" ;;
+          mingw*,*) # MSYS
+            my_copycmd="$my_copycmd //d" ;;
+          *)
+            my_copycmd="$my_copycmd /d" ;;
+          esac
+        fi
+      ;;
+      *) ;;
+      esac
     fi
     my_copy_msg="$my_copy_type file '$my_destfile'"
     $opt_verbose && my_copy_msg="$my_copycmd $my_srcfile $my_destdir"

Reply via email to