  We investigate optimal control problems with $L^0$ constraints, which
restrict the measure of the support of the controls. We prove necessary
optimality conditions of Pontryagin maximum principle type. Here, a special
control perturbation is used that respects the $L^0$ constraint. First, the
maximum principle is obtained in integral form, which is then turned into a
pointwise form. In addition, an optimization algorithm of proximal gradient
type is analyzed. Under some assumptions, the sequence of iterates contains
strongly converging subsequences, whose limits are feasible and satisfy a
subset of the necessary optimality conditions.
