summaryrefslogtreecommitdiffstats
path: root/aclocal.m4
diff options
context:
space:
mode:
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m447
1 files changed, 42 insertions, 5 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index c07702c..89e8cbb 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -255,26 +255,63 @@ int main()
AC_MSG_RESULT(no)
])])
+# PA_SEARCH_LIBS(FUNCTION, ARGUMENTS, SEARCH-LIBS,
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
+# [OTHER-LIBRARIES])
+# --------------------------------------------------------
+# Search for a library defining FUNC, if it's not already available.
+AC_DEFUN([PA_SEARCH_LIBS],
+[AS_VAR_PUSHDEF([ac_Search], [ac_cv_search_$1])dnl
+AC_CACHE_CHECK([for library containing $1], [ac_Search],
+[ac_func_search_save_LIBS=$LIBS
+AC_LANG_CONFTEST([AC_LANG_CALL([], [$1])])
+for ac_lib in '' $3; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $6 $ac_func_search_save_LIBS"
+ fi
+ AC_LINK_IFELSE([
+#include "xconfig.h"
+int main (void)
+{
+ $1$2;
+ return 0;
+}], [AS_VAR_SET([ac_Search], [$ac_res])])
+ AS_VAR_SET_IF([ac_Search], [break])
+done
+AS_VAR_SET_IF([ac_Search], , [AS_VAR_SET([ac_Search], [no])])
+LIBS=$ac_func_search_save_LIBS])
+AS_VAR_COPY([ac_res], [ac_Search])
+AS_IF([test "$ac_res" != no],
+ [test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+ $4],
+ [$5])
+AS_VAR_POPDEF([ac_Search])dnl
+])
+
dnl --------------------------------------------------------------------------
dnl PA_SEARCH_LIBS_AND_ADD
dnl
-dnl PA_SEARCH_LIBS_AND_ADD(function, libraries [,function to add])
+dnl PA_SEARCH_LIBS_AND_ADD(function, arguments, libraries [,function to add])
dnl --------------------------------------------------------------------------
-AC_DEFUN(PA_SEARCH_LIBS_AND_ADD,
+AC_DEFUN([PA_SEARCH_LIBS_AND_ADD],
[
AH_TEMPLATE(AS_TR_CPP(HAVE_$1), [Define if $1 function was found])
- AC_SEARCH_LIBS($1, $2,
+ PA_SEARCH_LIBS($1, $2, $3,
[
AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$1))
pa_add_$1=false;
],
[
XTRA=true;
- if test $# -eq 3; then
- AC_LIBOBJ($3)
+ if test $# -eq 4; then
+ AC_LIBOBJ($4)
else
AC_LIBOBJ($1)
fi
pa_add_$1=true;
])])
+