From 4f4bf2c5dc60992022f23c5962e0a93ff45016f1 Mon Sep 17 00:00:00 2001 From: Peter Rosin Date: Sat, 2 Aug 2008 14:54:10 +0200 Subject: [PATCH] The MSVC linker doesn't have a -L option. 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 | 12 ++++++++ libltdl/config/ltmain.m4sh | 62 ++++++++++++++++++++++++++++++++++++++ libltdl/m4/libtool.m4 | 4 +++ 3 files changed, 78 insertions(+) diff --git a/ChangeLog b/ChangeLog index 935f7c194..24bfe45d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2008-08-02 Peter Rosin + + 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 On Windows, find potential libs regardless of file name case. diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 0ab6537a6..b1de591e4 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -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" diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index ca032ed10..921521fdc 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -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]) -- 2.47.3