The Greeek parliament has signed the NATO accord for Macedonia, ending years of dispute with the country over its name.