Build: configure: match cc_temp_flags / cc_restore_flags correctly
Previously, the curses checks could result in cc_temp_flags being called twice
where cc_restore_flags was only being called once.
Problem originally detected and fix suggested by Jan Pokorný