Import most fixes from FFTPACK51
Most if the fixes are due to computing the lengths (and indices) for LENSAV. Apparently the lengths should be log2(N) instead of log(N). But the fix for c1fm1f.f fixes a genuine bug in the complex fft which caused wrong results for non-power of 2 FFT sizes. Also fixed a couple of typos and incorrect return ier codes.