Pirates agree to sign ex-All-Star slugger