问题标签 [m4]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
428 浏览

c++ - 编译 m4/glib 时出错

我有一些问题要编译glib。好像m4不是最新的。我收到此错误:

因此,当我编译 glib 时出现此错误:

PerlAutoconf并且Automake 1.14编译成功。因此,我得出结论,问题出在 m4 上。

0 投票
7 回答
34267 浏览

makefile - User of autotools-generated tarball gets error message: aclocal-1.13: command not found

I am distributing a tarball with installation scripts generated by autoconf version 2.69. Works fine on many different machines. Now a user, working on a fresh Arch Linux system, reports that configure executes properly, but make immediately terminates with the following error message:

There is no acinclude.m4 in the project directory. The user assures that he has not modified aclocal.m4, configure.ac, files in m4/, or anything else in the project.

The error message makes no sense for me: as I understand, aclocal is executed when I run autoreconf -if; it generates a file aclocal.m4 that is part of the tarball I distribute; there is no reason why a user's make command should request aclocal.

The user further reports that he can solve the problem for himself by running aclocal. However, that is not a clean solution: packagers are not supposed to request their users to have autotools installed, right?

For completeness, I attach the full configure.ac: is there anything wrong?

Could the problem be due to the presence of files that do not belong in a tarball? Here the contents of the tgz archive, except for the source files themselves:

0 投票
2 回答
342 浏览

bash - m4_toupper 为变量返回空字符串

我想以大写形式打印出一个字符串变量。我正在尝试使用m4_toupper宏,但我的变量似乎被忽略了。

例如,给定以下代码:

结果如下:

由于x大写,我怀疑 m4 宏工作正常,但可能没有收到我的变量字符串——然而,这些echo语句似乎工作正常。为什么返回一个空字符串?

0 投票
3 回答
860 浏览

preprocessor - 在 M4 中使用 ifdef 进行三重条件检查

我在我的 fortran 代码中使用 m4 根据我的参数文件中定义的标志生成特定代码。

我对预处理知之甚少,因此不太了解 M4。我正在尝试编写代码,我需要根据三种情况来定义事物:等温、正压,两者都不是。我写了以下代码:

现在,当我编译代码时,它可以很好地编译等温 [做某事 (1)] 和(没有定义等温和正压)[做某事 (3)]。但是当我定义正压时,它会退回到 [做某事 (3)] 而不是 [做某事 (2)]。

有关如何在 m4 中处理这种情况的任何指示?

谢谢!

0 投票
1 回答
803 浏览

makefile - 在 Makefile.am 中使用 pkg-config 变量的规范方法

一堆项目 foo-AB、foo-BC、foo-AC 等,每个都依赖于 foo-A、foo-B、foo-C 等。

每个 foo-X 都会安装一个 pkg-config 文件(foo-X.pc.in),其中包含一个变量srcdir=@datarootdir@/foo/foo-B. 一个 foo-XY 项目需要引用 Xsrcdir 和 Ysrcdir 中的文件。

目前我们在configure.ac中这样做:

(所以 Makefile.am 有类似的规则compile "$XSRC"/file.bar $@)。这还允许开发人员在运行 ./configure 时覆盖 XSRC。

我的问题:是否有更规范的方式在 autotools 配置/makefile 中使用非标准 pkg-config 变量?例如 libdir,我看到 pkg-config 设置变量本身,因此除了 PKG_CHECK_MODULES 之外不需要 configure.ac 行;我们应该使用其他 m4 宏吗?

0 投票
1 回答
145 浏览

m4 - 是否有 M4 文件的中央存储库

我一直在玩m4,我想知道是否有任何 m4“库”的中央存储库。m4 用途广泛,我相信人们已经编写了有用的宏,无论是通用的还是特定领域的。

0 投票
1 回答
96 浏览

recursion - m4 中的无限递归

此 m4 脚本旨在为 shell 脚本生成部分参数解析代码。不幸的是,它不会产生正确的输出:

预期输出:

实际输出:

或者,换句话说,无限递归(上面的程序被传送到 head -n 20 )。

如何终止递归?

0 投票
4 回答
1590 浏览

bash - 从 m4 中的 esyscmd 中删除尾随换行符

我正在使用 m4 创建一些基本的宏,并且我意识到在esyscmd运行命令时会在字符串中添加一个尾随新行。

例子:

渲染:

(带有尾随的新行)

通过dnl在定义(或 esyscmd)的末尾添加,似乎没有发生任何事情,并且仍然有一个尾随换行符。

esyscmd调用m4时删除尾随换行符的最佳方法是什么?

0 投票
1 回答
1169 浏览

autoconf - 如何将逻辑或放入 autoconf m4 AS_IF

在官方文档中,AS_IF 宏的描述非常类似于:

我怎样才能使test1包括几个条件?(“逻辑与”和“逻辑或”的组合)

谢谢

0 投票
3 回答
379 浏览

shell - BASH/SH/ .. AutoConf:包装字符串比较

我正在修改用于 AutoConf 的configure.ac:http://mathpad.wikidot.com/acousto-configure-ac

该脚本指出它需要在 darwin、solaris、cygwin 和 linux 上运行。

我认为这就是它使用比较字符串的神秘方法的原因:

这种双重否定使代码难以阅读。我可以清理它吗?

我如何实现字符串比较宏:

或者:

这是解决问题的最佳方法吗?

编辑:显然这个脚本是用 M4 http://www.gnu.org/software/m4/manual/m4.html编写的