ChrisB
ChrisB

Reputation: 4718

library found during configure, but not make

I'm trying to bundle up a small C++ program using automake and autotools. In my current setup, a required library is installed in a location that the configure script is able to find, but is not found when invoking g++ from make.

I can fix this by passing in the relevant -I option when calling configure (such that the proper include path is passed along to the compiler), but I'd prefer that the configure script to fail to find the library whenever make cannot find it either.

Alternatively, I'd like the configure script to generate the necessary -I commands so that the compiler finds everything it needs.

Is there some standard way to do this?

Upvotes: 0

Views: 361

Answers (1)

umläute
umläute

Reputation: 31424

your configure script might be broken, or your interpretation of configure's output:

if your library-check during configure checks whether it can link against a certain library, this does by no means guarantee that you have the required headers available (or findable) to compile.

you should therefore add checks to your configure.ac for both the library and the headers

AC_CHECK_LIB([foo], [foo_init])
AC_CHECK_HEADERS([foo.h])

and only assume that you can build if both lib & headers are present.

if headers cannot be found and you have a good idea where they are, you could add those paths (within configure) and re-run the tests. given that you have to add pretty standard paths ('/usr/local/include' should be part of the automated search paths in any case; '/sw/include' is part of fink, so you should make sure that you initialized your system properly by running

$ . /sw/bin/init.sh

in ther terminal (leave out the '$') before trying to run ./configure

Upvotes: 1

Related Questions