dnl
dnl AC_SEARCH_AND_DEFINE_LIB(filename, funcname, have, libs, libopt)
dnl
AC_DEFUN(AC_SEARCH_AND_DEFINE_LIB,[
	AC_CHECK_LIB($1, $2, ac_search_and_define_lib_result="YES", 
	  ac_search_and_define_lib_result="NO", $5)
	if test "X$ac_search_and_define_lib_result" = "XYES" ; then
		AC_DEFINE($3)
		$3="YES" ;
		ac_search_and_define_lib_libs="-l$1" ;
		case $LIBS in
			*$ac_search_and_define_lib_libs*) ;;
			*) $4="$ac_search_and_define_lib_libs" ;;
		esac
	else
		$3="NO" ;
		AC_NOLIB_MSG_WARN($1)
	fi
])

