autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: testing for library via C++ class


From: Vladimir Panov
Subject: Re: testing for library via C++ class
Date: Sat, 11 Jun 2005 11:44:43 +0300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050418

tom fogal wrote:

I can't seem to find the appropriate way to determine if a user has a
particular library by trying to link with a class and a class method in
that library.

There is a certain static function in a library named 'vtkCommon' that
I would like to check for. I'd like to have autoconf generate a program
like:

#include <vtk/vtkRectilinearGrid.h>
int main() { vtkRectilinearGrid::New(); }

and if it compiled/linked, then assume -lvtkCommon is in a std include
path, add it to LIBS, etc. Unfortunately

AC_CHECK_LIB(vtkCommon,[vtkRectilinearGrid::New()],,AC_MSG_ERROR(...))

is failing because one needs to include the appropriate header or else
compilation fails.

How could I get behavior similar to AC_CHECK_LIB but with an additional
include / other specified line? Maybe I'm making the wrong assumption
that this should be 'easy', and I must AC_DEFINE my own macro to be
testing this sort of thing...

Thanks for any help/insights,

-tom


_______________________________________________
Autoconf mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/autoconf

Hi, Tom.

For C++ libraries, you should use AC_LINK_IFELSE:

AC_LINK_IFELSE(
               [AC_LANG_PROGRAM(
                   [#include <vtk/vtkRectilinearGrid.h>],
                   [vtkRectilinearGrid::New()])],
               [],
               [AC_MSG_ERROR(...)])

Vlado





reply via email to

[Prev in Thread] Current Thread [Next in Thread]