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
19
votes
7 answers

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…
Joachim W
  • 7,290
  • 5
  • 31
  • 59
17
votes
3 answers

What is the best way to automatically transpose a LilyPond source file into multiple keys?

problem I'm using LilyPond to typeset sheet music for a church choir to perform. Depending on who is available on any given week, songs will be played in various keys. We have an amazing pianist who can play anything we throw at her and the…
Michael Steele
  • 15,512
  • 2
  • 23
  • 24
15
votes
3 answers

How do I escape text in autoconf/m4?

The following code from my configuration.ac file does not work (note the nested square brackets with [default=no]): AC_ARG_ENABLE(debug, [ --enable-debug build with debugging support [default=no].], [DEBUG="$enableval"], …
user278429
  • 391
  • 2
  • 6
14
votes
4 answers

No usable M4 in $PATH or /usr5bin

As part of a long, sordid story whose end goal is simply to get GMP installed for use with code::blocks in Windows, I am trying to configure gmp. I do this with the following command: ./configure --prefix=${gmp_install} Everything starts out well…
AndroidDev
  • 20,466
  • 42
  • 148
  • 239
12
votes
4 answers

Remove trailing newline from esyscmd in m4

I'm using m4 to create some basic macros and I realize that when using esyscmd there's a trailing new line added to a string when the command is run. Example: define(MY_HOSTNAME, esyscmd(`hostname')) MY_HOSTNAME Some other text... Renders: >…
Dan
  • 3,389
  • 5
  • 34
  • 44
10
votes
1 answer

My custom selinux policies seem to be ignored by android system

I have some trouble on getting custom selinux policies running properly on an AOSP based Android 7.1.2 (more precisely based on sony open devices tree). My problem is that the audit logs keep telling me about missing file access rules that I…
nexus
  • 236
  • 2
  • 10
10
votes
1 answer

GNU m4: escaping backticks (`)

A simple GNU m4 question, but I cannot find the correct answer. I'd like to print a markdown header starting/ending a code section: ``` echo Hello ``` How do I create a GNU M4 macro containing the 3 backticks ? something…
Pierre
  • 34,472
  • 31
  • 113
  • 192
9
votes
9 answers

Are there noteworthy uses of m4 besides autoconf?

Does someone know of any uses of m4 besides autoconf (preferably in a c or c++ environment) that is more than just an academic excerise, because it helped solve a problem that would otherwise (for example with a 'standard' preprocessor) have been…
René Nyffenegger
  • 39,402
  • 33
  • 158
  • 293
8
votes
5 answers

Approaches to implement macro definitions in html

I would be great doing things like

#1

  • #2
  • #3
and then use it: I regard macros as really big advantage. A work-around…
cibercitizen1
  • 20,944
  • 16
  • 72
  • 95
7
votes
1 answer

How to detect if a m4 macro exists / can be called

we're developing a software package that uses autotools (autoconf 2.69 and automake 1.13.3 to be precise). This package needs wxwidgets and this library provides its own m4 file to allow testing the installation of wxwidgets in the final…
Harald
  • 3,110
  • 1
  • 24
  • 35
6
votes
5 answers

aclocal/autoconf reports missing m4sugar.m4 on Mac OS X?

I have Xcode 3.2 installed into /Xcode3.2, and did not install anything into /Developer. When I wish to do development, I start up a shell as follows alias sysroot='PATH=${PATH}:${XCODE}/usr/bin CFLAGS=--sysroot\ ${SDK_ROOT} CXXFLAGS=--sysroot\…
Nathan Herring
  • 977
  • 8
  • 16
6
votes
2 answers

How to insert Git-based version in autoconf-managed project?

How can I assign a dynamic, git-based version number to an autoconf project? Autoconf requires a static string argument to AC_INIT([Title],[version],[name]) AC_INIT documentation says that one can use M4 to supply a shell-based version. M4 is…
Charlie Zender
  • 5,929
  • 14
  • 19
6
votes
2 answers

autoconf: should I always use AS_IF over if and m4_if?

The autoconf manual suggest using AS_IF instead of if, but it doesn't mention m4_if. Should AS_IF also be preferred over m4_if? The "Limitations of Builtins" section of the manual says to use AS_IF for it's portability, but the AC_REQUIRE…
tprk77
  • 1,151
  • 1
  • 9
  • 22
6
votes
2 answers

GNU-M4: Strip empty lines

How can I strip empty lines (surplus empy lines) from an input file using M4? I know I can append dnl to the end of each line of my script to suppress the newline output, but the blank lines I mean are not in my script, but in a data file that is…
j4x
  • 3,595
  • 3
  • 33
  • 64
5
votes
1 answer

Automatically escaping slashes in m4 for shell commands

I'm writing macros with m4 to easily embed math in HTML code. Slashes need to be escaped and I want to automate this process but I have not yet figured out a good way. Running m4 on the following shows the problem: define(`_imath', `esyscmd(`echo "$…
Ben Trettel
  • 191
  • 7
1
2 3
14 15