Integrating aclocal with Autoconf
In this final step, we will learn how to integrate the aclocal.m4 file with the Autoconf build process.
First, let's run the autoconf command to generate the configure script:
autoconf
Example output:
configure.ac:1: installing './install-sh'
configure.ac:1: installing './missing'
As you can see, the autoconf command has generated the configure script, which is responsible for configuring the build environment for our software project.
Now, let's run the configure script to see how it interacts with the aclocal.m4 file:
./configure
Example output:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile
The configure script has used the macro definitions from the aclocal.m4 file to configure the build environment for our software project.
Finally, let's take a look at the contents of the configure script:
cat configure
Example output:
#! /bin/sh
## Guess values for system-dependent variables and create Makefiles.
## Generated by GNU Autoconf 2.71.
## This script was automatically generated from config.status. Run this script,
## or rerun config.status, to recreate the current configuration.
## This file is freely redistributable without restrictions.
## Copyright (C) 1992-1996, 1998-2021 Free Software Foundation, Inc.
## This configure script is free software; the Free Software Foundation
## gives unlimited permission to copy, distribute and modify it.
As you can see, the configure script contains the necessary logic to configure the build environment for our software project, based on the macro definitions in the aclocal.m4 file.
In summary, the aclocal command is used to generate the aclocal.m4 file, which is then integrated with the Autoconf build process through the autoconf command. This allows for a more robust and automated build process for our software project.