3 dnl A replacement for autoconf's macro by the same name. This version
4 dnl uses `ac_lib' rather than `i' for the loop variable, but more importantly
5 dnl moves the ACTION-IF-FOUND ([$]3) into the inner `if'-block so that it is
6 dnl run only if one of the listed libraries ends up being used (and not in
7 dnl the `none required' case.
8 dnl I hope it's only temporary while we wait for that version to be fixed.
9 undefine([AC_SEARCH_LIBS])
11 # AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS,
12 # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
14 # --------------------------------------------------------
15 # Search for a library defining FUNC, if it's not already available.
16 AC_DEFUN([AC_SEARCH_LIBS],
18 AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
20 ac_func_search_save_LIBS=$LIBS
22 AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1='none required'])
23 if test "$ac_cv_search_$1" = no; then
25 LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS"
26 AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="-l$ac_lib"; break])
29 LIBS=$ac_func_search_save_LIBS
32 if test "$ac_cv_search_$1" = no; then :
35 if test "$ac_cv_search_$1" = 'none required'; then :
38 LIBS="$ac_cv_search_$1 $LIBS"