We should get over the monistic view that all companies all the time must have the same and singular goal, i.e., to maximize profits or the share price. That practice as we all know is not mandated by law but it is a custom, constrained by markets to be sure, and it grows out of business lore and business norms and business education....
Shareholder primacy, in other words, is one goal of many. Companies could, to varying degrees, and consistent with raising capital (shareholders have choice too and can stay away from comapanies they think are "too" socially responsible), pursue profits but not only profits.
I must respectfully--but strenuously--dissent.
Obviously, there are many situations in which a corporation can make a Pareto optimal move (a win-win decision) that makes everybody--shareholders and nonshareholder corporate stakeholders--better off. In some cases, however, boards of directors must make Kaldor-Hicks (or, if you prefer, zero sum) decisions. In the latter cases, the law requires that directors maximize shareholder wealth.
To be sure, the business judgment rule frequently precludes judicial review of board decisions that appear to have made trade offs between shareholder wealth maximization and nonshareholder interests. (Shlensky v. Wrigley being the canonical example.) The fact that judges choose to abstain from reviewing board decisions in such cases, however, does not mean that the underlying legal norm has changed.
I've addressed this issue in several articles, but most directly in The Bishops and the Corporate Stakeholder Debate (April 2002). Villanova Journal of Law and Investment Management. Available at SSRN: http://ssrn.com/abstract=308604.