Select Page

Introduction

Autoreconf is an efficient way to keep track of and update package-building scripts. To make a package in Linux, you first need to have quite a few components installed, and tinker then in the right order to have your program built. However, there are complications. Let’s say you updated some code for the package under subdirectories or wherever, you will be required to build your package once again, by first updating and executing each of the tools in the proper order to fully build it, which in turn can become horrifically tedious.

Autoreconf gives you an easier approach for all of that. When you have the configure.ac file properly set up in the directory of your program, it will do most of these micromanagements all by itself, and will run only the tools that are necessary, to prepare a configuration file that’ll help automate the building of your program. Also, when you update or change the code in any file, running autoreconf will remake and update them all together if you simply pass it the –force flag. Ain’t that awesome?

Well it very much is, but, to really be able to use this boss of a command, you need to have some technical knowledge. However, you may not need to know anything about it by yourself, if all you want to do is build some third party software from source, that requires the autoreconf command to be executed for itself. In such cases, it is possible that you get an error message which is something like “autoreconf: command not found”. Whether or not you know how to use autoreconf, this article will help you, to the very least, to fix this error message.


-bourne again shell: autoreconf: command not found

Let me guess, you copy pasted this error message from bourne again shell straight into Google and landed on this web page.

-bourne again shell: autoreconf: command not found

It’s a pretty common search term. People just copy paste their bourne again shell error message into Google.

Or perhaps you’re using zsh, like a pro user, and googled this search term instead.

zsh: command not found: autoreconf

This error usually means you need to install the autoreconf command. The standard way to do this in Linux is from the command line using your Linux distribution’s package manager. The less common way, but necessary if you don’t have a package manager or you really want the latest version is to compile autoreconf from source code.


Install Autoreconf in Linux

The easiest solution I could give you for fixing the error message, is to install the autoreconf command in your Linux machine, which is probably not shipped by default. The autoreconf command is a part of the autoconf package. If you try searching for the autoreconf package directly, you’re unlikely to see any results. Instead, you need to install the autoconf package. Do this by using the command that corresponds with your specific Linux distribution among the ones mentioned below.

Arch Linux:

$ sudo pacman -Syu autoconf

Ubuntu/Debian:

$ sudo apt-get install autoconf

Fedora:

$ sudo yum install autoconf

CentOS:

$ sudo yum install autoconf

RedHat:

$ sudo yum install unzip

If you’re unable to run the autoreconf command even after installation it, or if it is that you can’t install it in the first place, you can try out the other way instead, which is to build it from source. It could be a bit more hassle, though.


Build Autoreconf from source in Linux

To build the autoconf package from source, first download the latest version of the package using the wget command:

$ wget https://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz

Extract the downloaded file using tar command:

$ tar -xvf autoconf-latest.tar.gz

Enter the directory using cd and then run the commands in the right order to build and install the autoconf package in your system:

$ cd autoconf-2.71/ 
$ ./configure 
$ make 
$ sudo make install

You should now be able to run the autoreconf command without having to see the error message, messing your head up!

In case you have installed the command in some other directory than the primary one, which is /usr/bin, than you need to include that path to the global PATH variable of your system, so that bourne again shell can scan it when it starts up. To do this, you’d use the export command. However, it would only be temporarily affected, which is why, the best solution would be to rather add the command in the .bashrc file, which is located in your home directory.

To include the installation directory of autoreconf to the PATH variable, add the following in to your .bashrc file:

export PATH=$PATH:<path/to/install/directory>

Make sure to replace <path/to/install/directory> with the actual path where you installed, and don’t just copy paste it!


Autoreconf vs Autoconf | Are they the same?

The difference between autoreconf and autoconf lies in their actual use cases. Autoconf is used to generate the configure file, but if it requires other autotools, you’ll need to execute them one after the other, all by yourself. It gets a lot worse when you need to do small tweaks to the configure file, where you’ll need to execute each command again every time you make a change. Which is where autoreconf comes into play. It automates all the execution for you, and it’s capable of executing only the commands that are required, based on the build. However, autoreconf cannot be run the first time when you are creating the configure.ac file. You first need to use autoconf and after that, you can use the autoreconf command to automate the execution of the autotools, without any drops of sweat!


Conclusion

I;m quite confident that, after having tried the above mentioned fixes yourself, you should successfully be able to surpass the autoreconf: command not found error message. Whether it’s a program you’re creating yourself, or a third party program, it should work nevertheless. Linux might sound a bit hard when it’s about installing and managing packages, but there’s a good thing about it. As the dependencies are globally available, if more than 1 program requires the same dependency, it will not be required to install the dependency again, as compared to Windows, which will download the dependency modules in separate folders specific to the program, be it the same. To make such things possible in Linux, the autoreconf command by itself is quite essential.