From d8eb612fb9647be1492406d968829683d38d1947 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 4 Aug 2005 01:42:14 +0000 Subject: r9030: add a AC_SEARCH_FUNCS_EXT() which takes an extra argument that get the output libs to not pollute the global $LIBS variable metze (This used to be commit 80bdc68ec188728b80eedf0fde9f22f06349f9b6) --- source4/aclocal.m4 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'source4/aclocal.m4') diff --git a/source4/aclocal.m4 b/source4/aclocal.m4 index 9a044950d3..4bce14d9a6 100644 --- a/source4/aclocal.m4 +++ b/source4/aclocal.m4 @@ -117,8 +117,33 @@ m4_define([AH_CHECK_LIB_EXT], [AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1), [Define to 1 if you have the `]$1[' library (-l]$1[).])]) -# AC_CHECK_FUNCS_EXT(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ----------------------------------------------------------------- +dnl AC_SEARCH_LIBS_EXT(FUNCTION, SEARCH-LIBS, EXT_LIBS, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +dnl [OTHER-LIBRARIES]) +dnl -------------------------------------------------------- +dnl Search for a library defining FUNC, if it's not already available. +AC_DEFUN([AC_SEARCH_LIBS_EXT], +[AC_CACHE_CHECK([for library containing $1], [ac_cv_search_ext_$1], +[ +ac_func_search_ext_save_LIBS=$LIBS +ac_cv_search_ext_$1=no +AC_LINK_IFELSE([AC_LANG_CALL([], [$1])], + [ac_cv_search_ext_$1="none required"]) +if test "$ac_cv_search_ext_$1" = no; then + for ac_lib in $2; do + LIBS="-l$ac_lib $$3 $6 $ac_func_search_save_ext_LIBS" + AC_LINK_IFELSE([AC_LANG_CALL([], [$1])], + [ac_cv_search_ext_$1="-l$ac_lib" +break]) + done +fi +LIBS=$ac_func_search_ext_save_LIBS]) +AS_IF([test "$ac_cv_search_ext_$1" != no], + [test "$ac_cv_search_ext_$1" = "none required" || $3="$ac_cv_search_ext_$1" + $4], + [$5])dnl +]) + dnl check for a function in a $LIBS and $OTHER_LIBS libraries variable. dnl AC_CHECK_FUNC_EXT(func,OTHER_LIBS,IF-TRUE,IF-FALSE) AC_DEFUN([AC_CHECK_FUNC_EXT], -- cgit