The wave-front distortion of femtosecond laser pulses recorded with a Shack-Hartmann analyzer makes it possible to retrieve the nonlinear index of refraction of different glasses and the nonlinear phase shift induced during second-harmonic generation in beta-barium borate (BBO) crystal versus the phase mismatch. It is shown that the nonlinear phase shift induced in a 2-mm-thick BBO crystal allows compensation for up to a 2pi breakup-integral induced in a 4-cm fused-silica glass. The stability of the compensation is reported to be from 10 to 100 GW cm(-2).