GNU Autotools Installation and use

Source: Internet
Author: User
Tags automake

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.