I'm relatively new to using A开发者_开发技巧utoconf and so far I've only used PKG_CHECK_MODULES
and that's worked for me. I've come across a package, specifically the Debian libmhash-dev v0.9.9.9-1
, that doesn't include a .pc
file for pkg-config
to use.
How do I tell Autoconf to check for mhash
and pass the correct flags onto g++?
Not sure if this is the place for this diatribe (pretty sure it's not!), but my learning curve for a long time has looked like: foo is a great idea, but a lot of the old luddites say its bad, but I'm going to use it because it's great. (wait a few months) Oh, no, the people who said foo was bad were right, but now I've got several months of work committed and I'll have a lot of extra work in front of me to fix it. Bummer.
In short, PKG_CHECK_MODULES is a bad idea, but you may not realize it until you have used it for several months (or years) and have a whole lot of code that depends on it. Save yourself trouble in the future, and start purging PKG_CHECK_MODULES from your configure.ac files today. Use AC_CHECK_LIB and AC_SEARCH_LIBS and AC_CHECK_FUNC, but do not use PKG_CHECK_MODULES.
pkg-config certainly has a place, and a savvy administrator can use it in a CONFIG_SITE or in scripts to help in setting up configure runs, but PKG_CHECK_MODULES should not be used.
But it's better to use AC_SEARCH_LIBS
- as manual advises.
Use AC_CHECK_LIB
.
精彩评论