refactor configure.ac tests for libraries

In configure.ac four different ways to test if a library is
required are used. AC_SEARCH_LIBS is the recommended macro
to use but it adds -l<lib> to LIBS. We want just <lib> added to
EXTRA_LIBS and the new macro FP_SEARCH_LIBS does that.