Installing m4 Macro Processor on Ubuntu Linux

This short tutorial shows you how to install m4 (macro processor) on Ubuntu Linux Server. The process is very simple. For this tutorial, I'll be installing m4 version 1.4.10. Linux kernel is 2.6.15-26-powerpc. I have used a Mac Mini (powerpc/ppc architecture). GCC version number is 4.0.3. Your configuration may be different from mine but the installation steps below should work fine for most configurations with little or no change at all (including other Linux distributions and even unixes e.g. MacOS X).

m4 (general purpose macro processor):

According to gnu.org,

"GNU m4 is a general purpose macro processor. For more info please visit http://www.gnu.org/software/m4/m4.html."

Before starting, please check to see if there is a latest version available to download. Visit http://www.gnu.org/software/m4/m4.html to find out about the available versions. IMPORTANT: See "Configuring Ubuntu Linux After Installation" to install the development tools required to compile and install m4 from source code.

Steps to download, compile, and install are as follows. Note: Replace 1.4.10 with your version number:

Downloading m4:

Run the command below,

wget ftp://ftp.gnu.org/gnu/m4/m4-1.4.10.tar.gz

Extracting files from the downloaded package:

tar -xvzf m4-1.4.10.tar.gz

Now, enter the directory where the package is extracted.

cd m4-1.4.10

Configuring m4:

./configure --prefix=/usr/local/m4

Replace "/usr/local/m4" above with the directory path where you want to copy the files and folders. Note: check for any error message.

Compiling m4:

make

Note: check for any error message.

Installing m4:

As root (for privileges on destination directory), run the following.

With sudo,
sudo make install
Without sudo,
make install

Note: check for any error messages.

That’s it. m4 (general purpose macro processor) has been successfully installed.

Did this tutorial help a little? How about buy me a cup of coffee?

Buy me a coffee at ko-fi.com

Please feel free to use the comments form below if you have any questions or need more explanation on anything. I recommend thoroughy testing on a production-like test system first before moving to production.

tags cloud icon tags cloud

linux m4

popular searches icon popular searches

Comments (write a comment):

When I run "sudo make install", I get
make[3]: Nothing to be done for `install-data-am'.
make[4]: Nothing to be done for `install-exec-am'.
make[1]: Nothing to be done for `install'.
ect.
What does that mean? Is my installing successful or not? Posted by: Tran Xuan Bach on Apr 12, 2013

@Tran: this tutorial is quite old so you should install a new version and your installation wasn't successful Posted by: shahryar on May 27, 2013

just download latest version and run
"./configure; make; make install"
as stated in README file... Posted by: ILYA on Jun 05, 2013

I get below when I run >> sudo make install
make[3]: Entering directory `/opt/m4-1.4.16/tests'
Making install in .
make[4]: Entering directory `/opt/m4-1.4.16/tests'
make[5]: Entering directory `/opt/m4-1.4.16/tests'
make[5]: Nothing to be done for `install-exec-am'.
make[5]: Nothing to be done for `install-data-am'.
make[5]: Leaving directory `/opt/m4-1.4.16/tests'
make[4]: Leaving directory `/opt/m4-1.4.16/tests'
make[3]: Leaving directory `/opt/m4-1.4.16/tests'
make[2]: Leaving directory `/opt/m4-1.4.16/tests'
make[1]: Leaving directory `/opt/m4-1.4.16'
[[email protected] m4-1.4.16]#

Did I do it properly?
I used latest stable version.. m4.1.4.16 Posted by: Keshav on Jun 13, 2013

after running './configure --prefix=/usr/local/m4' ,i get following output:

checking if stack overflow is detectable... yes
checking if changeword is wanted... no
checking if malloc debugging is wanted... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating lib/Makefile
config.status: creating src/Makefile
config.status: creating checks/Makefile
config.status: creating examples/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing default command

how to resolve this? Posted by: bhushan sable on Dec 24, 2013

@bhushan: I dont see any issues there... did you try the next steps? Posted by: shahryar on Apr 08, 2014

make all-am
make[3]: Entering directory `/home/alyaothman/m4-1.4.16/lib'
gcc -std=gnu99 -I. -g -O2 -MT clean-temp.o -MD -MP -MF .deps/clean-temp.Tpo -c -o clean-temp.o clean-temp.c
In file included from clean-temp.h:22:0,
from clean-temp.c:23:
./stdio.h:477:1: error: 'gets' undeclared here (not in a function)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
^
make[3]: *** [clean-temp.o] Error 1
make[3]: Leaving directory `/home/alyaothman/m4-1.4.16/lib'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/alyaothman/m4-1.4.16/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/alyaothman/m4-1.4.16'
make: *** [all] Error 2

how to fix this problem? Posted by: alya othman on Apr 30, 2014

whats this "make all-am" doing? Did you try make only? Posted by: shahryar on May 01, 2014

I also have same problem like shahryar

make[3]: *** [clean-temp.o] Error 1
make[3]: Leaving directory `/tmp/autoconf/autoconf-2.69/m4-1.4.16/lib'
make[2]: *** [install] Error 2
make[2]: Leaving directory `/tmp/autoconf/autoconf-2.69/m4-1.4.16/lib'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/tmp/autoconf/autoconf-2.69/m4-1.4.16'
make: *** [install] Error 2 Posted by: YHS on Sep 16, 2014

Process after make install command end like this


Making install in src
make[1]: Entering directory `/home/jithin/m4-1.4.10/src'
make[2]: Entering directory `/home/jithin/m4-1.4.10/src'
test -z "/m4-1.4.10/m4/bin" || /bin/mkdir -p "/m4-1.4.10/m4/bin"
/usr/bin/install -c 'm4' '/m4-1.4.10/m4/bin/m4'
/usr/bin/install: cannot remove â/m4-1.4.10/m4/bin/m4â: Permission denied
make[2]: *** [install-binPROGRAMS] Error 1
make[2]: Leaving directory `/home/jithin/m4-1.4.10/src'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/home/jithin/m4-1.4.10/src'
make: *** [install-recursive] Error 1


Please help me out Posted by: Jithin on May 23, 2015

@Jithin: are you installing the latest version? Posted by: shahryar on Jun 09, 2015

Making install in src
../build-aux/install-sh -c -d '/usr/local/m4/bin'
/usr/bin/install -c m4 '/usr/local/m4/bin'
install: /usr/local/m4/bin/m4: Permission denied
make[3]: *** [install-binPROGRAMS] Error 71
make[2]: *** [install-am] Error 2
make[1]: *** [install-recursive] Error 1
make: *** [install] Error 2 Posted by: bast on Jun 24, 2015

@bast: you're clearly hitting permission issues ... you've to make sure you've proper permissions. Posted by: shahryar on Jun 25, 2015

After following these instructions, and receiving no errors, I was still not able to install the software that depended on M4 (GAP).

So instead I did this:
sudo apt-get update
sudo apt-get install m4

This worked fine and I was then able to install GAP. On Ubuntu 16.04 Posted by: Tim Marsh on Sep 23, 2016

leave a comment on tutorial leave a comment