2017.04.05
GNU Autotools Installation
Several files are required to install Autotools
Automake,autoconf,m4
The order of installation is M4-> autoconf-> automake (important)
To install the required commands:
Tar zxvf * *
./configure
Make
Make install
Under Mac:
Brew Install autoconf
Brew Install Automake
(not installed M4 also normal use)
Autotools Use
The source directory is as follows
Main.cpp
inc/test.h
src/test.cpp
1. Hand-written makefile.am this document
#Makefile. Am
utomake_options = foreign
bin_programs = Main
main_sources = main.cpp inc/test.h Src/test.cpp
Mian_cppflags =-I include/
2. Run AutoScan at the top level of the source directory tree. Then manually modify the Configure.scan file and rename it to Configure.ac
and modify the content:
Ac_init (Full-package-name, VERSION, bug-report-address)
is modified to: Ac_init (main,0.0.1,abc@qq.com)
in Ac_init (main , 0.0.1,abc@qq.com) Add
am_init_automake (main,0.0.1) to the next line add
ac_config_files on the Ac_output line
([Makefile])
3. Using the aclocal command, scan the configure.ac file to generate ACLOCAL.M4 files,
This file mainly handles the local macro definition, which defines the macro set required by the Configure.ac file to the file ACLOCAL.M4 based on the macros already installed, user-defined macros, and macro in the Acinclude.m4 file.
4. Generate configure files using the autoconf command. This command expands the macros in the Configure.ac file to generate the Configure script. This process may be used to use macros defined in ACLOCAL.M4.
5. Generate config.h.in files using the Autoheader command. This command typically copies the user-appended symbol definitions from the "acconfig.h" file. There is no additional symbol definition in this example, so you do not need to create a "acconfig.h" file
6. Run automake–add-missing, which generates makefile.in based on makefile.am content.
7. Run configure, which will generate makefile this file based on makefile.in content.
8. After obtaining the makefile file, we can use the make program to manage our project.
第3-7 steps can be written as build.sh
#!/bin/bash aclocal autoconf autoheader touch NEWS README AUTHORS changelog. Automake--add-missing