summaryrefslogtreecommitdiff
path: root/source4/aclocal.m4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-08-04 01:42:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:10 -0500
commitd8eb612fb9647be1492406d968829683d38d1947 (patch)
tree842a6e657f66300b06da370e7fe9ebbef96a2178 /source4/aclocal.m4
parent94bc92b7081c05a3dc7baa1c2a5fc96edbec432f (diff)
downloadsamba-d8eb612fb9647be1492406d968829683d38d1947.tar.gz
samba-d8eb612fb9647be1492406d968829683d38d1947.tar.bz2
samba-d8eb612fb9647be1492406d968829683d38d1947.zip
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)
Diffstat (limited to 'source4/aclocal.m4')
-rw-r--r--source4/aclocal.m429
1 files changed, 27 insertions, 2 deletions
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],