There is already an octave-config script. I don't know why you would
not have it on your system.
I just checked in my MinGW install, and I do have it (although there's something wrong with it.) I will double check on my RHEL4, but I thought there was none there. However, as you suggest, I have been using mkoctfile to get the compile and link options. Only trouble is, what I'm doing is rather fragile and Quentin got to see it first hand:
c1=`mkoctfile -p FPICFLAG`
c2=`mkoctfile -p INCFLAGS`
c3=`mkoctfile -p XTRA_CXXFLAGS`
l1=`mkoctfile -p RDYNAMIC_FLAG`
l2=`mkoctfile -p RLD_FLAG`
l3=`mkoctfile -p LFLAGS`
l4=`mkoctfile -p OCTAVE_LIBS`
l5=`mkoctfile -p FLIBS`
CXXFLAGS="$CXXFLAGS $c1 $c2 $c3"
LIBS="$LIBS $l1 $l2 $l3 $l4 $l5"
What do you suggest I do instead of these eight commands? I need an all-encompassing link line, and an all-encompassing compile line, especially containing all the -lfoo I need. One thing I'm thinking of doing is to compile a dummy file with mkoctfile with -v and then parse the output to figure out the g++ options.