autoconf
[Top][All Lists]
Advanced

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

[Autoconf] Re: Should the C++ sourcefile extension be changed?


From: Lassi A. Tuura
Subject: [Autoconf] Re: Should the C++ sourcefile extension be changed?
Date: Thu, 14 Sep 2000 09:17:34 +0200

[>>   c++ -c foo.cxx -o foo.o]
> >   c++ -o foo foo.o -L/some/where -lbar
> > must become:
> >   cl -c -Tpfoo.cxx -Fofoo.obj
> >   cl -Fefoo.exe foo.obj bar.lib -link -LIBPATH:\some\where
> 
> This is too dirty. Only a wrapper can help.

Yes, probably.  Just to record for archives that if autoconf doesn't do
this kind of munging, non-trivial linking tests are unlikely to succeed
with `cl'.  Maybe that should be mentioned somewhere in the
documentation?

BTW, it seems that my version of MSVC++ does in fact understand `-o' for
renaming the output executable, though this is not documented.  The
option is ignored when `-c' is used (it does not rename the object
file), but if the macros do not depend on that, I suppose there is no
harm in using `-o' instead of `-Fo' (except potential confusion; that
one test for make would probably fail).  And `-Fe' isn't mandatory, at
least if you cross your fingers and stand on your head at the same time.

Another discovery: `cl -o foo.exe -TP foo.cc kernel32.lib' has fun
behaviour.  `-TP' really applies to all the remaining arguments on the
command line :-)  `-Tp' is safer.

BTW, the first of the commands got lost, I put it back for
completeness.  I meant them as two separate example commands, one
compilation and one linking.  No need to track error codes.  After this
analysis, the commands could be:
  cl -c -Tpfoo.cxx -o foo.obj
  cl -o foo.exe foo.obj bar.lib -link LIBPATH:\some\where

Come to think of it, cl automatically searches libraries in the
directories mentioned in $LIB -- that's how it finds its own libraries. 
Another alternative for the linking command above would be:
  LIBS="$LIBS:<all directories from -L options in $LDFLAGS>"
  cl -o foo.exe foo.obj bar.lib

That munging would actually be doable...  Oh darn, except that it would
still have to translate the paths to windows paths under cygwin.  How
much pain is acceptable?  :-)

Cheers & thanks!
//lat
-- 
Children begin by loving their parents.  After a time they judge
them.  Rarely, if ever, do they forgive them.  --Oscar Wilde


reply via email to

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