Noeud:Preparation, Noeud « Next »:, Noeud « Up »:Pulling it Together



Preparation

To begin with, you'll need the M4 sources. Once you have installed them you'll end up with a directory where the binaries are kept, and the original source directory: don't delete this, as we'll use the source files to demonstrate different gcc options. By default when you run ./configure, make etc., the libraries and object files are put into the source tree. So after I'd installed M4 from my $HOME/gnu-src/m4-1.5 directory, the libraries were placed in the source tree under $HOME/gnu-src/m4-1.5/m4/.libs:

     $ ls $HOME/gnu-src/m4-1.5/m4/.libs
     libm4.a  libm4.la  libm4.lai  libm4.so  libm4.so.0  libm4.so.0.0.0
     $
     

These libraries are built from the m4 directory of sources. The files that we'll actually be interested in utilizing are in the src directory of M4:

     $ ls $HOME/gnu-src/m4-1.5/src
     freeze.c getopt.c m4.h main.c stackovf.c
     $
     

NOTE
In addition you'll need a temporary file in this directory (I named mine temp.c) with the following details:
               #include "m4module.h"
               const lt_dlsymlist *lt_preloaded_symbols = 0;
               

This is because normally libtool would handle this for you; since we are hand-running the examples (yes, it may seem counter-intuitive, but it's the only reasonable way to illustrate the example) we have to generate the file instead.