For each planet, you can define a target count and speed for each structure type. When ordered to perform automatic building, PCC2 will sort those values by speed, highest first. It will then try to build as many structures as the speed says, stopping only when the goal has been reached or rules don't allow building more. It will then proceed with the second structure, etc. If all structures have been processed, the cycle starts again, until nothing more can be built. As a special exception, PCC2 will make sure there's at least one factory, even if you ordered it to build mines first.

By default, goals are 1000 (meaning "infinite"), and speeds are 5 for mines, 10 for factories, and 3 for defense posts. This means that auto build will try to build 10 factories, then 5 mines, then 3 defense posts. If you have lots of money, this means that PCC2 will build twice as many factories as mines. If you have little money, this means PCC2 will first build up factories before starting with mines.

To disable auto build for one structure, set its goals and/or speeds to zero.

Reference

Keys:
G from build screen