c语言 - 简单"hello world" configure.ac 无法运行



我正在按照文档进行最新的自动制作(v1.12),但构建仍然失败。

这是我 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

3 行应改为

AM_INIT_AUTOMAKE([1.12 foreign no-define])

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

通常,所有自动制作宏都以 AM_ 开头。

最新更新