Hello Satya, * Satya wrote on Sun, Jan 28, 2007 at 03:13:11AM CET: > I have to autoconfiscate a package that depends on a C++ class library. How > can I put a check in configure.ac to check for this dependency ? I looked at > AC_CHECK_LIB() but this library is full of classes and no directly exposed > functions. And what's more, real C++ functions that aren't `extern "C"' are ugly to check with AC_CHECK_LIB anyway. You could use something like this (untested): # somewhere earlier: AC_LANG([C++]) # ... satya_save_LIBS=$LIBS LIBS="-lmy_class_lib $LIBS" AC_CACHE_CHECK([for my_class_lib], [satya_cv_my_class_lib], [AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include <lib-header> ], [ some_expression_that_involves_both_header_and_library_functions ]) ], [satya_cv_my_class_lib=yes], [satya_cv_my_class_lib=no]) ]) LIBS=$satya_save_LIBS if test "$satya_cv_my_class_lib" = yes; then # do whatever adjusting you need to do for presence of the library : ... fi > Do I have to write my own macro ? If you do more than one such check, it would probably be useful to wrap the test in a macro, yes. It could amount to something like # SATYA_CXX_LIB_CHECK(LIBRARY-NICE-NAME, CACHE_VAR, PROLOGUE, EXPR, LIB, # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) AC_DEFUN([SATYA_CXX_LIB_CHECK], [ AC_LANG_ASSERT([C++])dnl satya_save_LIBS=$LIBS LIBS="$5 $LIBS" AC_CACHE_CHECK([for $1], [$2], [AC_LINK_IFELSE([AC_LANG_PROGRAM([$3], [$4])], [AS_VAR_SET([$2], [yes])], [AS_VAR_SET([$2], [no])]) ]) LIBS=$satya_save_LIBS AS_IF([test AS_VAR_GET([$2]) = yes], [$6], [$7]) ]) and then call that like this: SATYA_CXX_LIB_CHECK([my_class_lib], [satya_cv_my_class_lib], [[#include <lib-header>]], [some_expression_that_involves_both_header_and_library_functions], [-lmy_class_lib], [...]) Completely untested, all typos and thinkos are mine. ;-) (Instead of the AC_LANG_ASSERT, you could also bound the macro by AC_LANG_PUSH([C++]) and AC_LANG_POP([C++])). Hope that helps. Cheers, Ralf _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf