您的位置:首页 > 其它

使用autotools工具制作Makefile过程可能出现问题与解决方式

2013-09-04 21:44 603 查看
首先是新建一个目录,例如:#mkdir automake
然后就进入这个目录,并且建立一个.c文件。例如:#cd automake

vim hello.c 建立一个代码如下所示:

#include "stdio.h"
int main()
{
printf("hello,welcome to linux!");
}


3. 运行命令,#autoscan。然后就ls下就有如下文件autoscan.log configure.scan hello.

如果现在直接运行命令:#aclocal 就会出现以下提示错误: aclocal: `configure.ac' or `configure.in' is required

出现这个错误原因是:缺少提示两个文件

解决方式:就是把configure.scan改名为configure.in

4.此刻如果运行#aclocal 会生产configure文件

5. 运行 #autoconf 后会生产很多文件,但是缺少后缀为.m4文件,后面就会出错,无法编译出makefile相关文件

原因:前面没有修改configure.in 文件内容或者依赖项

解决问题就是修改configure内容:

原来内容如下所示:

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.63])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_OUTPUT

修改后内容:

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.63])
AC_INIT(hello,1.0)
AM_CONFIG_SRCDUR(hello, 1.0)
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐