I'd hardly use Smashwords as an example - as I understand it, there's no "gatekeeper" as there would be at a publishing house. The writer of that book is on his/her own if the legal eagles find out!
I would suggest writing the story and giving the "famous" character a made-up name, then if you do get to the point of discussing sales with an agent or editor, that's the time to raise the issue. Just don't publish it without professional legal advice of some kind, as Neil says.
Also consider how vital it is to the story for the character to be a real person. Is it really essential? Is there honestly no-one else that could take the role? Fiction is full of invented celebrities, for good reason...
(I have an advantage here - no-one's going to sue over people who died four hundred years ago. And technically you can't libel the dead anyway.)