Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
0
answers
29
views
Simplest way to wrap an "AC_DEFINE_UNQUOTED" output around #ifndef and #endif?
This line for example AC_DEFINE_UNQUOTED([SOME_MACRO_NAME], "$SOME_VALUE", [some comment]) generates printf "%s\n" "#define SOME_MACRO_NAME \"$SOME_VALUE\"" >>confdefs.h as a line in `configure`. And something like the following in `config.h` after `configure` is run: /* some comment */ #define SOME...
This line for example
AC_DEFINE_UNQUOTED([SOME_MACRO_NAME], "$SOME_VALUE", [some comment])
generates
printf "%s\n" "#define SOME_MACRO_NAME \"$SOME_VALUE\"" >>confdefs.h
as a line in
configure
.
And something like the following in config.h
after configure
is run:
/* some comment */
#define SOME_MACRO_NAME ""
How would I make it produce the following instead?
/* some comment */
#ifndef SOME_MACRO_NAME
#define SOME_MACRO_NAME ""
#endif
Surely I can add some printf
lines manually or create a custom function but shouldn't there be an idiomatic way to do this already? Either methods I mentioned are hackish either way as I'm asserting confdefs.h
is the file being temporarily produced.
I'm already seeing people would be suggesting testing $SOME_VALUE
maybe through AS_IF
or m4_if
(or any of their applicable variants) instead but that's a varying use case. I might want to have the variable overridable through autoreconf
, through ./configure
or through CFLAGS
with the -D
option. It depends. But right now I just want the answer for this.
Also somebody might suggest using a template. Please, please no.
konsolebox
(1107 rep)
Dec 2, 2024, 04:20 PM
• Last activity: Dec 2, 2024, 04:25 PM
0
votes
1
answers
81
views
How can I pass a newline in the macro argument to m4
I have an m4 template where I want to insert more than one line. In my template I have the placeholder `__CODE__`. Now I want to call m4 with something like ``` m4 -D__CODE__="foo\nbar" template.m4 ``` but in the output I get ``` foo\nbar ``` in place of `__CODE__`. Any ideas how this could be done?
I have an m4 template where I want to insert more than one line.
In my template I have the placeholder
__CODE__
. Now I want to call m4 with something like
m4 -D__CODE__="foo\nbar" template.m4
but in the output I get
foo\nbar
in place of __CODE__
.
Any ideas how this could be done?
Thorsten
(113 rep)
Jul 26, 2024, 07:08 AM
• Last activity: Jul 26, 2024, 08:45 AM
2
votes
1
answers
96
views
Use m4 interactively with bc
I would like to use `m4` interactively as a preprocessor for `bc`. My immediate use case is to add an `include` capability to `bc`, but I can foresee other uses in the future. But there is a problem. Here is an example using `bc` on its own: ```` $ bc bc 1.07.1 Copyright 1991-1994, 1997, 1998, 2000,...
I would like to use
m4
interactively as a preprocessor for bc
. My immediate use case is to add an include
capability to bc
, but I can foresee other uses in the future. But there is a problem. Here is an example using bc
on its own:
`
$ bc
bc 1.07.1
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
3+7
10
sqrt(12345)
111
quit
$
`
And here is the same example using m4
interactively:
`
$ m4 -iP - | bc
3+7
10
sqrt(12345)
111
quit
$
`
There are two differences. First, the m4
version suppresses the banner. Second, the m4
version doesn't execute quit
immediately, but instead requires the enter key to be pressed an additional time before it executes the quit
.
Why do these things occur? How can I make the m4
version work the same way as the bc
version?
user448810
(131 rep)
Apr 9, 2024, 08:03 PM
• Last activity: Apr 12, 2024, 10:16 PM
5
votes
1
answers
2736
views
How can I install M4 on Linux, avoiding the dependency loop with Automake and Autoconf?
I am trying to install GNU M4 on my Chromebook using the 1.4.17 tarball, but when I run `./configure` and then`make` I get an error related to `aclocal`, which is apparently part of the GNU Automake package. The exact error I get is WARNING: 'aclocal-1.14' is missing on your system. You should only...
I am trying to install GNU M4 on my Chromebook using the 1.4.17 tarball, but when I run
./configure
and thenmake
I get an error related to aclocal
, which is apparently part of the GNU Automake package. The exact error I get is
WARNING: 'aclocal-1.14' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
make: *** [aclocal.m4] Error 127
I know the first part is only a warning, but the name indicates that the error is related.
I also tried to create an empty file for aclocal.m4
, and I get a different message: a warning about automake-1.14
missing and make: *** [Makefile.in] Error 1
Unfortunately, according to the official page , Automake requires Autoconf, which in turn requires M4 . What can I do to install M4 and avoid this problem?
murgatroid99
(173 rep)
Dec 15, 2013, 04:56 AM
• Last activity: Oct 18, 2023, 11:02 PM
2
votes
1
answers
86
views
output redirection issue - m4 macro with self increasing build counter
My goal is to create a m4 macro, that reads a value from a file (`BUILD`), increases it and then saves the output into the file. I came up with the following solution (`BUILD.m4`): ```m4 define(`__buildnumber__',`esyscmd(cat BUILD)')dnl define(`counter',__buildnumber__)dnl popdef(__buildnumber__)dnl...
My goal is to create a m4 macro, that reads a value from a file (
BUILD
), increases it and then saves the output into the file. I came up with the following solution (BUILD.m4
):
define(__buildnumber__',
esyscmd(cat BUILD)')dnl
define(`counter',__buildnumber__)dnl
popdef(__buildnumber__)dnl
define(count',
define(`counter',eval(counter+1))counter')dnl
count dnl
When BUILD
contains 3 then running m4 BUILD.m4
outputs 4
.
Which is great!
However, when I call it like this m4 BUILD.m4 > BUILD
the BUILD
file always contains 1
.
If I pipe to another file m4 BUILD.m4 > B
it works and the B
file will contain 4
when BUILD
was 3
.
I suspect it has to do with the >
output redirection. When comparing both variants with debug tracing it seems like the one with the redirection into the same file can not read from the file anymore.
Variant redirection to different file:
% m4 -dtaeq BUILD.m4 > B
m4trace: -1- define(__buildnumber__',
esyscmd(`cat BUILD')')
m4trace: -1- dnl
m4trace: -2- __buildnumber__ -> esyscmd(
cat BUILD')'
m4trace: -2- esyscmd(cat BUILD') ->
3'
m4trace: -1- define(counter',
3')
Variant redirection to same file:
% m4 -dtaeq BUILD.m4 > BUILD
m4trace: -1- define(__buildnumber__',
esyscmd(`cat BUILD')')
m4trace: -1- dnl
m4trace: -2- __buildnumber__ -> esyscmd(
cat BUILD')'
m4trace: -2- esyscmd(`cat BUILD')
m4trace: -1- define(counter',
')
Is there a way of doing it like this, or do I need to use some other means of capturing the output
bckmnn
(23 rep)
Oct 7, 2022, 11:21 AM
• Last activity: Oct 7, 2022, 02:38 PM
0
votes
0
answers
676
views
MacOS - curl: (60) SSL certificate problem: unable to get local issuer certificate
On Mac(Catalina) I'm trying to re-install `m4` package using terminal, However it fails with below errors. ``` $ brew reinstall m4 ==> Downloading https://ghcr.io/v2/homebrew/core/m4/manifests/1.4.19 Already downloaded: /Users/buildsystem/Library/Caches/Homebrew/downloads/5b2a7f715487b7377e409e8ca58...
On Mac(Catalina) I'm trying to re-install
m4
package using terminal, However it fails with below errors.
$ brew reinstall m4
==> Downloading https://ghcr.io/v2/homebrew/core/m4/manifests/1.4.19
Already downloaded: /Users/buildsystem/Library/Caches/Homebrew/downloads/5b2a7f715487b7377e409e8ca58569040cd89f33859f691210c58d94410fd33b--m4-1.4.19.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/m4/blobs/sha256:e0fec6a49fd80cc7279c71f319d70d01ed49e894b53cd91e39f170288232fa93
-#O#- # #
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
Error: Failed to download resource "m4"
Download failed: https://ghcr.io/v2/homebrew/core/m4/blobs/sha256:e0fec6a49fd80cc7279c71f319d70d01ed49e894b53cd91e39f170288232fa93
Even after echo insecure >> $HOME/.curlrc
also resulting same errors. Please let me know to solve this issue. Thanks in advance!
user4948798
(145 rep)
Mar 7, 2022, 10:50 AM
• Last activity: Sep 22, 2022, 04:24 PM
1
votes
1
answers
280
views
What does it mean when "aclocal cannot open VERSION"
Is this the correct forum? I am running ./bootstrap for a program called Qucs and it complains about VERSION ```~/Downloads/qucs-0.0.20$ ./bootstrap Running aclocal... Running automake... Running autoconf... bootstrapping /home/lasse/Downloads/qucs-0.0.20/qucs-core bootstrapping the qucs-core source...
Is this the correct forum? I am running ./bootstrap for a program called Qucs and it complains about VERSION
~/Downloads/qucs-0.0.20$ ./bootstrap
Running aclocal...
Running automake...
Running autoconf...
bootstrapping /home/lasse/Downloads/qucs-0.0.20/qucs-core
bootstrapping the qucs-core sources...
Creating aclocal.m4... sh: 1: cannot open VERSION: No such file
sh: 1: cannot open VERSION: No such file
done.
Creating config.h.in... sh: 1: cannot open VERSION: No such file
done.
Libtoolizing... libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: linking file 'm4/libtool.m4'
libtoolize: linking file 'm4/ltoptions.m4'
libtoolize: linking file 'm4/ltsugar.m4'
libtoolize: linking file 'm4/ltversion.m4'
libtoolize: linking file 'm4/lt~obsolete.m4'
done.
Creating Makefile.in(s)... sh: 1: cannot open VERSION: No such file
done.
Creating configure... done
bootstrapping /home/lasse/Downloads/qucs-0.0.20/qucs
Creating aclocal.m4... sh: 1: cannot open VERSION: No such file
fatal: not a git repository (or any of the parent directories): .git
sh: 1: cannot open VERSION: No such file
fatal: not a git repository (or any of the parent directories): .git
done.
Creating config.h.in... sh: 1: cannot open VERSION: No such file
fatal: not a git repository (or any of the parent directories): .git
done.
Running libtoolize
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: linking file 'm4/libtool.m4'
libtoolize: linking file 'm4/ltoptions.m4'
libtoolize: linking file 'm4/ltsugar.m4'
libtoolize: linking file 'm4/ltversion.m4'
libtoolize: linking file 'm4/lt~obsolete.m4'
Running automake... sh: 1: cannot open VERSION: No such file
fatal: not a git repository (or any of the parent directories): .git
done.
Running autoconf... done.
bootstrapping /home/lasse/Downloads/qucs-0.0.20/qucs-doc
Creating aclocal.m4... sh: 1: cannot open VERSION: No such file
configure.ac:15: error: AC_INIT should be called with package and version arguments
/usr/share/aclocal-1.15/init.m4:29: AM_INIT_AUTOMAKE is expanded from...
configure.ac:15: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1
done.
Creating Makefile.in(s)... sh: 1: cannot open VERSION: No such file
configure.ac:15: error: AC_INIT should be called with package and version arguments
aclocal.m4:172: AM_INIT_AUTOMAKE is expanded from...
configure.ac:15: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
automake: error: autoconf failed with exit status: 1
done.
Creating configure... sh: 1: cannot open VERSION: No such file
configure.ac:15: error: AC_INIT should be called with package and version arguments
aclocal.m4:172: AM_INIT_AUTOMAKE is expanded from...
configure.ac:15: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
done.
Lasse Karagiannis
(113 rep)
Aug 30, 2022, 06:52 PM
• Last activity: Aug 30, 2022, 07:38 PM
1
votes
2
answers
448
views
m4 macro implementation of global (non-volatile) counter
Is it possible to define a m4 macro (without arguments), which expands to 1 on first invocation, expands to 2 on second invocation, and so on? In other words, it should have internal memory storing the number of times it is invoked. Can this be done?
Is it possible to define a m4 macro (without arguments), which expands to 1 on first invocation, expands to 2 on second invocation, and so on? In other words, it should have internal memory storing the number of times it is invoked. Can this be done?
adgadg
(69 rep)
May 2, 2016, 08:49 AM
• Last activity: Jan 31, 2022, 02:37 PM
2
votes
1
answers
104
views
Why is m4 -D option not doing a substitution
How does `-DQUOTE=yes` work in the code below? I expected the second line to be `ifelse(yes,yes,Learn Linux today!)` The other parts make sense to me. From [Linux Pocket Guide - by Daniel J. Barrett][1] $ cat myfile My name is NAME and I am AGE years old. ifelse(QUOTE,yes,Learn Linux today!) $ m4 -D...
How does
-DQUOTE=yes
work in the code below?
I expected the second line to be ifelse(yes,yes,Learn Linux today!)
The other parts make sense to me.
From Linux Pocket Guide - by Daniel J. Barrett
$ cat myfile
My name is NAME and I am AGE years old.
ifelse(QUOTE,yes,Learn Linux today!)
$ m4 -DNAME=Sandy -DAGE=25 -DQUOTE=yes myfile
My name is Sandy and I am 25 years old.
Learn Linux today!
PurpleMongrel
(63 rep)
Nov 18, 2021, 05:53 AM
• Last activity: Nov 18, 2021, 06:12 PM
1
votes
1
answers
264
views
Freebsd 11.1 issues with gnu m4 eval test fail
I am pretty new Freebsd user. As I am trying to install `gnu m4-1.4.18`, I get eval fail on eval test section: Checking ./189.eval @ ../doc/m4.texi:6405: Origin of test ./189.eval: stdout mismatch --- m4-tmp.2536/m4-xout 2017-12-18 22:11:42.931036000 +0000 +++ m4-tmp.2536/m4-out 2017-12-18 22:11:42....
I am pretty new Freebsd user.
As I am trying to install
gnu m4-1.4.18
, I get eval fail on eval test section:
Checking ./189.eval
@ ../doc/m4.texi:6405: Origin of test
./189.eval: stdout mismatch
--- m4-tmp.2536/m4-xout 2017-12-18 22:11:42.931036000 +0000
+++ m4-tmp.2536/m4-out 2017-12-18 22:11:42.928582000 +0000
@@ -2,8 +2,8 @@
1
1
-overflow occurred
--2147483648
+
+2147483648
0
-2
-2
this is what inside 189.eval:
dnl @ ../doc/m4.texi:6405: Origin of test
dnl @ expected status: 0
dnl @ extra options:
dnl @ Copyright (C) 2006, 2007, 2008, 2009 Free Software
dnl @ Foundation, Inc.
dnl @ This file is free software; the Free Software Foundation
dnl @ gives unlimited permission to copy and/or distribute it
dnl @ with or without modifications, as long as this notice
dnl @ is preserved.
define(max_int', eval(
0x7fffffff'))
dnl @result{}
define(`min_int', incr(max_int))
dnl @result{}
eval(min_int` 0')
dnl @result{}1
ifelse(eval(min_int / -1'), min_int,
overflow occurred')
dnl @result{}overflow occurred
min_int
dnl @result{}-2147483648
eval(`0x80000000 % -1')
dnl @result{}0
eval(`-4 >> 1')
dnl @result{}-2
eval(`-4 >> 33')
dnl @result{}-2
Just to let you know its fresh OS (installation) and its one of the first software I am installing.
B. Belete
(13 rep)
Dec 18, 2017, 07:45 PM
• Last activity: Apr 10, 2021, 04:29 AM
0
votes
1
answers
48
views
m4: how to output literal $0?
How does one avoid `m4` interpreting a `$0`, for example? ``` # foo.m4 define(`m4_foo',`$0') # bar.txt m4_foo ``` M4 does not replace the text. There must be some way to deposit `$0` in a file via macros?
How does one avoid
m4
interpreting a $0
, for example?
# foo.m4
define(m4_foo',
$0')
# bar.txt
m4_foo
M4 does not replace the text. There must be some way to deposit $0
in a file via macros?
Chris
(1075 rep)
Jul 12, 2020, 08:36 PM
• Last activity: Jul 12, 2020, 09:47 PM
0
votes
1
answers
448
views
Building m4 from source on FreeBSD error: don't know how to make ../../build-aux/snippet/c++defs.h
I'm using FreeBSD 13.0-CURRENT (for more information see [here](http://mpuw-um9c5.byethost4.com/unamea.txt)), and I want to use [GNU m4](https://www.gnu.org/software/m4/m4.html). Downloaded [this version](ftp://ftp.gnu.org/gnu/m4/m4-latest.tar.xz) of it, configured, and tried to make. But it gives e...
I'm using FreeBSD 13.0-CURRENT (for more information see [here](http://mpuw-um9c5.byethost4.com/unamea.txt)) , and I want to use [GNU m4](https://www.gnu.org/software/m4/m4.html) . Downloaded [this version](ftp://ftp.gnu.org/gnu/m4/m4-latest.tar.xz) of it, configured, and tried to make. But it gives error as stated in the title: error:
don't know how to make ../../build-aux/snippet/c++defs.h
. For the whole log, [see here](http://mpuw-um9c5.byethost4.com/m4make.log) . Any idea? Thanks to all suggestions and answers.
EDIT1: indeed, my m4 version is 1.4.17.
code2828
(13 rep)
Mar 2, 2020, 04:57 AM
• Last activity: Mar 17, 2020, 09:17 AM
3
votes
1
answers
591
views
Expanding a macro into quotes in `m4`
In `m4`, is it possible to expand a macro and to immediately put it in quotes? That is, instead of define(HELLO, `Hello!')dnl define(MACRO, `HELLO')dnl MACRO expanding to `Hello!`, I would love to have some function `qexpand`, for example, such that define(HELLO, `Hello!')dnl define(MACRO, `HELLO')d...
In
m4
, is it possible to expand a macro and to immediately put it in quotes? That is, instead of
define(HELLO, `Hello!')dnl
define(MACRO, `HELLO')dnl
MACRO
expanding to Hello!
, I would love to have some function qexpand
, for example, such that
define(HELLO, `Hello!')dnl
define(MACRO, `HELLO')dnl
qexpand(`MACRO')
expands to HELLO
. But any other line after the first two that expands MACRO
into a string would do as well, of course.
---
*Background*. I want to operate substitutions on the expansion of a macro using patsubst
, say substituting commas in it. Unfortunately
define(MACRO',
x,y,z')dnl
patsubst(MACRO',
,',`.')
yields x,y,z
, as the substitution is performed on the string MACRO
. But if the expansion of the macro contains commas, the variant
define(MACRO',
x,y,z')dnl
patsubst(MACRO,,',
.')
has the second line first expand to `patsubst(x,y,z,
,',.')
, giving the error
Warning: excess arguments to builtin
patsubst' ignored``. The possibility of expanding a macro into quotes would solve this.
k.stm
(739 rep)
Feb 17, 2019, 09:53 AM
• Last activity: Feb 24, 2019, 10:11 AM
3
votes
2
answers
33548
views
m4 command not found after manual install
Just finished installing ubuntu 16.04.1 desktop version. Now I am trying to install m4. So far installed m4 as follows. 1. Downloaded m4-1.4.18.tar.gz 2. tar -xvzf m4-1.4.18.tar.gz 3. cd m4-1.4.18 4. ./configure --prefix=/usr/local/m4 5. make 6. sudo make install Now when I type: m4 --version It sti...
Just finished installing ubuntu 16.04.1 desktop version. Now I am trying to install m4. So far installed m4 as follows.
1. Downloaded m4-1.4.18.tar.gz
2. tar -xvzf m4-1.4.18.tar.gz
3. cd m4-1.4.18
4. ./configure --prefix=/usr/local/m4
5. make
6. sudo make install
Now when I type:
m4 --version
It still says:
The program 'm4' is currently not installed....
What step am I missing?
**Note**: I do not have internet access on this machine.
arod2028
(45 rep)
Jan 10, 2017, 02:24 PM
• Last activity: Jan 6, 2019, 01:10 PM
1
votes
2
answers
535
views
Create files from templates, substitutions in middle of other words
Is there a way to convince m4 to replace a macro in the middle of a word? I would like this file, day.m4: define(Sat,Cat)dnl Saturday and this command: m4 day.m4 to produce this output: Caturday As shown, m4 will not do this. Alternatively, is there a way to get sed to perform multiple substitutions...
Is there a way to convince m4 to replace a macro in the middle of a word?
I would like this file, day.m4:
define(Sat,Cat)dnl
Saturday
and this command:
m4 day.m4
to produce this output:
Caturday
As shown, m4 will not do this.
Alternatively, is there a way to get sed to perform multiple substitutions simultaneously? That is, without passing over the file for each substitution.
I can pipe a bunch of sed commands together or use a combination of sed and m4 and that's not so bad but if there's a convenient way to do this with one input file and one command that'd be preferable.
Any other commonly available tool would be fine too.
My goal is to use this for creating files from templates. Most of the tokens that are to be replaced are space separated.
Praxeolitic
(1688 rep)
Sep 16, 2014, 10:30 PM
• Last activity: Nov 27, 2018, 05:30 PM
1
votes
0
answers
277
views
Problem compiling autoconf
I am experiencing problems with compiling autoconf and they probably are related to the version of the M4 that I am using. I will put part of the result of running both ./configure as running ./make so someone can confirm is the cause is really that and what I should do to fix it (probably moving to...
I am experiencing problems with compiling autoconf and they probably are related to the version of the M4 that I am using. I will put part of the result of running both ./configure as running ./make so someone can confirm is the cause is really that and what I should do to fix it (probably moving to another version of it). If someone wants the full output of any, I will put i.
The M4 version is 1.4.10 and the autoconf is 2.64.
>./configure --prefix=/media/34GB/Arquivos-de-Programas-Linux/Autoconf-2.64/ --exec-prefix=/media/34GB/Arquivos-de-Programas-Linux/Autoconf-2.64/
>checking for GNU M4 that supports accurate traces... /usr/local/bin/m4
>checking whether /usr/local/bin/m4 accepts --gnu... no
>configure: WARNING: The version of M4 that was found does not support -g.
>configure: WARNING: Using it with POSIXLY_CORRECT set may cause problems.
>checking how m4 supports trace files... --debugfile
>make
>make: Entering directory `/media/34GB/Arquivos-de-Programas-Linux/autoconf-2.64/lib/m4sugar'
:;{ \
echo '# This file is part of -*- Autoconf -*-.' && \
echo '# Version of Autoconf.' && \
echo '# Copyright (C) 1999, 2000, 2001, 2002, 2006, 2007, 2009' && \
echo '# Free Software Foundation, Inc.' && \
echo &&\
echo 'm4_define([m4_PACKAGE_NAME], [GNU Autoconf])' && \
echo 'm4_define([m4_PACKAGE_TARNAME], [autoconf])' && \
echo 'm4_define([m4_PACKAGE_VERSION], [2.64])' && \
echo 'm4_define([m4_PACKAGE_STRING], [GNU Autoconf 2.64])' && \
echo 'm4_define([m4_PACKAGE_BUGREPORT], [bug-autoconf@gnu.org])' && \
echo 'm4_define([m4_PACKAGE_URL], [http://www.gnu.org/software/autoconf/]) ' && \
echo 'm4_define([m4_PACKAGE_YEAR], ['
sed 's/^\([0-9][0-9][0-9][0-9]\).*/\1/;q' ../../ChangeLog
'])'; \
} > version.m4-t
mv version.m4-t version.m4
make: Leaving directory `/media/34GB/Arquivos-de-Programas-Linux/autoconf-2.64/lib/m4sugar'
autom4te_perllibdir='..'/lib AUTOM4TE_CFG='../lib/autom4te.cfg' ../bin/autom4te -B '..'/lib -B '..'/lib --language M4sh --cache '' --melt ./autoconf.as -o autoconf.in
*** %n in writable segment detected ***
Aborted
autom4te: /usr/local/bin/m4 failed with exit status: 134
make: *** [autoconf.in] Error 134
make: Leaving directory `/media/34GB/Arquivos-de-Programas-Linux/autoconf-2.64/bin'
make: *** [all-recursive] Error 1
make: Leaving directory `/media/34GB/Arquivos-de-Programas-Linux/autoconf-2.64'
make: *** [all] Error 2
user2752471
(265 rep)
Jan 31, 2018, 08:30 PM
3
votes
2
answers
4874
views
Checking for required M4 macros... yelp.m4 not found
I am on Linux Mint 18 Cinnamon 64-bit. I was about to compile `file-roller` known as [Archive manager for GNOME from source][1]. But when running: ./autogen.sh There is a following M4 macro missing: > Checking for required M4 macros... yelp.m4 not found ***Error***: some autoconf macros required to...
I am on Linux Mint 18 Cinnamon 64-bit.
I was about to compile
file-roller
known as Archive manager for GNOME from source .
But when running:
./autogen.sh
There is a following M4 macro missing:
> Checking for required M4 macros...
yelp.m4 not found
***Error***: some autoconf macros required to build Package
were not found in your aclocal path, or some forbidden
macros were found. Perhaps you need to adjust your
ACLOCAL_PATH?
Vlastimil Burián
(30515 rep)
Nov 24, 2016, 01:11 PM
• Last activity: Mar 25, 2017, 01:51 PM
2
votes
1
answers
293
views
Implement inclusion of another file into a stream (read from stdin)
# Background I'm facing the following problem: I insist on using `m4_include([some/file.m4])` in my configure.ac file, where some/file.m4 then contains patterns like 'AC_INIT' and 'LT_INIT' that are necessary for libtoolize to work. In otherwords, I need configure.ac to be preprocessed by m4 before...
# Background
I'm facing the following problem: I insist on using
m4_include([some/file.m4])
in my configure.ac file, where some/file.m4 then contains patterns like 'AC_INIT' and 'LT_INIT' that are necessary for libtoolize to work. In otherwords, I need configure.ac to be preprocessed by m4 before libtoollize feeds it to sed looking for those patterns.
I do NOT want to generate configure.ac (if I can avoid it). The only hook that libtoolize provides that can help me is that they look for the environment variable SED and use that instead of /bin/sed when found.
I wrote a shell script that analyses sed arguments and passes them on to the real sed. Unfortunately, libtoolize concatenates m4local.ac and configure.ac and feeds that to $SED at some point, so looking for an input file named 'configure.ac' fails. Nevertheless, after analyzing the arguments passed to $SED I can just concatenate all input files and/or stdin, because in the end it has to work by reading from a stream (stdin) anyway.
# Remaining problem
The problem that I am facing therefore is the following:
My script must read from stdin and write to stdout, until it encounters a line like m4_include([cwm4/configure_ac_top.m4])
which it then should swallow and instead insert the contents of cwm4/configure_ac_top.m4, no other m4 preprocessing is necessary, just the includes will do. In fact, as sed is also used for countless other little things it would be downright dangerous to do any other preprocessing than the m4_include's. However I need it to be recursive as well: if an included file contains a line m4_sinclude([lt_init.m4])
then also that file needs to be included.
I found multiple question and their answers on this site that ask how to insert one file into another, but then the file name of the to-be inserted file is known (not read from the original file), it isn't recursive and in many cases it wasn't reading from stdin (but from the first, known, file by name).
Carlo Wood
(392 rep)
Jan 27, 2017, 09:01 PM
• Last activity: Feb 11, 2017, 12:06 AM
2
votes
1
answers
603
views
m4 macro using variable number of tabs to line up a column
This is the macro I have so far: define(`debug_macro', ` #ifndef $1_DEBUG #define $1_DEBUG'forloop(`i',`1',eval(5-(len($1)/4+ifelse(eval(len($1)%4 == 0)), `0', `1')),` ')dnl`0 #endif ') The goal is to put the correct number of tabs between the `_DEBUG` and the `0` character so they all line up. Ther...
This is the macro I have so far:
define(
debug_macro',
#ifndef $1_DEBUG
#define $1_DEBUG'forloop(i',
1',eval(5-(len($1)/4+ifelse(eval(len($1)%4 == 0)), 0',
1')), ')dnl
0
#endif
')
The goal is to put the correct number of tabs between the _DEBUG
and the 0
character so they all line up. There may be missing parens or quotes but hopefully you get the idea of where I'm going.
I'm using Xcode and have my tabs set to 4. Here are the changes I made to accommodate that:
divert(`-1')
# forloop(var, from, to, stmt)
define(`forloop',
pushdef(
$1', $2')_forloop(
$1', $2',
$3', $4')popdef(
$1')')
define(`_forloop',
$4
'ifelse($1, `$3', ,
define(
$1', incr($1))_forloop($1',
$2', $3',
$4')')')
divert`'dnl
changecom()dnl
define(debug_macro',
#ifndef $1_DEBUG
#define $1_DEBUG'forloop(
i', 1', ifelse(eval(len($1) >= 16), 1, 1, eval(5-(len($1)/4+ifelse(eval(len($1)%4 > 1), 0,
0', 1')))),
')0
#endif
')
changecom()dnl
Since I couldn't find 'forloop.m4' on my system I just included it. The division by 4 rounds so I added the check for when the remainder is greater than 1. I also change the run of spaces for a single tab character.
For the interested I use this macro to define constants I use to turn on debugging of different areas of my application. This file is checked into git. There is then a file that is personal and not checked in that looks something like this:
//#define NETWORK_DEBUG 1
The file is included in the myapp.pch file before including the above file. That way each programmer can have their own debug areas turned on or off as they please.
MyTallest
(123 rep)
Dec 19, 2014, 09:07 PM
• Last activity: Dec 22, 2014, 08:22 PM
1
votes
1
answers
154
views
Loop through m4's dumpdef
Is it possible to loop through the list of macro names given by `dumpdef`? I want to process certain macros which have a certain prefix in their name.
Is it possible to loop through the list of macro names given by
dumpdef
? I want to process certain macros which have a certain prefix in their name.
Rnet
(113 rep)
Dec 12, 2014, 01:42 PM
• Last activity: Dec 22, 2014, 01:31 PM
Showing page 1 of 20 total questions