configure: fix gcc crash and link optimizer