+2005-08-22 Peter Ekberg <peda@lysator.liu.se>
+
+ * 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 <gary@gnu.org>
* libltdl/Makefile.am: revert mistaken commit.
@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
@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
# the same distribution terms that you use for the rest of that program.
])
-# serial 50 LT_INIT
+# serial 51 LT_INIT
# LT_PREREQ(VERSION)
# 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"
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:
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