简单的“hello world”configure.ac无法运行

时间:2012-07-02 01:45:01

标签: c autoconf automake

我正在使用最新的automake(v1.12)关注documentation,但构建仍然失败。

这是我的 configure.ac

AC_PREREQ([2.69])
AC_INIT([helloworld], [0.1], [bugs@hw.com])
AC_INIT_AUTOMAKE([1.12 foreign no-define])
AC_CONFIG_SRCDIR([src/hello.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])

# Checks for programs.
AC_PROG_CC([gcc cc])

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_OUTPUT(src/Makefile)

执行:

$ autoreconf
configure.ac:3: error: possibly undefined macro: AC_INIT_AUTOMAKE
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

$ automake
configure.ac: error: no proper invocation of AM_INIT_AUTOMAKE was found.
configure.ac: You should verify that configure.ac invokes AM_INIT_AUTOMAKE,
configure.ac: that aclocal.m4 is present in the top-level directory,
configure.ac: and that aclocal.m4 was recently regenerated (using aclocal)
configure.ac:5: error: required file 'config.h.in' not found
/usr/share/automake-1.12/am/depend2.am: error: am__fastdepCC does not appear in AM_CONDITIONAL
/usr/share/automake-1.12/am/depend2.am:   The usual way to define 'am__fastdepCC' is to add 'AC_PROG_CC'
/usr/share/automake-1.12/am/depend2.am:   to 'configure.ac' and run 'aclocal' and 'autoconf' again
/usr/share/automake-1.12/am/depend2.am: error: AMDEP does not appear in AM_CONDITIONAL
/usr/share/automake-1.12/am/depend2.am:   The usual way to define 'AMDEP' is to add one of the compiler tests
/usr/share/automake-1.12/am/depend2.am:     AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX,
/usr/share/automake-1.12/am/depend2.am:     AM_PROG_AS, AM_PROG_GCJ, AM_PROG_UPC
/usr/share/automake-1.12/am/depend2.am:   to 'configure.ac' and run 'aclocal' and 'autoconf' again

1 个答案:

答案 0 :(得分:10)

第3行应该是

AM_INIT_AUTOMAKE([1.12 foreign no-define])

请注意,它以 AM_ 而不是 AC_ 开头。

通常,所有的automake宏都以 AM_ 开头。