Write the helloworld of Autoconf and automake first, and then add some frequently-used macros.
OK. Let's start with hello. C.
# Include <stdio. h>
Main ()
{
Printf ("howdy world!
");
}
Of course, you can compile this program as follows:
% GCC hello. C-O hello
% Hello
Let's take a look at the compilation method using Autoconf and automake. First, create the following two files:
'Makefile. am'
Bin_programs = Hello
Hello_sources = Hello. c
'Configure. in'
Ac_init (hello. c)
Am_init_automake (hello, 0.1)
Ac_prog_cc
Ac_prog_install
Ac_output (makefile)
Run 'autoconf ':
% Aclocal
% Autoconf
The above step will generate a familiar 'configure 'script. Next, run 'automake ':
% Automake-
Required file "./install-sh" not found; installing
Required file "./mkinstalldirs" not found; installing
Required file "./missing" not found; installing
Required file "./install" not found; installing
Required file "./News" not found
Required file "./readme" not found
Required file "./copying" not found; installing
Required file "./authors" not found
Required file "./changelog" not found
'-A' means 'add missing standard files
Package '. The first time you run automake, it will generate some standard files to comply with the GNU coding standard, but some files may not be found, these files need to be created by ourselves:
% Touch news readme authors changelog
Run automake again:
% Automake-
In this case, 'makefile. in' is generated'
Now all the tasks have been completed and can be packaged and distributed. Everyone knows how to use them:
%./Configure
% Make
%./Hello
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