autotools是系列工具, 它主要由autoconf、automake、perl语言环境和m4等组成;所包含的命令有五个:
(1)aclocal
(2)autoscan
(3)autoconf
sum.cpp:
二、autotools 使用步骤
(1)aclocal
(2)autoscan
(3)autoconf
(4)autoheader
(5)automake
一、准备源代码
本项目有三个源文件,分别为score.cpp, sum.cpp, average.cpp
内容分别如下:
score.cpp:
#include <iostream>
float Sum(float var[], int sum);
float Average(float var[], int sum);
using namespace std;
int main()
{
float score[5] = {91, 95, 100, 98, 92};
float sum, average;
sum = Sum(score, 5);
average = Average(score, 5);
cout << "The sum score is " << sum << endl;
cout << "The average score is " << average << endl;
cout << "H" << endl;
return 0;
}
sum.cpp:
float Sum(float var[], int num)
{
float sum = 0.0;
for(int i=0; i<num; i++)
sum += var[i];
return sum;
}
average.cpp:
float Average(float var[], int num)
{
float average = 0.0;
for(int i=0; i<num; i++)
average += var[i];
average /= num;
return average;
}
二、autotools 使用步骤
2.1 使用autoscan命令,它将扫描工作目录,生成 configure.scan 文件。
liuwei@liuwei:~/score$ ls
average.cpp score.cpp sum.cpp
liuwei@liuwei:~/score$ autoscan
liuwei@liuwei:~/scor