build: fixing configure macros for checking library compatibility