The off-shell M5-brane and non-perturbative gauge theory
M5-branes wrapping a holomorphic curve in a Calabi-Yau manifold can be used to construct four-dimensional N=1 gauge theories. In this paper we will consider M5-brane configurations corresponding to N=2 theories broken to N=1 by a superpotential for the adjoint scalar field. These M5-brane configurations can be obtained by lifting suitable intersecting brane configurations in type IIA, or equivalently by T-dualizing IIB configurations with branes and/or fluxes. We will show that turning on non-trivial expectation values for the glueball superfields corresponds to non-holomorphic deformations of the M5-brane. We compute the superpotential and show it agrees with that computed by Dijkgraaf and Vafa. Several aspects of the gauge theory, such as the appearance of non-holomorphic one-forms with integer periods on the Seiberg-Witten curve, have a natural interpretation from the M5-brane point of view. We also explain the interpretation of the superpotential in terms of the twisted (2,0) theory living on the fivebrane.