Questions tagged [m4]

m4 is a general purpose macro processing language developed by Brian Kernighan and Dennis Ritchie.

m4 is a general purpose macro processing language developed by Brian Kernighan and Dennis Ritchie in 1977.

Various implementations of m4 exist, e.g. those in FreeBSD, NetBSD, OpenBSD, and the GNU implementation commonly found in Linux distributions.

GNU m4 is used extensively by GNU Autoconf. The GNU implementation addresses many limitations found in prior m4 implementations, like limits on line lengths and the number of macros in use.

212 questions
5
votes
2 answers

include file and indent every line

I want to include a file and have all the lines indented. I want it to be a code block in a markdown document. Basically I want something like this: text include(somefile) text to have this output: text content from somefile text I…
Lesmana
  • 25,663
  • 9
  • 82
  • 87
5
votes
1 answer

How do I define a macro with the same name as its expansion in m4?

I am attempting to replace if with if( using GNU m4 1.4.14 and I am receiving ERROR: end of file in argument list when trying: define(`if', `if(') define(`then', `){') define(`fi', `}') if foo then bar() fi I have tried escaping the parentheses…
Jimmio92
  • 321
  • 2
  • 9
4
votes
1 answer

Doxygen for GNU M4 language

Is it possible to document GNU M4 macros with Doxygen or something similar? We have a large collection of macros and would like to document them in comments and generate documentation from that (similar to Doxygen, JavaDoc, etc.) Thanks!
Oppy
  • 91
  • 2
  • 5
4
votes
2 answers

In m4, how do you include a file that has an environment variable in its name?

I want to include a file based relative to my sandbox base directory inside of my m4 text without using the -I switch. So far, I have figured out how to grab the environment variables using a sys call: define(MODEL_ROOT,`syscmd(`printf…
Ross Rogers
  • 23,523
  • 27
  • 108
  • 164
4
votes
1 answer

How to change the default autoconf configure --help output

I'd like to change the contents of autoconf's default configure --help output, in particular the text that is placed in the HELP_BEGIN diversion by _AC_INIT_HELP. I realize this will be a hack that is not entirely "kosher" under autoconf doctrine,…
Dan Bonachea
  • 2,408
  • 5
  • 16
  • 31
4
votes
1 answer

Why is the "wrong" expression of an ifelse macro evaluated anyway?

I wrote a small m4 script (test.m4) for testing purposes: define(`test', `ifelse(`$#', `1', `$1', test(shift($@)))') test(`arg1', `arg2') and ran it with m4 test.m4 -t test -de1. The output was m4trace: -1- test -> ifelse(`2', `1', `arg1',…
cadaniluk
  • 15,027
  • 2
  • 39
  • 67
4
votes
4 answers

Scala, Maven, and preprocessors

I know all of the philosophical arguments against preprocessors and macros in Java. I don't agree that just because some may abuse a language feature, it should be excluded for all. I would like to include __FILE__ and __LINE__ macros in my Java and…
Ralph
  • 31,584
  • 38
  • 145
  • 282
4
votes
4 answers

Is there an eclipse plugin for developing in m4?

Googling has turned up little to nothing. I need to develop some heavy stuff in m4 and I'd love to do it in my favorite environment with all the bells and whistles thereof. There are packages for running m4 on just about every platform, such as…
Keith Twombley
  • 1,666
  • 1
  • 17
  • 21
4
votes
2 answers

AC_SUBST does not expand variable

In an Autotools project I am trying to generate parts of my .conf file. The program needs to read from $(pkgdatadir), but I know that that variable is only set in Makefile.in, so I instead substituted datadir and PACKAGE. configure.ac: …
4
votes
2 answers

"Help" string variable substitution for "configure --help"

I have a string that I want to use multiple times for the output of configure --help. So I try doing something like this in configure.ac: AC_ARG_ENABLE([foobar], AS_HELP_STRING([--enable-foobar], [$foobar_help_str])) But no expansion…
Matthew Cline
  • 2,312
  • 1
  • 19
  • 36
4
votes
2 answers

Build m4, autoconf, automake, libtool on unix

I'm trying to setup PHP, apache environment on HP-UX server. While install i'm using usual commands of "./configur, make, make install". Here when I'm trying to install PCRE I got an error like follows. CDPATH="${ZSH_VERSION+.}:" && cd . &&…
sugunan
  • 4,408
  • 6
  • 41
  • 66
4
votes
2 answers

AM_PATH_PYTHON for python2 and python3

I am using automake's macro AM_PATH_PYTHON to find the pythondir variable. Till now I have been calling it without arguments which defaults to python 2.7 on Ubuntu. Now I also want to build it for python3.x (3.3 specifically). Is there a way where I…
Manish Sinha
  • 2,092
  • 2
  • 22
  • 33
4
votes
2 answers

In autotools, what is dnl'ed?

I see a lot in autoconf code about stuff being dnl'ed and not dnl'ed. What is dnl'ed?
Crazy Chenz
  • 12,650
  • 12
  • 50
  • 62
3
votes
2 answers

Is there a way to include a subset of lines from an included file using m4?

Is there a way to include a subset of lines from an included file when using m4? something along the lines of include(`source.cpp', 12-15)? I'm creating a markdown presentation using reveal.js and want to include code samples. In many cases I want…
MattiasL
  • 33
  • 5
3
votes
2 answers

Fixing m4 on MAC OS 10.14.5

I'm having an issue with pecl which is erring out saying phpize had failed. The problem ultimately seems to be with m4. Error is autom4te: need GNU m4 1.4 or later: /Applications/MAMP/Library/bin/m4 When I run "which m4" I get…
user3521590
  • 111
  • 3
  • 6
1
2
3
14 15