how to handle differing compilers?

Tollef Fog Heen tfheen at err.no
Mon Apr 17 21:56:34 PDT 2006


* Rick Jones 

| So, I'm seeking collective wisdom as to how best to address this - if
| I should keep using the "only" options and special-case exceptions, or
| if there might be something a bit more general?  Is there a way to get
| pkg-config to say what compiler was used to compile the package?

Sorry for being a bit slow in responding to this; I've been on
vacation and even though I've been thinking about this for a while,
there doesn't seem to be a good way to solve this.  You might be able
to play trickes with --variable and such, but this would not be
standardised, so therefore not a very good solution.

pkg-config doesn't know what compiler is being used (there might be
more than one too), unless the application sets it in a variable
somewhere.

What pkg-config could have is something similar to gcc specs files
where you have «if this parameter is set, set this other one», so you
could do pkg-config --compiler=gcc and have a .pc file which said
something like:

Cflags: {compiler=gcc*:-pthread} {compiler=hp-cc*:-yourthreadoption}

I would need to toss this idea about a bit before knowing what to do
about it.  «Use one compiler for all your needs» is an obvious
workaround, but I presume that's a bit hard if you're getting some
precompiled software from somewhere.

-- 
Tollef Fog Heen                                                        ,''`.
UNIX is user friendly, it's just picky about who its friends are      : :' :
                                                                      `. `' 
                                                                        `-  


More information about the pkg-config mailing list