If you are going to compile a library like SVGAlib or Mesa for use with Quake, it must be compiled with libc5 and friends. Simply building a new library according its installation instructions will result in a library that is linked against your default library, glibc. You must ensure your new library is linked only with libc5 and libc5-based libraries so it will be compatible with Quake. See your distribution's documentation for information on linking to the non-default libraries. My mouse doesn't work or seems to respond randomly.
Many distributions enable it by default.
It may be interfering with Quake. If you never use gpm, you may want to stop it from running at startup. See the documentation for your distribution for information on how to do this. Open it up and look for a line like mouse Microsoft On my system, this is the first option in the file. Make sure the mouse type is appropriate for your hardware.