autotool

来源:互联网 发布:淘宝快递证明模板 编辑:程序博客网 时间:2024/05/17 04:31

autotool能够自动生成Makefile文件,

㈠如果你是root用户登陆,在/root目录下建立项目,用autoscal后生成的configure.scan内容如下:

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

AC_PREREQ(2.57)
#AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)

AC_INIT(name,1.0)

AM_INIT_AUTOMAKE(name,1.0)
AC_CONFIG_SRCDIR([k.c])
AM_CONFIG_HEADER([config.h])

# Checks for programs.
AC_PROG_CC
AC_PROG_AWK
AC_PROG_INSTALL

# Checks for libraries.

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_CHECK_FUNCS([atexit])

AC_CONFIG_FILES([.Trash/makefile
                 makefile])
AC_OUTPUT
其中黑体字为要修改和添加的内容,让后可以依次执行aclocal,autoconf,autoheader,用vim编辑Makefile.am文件,automake--add-missing,automake,./configure就可生成Makefile文件。

㈡如果你是非root用户登陆,在其他目录下,autoscan后生成的文件如下:

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

AC_PREREQ(2.57)
#AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)

AC_INIT(name,1.0)

AM_INIT_AUTOMAKE(name,1.0)
AC_CONFIG_SRCDIR([he.c])
AM_CONFIG_HEADER([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(Makefile)

文件中会少AC_CHECK_FUNCS([atexit])

AC_CONFIG_FILES([.Trash/makefile
                 makefile])

这两行,需要把末尾一行改为AC_OUTPUT(Makefile)否则不会生成Makefile文件,其他操作相同。

原创粉丝点击