When we use AC_SEARCH_LIBS with OTHER-LIBRARIES, current implementation ignores OTHER-LIBRARIES when it tests ac_lib=''.
I think that it is not intended behavior, but a bug. A patch something like following is needed. I put my code into public domain, if copyright matters. diff --git a/lib/autoconf/libs.m4 b/lib/autoconf/libs.m4 index 73edad5..19892f4 100644 --- a/lib/autoconf/libs.m4 +++ b/lib/autoconf/libs.m4 @@ -53,6 +53,7 @@ AC_LANG_CONFTEST([AC_LANG_CALL([], [$1])]) for ac_lib in '' $2; do if test -z "$ac_lib"; then ac_res="none required" + LIBS="$5 $ac_func_search_save_LIBS" else ac_res=-l$ac_lib LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS" --