AC_SEARCH_LIBS does exactly what we need here: check if a function is available; if not, check if it's available in the specified library, and add it to LIBS.
@top_srcdir@ expands to the source code base directory relative to the file being processed. This prevents doxygen from working, as it is called from the top directory but expects the source code in ../include/mpd. To work around this problem, this patch changes @top_srcdir@ to @abs_top_srcdir@, which expands to the absolute path of the top source directory.  http://www.gnu.org/s/hello/manual/autoconf/Preset-Output-Variables.html