]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
The MSVC linker doesn't have a -L option.
authorPeter Rosin <peda@lysator.liu.se>
Sat, 2 Aug 2008 12:54:10 +0000 (14:54 +0200)
committerPeter Rosin <peda@lysator.liu.se>
Tue, 13 Jan 2009 09:03:54 +0000 (10:03 +0100)
The MSVC linker doesn't have a -L option, and doesn't understand
posix paths.  Move paths to an envvar with a prefix (-LIBPATH:).

* libltdl/m4/libtool.m4: Add new tag variables to specify
to what variable (dashL_envvar) -L options should be moved,
and what to prepend to the -L path (dashL_envvar_spec).
* libltdl/config/ltmain.m4sh (func_dashL_to_envvar): New
function that moves -L options to a variable.
* libltdl/config/ltmain.m4sh (func_mode_link): Prior to
linking, call above function if dashL_envvar is set.

ChangeLog
libltdl/config/ltmain.m4sh
libltdl/m4/libtool.m4

index 935f7c194554b03c3f2f129eb3f5b553f5469b28..24bfe45d66bd8743e31232c71a69972821c901e3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-08-02  Peter Rosin  <peda@lysator.liu.se>
+
+       The MSVC linker doesn't have a -L option, and doesn't understand
+       posix paths.  Move paths to an envvar with a prefix (-LIBPATH:).
+       * libltdl/m4/libtool.m4: Add new tag variables to specify
+       to what variable (dashL_envvar) -L options should be moved,
+       and what to prepend to the -L path (dashL_envvar_spec).
+       * libltdl/config/ltmain.m4sh (func_dashL_to_envvar): New
+       function that moves -L options to a variable.
+       * libltdl/config/ltmain.m4sh (func_mode_link): Prior to
+       linking, call above function if dashL_envvar is set.
+
 2008-08-02  Peter Rosin  <peda@lysator.liu.se>
 
        On Windows, find potential libs regardless of file name case.
index 0ab6537a61266286eac6b36b9b6c7e05059448b7..b1de591e4ee8804f06c005f77db31208f6ad7a20 100644 (file)
@@ -628,6 +628,36 @@ func_infer_tag ()
 }
 
 
+# func_dashL_to_envvar deplibs_variable deplibs...
+func_dashL_to_envvar ()
+{
+  deplibs_variable=$1
+  shift
+  tmp_libs=
+  for deplib; do
+    case $deplib in
+    -L*)
+      func_stripname '-L' '' "$deplib"
+      env_path=$func_stripname_result
+      case $host_os in
+      mingw*)
+       env_path=`cmd \\\\/C echo "$env_path " | $SED -e 's/"\(.*\) " *$/\1/'`
+       ;;
+      cygwin*)
+       env_path=`cygpath -w "$env_path"`
+       ;;
+      esac
+      eval $dashL_envvar="\"\$$dashL_envvar $dashL_envvar_spec$env_path\""
+      ;;
+    *)
+      tmp_libs="$tmp_libs $deplib"
+      ;;
+    esac
+  done
+  eval $deplibs_variable="\"$tmp_libs\""
+}
+
+
 
 # func_write_libtool_object output_name pic_name nonpic_name
 # Create a libtool object file (analogous to a ".la" file),
@@ -7084,6 +7114,19 @@ EOF
          test "X$libobjs" = "X " && libobjs=
        fi
 
+       case $pass/$dashL_envvar in
+       link/) ;;
+       link/*)
+         # Move all -L options to the environment variable
+         # specified by $dashL_envvar.
+         eval save_dashL_envvar="\"\$$dashL_envvar\""
+         eval cmds=\"\$cmds~$dashL_envvar="$save_dashL_envvar"\"
+
+         func_dashL_to_envvar deplibs $deplibs
+         export $dashL_envvar
+         ;;
+       esac
+
        save_ifs="$IFS"; IFS='~'
        for cmd in $cmds; do
          IFS="$save_ifs"
@@ -7312,6 +7355,25 @@ EOF
       compile_deplibs="$new_libs"
 
 
+      case $pass/$dashL_envvar in
+      link/) ;;
+      link/*)
+       # Move all -L options to the environment variable
+       # specified by $dashL_envvar.
+       eval save_dashL_envvar="\"\$$dashL_envvar\""
+
+       func_dashL_to_envvar compile_deplibs $compile_deplibs
+       eval prepend_dashL_envvar="$dashL_envvar=\\\"\$$dashL_envvar\\\""
+       compile_command="$prepend_dashL_envvar $compile_command"
+       eval $dashL_envvar="\"$save_dashL_envvar\""
+
+       func_dashL_to_envvar finalize_deplibs $finalize_deplibs
+       eval prepend_dashL_envvar="$dashL_envvar=\\\"\$$dashL_envvar\\\""
+       finalize_command="$prepend_dashL_envvar $finalize_command"
+       eval $dashL_envvar="\"$save_dashL_envvar\""
+       ;;
+      esac
+
       compile_command="$compile_command $compile_deplibs"
       finalize_command="$finalize_command $finalize_deplibs"
 
index ca032ed10df7d5333947de42e9bbd52757ea86d1..921521fdc8088fccbd35182b04c57474dc9feaab 100644 (file)
@@ -5239,6 +5239,10 @@ _LT_TAGDECL([], [prelink_cmds], [2],
     [Commands necessary for linking programs (against libraries) with templates])
 _LT_TAGDECL([], [file_list_spec], [1],
     [Specify filename containing input files])
+_LT_TAGDECL([], [dashL_envvar], [1],
+    [When linking, move all paths specified with -L options to this variable])
+_LT_TAGDECL([], [dashL_envvar_spec], [1],
+    [When moving paths with dashL_envvar, prepend this to each path])
 dnl FIXME: Not yet implemented
 dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
 dnl    [Compiler flag to generate thread safe objects])