Install M4 by running the following commands:
./configure --prefix=/usr &&
make &&
make install
If you're base system is running a 2.0 kernel and your Glibc version is 2.1 then you will most likely get problems executing M4 in the chroot'ed environment due to incompatibilities between the M4 program, Glibc-2.1 and the running 2.0 kernel. If you have problems executing the m4 program in the chroot'ed environment (for example when you install the autoconf and automake packages) you'll have to exit the chroot'ed environment and compile M4 statically. This way the binary is linked against Glibc 2.0 (if you run kernel 2.0 you're Glibc version is 2.0 as well on a decent system. Kernel 2.0 and Glibc-2.1 don't mix very well) and won't give you any problems.
To create a statically linked version of M4, execute the following commands:
root:m4-1.4# logout
root:lfs# cd $LFS/usr/src/m4-1.4
root:m4-1.4# ./configure --prefix=/usr --disable-nls
root:m4-1.4# make LDFLAGS=-static
root:m4-1.4# make prefix=$LFS/usr install
root:m4-1.4# chroot $LFS env -i HOME=/root bash --login
Now you can re-enter the chroot'ed environment and continue with the next package. If you wish to recompile M4 dynamically, you can do that after you have rebooted into the LFS system rather than chroot'ed into it.
The M4 package contains the M4 processor
M4 is a macro processor. It copies input to output expanding macros as it goes. Macros are either builtin or user-defined and can take any number of arguments. Besides just doing macro expansion m4 has builtin functions for including named files, running UNIX commands, doing integer arithmetic, manipulating text in various ways, recursion, etc. M4 can be used either as a front-end to a compiler or as a macro processor in its own right.