Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have Autoconf manually check for library when there is no .pc file

I'm relatively new to using Autoconf 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++?

like image 843
Infiltrator Avatar asked Feb 15 '11 09:02

Infiltrator


1 Answers

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.

like image 89
William Pursell Avatar answered Nov 15 '22 12:11

William Pursell