LONDON — Major nations agree on first-ever global tax on greenhouse gases with plan that targets shipping.