Protect libflags use in scipy