Necessary optimality conditions in control problems for systems described by eigenfunctions of an elliptic operator