A general existence theorem for boundary value problems for ordinary differential equations