Note: XScreenSaver is not available on the macOS App Store, because reasons. If you search for it there you might get the iOS version instead, which is probably not what you want.
Most distros divide XScreenSaver into three or more binary packages, over my objections. 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.