What you need to do is use GREP to find the following in the code,
/* Port definitions for various commands - Samson 8-22-98 */
/* Now only works if Multiport support is enabled at compile time - Samson 7-12-02 */
#define CODEPORT 9700
#define BUILDPORT 9600
#define MAINPORT 9500
Then you can open up the file that these lines are contained in with your favorate editor, nano perhaps.
Change the numbers there, to be the port numbers that you wish to use, then make clean and make
the whole server.
Check the startup script and change any port numbers set in there, then just start your server as normal,