The European Union and the Mercosur bloc of South American countries have formally signed a long-sought landmark free trade agreement.