Hi, [Full quoting since I added libtool-patc...@]
Den 2010-08-25 22:28 skrev Charles Wilson: > [Added Peter] > > On 8/25/2010 4:17 PM, Ralf Wildenhues wrote: >> * Charles Wilson wrote on Wed, Aug 25, 2010 at 10:15:55PM CEST: >>> On 8/25/2010 3:50 PM, Ralf Wildenhues wrote: >>>> just to let you know that I am working on reviewing your patch. >>>> But it is not quick to digest ... >>> >>> I know, it is a beast. Fortunately, it has been picked apart in the >>> past, so if you go back and review the threads I posted (which, >>> itself, will take some time to do) that may help make the actual >>> review of the current iteration a little less arduous. >>> >>> I knew it would be a bear, which is why I didn't want to drop it on >>> everybody while we were still discussing the sysroot stuff. >>> Unfortunately, with the 2.2.next deadline approaching, and the >>> sysroot stuff still unmerged...I was running out of time. Since I >>> didn't want to hold Peter's MSVC stuff up any longer, AND I know >>> I'll need a follow-on docu patch or two...I went ahead this week. >>> Sorry :-( >> >> No problem at all, that's what I get from postponing forever. Do you >> know how many other non-doc patches are pending from you and Peter? > > I have no idea how many patches Peter has still pending. In my queue > there are only a few -- none of which are critical for 2.2.next. > > Two have already been presented, but with objections: > > 1) passing -{static|shared}-{libgcc|libstdc++|...} flags thru libtool > to the compiler > 2) handling of win32 manifest files > > In both cases, a long discussion was spawned which never reached a > conclusion about what the right thing to do is. So, I'd just punt on > both until after the next release. I'll just forward port my existing > patches, and package custom cygwin|mingw releases as I've been doing > for the last few years. > > > For #1, I suspect TRTTD is a big scary change: for g++ (and probably, > other gcc language drivers), don't use ld to link, and don't save > pre/post deps. Instead, for GNU tools, use the language drivers > to link. Then, there's no problem allowing these flags thru. (The > issue is, if you configure libtool *without* the flag, but use it > *with* the flag -- or vice versa -- then all your pre/post deps are > wrong.) > > For #2, I'd prefer to wait until after Peter's MSVC stuff is > completely merged, and then see if the GNU toolchains for win32 can > piggy back off of any of his machinery. > > Other than that, there are the following (not yet written) patches: > 3) docu for this patch > 4) tests for my earlier monster patch merged a few months ago ("allow > -dlpreopen with -disable-shared", mostly concerned with getting the > correct symbol exports when -{enable|disable}-{static|shared}). This is my current queue of libtool patches. They need more work. In particular, I don't know if 0008-Slashify-instead-of-backslashify is even remotely acceptable. The subject has been up before and I think Chuck had some issue with it, but don't remember what. I Can do some searching in my mailbox if that's important... Further, my patches regresses library searching, I think due to paths being converted from posix form to win32 form too early and then something fails to find dependent libraries. Possibly other problems too? Perhaps most interesting are the patches 0002-Add-path-conversion-from-build-to-toolchain 0005-Convert-file-names-to-toolchain-format-in-NM-and-AR which *should* fix stresstest.at on MSYS (not confirmed, due to the above problems). Maybe 0001-Move-path-conversion-functions-earlier-in-the-libtoo is needed for 0002 to apply cleanly, but it should not be needed in principle. Anyway, here they are, just so that you can see where I'm at... Cheers, Peter
>From c8344d25b28d300bf14124ed0fe36346a462a0f8 Mon Sep 17 00:00:00 2001 From: Peter Rosin <p...@lysator.liu.se> Date: Wed, 25 Aug 2010 08:55:01 +0200 Subject: [PATCH 1/7] Move path conversion functions earlier in the libtool script. * libltdl/config/ltmain.m4sh (func_wine_to_win32_path) (func_cygpath, func_msys_to_win32, func_path_convert_check) (func_to_host_path, func_noop_path_convert) (func_msys_to_mingw_path_convert) (func_cygwin_to_mingw_path_convert) (func_nix_to_mingw_path_convert) (func_msys_to_cygwin_path_convert) (func_nix_to_cygwin_path_convert): Move to before func_mode_compile to make them usable from there. Signed-off-by: Peter Rosin <p...@lysator.liu.se> --- ChangeLog | 13 + libltdl/config/ltmain.m4sh | 560 ++++++++++++++++++++++---------------------- 2 files changed, 295 insertions(+), 278 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f11204..cda261e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2010-08-25 Peter Rosin <p...@lysator.liu.se> + + Move path conversion functions earlier in the libtool script. + * libltdl/config/ltmain.m4sh (func_wine_to_win32_path) + (func_cygpath, func_msys_to_win32, func_path_convert_check) + (func_to_host_path, func_noop_path_convert) + (func_msys_to_mingw_path_convert) + (func_cygwin_to_mingw_path_convert) + (func_nix_to_mingw_path_convert) + (func_msys_to_cygwin_path_convert) + (func_nix_to_cygwin_path_convert): Move to before + func_mode_compile to make them usable from there. + 2010-08-23 Charles Wilson <libt...@cwilson.fastmail.fm> Fix syntax for cygwin-cross diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 72927ba..01fabf8 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -646,6 +646,285 @@ EOF } } +#################################### +# PATH CONVERSION HELPER FUNCTIONS # +#################################### + +# func_wine_to_win32_path ARG +# Helper function used by path conversion functions +# when $build is *nix, and $host is mingw, cygwin, +# or some other win32 environment. Relies on a +# correctly configured wine environment available, +# with the winepath program in $build's $PATH. +# +# ARG is the $build path to be converted to win32 format. +# result is available in $func_wine_to_win32_path_result +# result is empty on error (or when arg is empty) +func_wine_to_win32_path () +{ + $opt_debug + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + func_wine_to_win32_path_result="$1" + if test -n "$1"; then + # Unfortunately, winepath does not exit with a non-zero + # error code, so we are forced to check the contents of + # stdout. On the other hand, if the command is not + # found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both + # error code of zero AND non-empty stdout, which explains + # the odd construction: + func_wine_to_win32_path_tmp=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "${func_wine_to_win32_path_tmp}"; then + func_wine_to_win32_path_result=`$ECHO "$func_wine_to_win32_path_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_wine_to_win32_path_result= + fi + fi +} +# end: func_wine_to_win32_path + + +# func_cygpath ARGS... +# a wrapper around calling the cygpath program via +# LT_CYGPATH, when $host is *nix and cygwin is +# hosted via a wine environment (or, rarely, when +# host is mingw -- that is, msys). +# +# Result is available in func_cygpath_result, which +# may be empty on error. Can accomodate both paths +# and pathlists (with appropriate options). +# +# ARGS are the typical arguments and options for +# the cygpath program. Usually, the last argument +# is the path or pathlist to be converted. +# +# The full *nix (or msys) path to the cygpath program must be +# specified in the LT_CYGPATH environment variable. This +# is because (a) the cygpath program shouldn't be in $PATH, +# because it usually lives in cygwin's bin/ directory -- +# along with *cygwin* versions of sed, id, cp. If the *nix (or +# msys) host environment had those programs in its $PATH, many +# bad things could happen. (b) especially in cygwin-1.7, multiple +# installations (with separate "mount tables" in +# <CYGROOT-N>/etc/fstab) can coexist on the same Win32 +# instance. The cygpath.exe for cygwin installation #N in +# <CYGROOT-N>/bin automatically deduces the appropriate +# ../etc/fstab file. Therefore, it matters which cygpath.exe +# is used. LT_CYGPATH may be replaced or supplemented by an +# LT_INIT-activated configure option in the future. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existant file: \`$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_msys_to_win32 ARG +# Converts ARG from msys (unix-ish) format to +# win32 format. Can accomodate both paths and pathlists. +# Result is available in func_msys_to_win32_result. +func_msys_to_win32 () +{ + $opt_debug + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + # awkward: cmd appends spaces to result + func_msys_to_win32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_msys_to_win32 + + +# func_path_convert_check ARG1 ARG2 +# Verify that ARG1 (a path in $build format) was +# converted to $host format in ARG2. Otherwise, emit +# an error message, but continue (resetting +# func_to_host_path_result to ARG1). +func_path_convert_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host path corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_path_result="$1" + fi +} +# end func_path_convert_check + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `eval $to_host_path_cmd ARG' +# +# At present, the following path conversions are supported: +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# mingw (msys) cygwin [*] [**] +# *nix + wine cygwin [**] +# where wine is equipped with the `winepath' executable. +# [*] available, but not officially supported. See comments with +# func_msys_to_cygwin_path_convert. +# [**] requires environment variable $LT_CYGPATH. See comments +# with func_cygpath. +# In each case, ARG is the path to be converted from $build +# to $host format. the result will be available in +# $func_to_host_path_result. + + +# func_to_host_path ARG +# converts the path ARG from $build format to $host +# format. +func_to_host_path () +{ + $opt_debug + eval '$to_host_path_cmd "$1"' +} +# end func_to_host_path + + +# func_noop_path_convert ARG +# A no-op path conversion function for use when $build == $host. +# or when there is no required (or known) conversion function +# between $build and $host. +func_noop_path_convert () +{ + $opt_debug + func_to_host_path_result="$1" +} +# end func_noop_path_convert + + +# func_msys_to_mingw_path_convert ARG +# A path conversion function for use with "native" mingw +# builds -- that is, when $host is *mingw*, and $build +# is *mingw* (which is to say, msys). In this case, the +# msys shell automatically converts paths for any non-msys +# applications it launches, but that facility isn't available +# from inside the cwrapper. +# +# ARG is the path to be converted; the result is available +# in func_to_host_path_result. +func_msys_to_mingw_path_convert () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + func_msys_to_win32 "$1" + func_to_host_path_result="$func_msys_to_win32_result" + fi + func_path_convert_check "$1" "$func_to_host_path_result" +} +# end func_msys_to_mingw_path_convert + + +# func_cygwin_to_mingw_path_convert ARG +# A path conversion function for use when $host is *mingw* +# but $build is *cygwin*. In this case, the cygpath program +# provided by the $build environment is sufficient for all +# conversions. +# +# ARG is the path to be converted; the result is available +# in func_to_host_path_result. +func_cygwin_to_mingw_path_convert () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath + # in $PATH; no need to use LT_CYGPATH in this case. + func_to_host_path_result=`cygpath -m "$1"` + fi + func_path_convert_check "$1" "$func_to_host_path_result" +} +# end func_cygwin_to_mingw_path_convert + + +# func_nix_to_mingw_path_convert ARG +# A path conversion function for use when $host is *mingw* +# but $build is some *nix variant. In this case, we assume +# that a wine environment with a working winepath executable +# is available in $build's $PATH. +# +# ARG is the path to be converted; the result is available +# in func_to_host_path_result. +func_nix_to_mingw_path_convert () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + func_wine_to_win32_path "$1" + func_to_host_path_result="$func_wine_to_win32_path_result" + fi + func_path_convert_check "$1" "$func_to_host_path_result" +} +# end func_nix_to_mingw_path_convert + + +# func_msys_to_cygwin_path_convert ARG +# A path conversion function for use when $host is *cygwin* +# but $build is *mingw* (that is, msys). This implies running +# a cross build from msys to cygwin -- but msys has notorious +# problems executing cygwin apps, because of conflicts between +# cygwin1.dll and msys-1.0.dll. However, we'll try it. First, +# convert from msys to win32, then use func_cygpath to convert +# from win32 to cygwin. Requires LT_CYGPATH. +# +# ARG is the path to be converted; the result is available +# in func_to_host_path_result. +func_msys_to_cygwin_path_convert () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + func_msys_to_win32 "$1" + func_cygpath -u "$func_msys_to_win32_result" + func_to_host_path_result="$func_cygpath_result" + fi + func_path_convert_check "$1" "$func_to_host_path_result" +} +# end func_msys_to_cygwin_path_convert + +# func_nix_to_cygwin_path_convert ARG +# A path conversion function for use when $host is *cygwin* +# but $build is some *nix variant. In this case, we assume +# that a wine environment with a working winepath executable +# is available in $build's $PATH, and that cygwin is installed +# within that wine environment. Requires LT_CYGPATH (see +# func_cygpath). +# +# ARG is the path to be converted; the result is available +# in func_to_host_path_result. +func_nix_to_cygwin_path_convert () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # convert from *nix to win32, then use cygpath to + # convert from win32 to cygwin. + func_wine_to_win32_path "$1" + func_cygpath -u "$func_wine_to_win32_path_result" + func_to_host_path_result="$func_cygpath_result" + fi + func_path_convert_check "$1" "$func_to_host_path_result" +} +# end func_nix_to_cygwin_path_convert + + # func_mode_compile arg... func_mode_compile () { @@ -2775,44 +3054,9 @@ fi\ " } -#################################### -# PATH CONVERSION HELPER FUNCTIONS # -#################################### - -# func_wine_to_win32_path ARG -# Helper function used by path conversion functions -# when $build is *nix, and $host is mingw, cygwin, -# or some other win32 environment. Relies on a -# correctly configured wine environment available, -# with the winepath program in $build's $PATH. -# -# ARG is the $build path to be converted to win32 format. -# result is available in $func_wine_to_win32_path_result -# result is empty on error (or when arg is empty) -func_wine_to_win32_path () -{ - $opt_debug - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - func_wine_to_win32_path_result="$1" - if test -n "$1"; then - # Unfortunately, winepath does not exit with a non-zero - # error code, so we are forced to check the contents of - # stdout. On the other hand, if the command is not - # found, the shell will set an exit code of 127 and print - # *an error message* to stdout. So we must check for both - # error code of zero AND non-empty stdout, which explains - # the odd construction: - func_wine_to_win32_path_tmp=`winepath -w "$1" 2>/dev/null` - if test "$?" -eq 0 && test -n "${func_wine_to_win32_path_tmp}"; then - func_wine_to_win32_path_result=`$ECHO "$func_wine_to_win32_path_tmp" | - $SED -e "$lt_sed_naive_backslashify"` - else - func_wine_to_win32_path_result= - fi - fi -} -# end: func_wine_to_win32_path - +######################################## +# PATHLIST CONVERSION HELPER FUNCTIONS # +######################################## # func_wine_to_win32_pathlist ARG # Helper function used by path conversion functions @@ -2854,85 +3098,6 @@ func_wine_to_win32_pathlist () # end: func_wine_to_win32_pathlist -# func_cygpath ARGS... -# a wrapper around calling the cygpath program via -# LT_CYGPATH, when $host is *nix and cygwin is -# hosted via a wine environment (or, rarely, when -# host is mingw -- that is, msys). -# -# Result is available in func_cygpath_result, which -# may be empty on error. Can accomodate both paths -# and pathlists (with appropriate options). -# -# ARGS are the typical arguments and options for -# the cygpath program. Usually, the last argument -# is the path or pathlist to be converted. -# -# The full *nix (or msys) path to the cygpath program must be -# specified in the LT_CYGPATH environment variable. This -# is because (a) the cygpath program shouldn't be in $PATH, -# because it usually lives in cygwin's bin/ directory -- -# along with *cygwin* versions of sed, id, cp. If the *nix (or -# msys) host environment had those programs in its $PATH, many -# bad things could happen. (b) especially in cygwin-1.7, multiple -# installations (with separate "mount tables" in -# <CYGROOT-N>/etc/fstab) can coexist on the same Win32 -# instance. The cygpath.exe for cygwin installation #N in -# <CYGROOT-N>/bin automatically deduces the appropriate -# ../etc/fstab file. Therefore, it matters which cygpath.exe -# is used. LT_CYGPATH may be replaced or supplemented by an -# LT_INIT-activated configure option in the future. -func_cygpath () -{ - $opt_debug - if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then - func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` - if test "$?" -ne 0; then - # on failure, ensure result is empty - func_cygpath_result= - fi - else - func_cygpath_result= - func_error "LT_CYGPATH is empty or specifies non-existant file: \`$LT_CYGPATH'" - fi -} -#end: func_cygpath - - -# func_msys_to_win32 ARG -# Converts ARG from msys (unix-ish) format to -# win32 format. Can accomodate both paths and pathlists. -# Result is available in func_msys_to_win32_result. -func_msys_to_win32 () -{ - $opt_debug - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - # awkward: cmd appends spaces to result - func_msys_to_win32_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` -} -#end: func_msys_to_win32 - - -# func_path_convert_check ARG1 ARG2 -# Verify that ARG1 (a path in $build format) was -# converted to $host format in ARG2. Otherwise, emit -# an error message, but continue (resetting -# func_to_host_path_result to ARG1). -func_path_convert_check () -{ - $opt_debug - if test -z "$2" && test -n "$1" ; then - func_error "Could not determine host path corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_path_result="$1" - fi -} -# end func_path_convert_check - - # func_pathlist_convert_check FROM_PATHSEP TO_PATHSEP FROM_PATHLIST TO_PATHLIST # Verify that FROM_PATHLIST (a path in $build format) was converted # $host format in TO_PATHLIST. Otherwise, emit an error message, but @@ -2983,167 +3148,6 @@ func_pathlist_front_back_pathsep () # end func_pathlist_front_back_pathsep -############################################# -# $build to $host PATH CONVERSION FUNCTIONS # -############################################# -# invoked via `eval $to_host_path_cmd ARG' -# -# At present, the following path conversions are supported: -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# mingw (msys) cygwin [*] [**] -# *nix + wine cygwin [**] -# where wine is equipped with the `winepath' executable. -# [*] available, but not officially supported. See comments with -# func_msys_to_cygwin_path_convert. -# [**] requires environment variable $LT_CYGPATH. See comments -# with func_cygpath. -# In each case, ARG is the path to be converted from $build -# to $host format. the result will be available in -# $func_to_host_path_result. - - -# func_to_host_path ARG -# converts the path ARG from $build format to $host -# format. -func_to_host_path () -{ - $opt_debug - eval '$to_host_path_cmd "$1"' -} -# end func_to_host_path - - -# func_noop_path_convert ARG -# A no-op path conversion function for use when $build == $host. -# or when there is no required (or known) conversion function -# between $build and $host. -func_noop_path_convert () -{ - $opt_debug - func_to_host_path_result="$1" -} -# end func_noop_path_convert - - -# func_msys_to_mingw_path_convert ARG -# A path conversion function for use with "native" mingw -# builds -- that is, when $host is *mingw*, and $build -# is *mingw* (which is to say, msys). In this case, the -# msys shell automatically converts paths for any non-msys -# applications it launches, but that facility isn't available -# from inside the cwrapper. -# -# ARG is the path to be converted; the result is available -# in func_to_host_path_result. -func_msys_to_mingw_path_convert () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - func_msys_to_win32 "$1" - func_to_host_path_result="$func_msys_to_win32_result" - fi - func_path_convert_check "$1" "$func_to_host_path_result" -} -# end func_msys_to_mingw_path_convert - - -# func_cygwin_to_mingw_path_convert ARG -# A path conversion function for use when $host is *mingw* -# but $build is *cygwin*. In this case, the cygpath program -# provided by the $build environment is sufficient for all -# conversions. -# -# ARG is the path to be converted; the result is available -# in func_to_host_path_result. -func_cygwin_to_mingw_path_convert () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # because $build is cygwin, we call "the" cygpath - # in $PATH; no need to use LT_CYGPATH in this case. - func_to_host_path_result=`cygpath -m "$1"` - fi - func_path_convert_check "$1" "$func_to_host_path_result" -} -# end func_cygwin_to_mingw_path_convert - - -# func_nix_to_mingw_path_convert ARG -# A path conversion function for use when $host is *mingw* -# but $build is some *nix variant. In this case, we assume -# that a wine environment with a working winepath executable -# is available in $build's $PATH. -# -# ARG is the path to be converted; the result is available -# in func_to_host_path_result. -func_nix_to_mingw_path_convert () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - func_wine_to_win32_path "$1" - func_to_host_path_result="$func_wine_to_win32_path_result" - fi - func_path_convert_check "$1" "$func_to_host_path_result" -} -# end func_nix_to_mingw_path_convert - - -# func_msys_to_cygwin_path_convert ARG -# A path conversion function for use when $host is *cygwin* -# but $build is *mingw* (that is, msys). This implies running -# a cross build from msys to cygwin -- but msys has notorious -# problems executing cygwin apps, because of conflicts between -# cygwin1.dll and msys-1.0.dll. However, we'll try it. First, -# convert from msys to win32, then use func_cygpath to convert -# from win32 to cygwin. Requires LT_CYGPATH. -# -# ARG is the path to be converted; the result is available -# in func_to_host_path_result. -func_msys_to_cygwin_path_convert () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - func_msys_to_win32 "$1" - func_cygpath -u "$func_msys_to_win32_result" - func_to_host_path_result="$func_cygpath_result" - fi - func_path_convert_check "$1" "$func_to_host_path_result" -} -# end func_msys_to_cygwin_path_convert - -# func_nix_to_cygwin_path_convert ARG -# A path conversion function for use when $host is *cygwin* -# but $build is some *nix variant. In this case, we assume -# that a wine environment with a working winepath executable -# is available in $build's $PATH, and that cygwin is installed -# within that wine environment. Requires LT_CYGPATH (see -# func_cygpath). -# -# ARG is the path to be converted; the result is available -# in func_to_host_path_result. -func_nix_to_cygwin_path_convert () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # convert from *nix to win32, then use cygpath to - # convert from win32 to cygwin. - func_wine_to_win32_path "$1" - func_cygpath -u "$func_wine_to_win32_path_result" - func_to_host_path_result="$func_cygpath_result" - fi - func_path_convert_check "$1" "$func_to_host_path_result" -} -# end func_nix_to_cygwin_path_convert - - ################################################# # $build to $host PATHLIST CONVERSION FUNCTIONS # ################################################# -- 1.7.1
>From 6142f2d434781373d572009af2b9cf40ccd7b93b Mon Sep 17 00:00:00 2001 From: Peter Rosin <p...@lysator.liu.se> Date: Wed, 25 Aug 2010 11:25:40 +0200 Subject: [PATCH 2/7] Add path conversion from $build to toolchain. * libltdl/m4/libtool.m4 (_LT_PATH_CONVERSION_FUNCTIONS): Add cache variable lt_cv_to_tool_path_cmd that describes how to convert paths from $build to toolchain format. * libltdl/config/ltmain.m4sh (func_to_tool_path): New function that utilizes the above. * Makefile.am: Ensure to_tool_path_cmd is included in TEST_ENVIRONMENT so that it is passed to (old testsuite) tests. * testsuite.at: Ensure to_tool_path_cmd is passed as a variable setting on the configure line for (new testsuite) tests. Signed-off-by: Peter Rosin <p...@lysator.liu.se> --- ChangeLog | 13 +++++++++++++ Makefile.am | 3 ++- libltdl/config/ltmain.m4sh | 14 ++++++++++++++ libltdl/m4/libtool.m4 | 20 ++++++++++++++++++++ tests/testsuite.at | 5 ++++- 5 files changed, 53 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cda261e..c951f8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2010-08-25 Peter Rosin <p...@lysator.liu.se> + Add path conversion from $build to toolchain. + * libltdl/m4/libtool.m4 (_LT_PATH_CONVERSION_FUNCTIONS): Add + cache variable lt_cv_to_tool_path_cmd that describes how to + convert paths from $build to toolchain format. + * libltdl/config/ltmain.m4sh (func_to_tool_path): New function + that utilizes the above. + * Makefile.am: Ensure to_tool_path_cmd is included in + TEST_ENVIRONMENT so that it is passed to (old testsuite) tests. + * testsuite.at: Ensure to_tool_path_cmd is passed as a variable + setting on the configure line for (new testsuite) tests. + +2010-08-25 Peter Rosin <p...@lysator.liu.se> + Move path conversion functions earlier in the libtool script. * libltdl/config/ltmain.m4sh (func_wine_to_win32_path) (func_cygpath, func_msys_to_win32, func_path_convert_check) diff --git a/Makefile.am b/Makefile.am index 251dc19..b0fdece 100644 --- a/Makefile.am +++ b/Makefile.am @@ -529,7 +529,8 @@ TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ F77="$(F77)" FFLAGS="$(FFLAGS)" \ FC="$(FC)" FCFLAGS="$(FCFLAGS)" \ GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)" \ - lt_cv_to_host_path_cmd="$(to_host_path_cmd)" + lt_cv_to_host_path_cmd="$(to_host_path_cmd)" \ + lt_cv_to_tool_path_cmd="$(to_tool_path_cmd)" BUILDCHECK_ENVIRONMENT = _lt_pkgdatadir="$(abs_top_srcdir)" \ LIBTOOLIZE="$(abs_top_builddir)/libtoolize" \ diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 01fabf8..a8ba41d 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -797,6 +797,20 @@ func_to_host_path () # end func_to_host_path +# func_to_tool_path ARG +# converts the path ARG from $build format to toolchain +# format. +func_to_tool_path () +{ + $opt_debug +# lt_func_to_host_path_result=$func_to_host_path_result + eval '$to_tool_path_cmd "$1"' + func_to_tool_path_result=$func_to_host_path_result +# func_to_host_path_result=$lt_func_to_host_path_result +} +# end func_to_tool_path + + # func_noop_path_convert ARG # A no-op path conversion function for use when $build == $host. # or when there is no required (or known) conversion function diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index d7bd57d..03786bc 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -7627,5 +7627,25 @@ AC_MSG_RESULT([$lt_cv_to_host_path_cmd]) _LT_DECL([to_host_path_cmd], [lt_cv_to_host_path_cmd], [0], [convert $build paths to $host format])dnl AC_SUBST([to_host_path_cmd])dnl + +AC_MSG_CHECKING([how to convert $build paths to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_path_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_path_cmd=func_noop_path_convert +case $host in + *mingw* ) + case $build in + *mingw* ) # actually msys + lt_cv_to_tool_path_cmd=func_msys_to_mingw_path_convert + ;; + esac + ;; +esac +]) +to_tool_path_cmd=$lt_cv_to_tool_path_cmd +AC_MSG_RESULT([$lt_cv_to_tool_path_cmd]) +_LT_DECL([to_tool_path_cmd], [lt_cv_to_tool_path_cmd], + [0], [convert $build paths to toolchain format])dnl +AC_SUBST([to_tool_path_cmd])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/tests/testsuite.at b/tests/testsuite.at index 3475fa1..ee54dd3 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -37,7 +37,7 @@ for tool in ACLOCAL AUTOHEADER AUTOCONF AUTOMAKE AUTORECONF; do done export ACLOCAL AUTOHEADER AUTOCONF AUTOMAKE AUTORECONF eval `$LIBTOOL --config | grep '^EGREP='` -eval `$LIBTOOL --config | $EGREP '^(host|host_os|host_alias|build|build_alias|to_host_path_cmd)='` +eval `$LIBTOOL --config | $EGREP '^(host|host_os|host_alias|build|build_alias|to_host_path_cmd|to_tool_path_cmd)='` configure_options=--prefix=/nonexistent if test -n "$host_alias"; then configure_options="$configure_options --host $host_alias" @@ -48,6 +48,9 @@ fi if test -n "$to_host_path_cmd"; then configure_options="$configure_options lt_cv_to_host_path_cmd=$to_host_path_cmd" fi +if test -n "$to_tool_path_cmd"; then + configure_options="$configure_options lt_cv_to_tool_path_cmd=$to_tool_path_cmd" +fi if (FOO=bar; unset FOO) >/dev/null 2>&1; then unset=unset else -- 1.7.1
>From 798d514f2afa31ca0a62478e9c754a0add9971ee Mon Sep 17 00:00:00 2001 From: Peter Rosin <p...@lysator.liu.se> Date: Wed, 25 Aug 2010 11:08:31 +0200 Subject: [PATCH 3/7] Convert file names to toolchain format when linking. * libltdl/config/ltmain.m4sh (func_mode_link): When exporting symbols and when linking using command files (or response files), make sure that both the name of the command file and the content are made up of file names in a format appropriate for the tool. Fixes problems in stresstest.at on MSYS when run with low command line length. Signed-off-by: Peter Rosin <p...@lysator.liu.se> --- ChangeLog | 10 ++++++++++ libltdl/config/ltmain.m4sh | 11 ++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c951f8f..a9ba720 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2010-08-25 Peter Rosin <p...@lysator.liu.se> + Convert file names to toolchain format when linking. + * libltdl/config/ltmain.m4sh (func_mode_link): When exporting + symbols and when linking using command files (or response + files), make sure that both the name of the command file and + the content are made up of file names in a format appropriate + for the tool. Fixes problems in stresstest.at on MSYS when run + with low command line length. + +2010-08-25 Peter Rosin <p...@lysator.liu.se> + Add path conversion from $build to toolchain. * libltdl/m4/libtool.m4 (_LT_PATH_CONVERSION_FUNCTIONS): Add cache variable lt_cv_to_tool_path_cmd that describes how to diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index a8ba41d..347d859 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -7519,10 +7519,13 @@ EOF echo 'INPUT (' > $output for obj in $save_libobjs do - $ECHO "$obj" >> $output + func_to_tool_path "$obj" + $ECHO "$func_to_tool_path_result" >> $output done echo ')' >> $output func_append delfiles " $output" + func_to_tool_path "$output" + output=$func_to_tool_path_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" @@ -7536,10 +7539,12 @@ EOF fi for obj do - $ECHO "$obj" >> $output + func_to_tool_path "$obj" + $ECHO "$func_to_tool_path_result" >> $output done func_append delfiles " $output" - output=$firstobj\"$file_list_spec$output\" + func_to_tool_path "$output" + output=$firstobj\"$file_list_spec$func_to_tool_path_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." -- 1.7.1
>From d1b67707192a709fb3d87f35123dd9f365f479c6 Mon Sep 17 00:00:00 2001 From: Peter Rosin <p...@lysator.liu.se> Date: Wed, 25 Aug 2010 09:13:05 +0200 Subject: [PATCH 4/7] Translate dependent libraries using func_to_tool_path * libltdl/config/ltmain.m4sh (func_mode_link): Translate paths to dependent libraries for easy consumption by the toolchain. Signed-off-by: Peter Rosin <p...@lysator.liu.se> --- ChangeLog | 7 +++++++ libltdl/config/ltmain.m4sh | 5 ++++- 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index a9ba720..d8995d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2010-08-25 Peter Rosin <p...@lysator.liu.se> + Translate dependent libraries using func_to_tool_path + * libltdl/config/ltmain.m4sh (func_mode_link): Translate + paths to dependent libraries for easy consumption by the + toolchain. + +2010-08-25 Peter Rosin <p...@lysator.liu.se> + Convert file names to toolchain format when linking. * libltdl/config/ltmain.m4sh (func_mode_link): When exporting symbols and when linking using command files (or response diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 347d859..26f6fda 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -6379,7 +6379,10 @@ func_mode_link () *) func_append tmp_libs " $deplib" ;; esac ;; - *) func_append tmp_libs " $deplib" ;; + *) + func_to_tool_path "$deplib" + func_quote_for_eval "$func_to_tool_path_result" + func_append tmp_libs " $func_quote_for_eval_unquoted_result" ;; esac done eval $var=\"$tmp_libs\" -- 1.7.1
>From f07b1a418c5f871f6284f63cfed2b1647f29ca11 Mon Sep 17 00:00:00 2001 From: Peter Rosin <p...@lysator.liu.se> Date: Wed, 25 Aug 2010 10:57:16 +0200 Subject: [PATCH 5/7] Convert file names to toolchain format in $NM and $AR @files. * libltdl/config/ltmain.m4sh (func_mode_link): When listing symbols and when creating archives using command files (or response files), make sure that both the name of the command file and the content are made up of file names in a format appropriate for the tool. Fixes stresstest.at on MSYS when run with low command line length. Signed-off-by: Peter Rosin <p...@lysator.liu.se> --- ChangeLog | 10 ++++++++++ libltdl/config/ltmain.m4sh | 12 ++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index d8995d4..a914544 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2010-08-25 Peter Rosin <p...@lysator.liu.se> + Convert file names to toolchain format in $NM and $AR @files. + * libltdl/config/ltmain.m4sh (func_mode_link): When listing + symbols and when creating archives using command files (or + response files), make sure that both the name of the command + file and the content are made up of file names in a format + appropriate for the tool. Fixes stresstest.at on MSYS when + run with low command line length. + +2010-08-25 Peter Rosin <p...@lysator.liu.se> + Translate dependent libraries using func_to_tool_path * libltdl/config/ltmain.m4sh (func_mode_link): Translate paths to dependent libraries for easy consumption by the diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 26f6fda..8751c34 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -7373,11 +7373,13 @@ EOF save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm - libobjs=$nm_file_list_spec$output + func_to_tool_path "$output" + libobjs=$nm_file_list_spec$func_to_tool_path_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do - $ECHO "$obj" + func_to_tool_path "$obj" + $ECHO "$func_to_tool_path_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' @@ -8359,9 +8361,11 @@ EOF func_verbose "using command file archive linking..." for obj in $oldobjs do - $ECHO "$obj" + func_to_tool_path "$obj" + $ECHO "$func_to_tool_path_result" done > $output_objdir/$libname.libcmd - oldobjs=" $archiver_list_spec$output_objdir/$libname.libcmd" + func_to_tool_path "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_path_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts -- 1.7.1
>From ca77d16fa4ec03ff527206d81675afffa69cc360 Mon Sep 17 00:00:00 2001 From: Peter Rosin <p...@lysator.liu.se> Date: Wed, 25 Aug 2010 09:36:47 +0200 Subject: [PATCH 6/7] Use func_to_tool_path instead of fix_srcfile_path. * libltdl/config/ltmain.m4sh (func_mode_compile): Replace the fix_srcfile_path hook with a call to func_to_host_path. * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) [cygwin,mingw,pw32] [cegcc]: Drop fix_srcfile_path. Signed-off-by: Peter Rosin <p...@lysator.liu.se> --- ChangeLog | 8 ++++++++ libltdl/config/ltmain.m4sh | 5 ++--- libltdl/m4/libtool.m4 | 3 --- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index a914544..d944a5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2010-08-25 Peter Rosin <p...@lysator.liu.se> + Use func_to_tool_path instead of fix_srcfile_path. + * libltdl/config/ltmain.m4sh (func_mode_compile): Replace the + fix_srcfile_path hook with a call to func_to_host_path. + * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) [cygwin,mingw,pw32] + [cegcc]: Drop fix_srcfile_path. + +2010-08-25 Peter Rosin <p...@lysator.liu.se> + Convert file names to toolchain format in $NM and $AR @files. * libltdl/config/ltmain.m4sh (func_mode_link): When listing symbols and when creating archives using command files (or diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 8751c34..909db6f 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -1167,9 +1167,8 @@ compiler." func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi + func_to_tool_path "$srcfile" + srcfile=$func_to_tool_path_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index 03786bc..7e4a146 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -4985,7 +4985,6 @@ _LT_EOF _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac @@ -5511,8 +5510,6 @@ _LT_TAGDECL([], [inherit_rpath], [0], to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [fix_srcfile_path], [1], - [Fix the shell variable $srcfile for the compiler]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], -- 1.7.1
>From a519184f2de3ceb351880aefe4164e7f473cff95 Mon Sep 17 00:00:00 2001 From: Peter Rosin <p...@lysator.liu.se> Date: Wed, 25 Aug 2010 10:42:16 +0200 Subject: [PATCH 7/8] Convert POSIX paths to toolchain format for MSVC * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS, _LT_LANG_CXX_CONFIG) [mingw] <cl>: Make sure the -outputresource: path for the manifest tool is in Win32 format. Same for the MSVC command file containing the exports. Signed-off-by: Peter Rosin <p...@lysator.liu.se> --- ChangeLog | 8 ++++++++ libltdl/m4/libtool.m4 | 10 ++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d944a5c..771a442 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2010-08-25 Peter Rosin <p...@lysator.liu.se> + Convert POSIX paths with prefixes to host format for MSYS/MSVC + * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS, _LT_LANG_CXX_CONFIG) + [mingw] <cl>: Make sure the -outputresource: path for the + manifest tool is in Win32 format. Same for the MSVC command file + containing the exports. + +2010-08-25 Peter Rosin <p...@lysator.liu.se> + Use func_to_tool_path instead of fix_srcfile_path. * libltdl/config/ltmain.m4sh (func_mode_compile): Replace the fix_srcfile_path hook with a call to func_to_host_path. diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index 7e4a146..2e90b5a 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -4953,7 +4953,8 @@ _LT_EOF else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ - $CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs @$output_objdir/$soname.exp -Wl,-DLL~ + func_to_tool_path "$output_objdir/$soname.exp"~ + $CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs "@$func_to_tool_path_result" -Wl,-DLL~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' @@ -4962,6 +4963,8 @@ _LT_EOF # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + func_to_tool_path "$lt_outputfile"~ + lt_outputfile=$func_to_tool_path_result~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" ;; @@ -5939,7 +5942,8 @@ if test "$_lt_caught_CXX_error" != yes; then else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ - $CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs @$output_objdir/$soname.exp -Wl,-DLL~ + func_to_tool_path "$output_objdir/$soname.exp"~ + $CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs "@$func_to_tool_path_result" -Wl,-DLL~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' @@ -5947,6 +5951,8 @@ if test "$_lt_caught_CXX_error" != yes; then # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + func_to_tool_path "$lt_outputfile"~ + lt_outputfile=$func_to_tool_path_result~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" ;; -- 1.7.1
>From d2d69e4f681d76da47583245627ce439e350c400 Mon Sep 17 00:00:00 2001 From: Peter Rosin <p...@lysator.liu.se> Date: Thu, 26 Aug 2010 08:08:35 +0200 Subject: [PATCH 8/8] Slashify instead of backslashify. --- libltdl/config/ltmain.m4sh | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 909db6f..b5be7f0 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -737,10 +737,10 @@ func_cygpath () func_msys_to_win32 () { $opt_debug - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + lt_sed_naive_slashify='s|\\|/|g' # awkward: cmd appends spaces to result func_msys_to_win32_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_slashify"` } #end: func_msys_to_win32 -- 1.7.1