On Wed, Nov 29, 2000 at 04:51:32PM +0100, Karsten Weiss wrote:
: I'm new to autoconf and would like to know the best way to
: check for the existance of a C++ shared library using autoconf.

If it doesn't matter whether the library is shared or static
(and why should it, really?), do simething like this:

Save $LIBS, and prefix $LIBS with the library link flag (-llib).
Run AC_TRY_LINK with a header file and a call to one of the C++
functions.  Restore $LIBS.

Example (using CVS Autoconf):

    AC_CACHE_CHECK(
      [whether libmycpplib library is available],
      [my_cv_cpplib_avail],
      [my_ac_save_libs=$LIBS
      LIBS="-lmycpplib $LIBS"
      AC_LANG_PUSH(C++)
      AC_TRY_LINK(
        [#include <mycpplib.h>],
        [ClassName::Method();],
        [my_cv_cpplib_avail=true],
        [my_cv_cpplib_avail=false])
      AC_LANG_POP
      LIBS=$my_ac_save_libs
    ])


  Lars J

Reply via email to