You don't need to download source and compile yourself for Solaris.
We provide compiled postgres as Solaris 11.4 SPARC IPS pkgs.
Current versions are 18.2, 17.8, 16.12, 15.16, 14.21
Free download and no registration
https://www.jomasoft.ch/downloads/#js-opensource