Treating Constipation

I occasionally have a problem with constipation, and fortunately it usually clears up by itself. But if I ever should need to take something for it, what should I take? I’ve noticed all kinds of laxatives, stool softeners and other treatments for constipation at the drug store, but I’m not sure what works best.