Prerequisite
aclocal
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
Autoconf
source : http://ftp.gnu.org/gnu/automake/
Autotools unifies the build process of C/C++ applications(and libraries) by auto-generating consistent Makefile.
1. Run $ autoscan
to generate and configure.scan and copy the file as configure.ac
Generated scan file looks like :
-*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AC_CONFIG_SRCDIR([hello-core/main.c])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h])
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CONFIG_FILES([Makefile
hello-core/Makefile
tester/Makefile])
AC_OUTPUT
2. Edit configure.ac
Replace the FULL-PACKAGE-NAME
, VERSION
.
Insert a line AM_INIT_AUTOMAKE
.
Add following lines for:
AC_PROG_RANLIB
Library CompilesAC_LANG(C++)
Build C++ srcAC_PROG_CXX
Build C srcAC_PROG_CC
Build C src(alternative)
3. Run $ aclocal
to generate aclocal.m4 file.
4. For Each Directories for compilation, write Makefile.am
On top directory,
# ./Makefile.am
SUBDIRS = hello-core tester
For sub-directories,
# ./hello-core/Makefile.am
bin_PROGRAMS = hello
hello_SOURCES = hello.c main.c
5. Create mandatory files.
touch NEWS README AUTHORS ChangeLog
6. Run $ autoconf
Generate configure file
7. For any edits, run $ autoreconf -fvi
This is the end of distribution
8. Users can compile the source by :
./configure
./make
Install Troubleshoot
%n in writable segment detected ***
Search for the script where ā%nā was used.
grep "%n" -R