Fix configure check for libraries to work
Add header file tests to configure script