The patch has to happen after configure. I don't know why the configure script is coming up with the wrong extension but this was the least ugly method I could think of to fix this.