libtool-patches
[Top][All Lists]
Advanced

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

[PATCH] msvc: eliminate spaces in the library search path.


From: Peter Rosin
Subject: [PATCH] msvc: eliminate spaces in the library search path.
Date: Tue, 21 Sep 2010 09:37:16 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2

Hi!

I know it's late for the release, but I'd like to squeeze this one in
too, if at all possible. After all, it doesn't affect anything but MSVC.

With the patch, I get

sys_lib_search_path_spec="/c/PROGRA~1/MID05A~1/VC/ATLMFC/LIB 
/c/PROGRA~1/MID05A~1/VC/LIB /c/PROGRA~1/MID05A~1/VC/PLATFO~1/lib 
/c/PROGRA~1/MID05A~1/SDK/v2.0/lib"

on MSYS/MSVC, and

sys_lib_search_path_spec="/cygdrive/c/PROGRA~1/MID05A~1/VC/ATLMFC/LIB 
/cygdrive/c/PROGRA~1/MID05A~1/VC/LIB 
/cygdrive/c/PROGRA~1/MID05A~1/VC/PLATFO~1/lib 
/cygdrive/c/PROGRA~1/MID05A~1/SDK/v2.0/lib"

on Cygwin/MSVC, which is a whole lot better than what was there before,
namely this for both

sys_lib_search_path_spec="C:\Program Files\Microsoft Visual Studio 
8\VC\ATLMFC\LIB C:\Program Files\Microsoft Visual Studio 8\VC\LIB C:\Program 
Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib C:\Program Files\Microsoft 
Visual Studio 8\SDK\v2.0\lib"

which simply isn't any good at all.

If this patch is included it means that I can remove tiresome workarounds
when linking with system libraries.

This needs testsuite exposure, and search-path.at seems to come close,
but is not up to the task. Not even if I extend it to try some other
"system library" such as -luser32 if -lz isn't found.

So, ok to push even if it's late and without testsuite coverage?

Cheers,
Peter

>From 6292de4810a69f5debc89d714df0db580e684eef Mon Sep 17 00:00:00 2001
From: Peter Rosin <address@hidden>
Date: Tue, 21 Sep 2010 09:30:07 +0200
Subject: [PATCH] msvc: eliminate spaces in the library search path.

* libltdl/m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER) [mingw, cygwin]
<cl*, sys_lib_search_path_spec>: The LIB path variable telling
where MSVC looks for libraries is with high probably containing
directory names with spaces.  Convert those directory names to
the short 8.3 dos form (i.e. without spaces) when storing them
in sys_lib_search_path_spec, as that is a space separated
variable.

Signed-off-by: Peter Rosin <address@hidden>
---
 ChangeLog             |   11 +++++++++++
 libltdl/m4/libtool.m4 |   49 ++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ceb193c..f32a59a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-09-21  Peter Rosin  <address@hidden>
+
+       msvc: eliminate spaces in the library search path.
+       * libltdl/m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER) [mingw, cygwin]
+       <cl*, sys_lib_search_path_spec>: The LIB path variable telling
+       where MSVC looks for libraries is with high probably containing
+       directory names with spaces.  Convert those directory names to
+       the short 8.3 dos form (i.e. without spaces) when storing them
+       in sys_lib_search_path_spec, as that is a space separated
+       variable.
+
 2010-09-20  Eric Blake  <address@hidden>
 
        maint: drop autobuild requirement
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index a8b07bf..534e912 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -2313,15 +2313,46 @@ m4_if([$1], [],[
     libname_spec='$name'
     soname_spec='${libname}`echo ${release} | $SED -e 
's/[[.]]/-/g'`${versuffix}${shared_ext}'
     library_names_spec='${libname}.dll.lib'
-    sys_lib_search_path_spec="$LIB"
-    if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; 
then
-      # It is most probably a Windows format PATH.
-      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 
's/;/ /g'`
-    else
-      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 
"s/$PATH_SEPARATOR/ /g"`
-    fi
-    # FIXME: find the short name or the path components, as spaces are
-    # common. (e.g. "Program Files" -> "PROGRA~1")
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      # Doesn't work to have IFS=; so select some other char that is
+      # invalid in w32 file names.
+      IFS=?
+      for lt_path in `echo "$LIB" | tr ';' '?'`
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 
's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos 
"$sys_lib_search_path_spec"`
+      sys_lib_search_path_spec=`cygpath --path --unix 
"$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; 
then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 
's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 
"s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo 
\$dlname'\''`~
-- 
1.7.1




reply via email to

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