tags:

views:

511

answers:

2

I've written a library that has a dependency on libxml++ and curl and I am having a hard time figuring out how to use AC_CHECK_LIB on my library in another package I've written. The config.log file for the new package indicates that there are undefined references to curl_* and xmlpp::*.

I have PKG_CHECK_MODULES setup for libxml++ and curl in my newest package already, and those work, but they are apparently not available for the AC_CHECK_LIB call for my own library. (I have the checks for libxml++ and curl before the check for my own library)

+3  A: 

I don't know how do you call AC_CHECK_LIB, because it's not in your question, but my guess is that you don't have your dependencies specified as other libraries.

The syntax is:

AC_CHECK_LIB (library, function, [action-if-found], [action-if-not-found], [other-libraries])

so put [-lcurl ...] as the last argument.

marcin
This didn't answer my question directly, but it did point me in the correct direction. Thanks!
Beau Simensen
+1  A: 

Why don't you just provide a pkg-config metadata file (*.pc) for your package. That way clients could use PKG_CHECK_MODULES and things would Just Work.

But the fact that you're having this problem suggests that you aren't linking your library with libxml++ and libcurl--and you probably should be. On most modern systems (including Linux), shared libraries know about their dependencies.

Braden
I find the GNU autotoolset to be extremely hard to find *good* documentation on. I was using pkg-config in my first library directly to get data for curl and libxml++ and I was not using AC_CHECK_LIB or PKG_CHECK_MODULES. So, I was linking against them and using pkg-config... just not in this way.I have already started the process of adding a *.pc file for my first library and things seem to be going more smoothly now.
Beau Simensen