Home » Linux Host, Ubuntu, SysAdmin » Commands and Packages » What is m4 and How to Fix: “m4: command not found” error ?

What is m4 and How to Fix: “m4: command not found” error ?

If you have installed fresh Ubuntu on your development machine and tried to compile some opensource source code which uses “autoconf” for generating Makefile for compilation, its highly possible that you may see an error as below,

/bin/bash: m4: command not found

what is m4 ?

GNU ‘m4’ is an implementation of the traditional UNIX macro processor.

‘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 shell commands, doing integer arithmetic, manipulating text in various ways, performing recursion, etc…. ‘m4’ can be used either as a front-end to a compiler, or as a macro processor in its own right.

Autoconf needs GNU ‘m4’ for generating ‘configure’ scripts, but not for running them.

How to resolve error “m4: command not found” ?

$ sudo apt-get install m4 

Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment