Global free boundary problems and the calculus of variations in the large