1. Download
Http://www.gnu.org/software/software.html
2. Installation
M4-1.4.11.tar.gz
Autoconf-2.63.tar.gz
Automake-1.9.1.tar.gz
3. Autotools Five tools aclocal AutoScan autoconf autoheader automake
4. Autotools Use Process
The first step: hand-written makefile.am this file
Step two: Run AutoScan at the highest level of the source directory tree. Then manually modify the Configure.scan file and rename it to configure.ac/configure.in
Step three: Run aclocal, which generates ACLOCAL.M4 files based on the contents of the Configure.ac
Fourth step: Run autoconf, which generates configure this configuration script file based on the contents of Configure.ac and ACLOCAL.M4
Fifth step: Run automake–add-missing, which generates makefile.in based on the contents of the makefile.am
Sixth step: Run configure, which will generate makefile this file based on the contents of makefile.in
5. Flowchart
6. For example
# cat hello.c
#include <stdio.h>
#include "include/hello.h"
int main ()
{
puts ("Hello");
return 0;
}
# cat makefile.am //automake using
subdirs = lib
automake_options = foreign
bin_programs = Hello
Hello _sources = hello.c
Hello_ldadd = lib/libprint.a
Automake_options is the option to set Automake. Automake offers 3 software levels: foreign//Only files required GNU//default level GnitS
Subdirs: Sub-directory Options
Bin_programs: If more than one execution file is separated by a space
Hello_sources: "Hello" is the original file required by this executable program. If the "Hello" program is generated by multiple source files, all source files are separated by a space
# cat lib/makefile.am
noinst_libraries = libprint.a
libprint_a_sources = print.c. /include/print.h
# ls include
hello.h
print.h
7. Start using
# AutoScan
Generate Configure.scan
Modification (software name, version information, BUG report e-mail)
ac_init ([Full-package-name], [version], [bug-report-address])
//For
AC_ INIT (Hello, 0.01, [bug@sounos.org])
am_init_automake
ac_prog_ranlib
Rename to Configure.ac
AC_CONFIG_SCRDIR: Macro is used to detect the existence of the specified source code files, to determine the validity of the source directory
Ac_config_header: Macros are used to generate config.h files so that the Autoheader command uses
AC_PROG_CC: Used to specify the compiler, if not specified, the default GCC
Ac_config_files: Macros are used to generate the appropriate makefile file
Ac_output: Used to set the Configure to produce the file, if it is makefile,configure will check it out of the results brought into the makefile.in file to produce the appropriate makefile
# aclocal #
autoconf
# autoheader #
Automake--add-missing
The Automake tool converts makefile.am into makefile.in files according to the parameters in the Configure.in
–add-missing: You can have Automake automatically add some required script files
Run again to assist in generating several necessary files:
Makefile.am:required file './news ' not found
Makefile.am:required file './readme ' not found
Makefile.am:requir Ed file './authors ' not found
Makefile.am:required file './changelog ' not found
Workaround: Manual Touch
#./configure
# Make