To compile, first see if there is anything in the Makefile
that you want to change.  You may wish to change the default
installation directories BINDIR, where the executable goes,
and MANDIR, where the manual page goes. The compiler is also
set to gcc.  If you don't have gcc, or want to use another
compiler, change the value of CC.

Then a simple "make" should suffice to compile msort.

To install, su if necessary, then "make install".

I haven't created a configure script because as far as I
know, none is necessary.  If you encounter problems
compiling msort and need to make changes to port it to your
system, please let me know what problems you have
encountered and what you did to fix them.

Msort uses the TRE regular expression library to match tags
and to perform substitutions on keys. This library is
available for a wide range of systems but in source form. It
must be compiled and installed. Clear instructions for
compiling and installing it are provided with the
package. However, those not experienced with installing
libraries may encounter difficulties.

One problem that you may encounter is that, even after you
install the library, the linker (part of the compilation
process) says that it cannot find it. This is probably the
result of the library having been installed in a directory
that the linker does not know about.

To remedy this, you need to run the ldconfig program. On
Linux systems this should be located in /sbin, a directory
that contains programs normally used only by the system
administrator. You will need to be root to run ldconfig.

Ldconfig indexes the standard directories /usr/lib and /lib,
any directories listed in the file /etc/ld.so.conf, and
directories listed on the command line.  If you install the
TRE library in a directory other than /lib or /usr/lib, such
as the default /usr/local/lib, you will need to tell
ldconfig to search that directory. You can do this either by
adding the name of the directory to /etc/ld.so.conf or
supplying the directory name on the command line, e.g.:

/sbin/ldconfig /usr/local/lib

Another approach is to give the compiler options that it will
pass on to the linker to tell it where to look.
There are two such options: -L and -rpath.
On some systems -L is used for static libraries and -rpath
for shared libraries, but there is some variation. It appears
always to work if you just use both.

This is especially useful if you do not have root privileges
on the system. 

In the msort Makefile, the relevant portion looks like this:


msort:		${OBJS}
		${CC} -o msort ${OBJS} -ltre

This says that "msort" depends on the files listed in the
variable OBJS, namely msort.o, misc.o, etc., and that
"msort" is created from these files by running the command
that is the value of the variable CC.  The value of CC will
generally be "gcc". The flag -ltre indicates that the TRE
library should be loaded. To tell the linker that the files
for the TRE library are located in /usr/local/lib/, change
the second line above to:

	${CC} -o msort ${OBJS} -L /usr/local/lib -rpath /usr/local/lib -ltre

Of course, if you don't have root privileges you probably can't install
TRE in /usr/local/lib. If you install it in one of your own directories,
give that directory as argument to -L and -rpath instead, e.g.:

	${CC} -o msort ${OBJS} -L /home/wjposer/Src/lib -rpath /home/wjposer/Src/lib -ltre
