0

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)

Beau Simensen
  • 4,558
  • 3
  • 38
  • 55

2 Answers2

7

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
  • 3,351
  • 1
  • 29
  • 33
4

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
  • 1,448
  • 10
  • 11
  • 1
    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 Jul 01 '09 at 18:09