Update configure script to check compiler flags during linking