We show that a constriction-type Josephson junction realized by an epitactic thin film of a d-wave superconductor with an appropriate boundary geometry exhibits intrinsic phase differences between 0 and pi depending on geometric parameters and temperature. Based on microscopic Eilenberger theory, we provide a general derivation of the relation between the change of the free energy of the junction and the current-phase relation. From the change of the free energy, we calculate phase diagrams and discuss transitions driven by geometric parameters and temperature.