This paper is concerned with the existence of minimizers for functionals having a double-well integrand with affine boundary conditions. Such functionals are related to the so-called Kohn–Strang functional, which arises in optimal shape design problems in electrostatics or elasticity. They are known to be not quasiconvex, and therefore existence of minimizers is, in general, guaranteed only for their quasiconvex envelopes. We generalize the previous results of Allaire and Francfort, and give necessary and sufficient conditions on the affine boundary conditions for existence of minimizers. Our method relies on the computation of the quasiconvexification of these functionals by using homogenization theory. We also prove by a general argument that their rank-one convexifications coincide with their quasiconvexifications.