summary refs log tree commit diff
path: root/aczsh.m4
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2001-04-19 14:45:41 +0000
committerClint Adams <clint@users.sourceforge.net>2001-04-19 14:45:41 +0000
commita43aa761cdb3fd1051dad474fccf9e500a0d49ea (patch)
tree1035a488b2c17d3314b4cfa08f702ea88c5b46c4 /aczsh.m4
parente3ff47f8ee64cbeb48ed032939342bde1ac840bc (diff)
downloadzsh-a43aa761cdb3fd1051dad474fccf9e500a0d49ea.tar.gz
zsh-a43aa761cdb3fd1051dad474fccf9e500a0d49ea.tar.xz
zsh-a43aa761cdb3fd1051dad474fccf9e500a0d49ea.zip
14033: reduce unnecessary library linking for modules and main binary
Diffstat (limited to 'aczsh.m4')
-rw-r--r--aczsh.m424
1 files changed, 24 insertions, 0 deletions
diff --git a/aczsh.m4 b/aczsh.m4
index 45334b6dc..aa16bffd0 100644
--- a/aczsh.m4
+++ b/aczsh.m4
@@ -683,3 +683,27 @@ AC_DEFUN(zsh_COMPILE_FLAGS,
 	then LIBS="$4"
 	else LIBS="$enable_libs"
 	fi)])
+
+dnl zsh_SEARCH_LIBS(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND
+dnl            [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
+dnl Search for a library defining FUNC, if it's not already available.
+
+AC_DEFUN(zsh_SEARCH_LIBS,
+[AC_PREREQ([2.13])
+AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
+[ac_func_search_save_LIBS="$LIBS"
+ac_cv_search_$1="no"
+AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"])
+test "$ac_cv_search_$1" = "no" && for i in $2; do
+LIBS="-l$i $5 $ac_func_search_save_LIBS"
+AC_TRY_LINK_FUNC([$1],
+[ac_cv_search_$1="-l$i"
+break])
+done
+LIBS="$ac_func_search_save_LIBS"])
+if test "$ac_cv_search_$1" != "no"; then
+  test "$ac_cv_search_$1" = "none required" || ZS_LIBS="$ac_cv_search_$1"
+  $3
+else :
+  $4
+fi])