configure: simplify check_lib function