Lift the bread pan out of the machine and fit the blade. Put the dough ingredients in the pan, following the order specified in the manual. Fit the pan into the machine and close the lid. Set to the dough programme.
Heat 1 tablespoon oil in a frying pan. Add the onion and garlic and fry gently for 5 minutes until softened. Scoop out one-quarter and reserve for the topping. Add the sugar to the remaining onions and cook for a few minutes more until caramelized.
At the end of the programme turn the dough out on to a floured surface and cut it in half. Roll one half to a 23 cm (9 inch) round. Place on an oiled baking sheet. Spread with the pesto. Top with the caramelized onions, three-quarters of the sun-dried tomatoes, half the basil leaves and drizzle with 2 tablespoons oil.
Roll out the remaining dough to a circle and cover the first circle. Sprinkle with the remaining onions, tomatoes, basil leaves and a little salt. Cover loosely with oiled clingfilm and leave to rise in a warm place for 30 minutes.
Bake in a preheated oven, 200°C (400°F), Gas Mark 6, for 25 minutes until golden brown and the centre is cooked through. Transfer to a chopping board, drizzle with the remaining oil and serve warm, cut into wedges.