Collapse and explosion of white dwarfs. I - Precollapse evolution