libtool
[Top][All Lists]
Advanced

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

ASFLAGS handling for dlltool


From: Tor Lillqvist
Subject: ASFLAGS handling for dlltool
Date: Mon, 23 Sep 2002 04:00:12 +0300

When libool invokes dlltool on mingw (and cygwin), it needs to pass in
any ASFLAGS that the client configure.in might have set, because the
configure.in might set AS=gcc and ASFLAGS=-c. (If it set just AS="gcc
-c" dlltool would try to invoke a program called "gcc -c", sigh. The
client configure.in typically sets AS beause of the need to compile
some real assembly code in the client in some special way, but the
same AS flags gets passed to dlltool by libtool, too. Maybe it
shouldn't, surely the assembler invokation by dlltool never needs to
use any special-purpose assembler or assembler flags that might be
needed for client assembler source files?)

Some complication is caused by the fact that ASFLAGS in the client
configure.in contains just the flags to (the program to be used as)
assembler, possibly with embedded whitespace, and dlltool wants them as
--as-flags "flags".

Anyway, I think the below patch fixes that, at least it seems to work
for me. (Hmm, another small change slipped into this diff: Check for
EXPORTS on any line in a --export-symbols file, not just the
first. Some .def files have other stuff in them, too.)

But: Now as I rethink, a better fix might indeed be to *not* pass any
--as=$AS to dlltool, and instead assume dlltool knows what assembler
to use for the assembler sources it produces itself? Any $AS specified
by configure.in should be only for the user's .[sS] files. Libtool
would ignore AS and ASFLAGS altogether.

Index: libtool.m4
===================================================================
RCS file: /cvs/libtool/libtool.m4,v
retrieving revision 1.264
diff -u -2 -r1.264 libtool.m4
--- libtool.m4  10 Sep 2002 13:50:06 -0000      1.264
+++ libtool.m4  23 Sep 2002 00:23:22 -0000
@@ -171,4 +171,6 @@
 test -z "$AR_FLAGS" && AR_FLAGS=cru
 test -z "$AS" && AS=as
+test -z "$ASFLAGS" && AS_FLAGS=
+test -n "$ASFLAGS" && AS_FLAGS="--as-flags \\\"$ASFLAGS\\\""
 test -z "$CC" && CC=cc
 test -z "$LTCC" && LTCC=$CC
@@ -3616,4 +3618,7 @@
 AS="$AS"
 
+# Flag for assembler flags to pass to dlltool
+AS_FLAGS="$AS_FLAGS"
+
 # The name of the directory that contains temporary libtool files.
 objdir=$objdir
@@ -4647,5 +4652,5 @@
        $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
 
-      _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)='$DLLTOOL --as=$AS 
--dllname $soname --def $output_objdir/$soname-def --output-lib 
$output_objdir/$newlib'
+      _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)='$DLLTOOL --as="$AS" 
$AS_FLAGS --dllname $soname --def $output_objdir/$soname-def --output-lib 
$output_objdir/$newlib'
 
       # FIXME: what about values for MSVC?
@@ -4679,8 +4684,8 @@
        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 isline
-      # 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
@@ -4699,7 +4704,7 @@
        '"$ltdll_cmds"'
        $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' 
-Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs 
$compiler_flags~
-       $DLLTOOL --as=$AS --dllname $soname --exclude-symbols 
'$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file 
$output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+       $DLLTOOL --as="$AS" $AS_FLAGS --dllname $soname --exclude-symbols 
'$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file 
$output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
        $CC -Wl,--base-file,$output_objdir/$soname-base 
$output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o 
$output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
-       $DLLTOOL --as=$AS --dllname $soname --exclude-symbols 
'$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file 
$output_objdir/$soname-base --output-exp $output_objdir/$soname-exp 
--output-lib $output_objdir/$libname.dll.a~
+       $DLLTOOL --as="$AS" $AS_FLAGS --dllname $soname --exclude-symbols 
'$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file 
$output_objdir/$soname-base --output-exp $output_objdir/$soname-exp 
--output-lib $output_objdir/$libname.dll.a~
        $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' 
-Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs 
$compiler_flags'
       ;;






reply via email to

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