libtool-patches
[Top][All Lists]
Advanced

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

Re: MSVC: MSVC needs a hint to force it to compile either as C or C++.


From: Peter Rosin
Subject: Re: MSVC: MSVC needs a hint to force it to compile either as C or C++.
Date: Wed, 23 Jun 2010 09:57:54 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5

Hi Ralf,

Den 2010-06-22 22:16 skrev Ralf Wildenhues:
* Peter Rosin wrote on Tue, Jun 22, 2010 at 03:07:30PM CEST:
So, it's not a bit deal for me to have this one dangling. But that
said, it is nice to "fire and forget"...

This one is not fire and forget.  I can live with "fire", but not with
forget, because the right place to fix this issue is not within Libtool.

The issue is similar to what Fortran solves with AC_FC_SRCEXT in
Autoconf, whose result automake uses to to put right before the source
file name.  Here, the same could be done for -Tc or -Tp, respectively.
One difference is that the flag is not specific to the file name
extension, just to the language.

What am I missing?  Ah yes, someone would need to call such a macro;
probably the cleanest way would be call it from AC_PROG_CC.  One cheaper
way could be to hard-code known extensions into 'compile' now, but that
means this script is getting more uglier.

For those that didn't know, we have these cl options to play with:

/Tp<source file> compile file as .cpp   /Tc<source file> compile file as .c
/TP compile all files as .cpp           /TC compile all files as .c

(but using - instead of / to not go insane immediately)

cl will interpret any files with unknown extensions as object files. It does
know about .c and .cpp, but falls over on .cc .c++ .cxx etc. It will treat
.C files as plain old C since it doesn't care about filename case.

My patches went with -TP/-TC. IIUC AC_FC_SRCEXT outputs FCFLAGS_ext which
can be used as this:

          foo.o: foo.f90
               $(FC) -c $(FCFLAGS) $(FCFLAGS_f90) '$(srcdir)/foo.f90'

which is a closer match for -Tp/-Tc but I don't know if the missing space
is going to be an issue for other potential future users of the macro. I.e.
can you portably store a trailing space in a makefile variable so that the
following is a usable construct for something that needs e.g. say
CXXFLAGS_cc="-cpp "?

     $(CXX) -c $(CXXFLAGS) $(CXXFLAGS_cc)'$(srcdir)/foo.cc'

Another issue that doesn't translate directly from the Fortran case is that
one extension we /may/ want to cover is .c++, and I don't expect that
CXXFLAGS_c++ is very good as a variable name.

To me, it seems way easier to do it in compile. Can it take the clutter?
(which would be something like this added to the proposed compile script)

        *.C | *.cc | *.cpp)
          func_file_conv "$1"
          set x "$@" -Tp"$file"
          shift
          ;;
        *.c)
          func_file_conv "$1"
          set x "$@" -Tc"$file"
          shift
          ;;

And yes, I should apologize for not seeing this four years ago ...

You might have, I just don't remember it (I did search and couldn't find
anything, but that's hardly water tight evidence...). I do have vague
memories of a discussion about which of -TP/-TC and -Tp/-Tc to use though
so don't feel too bad. But that might have been before I proposed the
patch? Anyway, that doesn't matter.

I'm not adding these references about what happened when in these messages
to make everyone apologize and generally feel bad. I add them to simplify
review and to save others from digging in history that I have already been
through.

Cheers,
Peter



reply via email to

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