libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Suggested improvement to libtool.m4 for Win32


From: Tor Lillqvist
Subject: Suggested improvement to libtool.m4 for Win32
Date: Mon, 1 Jul 2002 01:22:05 +0300 (EEST)

Some sources come with .def files where the EXPORTS line isn't the 1st
one. The following change to curent CVS libtool.m4 takes care of
recognising also those .def files when given as --export-symbols
parameter.

Also included is the addition of -Wl,--enable-auto-image-base to the
switches used when building a DLL. It should make DLLs load a tiny bit
faster. Not that I have done any measurements... but as this feature
is there in ld on Win32, why not use it? I have been using this for a
while for GLib and GTK+ DLLs, with no ill effects.

Another thing: There is an autoconf/libtool glitch that occurs at
least on Cygwin where /bin/sh doesn't support $LINENO: the configure
script produced sets tagnames first to "$tagnames,CXX" which gets
cleaned to just "CXX", then to "$tagnames,GCJ" ie "CXX,GCJ" and *then*
generates the configure.lineno file and sources that. Which then after
a while again appends ",CXX" and ",GCJ" to tagnames. The end result is
that $tagnames contains "CXX,GCJ,CXX,GCJ". This causes a 'tag name
"CXX" already exists' error when CXX comes up the second time.

A workaround is to set CONFIG_SHELL to /bin/bash when running
configure. The correct fix would probably be to check for duplicates
in the _LT_AC_LANG_CXX, _LT_AC_LANG_GCJ and AC_LIBTOOL_RC functions in
libtool.m4, not appending the tag in question to $tagnames if already
there.

Cheers,
--tml

Index: libtool.m4
===================================================================
RCS file: /cvs/libtool/libtool.m4,v
retrieving revision 1.261
diff -u -4 -r1.261 libtool.m4
--- libtool.m4  26 Jun 2002 07:15:36 -0000      1.261
+++ libtool.m4  30 Jun 2002 14:10:26 -0000
@@ -504,9 +504,9 @@
     # require "-mdll"
     SAVE_CFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS -mdll"
     AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
-      [AC_TRY_LINK([], [], 
[lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
+      [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch='-mdll 
-Wl,--enable-auto-image-base'],[lt_cv_cc_dll_switch=-dll])])
     CFLAGS="$SAVE_CFLAGS" ;;
   *-*-cygwin* | *-*-pw32*)
     # cygwin systems need to pass --dll to the linker, and not link
     # crt.o which will require a address@hidden definition.
@@ -4550,12 +4550,12 @@
       _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"'
        $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' 
--output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
        sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < 
$output_objdir/$soname-def > $export_symbols'
 
-      # If the export-symbols file already is a .def file (1st line
-      # is EXPORTS), use it as is.
+      # If the export-symbols file already is a .def file (contains a line
+      # starting with EXPORTS), use it as is.
       # If DATA tags from a recent dlltool are present, honour them!
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`sed 1q 
$export_symbols`" = xEXPORTS; then
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if grep -i ^EXPORTS 
$export_symbols >/dev/null; then
          cp $export_symbols $output_objdir/$soname-def;
        else
          echo EXPORTS > $output_objdir/$soname-def;
          _lt_hint=1;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]