A condition equivalent to the existence of entropy in classical thermodynamics