【发布时间】:2016-10-21 16:00:26
【问题描述】:
我是第一次尝试使用 Autotools。我设法用手写的 Makefile.in 编译了我的代码。并使用 autoconf(./configure make)。
但是现在,我决定使用Automake 生成Makefile.in 使用Makefile.am
我的 Makefile.am:
bin_PROGRAMS=hello_portable
hello_portable_SOURCES=hello_portable.c
我的 configure.ac 由 autoscan 自动生成:
AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE(summary, 1.0.0)
AC_CONFIG_SRCDIR([hello_portable.c])
AC_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_OUTPUT
当我为了生成 Makefile.in 进行 automake 时
# automake --add-missing
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)
Makefile.am: error: required file './NEWS' not found
Makefile.am: error: required file './README' not found
Makefile.am: error: required file './AUTHORS' not found
Makefile.am: error: required file './ChangeLog' not found
/usr/share/automake-1.14/am/depend2.am: error: am__fastdepCC does not appear in AM_CONDITIONAL
/usr/share/automake-1.14/am/depend2.am: The usual way to define 'am__fastdepCC' is to add 'AC_PROG_CC'
/usr/share/automake-1.14/am/depend2.am: to 'configure.ac' and run 'aclocal' and 'autoconf' again
/usr/share/automake-1.14/am/depend2.am: error: AMDEP does not appear in AM_CONDITIONAL
/usr/share/automake-1.14/am/depend2.am: The usual way to define 'AMDEP' is to add one of the compiler tests
/usr/share/automake-1.14/am/depend2.am: AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX,
/usr/share/automake-1.14/am/depend2.am: AM_PROG_AS, AM_PROG_GCJ, AM_PROG_UPC
/usr/share/automake-1.14/am/depend2.am: to 'configure.ac' and run 'aclocal' and 'autoconf' again
我做错了什么。
【问题讨论】:
-
作为一个起点:Makefile.am:错误:找不到所需的文件'./INSTALL'。你有所有这些文件吗?
-
没有。这些是什么。我应该只触摸这些文件吗?
-
使用 --add--missing 命令行参数,生成它们。 Makefile.am 中的第二行应该开始 hello_portable_SOURCES
-
嗨@arved 查看我的编辑。我按照你说的修改了文件。一些错误已解决,但仍有一些错误。
-
AM_INIT_AUTOMAKE([foreign])放宽了 GNU (gnits) 标准。即,您不需要官方“GNU”软件包所需的文件NEWS、README、AUTHORS、ChangeLog。推荐使用autoreconf -fvi进行再生。
标签: linux autotools configure autoconf automake