A continuation method on locally convex spaces and applications to ordinary differential equations on noncompact intervals