Just because I have not seen it anyway in other answers, let me add that I think that the supporting effect strongly depends on how many people are doing it in a coordinated way. There would need to be a critical mass of similarly minded, organized people to actually make an impact.
You say you want to support some companies for some not-necessarily profit related reasons. You might be able to simply donate money to them somehow as a more direct way, but maybe you want to know if investing in the stock market is a more efficient long-term support for some definition of efficiency like at least getting your money out of it or even profiting and supporting at the same time.
If it's only you and your means are limited, you will get a tiny ownership, which is not really useful for you, your order will make the shares of that company a tiny bit more expensive. The seller who sold his shares to you for the slightly elevated price will make a win. But apart from that not much happens.
If however, there are lots and lots of similar minded people, who would pool their financial resources, they could strongly influence the share price, gain substantial parts of ownership and possibly even take over some companies completely.
While a higher share price is indirectly good for the company (other answers), owning it is arguably much better. As owner you could "support" the company in the sense of letting it do whatever you felt the company ought to do. If for example you decided, you don't need dividends from the company, you would earn less, but the company would have left more means to re-invest in their business. This would undoubtedly support the company but would also mean that you earn less on your invested assets.
Why do all the hassle? You could also just invest your money in the whole market and donate part of the returns to that company (some kind of charitable foundation or so). Should result in roughly the same net support if the company was making an average profit. Owning a company would give you a bit more influence and protect this company more against adversarial developments, but it's also more risky than investing in the whole market.
To summarize: Only do this with others together and aim for small companies (not Apple or Google). Aim for control of ownership and think about what this means for you and how you can then support this particular companies better. Otherwise aim for creating a charitable foundation, invest in the whole market and use the ongoing profits to give to companies to your liking or simply give directly to companies you want to support.