Optimization of the first eigenvalue of equations with indefinite weights