Author: metze
Date: 2005-08-04 01:42:14 +0000 (Thu, 04 Aug 2005)
New Revision: 9030

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9030

Log:
add a AC_SEARCH_FUNCS_EXT() which takes an extra argument that get the output 
libs
to not pollute the global $LIBS variable

metze
Modified:
   branches/SAMBA_4_0/source/aclocal.m4


Changeset:
Modified: branches/SAMBA_4_0/source/aclocal.m4
===================================================================
--- branches/SAMBA_4_0/source/aclocal.m4        2005-08-04 01:41:03 UTC (rev 
9029)
+++ branches/SAMBA_4_0/source/aclocal.m4        2005-08-04 01:42:14 UTC (rev 
9030)
@@ -117,8 +117,33 @@
 [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],

Reply via email to