configure: Replace manual header checks by header_check function