configure: move flag filtering functions out of if/else blocks