The rules are pretty clear to me:
Feeding troughs double the animal number that can be
kept both in pastures as well as in buildings.
You are allowed to build a stall or other building on a
space with a pre-existing feeding trough. In that case
the feeding trough remains but again has a new effect.
You can add a feeding trough to any building and you can add a building to a space with a feeding trough. I don't see anything that restricts it to certain buildings.