diff --git a/ChangeLog b/ChangeLog index 10259da8..cd4bd028 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-08-22 Peter Ekberg + + * m4/libtool.m4: Bump serial number. + (LT_PATH_NM): If nm is not found on the path, look for + dumpbin. Then check if $NM responds as dumpbin would + and if not, assume the name lister is BSD nm compatible. + (_LT_CMD_GLOBAL_SYMBOLS): If the name lister uses the + dumpbin interface, adjust the test to find a working + global_symbol_pipe. + * doc/libtool.texi: Document $NM to possibly be MS + dumpbin compatible, and also document the format of the + relevant output from MS dumpbin. + 2005-08-21 Gary V. Vaughan * libltdl/Makefile.am: revert mistaken commit. diff --git a/doc/libtool.texi b/doc/libtool.texi index 92b592f3..c499881f 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -1685,9 +1685,9 @@ the path to the linker used by @samp{$CC}, and whether it is the @end defmac @defmac LT_PATH_NM -Try to find a @sc{bsd} compatible @command{nm} command on this -machine. The result is stored in the shell variable @samp{$NM}, which -is @code{AC_SUBST}ed. +Try to find a @sc{bsd} compatible @command{nm} or a @sc{ms} compatible +@command{dumpbin} command on this machine. The result is stored in the +shell variable @samp{$NM}, which is @code{AC_SUBST}ed. @end defmac @noindent @@ -4997,14 +4997,27 @@ linking and possibly shared libraries. @end defvar @defvar NM -The name of a BSD-compatible @command{nm} program that produces listings -of global symbols in one the following formats: +The name of a BSD- or MS-compatible program that produces listings of +global symbols. +For BSD @command{nm}, the symbols should be in one the following formats: @example @var{address} C @var{global-variable-name} @var{address} D @var{global-variable-name} @var{address} T @var{global-function-name} @end example + +For MS @command{dumpbin}, the symbols should be in one of the following +formats: + +@example +@var{counter} @var{size} UNDEF notype External | @var{global-variable-name} +@var{counter} @var{address} @var{section} notype External | @var{global-variable-name} +@var{counter} @var{address} @var{section} notype () External | @var{global-function-name} +@end example + +The @var{size} of the global variables are not zero and the @var{section} +of the global functions are not "UNDEF". @end defvar @defvar RANLIB diff --git a/m4/libtool.m4 b/m4/libtool.m4 index cbca3dd6..ea06f5b3 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -37,7 +37,7 @@ m4_define([_LT_COPYING], [dnl # the same distribution terms that you use for the rest of that program. ]) -# serial 50 LT_INIT +# serial 51 LT_INIT # LT_PREREQ(VERSION) @@ -2858,9 +2858,11 @@ _LT_DECL([], [file_magic_cmd], [1], # LT_PATH_NM # ---------- -# find the pathname to a BSD-compatible name lister +# find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_OBJEXT])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" @@ -2897,10 +2899,35 @@ else IFS="$lt_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi]) -NM="$lt_cv_path_NM" +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + AC_CHECK_TOOL(DUMPBIN, [dumpbin -symbols], :) + AC_SUBST([DUMPBIN]) + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi test -z "$NM" && NM=nm AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD-compatible nm program])dnl +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + printf "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) ])# LT_PATH_NM # Old names: @@ -3037,7 +3064,19 @@ for ac_symprfx in "" "_"; do symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$SED -n -e ['/ UNDEF [^|]*()/d; / 00* UNDEF /d; + s/.*().*External *| *$ac_symprfx$sympat.*/T $ac_symprfx\1 \1/p; + s/.*External *| *$ac_symprfx$sympat.*/D $ac_symprfx\1 \1/p; + s/.*().*External *| *\([@?][_A-Za-z0-9@?]*\).*/T \1 \1/p; + s/.*External *| *\([@?][_A-Za-z0-9@?]*\).*/D \1 \1/p'" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi # Check to see that the pipe works correctly. pipe_works=no