aboutsummaryrefslogtreecommitdiff
path: root/m4/ifdef
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-12-10 00:39:16 +0100
committerThomas Voss <mail@thomasvoss.com> 2023-12-10 00:39:37 +0100
commit03f8544691a8de9f77a803fd8cd2eeadb919ec03 (patch)
tree4d3431d678b892cb057af72a982ac73d313d60f9 /m4/ifdef
Genesis commit
Diffstat (limited to 'm4/ifdef')
-rw-r--r--m4/ifdef/ifdef.m419
1 files changed, 19 insertions, 0 deletions
diff --git a/m4/ifdef/ifdef.m4 b/m4/ifdef/ifdef.m4
new file mode 100644
index 0000000..3bc397e
--- /dev/null
+++ b/m4/ifdef/ifdef.m4
@@ -0,0 +1,19 @@
+m4_dnl Execute this file with ‘m4 -P ifdef.m4 -’
+m4_changequote([,])m4_dnl
+m4_dnl
+This file has an implementation of ‘__ifdef’ and ‘__endif’ macros. The two
+macros act like the ‘#ifdef’ and ‘#endif’ macros from cpp(1). The usage looks
+as follows:
+
+__ifdef(`foo')
+This is some text
+and some more text
+__ifdef(`bar')
+This is also some
+text on two lines
+__endif
+
+TODO: Add __elifdef()?
+
+m4_define([__endif], [m4_divert(0)m4_dnl])m4_dnl
+m4_define([__ifdef], [m4_ifdef([$1], [__endif], [m4_divert(-1)])])m4_dnl