automake错误:未找到AM_INIT_AUTOMAKE的正确调用

ars*_*lan 11 automake autotools

我是autotools的新手,并且遵循本教程.但我无法解决这个错误,

   $ automake
   configure.ac: error: no proper invocation of AM_INIT_AUTOMAKE was found.
   ..
   Makefile.am: error: required file './depcomp' 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: error: AMDEP does not appear in AM_CONDITIONAL
  ..
Run Code Online (Sandbox Code Playgroud)

我的configure.ac档案是

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

   AC_PREREQ([2.69])
   AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
   AM_INIT_AUTOMAKE(hello,1.0)
   AC_CONFIG_SRCDIR([config.h.in])
   AM_CONFIG_HEADERS(config.h)

   # Checks for programs.
   AC_PROG_CC

   # Checks for libraries.

   # Checks for header files.
   AC_CHECK_HEADERS([sys/time.h])

   # Checks for typedefs, structures, and compiler characteristics.

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

   AC_CONFIG_FILES([Makefile])
   AC_OUTPUT
Run Code Online (Sandbox Code Playgroud)

我在互联网上检查了解决方案,我configure.ac看起来很好,不知道它有什么问题.

adl*_*adl 26

configure.ac从哪里复制并粘贴你的?无论该网站是什么,您都应该从书签中删除它!

您正在混合使用新AC_INIT方法来指示包版本,使用旧AM_INIT_AUTOMAKE方法来执行相同的操作.不要两者都做.(旧的新的是指10年前发生的交换机.)从Automake 1.13开始,AM_INIT_AUTOMAKE使用两个参数调用的旧方法是no-longuer支持.

在您的情况下,删除AM_INIT_AUTOMAKE参数,并正确设置AC_INIT争论以反映项目的名称和版本应该就足够了.

有关最简单的最新示例,请参阅automake手册configure.ac.

不要automake自称,只需使用autoreconf -vfi它以正确的顺序运行所有相关工具,并安装丢失的文件.


小智 8

你必须逐行修复它.

首先,你的Makefile.am要求depcomp.因此,您必须将其复制到您的文件夹(对于此步骤,您可以运行automake --add-missing以便自动添加丢失的文件):

cp -a /usr/share/automake-X.XX/depcomp .
Run Code Online (Sandbox Code Playgroud)

其次,你必须aclocal先行automake:

$ aclocal
Run Code Online (Sandbox Code Playgroud)

最后,你可以运行automake:

$ automake
$ autoconf
Run Code Online (Sandbox Code Playgroud)