Optimal shape design for systems governed by variational inequalities, part 3: Necessary conditions in the elliptic case