Gladly to see that you're on it - working hard to port Raydium to FreeBSD.
I know there are ways to execute GNU/Linux binaries on FreeBSD, but let's focus on the native part. Libraries you've installed in a non standard directory, which should be at some common places like e. g. "/usr" and "/urs/local", must be given to the compiler and linker commands. You've also the possibility to create symbolic links or to export the necessary flags, but I'd normally prefer the way to pass the options to the commands.
As mentioned above you should check the configure script which comes with Raydium. Perhaps it'll be useful to get this script running under FreeBSD, because it'll check the availability of the libraries and install some required libraries in the right directories with the required build options. Using the configure script you can see, that on the GNU/Linux target the stable version of ODE is always
0.7 and the latest snapshot version of PHP is always
5.2. The dependency list above is an example to see what is used under Mac OS X. You can use your preferred port system to get the needed packages, but be sure to obtain them with at least the build options that Raydium requires. For example ODE needs to be build without double precision, so be sure that it was build using single precision. That is one reason I've posted the dependency list with the build options, but the list doesn't include the minimum library versions required. Using the versions included within the list works and using lower or higher versions could work. So, the libraries you've posted should work, regarding they were build with the options needed by Raydium. There are also port systems available for Mac OS X, e. g.
MacPorts, but I'm building the needed libraries myself manually to have maximum control over the build options.
Regarding to your modification on the Makefile, I can only say that you have to modify whatever needed to reach our goal, to get Raydium natively running under FreeBSD. Good job!
While reading your last post, I've to think about the PHP module for Apache. I don't really know if you can use the Apache module version of PHP for Raydium. To exclude this issue, you're pleased to try a method written above. To get the configure script up and running or to build the library manually yourself from scratch, to obtain a new, adapted version of PHP which exactly matches the Raydium requirements.
Perhaps it'll be easier to make tests, using (modified versions of) the GNU/Linux compile scripts and some "official" test files like e. g. "./odyncomp.sh test6.c".