It should be determined once, not every time the link command is done (they are slow enough already). It could be in configure, or just done once into a file with a makefile rule depending config.make or suchlike.