Incompatibility w/ Automake

Tollef Fog Heen tfheen at err.no
Sun Mar 23 12:17:20 PDT 2008


* Stepan Kasal 

| I'd like to discuss the following problem:
| 
| When using Automake, the -I and -D options should go to *_CPPFLAGS,
| while only the rest should go to *_CFLAGS.
| Likewise -l and -L options go to *_LDADD or *_LIBADD, the rest to
| *_LDFLAGS.

In practice, not distinguishing between CPPFLAGS and CFLAGS doesn't
cause a problem, so I'd recommend just using CFLAGS.  Yes, it might be
unesthetical, but it'll work just fine.  (And use CXXFLAGS if you're
dealing with C++.)

| While the pkg-config program is getting some support for this
| (--libs-only-l, --cflags-only-I, etc.), some problems remain:
| 
| 1) --cflags-only-D is probably also needed.

We could add that if it actually adds value.

| 2) "pkg-config --libs-only-l --libs-only-L" could list both -l and
| -L options, so that pkg-config does not have to be called twice.
| (Looking at the command, --libs-l and --libs-L might actually be
| better names, if it is not too late to rename.)

I'd rather not change the names here as they have been around for
years so if they are to change, we should have a ten-year transition
period or similar.

| 3) PKG_CHECK_MODULES, which is the most used interface to pkg-config,
| still is not aware about the problem.  We need a new, incompatible
| macro.  Shall it have a new name?  If not, shall it have another
| number of parameters?

Why would it need to be changed?  We'd just need to add

$1[]_CPPFLAGS=$pkg_cv_[]$1[]_CPPFLAGS

to the end of the macro in pkg.m4.  I'm not sure if this is a good
idea though, as this will cause problems when people are just using
CFLAGS and not CPPFLAGS in their Makefiles.

| PS: Be tolerant if you think this complaint is not helpful enough.
| I hope it was step forward to send this mail insted of mumbling to my
| pocker, anyway.

No problem. :-)

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


More information about the pkg-config mailing list