Prevent constipation is babies

It is so hard to watch baby cry and struggle to have a poo. N the only thing I can do is hold him trying to comfort him as he tries to push it out. Is there anything you feed babies on to prevent their poo from getting that hard?