libtool-patches
[Top][All Lists]
Advanced

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

Re: MSYS+MSVC for libtool branch-2-0, take 7


From: Ralf Wildenhues
Subject: Re: MSYS+MSVC for libtool branch-2-0, take 7
Date: Sat, 20 Aug 2005 11:03:18 +0200
User-agent: Mutt/1.5.9i

Hi Peter,

Something beforehand, I forgot to mention it earlier:
You called successful `configure' without options the
holy grail.  Please move away from this thought.

For MSVC, I am very happy and content with a solution
which requires the user to set some default values.
It is trivially possible to automate this for several
packages, either using a config.site file or plain
exported environment variables.

Now to the specific issues (this mail is not your last
one, but deserves some commenting anyway):

* Peter Ekberg wrote on Mon, Aug 15, 2005 at 12:28:14PM CEST:
> Ralf Wildenhues wrote:
> > 
> > Hrmpf.  We can do the -TC/-TP munging inside the libtool script,
> > but people expect to be able to use $CXX as done in the tests.
> > See, not everybody uses Automake, and these people cannot be 
> > expected to use libtool for compilation of code which does not
> > end up in a shared library.
*snip*
> > For the general case, I'm not certain which way is good:
> > Set -TC in CXX, and override CXXLD, or set -TC in per-target CPPFLAGS?
> > The latter still won't work for mixed C/C++ code.  In any 
> > case, the user
> > will have to manually adapt if the package author did not use .cpp.
> 
> Well, I didn't know about those tests when I figured fixing it
> in the compile mode was the easiest.

That's one of the reasons I made you try the new test suite.

> And since people apparently
> also expect to link without libtool (see tests/demo-hardcode.test),

Well, look at this: there is an installed library by some random
package, I write a program which uses it.  Why should the fact that
the package author uses Libtool influence my use or non-use of it?
(There is a difference to some extent, surely, but we don't want
to force people to do one or the other.)

> there is as you say no easy way out here. Looks like my first
> assessment was correct, -TC/-TP are useless. I suppose one
> approach does not contradict the other, we can both add -TC/-TP
> in compile mode and zap them in link mode. But, since there is no
> perfect solution, I kind of think it should just be required that
> sources are named *.cpp if you want to be portable. Wonder if
> there is some other braindead C++ compiler that only understands
> *.cc or something. That would be ... fun.

The link I already posted about this issue:
http://lists.gnu.org/archive/html/bug-autoconf/2005-05/msg00001.html
sounds rather assuring.

> You lost me in the last paragraph. What is CXXLD? The linker used
> to link C++ stuff? What do you mean by "per-target CPPFLAGS"?
> The whole paragraph does not make sence to me, I just don't get
> what you are trying to say...

I am thinking about Automake.

Let's take another step back first and view the whole problem space:
Libtool may be used in conjunction with Autoconf and Automake (the
most common situation), but Libtool may just as well be used with
Automake only and some other means to produce Makefile.in (the most
common situation here being a hand-written Makefile.in).  Alternatively,
a package author may want to rely on a preinstalled `libtool' script
(read: as opposed to a libtoolized package, where libtool.m4 and
ltmain.sh are present) and call that from whatever other build software
(make, ...) she employs.

We want Libtool to work well in conjunction with Automake, but we also
want it to work in any situation.  The non-Automake situations are less
under our control, but also usually easier to adapt by package authors.

Let's focus on Libtool+Automake+Autoconf now:
Right now, there are packages which create libraries both with Libtool
and (usually static ones) without.  This works so-so, it certainly is
buggy when the former are linked against the latter (build tree
references in installed .la files are a common result).  Now, even with
this bug (which eventually needs fixing in some way), I still don't want
to kill this possibility off in general.  For package supposed to be
buildable with MSVC, I don't mind killing that option too much[1].
However, since the time Automake makes merging (sub-)packages into trees
of packages easier, it is becoming a rather common issue.

Now to CXXLD:
One workaround for the /TP issue would be to configure with
  CXX='cl /TP'  CXXLD=cl
(when Automake is in use).  I don't know, however, whether this breaks
many configure tests in other packages.  Does it work for Libtool?

> Regarding those tests in the new testsuite, they are using both
> the -c and the -o flags, without regard to the outcome of the
> _LT_COMPILER_C_O macro. Not that I suffer from this and I guess
> you where aware of it, but it is a tiny tiny point in favour
> of using the libtool compile mode :-)

Ahh, thanks, I missed that one, too.  Must've been because MSVC is
the only compiler I know and have used in the last couple of years
that barfs over `-c -o'.  See patch below.

> > (Note: we need to provide patches for Automake.)
> 
> I'm lost there, haven't really looked at perl code in ages, and
> my perl knowledge is, err, limited...

OK.  I'm a bit lost there still, too.  Even so, there is no point moving
more and more functionality into Libtool which belongs into Automake.

> > OK.  I just realized that stresstest doesn't do half the damage
> > that I want it to expose on win32.  Will propose an updated version
> > soon, which I expect to break on several platforms.
> 
> Noooooo, more work :-)

Not yet done, sorry.

> > Meanwhile, I installed these patches below.  If inherited_flags still
> > fails, at least we should now be able to see why.
> 
> Thanks!

OK, it still fails.  Does it succeed with the proposed patch below?
(Use TESTSUITE_FLAGS='-v -d N-M' and similar to only run test numbers
N-M, --list gives you the numbers).

OK to apply to HEAD?

[1] After all, you're not very likely to want to build GCC with MSVC,
for example.

        * tests/inherited_flags.at: Weaken for MSVC.
        * tests/early-libtool.at, tests/template.at: Fix for compiler
        that do not understand `-c -o'.

Index: tests/inherited_flags.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/inherited_flags.at,v
retrieving revision 1.5
diff -u -r1.5 inherited_flags.at
--- tests/inherited_flags.at    13 Aug 2005 07:26:52 -0000      1.5
+++ tests/inherited_flags.at    19 Aug 2005 09:21:27 -0000
@@ -57,11 +57,15 @@
 
 AT_CHECK([${LIBTOOL} --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la 
baz.lo -no-undefined -rpath /usr/local/lib ./libfoo.la ./libbar.la],
         [ignore],[stdout],[ignore])
-AT_CHECK([grep 
'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib' stdout],
+# We used to grep for
+# 'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib'
+# here.  This fails on win32/MSVC because the generated command lines have a
+# different syntax.  So drop the first `l'.
+AT_CHECK([grep 'lt_[[ui]]nlikely_existing_lib.*lt_[[ui]]nlikely_existing_lib' 
stdout],
         [0],[ignore],[ignore])
 AT_CHECK([${LIBTOOL} --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main main.lo 
-no-undefined -rpath /usr/local/lib  ./libfoo.la ./libbar.la],
        [ignore],[stdout],[ignore])
-AT_CHECK([grep 
'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib' stdout],
+AT_CHECK([grep 'lt_[[ui]]nlikely_existing_lib.*lt_[[ui]]nlikely_existing_lib' 
stdout],
         [0],[ignore],[ignore])
 
 AT_CLEANUP
Index: tests//early-libtool.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/early-libtool.at,v
retrieving revision 1.1
diff -u -r1.1 early-libtool.at
--- tests//early-libtool.at     18 Aug 2005 17:07:17 -0000      1.1
+++ tests//early-libtool.at     20 Aug 2005 08:57:55 -0000
@@ -58,7 +58,7 @@
 .SUFFIXES: .c .o .lo
 
 .c.o:
-       $(COMPILE) -c -o $@ $<
+       $(COMPILE) -c $<
 .c.lo:
        $(LTCOMPILE) -c -o $@ $<
 ]])
@@ -162,7 +162,7 @@
 .SUFFIXES: .c .o
 
 .c.o:
-       $(COMPILE) -c -o $@ $<
+       $(COMPILE) -c $<
 ]])
 
 AT_DATA([hello.c],
Index: tests//template.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/template.at,v
retrieving revision 1.4
diff -u -r1.4 template.at
--- tests//template.at  13 Aug 2005 06:45:36 -0000      1.4
+++ tests//template.at  20 Aug 2005 08:57:55 -0000
@@ -81,7 +81,7 @@
 AT_CHECK($LIBTOOL --tag=CXX --mode=compile $CXX -I. $CPPFLAGS $CXXFLAGS -c -o 
aclib.lo aclib.cpp, [0], [ignore], [ignore])
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS -o 
libaclib.la aclib.lo, [0], [ignore], [ignore])
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS -o libalib.la 
-rpath /usr/local/lib alib.lo libaclib.la, [0], [ignore], [ignore])
-AT_CHECK($CXX -I. $CPPFLAGS $CXXFLAGS -c -o prog.o prog.cpp, [0], [ignore], 
[ignore])
+AT_CHECK($CXX -I. $CPPFLAGS $CXXFLAGS -c prog.cpp, [0], [ignore], [ignore])
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS -o prog 
prog.o libalib.la, [0], [ignore], [ignore])
 
 LT_AT_EXEC_CHECK([./prog], [0], [a sample prog
@@ -125,6 +125,7 @@
 LT_AT_TAG([CXX])
 CPPFLAGS="$CPPFLAGS -I../src/lib -I../src/lib2"
 
+
 mkdir src obj
 ( cd src; mkdir lib lib2 sub )
 ( cd obj; mkdir lib lib2 sub )
@@ -199,36 +200,49 @@
 
 cd obj
 
+# If the compiler supports -c -o, we want to use it:
+# it may make a difference for templates
+eval `$LIBTOOL --tag=CXX --config | grep ^compiler_c_o=`
+case $compiler_c_o in
+yes)
+  main_o=sub/main.o
+  AT_CHECK($CXX $CPPFLAGS $CXXFLAGS -c -o $main_o ../src/sub/main.cpp, [0], 
[ignore], [ignore])
+  ;;
+*)
+  main_o=main.o
+  AT_CHECK($CXX $CPPFLAGS $CXXFLAGS -c ../src/sub/main.cpp, [0], [ignore], 
[ignore])
+  ;;
+esac
+
 AT_CHECK($LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS -c -o 
lib/a.lo ../src/lib/a.cpp, [0], [ignore], [ignore])
 AT_CHECK($LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS -c -o 
lib2/b.lo ../src/lib2/b.cpp, [0], [ignore], [ignore])
-AT_CHECK($CXX $CPPFLAGS $CXXFLAGS -c -o sub/main.o ../src/sub/main.cpp, [0], 
[ignore], [ignore])
 # both convenience
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib/liba.la 
lib/a.lo, [0], [ignore], [ignore])
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la 
lib2/b.lo, [0], [ignore], [ignore])
-AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o 
lib2/libb.la lib/liba.la, [0], [ignore], [ignore])
+AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main $main_o 
lib2/libb.la lib/liba.la, [0], [ignore], [ignore])
 LT_AT_EXEC_CHECK([./sub/main], [ignore])
 # lib convenience
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la 
lib2/b.lo -rpath /foo, [0], [ignore], [ignore])
-AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o 
lib2/libb.la lib/liba.la, [0], [ignore], [ignore])
+AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main $main_o 
lib2/libb.la lib/liba.la, [0], [ignore], [ignore])
 LT_AT_EXEC_CHECK([./sub/main])
 # both installed
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib/liba.la lib/a.lo 
-rpath /foo, [0], [ignore], [ignore])
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la 
lib2/b.lo -rpath /bar, [0], [ignore], [ignore])
-AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o 
lib2/libb.la lib/liba.la, [0], [ignore], [ignore])
+AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main $main_o 
lib2/libb.la lib/liba.la, [0], [ignore], [ignore])
 LT_AT_EXEC_CHECK([./sub/main])
 # both convenience, libb depending on liba
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib/liba.la 
lib/a.lo, [0], [ignore], [ignore])
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la 
lib2/b.lo lib/liba.la, [0], [ignore], [ignore])
-AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o 
lib2/libb.la, [0], [ignore], [ignore])
+AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main $main_o 
lib2/libb.la, [0], [ignore], [ignore])
 LT_AT_EXEC_CHECK([./sub/main])
 # lib convenience
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la 
lib2/b.lo lib/liba.la -rpath /foo, [0], [ignore], [ignore])
-AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o 
lib2/libb.la, [0], [ignore], [ignore])
+AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main $main_o 
lib2/libb.la, [0], [ignore], [ignore])
 LT_AT_EXEC_CHECK([./sub/main])
 # both installed
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib/liba.la lib/a.lo 
-rpath /foo, [0], [ignore], [ignore])
 AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la 
lib2/b.lo lib/liba.la -rpath /bar, [0], [ignore], [ignore])
-AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o 
lib2/libb.la, [0], [ignore], [ignore])
+AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main $main_o 
lib2/libb.la, [0], [ignore], [ignore])
 LT_AT_EXEC_CHECK([./sub/main])
 
 cd ..




reply via email to

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