M4, or "GNU M4", is an implementation of the traditional Unix macro
processor. It is mostly SVR4 compatible although it has some extensions
(for example, handling more than 9 positional parameters to macros). GNU
M4 also has built-in functions for including files, running shell commands,
doing arithmetic, and so on.
GNU M4 is a macro processor in the sense that it copies its input to the
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 and so on. M4 can be used either as a front-end
to a compiler or as a macro processor in its own right.
GNU M4 Manual,
On any ARC cluster, check the installation details
by typing "module spider m4".
M4 requires that several modules be loaded before it can be run.
One version of the appropriate commands for use on NewRiver is:
module purge module load gcc/5.2.0 module load m4/1.4.18
Here is a simple example of the batch usage of M4:
#! /bin/bash # #PBS -l walltime=00:05:00 #PBS -l nodes=1:ppn=1 #PBS -W group_list=newriver #PBS -q open_q #PBS -j oe module purge module load gcc/5.2.0 module load m4/1.4.18 # m4 input.m4
A complete set of files to carry out a similar process are available in