Jef Driesen <jefdrie...@hotmail.com> writes: > I'm aware of the advantage of using pkg-config. I even supply the *.pc > files for my own projects. But the point is that if I want to support > systems that don't have pkg-config installed (like Mac OS X in my > case), I have to provide a fallback with manual detection anyway. So > why not skip pkg-config entirely?
I don't even try to fully support systems without pkg-config, I basically just want a fallback so I can get some sort of build on them, maybe with some features disabled. So what I do is use PKG_CHECK_MODULES for normally pkg-config'd packages. It's very concise and easy to use (one line per library, normally). On systems without pkg-config, this will just fail as if the package wasn't installed at all. For a few of the most critical libraries, I use both PKG_CHECK_MODULES (it yields better results when available, is almost trivial, and the support infrastructure is present for other packages anyway), _and_ more traditional probing code as a backup (but see below why it's annoying). > And I could simply replace the pkg-config based check with something like: Even that -- rather verbose -- code often isn't enough, because install locations can vary between systems, in a manner that varies from package to package. In such cases, you can either require the user to specify the location with a configure option (and I want to avoid require user input if at all possible), or you can add a loop to guess various common configurations (which make the configure code somewhat more complex as well as being more likely to yield incorrect results). [Note, all of this results from trying to compile on systems where something didn't work!] -Miles -- Faith, n. Belief without evidence in what is told by one who speaks without knowledge, of things without parallel.