(Note: there used to be a version of this on the Google Play store, but that version will no longer be updated. Install directly from this page, instead.)
Most distros divide XScreenSaver into three or more binary packages, for some reason. Look for packages whose names begin with "xscreensaver" and end with a random assortment of the words "data", "extra", "extras", and/or "GL".
NOTE: some distros, notably Debian, distribute a version of XScreenSaver that is years out of date. This is bad and they should feel bad. You should use distros that give you the option of keeping your software up to date, and that understand that "stable" and "ancient" are not the same thing.
If you are using Debian, you should be able to find a more recent version of XScreenSaver in their so-called "unstable" packages. Scroll down, find the .deb package for your architecture, and install that.
If you are using an out-of-date Red Hat / Centos based system, you can probably find recent XScreenSaver executables at rpmfind.net.
If that doesn't work, you'll have to build from source. However, if at all possible, I strongly recommend that you install a binary package rather than compiling it yourself. There are many build dependencies, and installing packages from source on Linux is way harder than it should be. I don't have time to help you figure out compilation problems, sorry.