The ref-gl.so libraries are part of quake, you should find them in the same directory as the quake binary. Alas, quake is too stupid to figure out where the libraries are from the pathname you call it with, so you just need a shell wrapper to cd to the correct directory, e.g.,
Code:
#!/bin/sh
cd /path/to/quake
exec ./${0##*/}
The "${0##*/}" takes the basename the script so you can symlink quake2/sdlquake2 to the same wrapper script if you want. The sdl version works better for me, though, so I always just run sdlquake2.