]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
libtoolize.in: Create symlinks with mklink for MSVC
authorIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Wed, 11 Dec 2024 16:43:47 +0000 (18:43 +0200)
committerIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Mon, 26 May 2025 14:18:50 +0000 (17:18 +0300)
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

index 77d0c9edb7fcc60f682953253bfb0ce886ef4804..fe8abe74194ed607a0d466b5f98a1b4160f6d63a 100644 (file)
@@ -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"