标签: automake

需要命令行参数的 automake 测试

在 automake 中,您可以使用变量添加测试TESTS,但这些测试必须是独立的测试。我需要一种方法来调用提供参数的标准测试驱动程序。有什么方法可以做到这一点,或者在测试期间调用标准 makefile 目标?

例如,我的目标之一需要运行:

driver.sh suite-a
Run Code Online (Sandbox Code Playgroud)

还有一次我需要运行:

driver.sh suite-b
Run Code Online (Sandbox Code Playgroud)

每次都必须添加另一个 bash 脚本包装器才能分配给TESTS. 因此,要么我需要添加TESTS命令行选项,要么我需要一种方法来添加 make 目标作为测试本身。

我怎样才能做到这一点?

automake

5
推荐指数
1
解决办法
1534
查看次数

libtool 安装保留可执行文件的临时 rpath

我正在修改一个与Automake / libtool文档提供的示例非常相似的项目。摘录:

顶级configure.ac:

LT_INIT
Run Code Online (Sandbox Code Playgroud)

顶级 Makefile.am:

ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src doc
Run Code Online (Sandbox Code Playgroud)

./src 生成文件.am:

lib_LTLIBRARIES = libname.la
libname_la_SOURCES = <my cc file list>
libname_la_LDFLAGS = -no-undefined -version-info $(GENERIC_LIBRARY_VERSION)
include_HEADERS = <my h file list>

bin_PROGRAMS = progname
progname_SOURCES = <my cc file list>
progname_LDADD = libname.la
progname_LDFLAGS = -static
Run Code Online (Sandbox Code Playgroud)

在我的包创建软件提供的fakeroot环境中,我执行以下命令

$ autogen.sh # contains the usual calls to aclocal, libtoolize, automake, autoconf.
$ ./configure --prefix="/usr" --disable-static
$ make
 ...
 /bin/sh ../libtool  --tag=CXX   --mode=link g++ -Wall …
Run Code Online (Sandbox Code Playgroud)

linux automake rpath libtool

5
推荐指数
1
解决办法
1205
查看次数

aclocal的搜索路径在哪里

当我运行automake --foreign --add-missing我的 C 程序编译时,我收到以下消息 。

mylib/Makefile.am:1: error: Libtool library used but 'LIBTOOL' is undefined
mylib/Makefile.am:1:   The usual way to define 'LIBTOOL' is to add 'LT_INIT'
mylib/Makefile.am:1:   to 'configure.ac' and run 'aclocal' and 'autoconf' again.
mylib/Makefile.am:1:   If 'LT_INIT' is in 'configure.ac', make sure
mylib/Makefile.am:1:   its definition is in aclocal's search path.
Run Code Online (Sandbox Code Playgroud)

这是我的configure.acwhitch 包括 LT_INIT。

AC_PREREQ([2.69])
AC_INIT([drive], [1], [admin@local])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/drive.c])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CC
LT_INIT
AC_CONFIG_FILES([Makefile
                src/Makefile
                mylib/Makefile])
AC_OUTPUT
Run Code Online (Sandbox Code Playgroud)

mylib/Makefile.am 也在这里

lib_LTLIBRARIES = libmylib.la …
Run Code Online (Sandbox Code Playgroud)

c automake autoconf autotools

5
推荐指数
1
解决办法
4872
查看次数

使用 autotools 构建和安装多个版本的 Python

我正在尝试弄清楚如何为多个版本的 Python 构建我的项目。我正在 Debian wheezy 上测试这个,Python 的默认版本是 2.7。但也支持并安装 2.6。但是,automake 仅针对 Python 2.7 进行安装和编译。我希望它也能编译 2.6。

这是configure.ac 和Makefile.am。如有必要,我可以提供更多详细信息,但希望这些就足够了。

我是 Autotools 的初学者,所以可能有一些明显的解决方案。

这似乎是一个愿望清单错误: RFE: build against multiple python stacks。这里也有类似的讨论:RFC: (automake) add support for Dual python 2 / python 3 builds

还有一个建议的解决方案(看起来很复杂),在 CDBS + Autotools + Python中给出

这是configure.ac。

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

AC_PREREQ([2.69])
AC_INIT([corrmodel], [0.1], [faheem@faheem.info])
AM_INIT_AUTOMAKE([foreign -Wall -Werror -Wno-extra-portability parallel-tests])
AM_MAINTAINER_MODE
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])

# Checks for programs. …
Run Code Online (Sandbox Code Playgroud)

python automake build-process autotools

5
推荐指数
1
解决办法
447
查看次数

检查框架示例在运行“./configure”时给我错误

我正在构建支票框架示例“check_money”,但它不是在我的机器上构建的。错误是:

configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."
Run Code Online (Sandbox Code Playgroud)

我尝试使用以下方法安装它:

libtoolize --force
aclocal
autoheader
automake --force-missing --add-missing
autoconf
./configure
Run Code Online (Sandbox Code Playgroud)

它仍然给我同样的错误。

因此,我将同一目录复制到另一个目录并运行:

autoreconf --install
./configure
Run Code Online (Sandbox Code Playgroud)

它仍然给我同样的错误。我不知道还能尝试什么。

我在 Mac OS X Mavericks (10.9) 上

  • 自动配置 2.69
  • 汽车制造商 1.15
  • 库工具 2.4.6
  • 检查 0.9.14

automake autoconf autotools configure check-framework

5
推荐指数
1
解决办法
1570
查看次数

autoconf:设置 AC_CHECK_LIB 编译器标志

我正在尝试设置我的项目以使用 autotools 构建系统进行分发。但是,当涉及到包含一些额外的库时,我遇到了问题。

我的代码依赖于几个库:

  • 我写的一个(我会叫 libfoo)

  • 一个是第三方(我将称之为 libbar)

  • Eigen3(这只是头文件)

这些都已经编译并安装在我的 $HOME 目录中。我不需要将它们构建为这个项目的一部分。

我需要的标志是

-std=c++11 (Got this taken care of)
Run Code Online (Sandbox Code Playgroud)

-I/path/to/include/libfoo (or libbar, or Eigen3)
Run Code Online (Sandbox Code Playgroud)

-L/path/to/lib/ (Where libfoo and libbar reside)
Run Code Online (Sandbox Code Playgroud)

-lfoo
Run Code Online (Sandbox Code Playgroud)

编译和链接 libfoo 和 libbar

问题是我想设置检查 libfoo 和 libbar 及其标头的存在(我已经检查了 Eigen3 设置)。问题是像 AC_CHECK_HEADERS 和 AC_CHECK_LIB 这样的宏似乎不想包含所需的 CPPFLAGS 或 LDFLAGS,无论我如何尝试定义它们,因此配置步骤失败。

AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([libfoo/foo.h], , [echo "Did not find libfoo headers"; exit -1])
AC_LANG_POP([C++])
Run Code Online (Sandbox Code Playgroud)

阅读 config.log 显示 configure 正在尝试使用

g++ -std=c++11 (other flags...)
Run Code Online (Sandbox Code Playgroud)

但由于缺少上述标志而失败(错误是“找不到 Eigen3/dense”或类似的,表明缺少 -I 标志)

我是 autotools 的新手,所以我可能会遗漏一些明显的东西,但我已经阅读了大量的帮助和手册,但到目前为止还没有弄清楚我需要做什么来设置它。 …

c++ automake autoconf autotools

5
推荐指数
1
解决办法
1972
查看次数

更改 configure.ac 中的 *FLAGS 与使用子项目缓存

假设我想CFLAGS在我的configure脚本中添加一个特定的标志,它应该传播到所有子项目的configure脚本:

CFLAGS+=" -Dfoobar"
export CFLAGS
AC_CONFIG_SUBDIRS([sub])
Run Code Online (Sandbox Code Playgroud)

这在configure被简单调用时有效。一旦发生以下情况之一:

  1. CFLAGSconfigure调用时在环境中导出
  2. CFLAGSconfigure命令行上设置
  3. 使用缓存 ( configure -C)

这种方法不再有效。在前两种情况下,exportedCFLAGS被简单地忽略了;在最后一个中,configure失败了

配置:错误:上次运行中未设置“CFLAGS”


我设法通过以下方式使其可靠地工作:

AM_CFLAGS+=" -Dfoobar"
export AM_CFLAGS
AC_SUBST([AM_CFLAGS]) # repeat this line in every configure.ac for each *FLAGS
AC_CONFIG_SUBDIRS([sub])
Run Code Online (Sandbox Code Playgroud)

考虑到有多个子项目,并且*FLAGS可能需要像这样设置多个变量,这虽然半途而废,但仍然是次优的。有没有办法通过只破解顶级来完成这项工作configure.ac

automake autoconf autotools cflags

5
推荐指数
1
解决办法
1091
查看次数

如何使自动工具测试读取文件?

my autotools project has a couple of unit-tests. one of these tests (filereader) needs to read a file (data/test1.bin)

Here's my filesystem layout: - libfoo/tests/filereader.c - libfoo/tests/data/test1.bin

and my libfoo/tests/Makefile.am:

AUTOMAKE_OPTIONS = foreign
AM_CPPFLAGS = -I$(top_srcdir)/foo
LDADD = $(top_builddir)/src/libfoo.la

EXTRA_DIST = data/file1.bin

TESTS = filereader
check_PROGRAMS= filereader
filereader_SOURCES = filereader.c
Run Code Online (Sandbox Code Playgroud)

this works great, as long as i do in-tree builds. However, when running the test-suite out-of-tree (e.g. make distcheck), the filereader test cannot find the …

automake unit-testing autotools

5
推荐指数
1
解决办法
358
查看次数

使用 gcc-ar 和 gcc-ranlib 的 autoconf 配方

我在一个在 GCC 和 Clang 下编译并构建静态库的项目中使用链接时优化 (LTO) 。它与 GCC 4.8 一起工作,但 GCC 5.4 生成瘦 LTO 对象,当 automake 尝试使用ar它构建静态库时失败,因为它需要包装脚本gcc-ar

有没有一个很好的例子,我可以看看如何使用 automakegcc-ar而不是ar(类似地gcc-ranlib)?我可能可以破解一些东西,但理想情况下它应该:

  • 为编译器使用合适的工具(Clang 有自己的说明)。
  • 即使用户将编译器覆盖为不是系统默认值的编译器,也能工作。
  • 交叉编译时工作

automake autoconf gcc lto

5
推荐指数
1
解决办法
1070
查看次数

FFF 假函数与谷歌测试

我正在尝试使用 google test 测试我的 C 库,但在使用框架模拟函数时遇到问题fff.h。这是我的文件结构:

\n\n
.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Makefile.am\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 configure.ac\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 include\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Makefile.am\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 public_header.h\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libmylib\n\xe2\x94\x82\xc2\xa0\xc2\xa0     \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Makefile.am\n\xe2\x94\x82\xc2\xa0\xc2\xa0     \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 private_functions.c\n\xe2\x94\x82\xc2\xa0\xc2\xa0     \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 private_functions.h\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libmylib.la\n\xe2\x94\x82\xc2\xa0\xc2\xa0     \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libmylib.c\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 test\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libmylib_test\n        \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Makefile.am\n        \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 fff.h\n        \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 test.cc\n
Run Code Online (Sandbox Code Playgroud)\n\n

我想从标头模拟一个函数,该函数在使用框架private_functions.h的函数中使用。public_header.hfff.h

\n\n
public_function()\n{\n        private_function(); //This function is the one I want to mock.\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

我的测试如下所示:

\n\n
#include "gtest/gtest.h"\n#include "public_header.h"\n#include "fff.h"\n\nextern "C" {\n    #include "private_functions.h"\n}\n\nDEFINE_FFF_GLOBALS;\n\nFAKE_VALUE_FUNC(int, function, char *, char *);\n\nclass libtest : public testing::Test\n{\npublic:       \n    virtual void …
Run Code Online (Sandbox Code Playgroud)

c c++ automake googletest

5
推荐指数
1
解决办法
4508
查看次数