summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-01-30 19:10:49 -0500
committerJakob Kaivo <jkk@ung.org>2019-01-30 19:10:49 -0500
commit6c33dd897be95bf1b7b43d70d9e5f7ab179f1ea2 (patch)
tree6e322b879ee575704cc5128c169b0ad1d66d0bca
parent1a9d7ed19bc9f80c0f704918ea74f084e8a522a0 (diff)
generate #if lines for headers
-rw-r--r--ftm.m423
1 files changed, 23 insertions, 0 deletions
diff --git a/ftm.m4 b/ftm.m4
new file mode 100644
index 00000000..5a6736da
--- /dev/null
+++ b/ftm.m4
@@ -0,0 +1,23 @@
+
+define(`STDC',
+ `ifelse($#, 2,
+ `ifelse($1, 1, `!defined __STDC_VERSION__ || __STDC_VERSION__ <= $2', `defined __STDC_VERSION__ && $1 <= __STDC_VERSION__ && __STDC_VERSION__ <= $2')',
+ `ifelse($1, 1, `', `defined __STDC_VERSION__ && $1 <= __STDC_VERSION__')')
+ ')
+
+define(`POSIX',
+ `ifelse($#, 2,
+ `ifelse($1, 1, `defined _POSIX_SOURCE && (!defined _POSIX_C_SOURCE || _POSIX_C_SOURCE <= $2)', `defined _POSIX_C_SOURCE && $1 <= _POSIX_C_SOURCE && _POSIX_C_SOURCE <= $2')',
+ `ifelse($1, 1, `defined _POSIX_SOURCE', `defined _POSIX_C_SOURCE && $1 <= _POSIX_C_SOURCE')')
+ ')
+
+define(`XEXT', `defined _XOPEN_SOURCE && ((defined _XOPEN_SOURCE_EXTENDED && _XOPEN_SOURCE_EXTENDED == 1) || 500 <= _XOPEN_SOURCE)')
+define(`XOPEN',
+ `ifelse($#, 2,
+ `ifelse($1, 4, `defined _XOPEN_SOURCE && _XOPEN_SOURCE <= $2',
+ `ifelse($1, 400, `XEXT() && _XOPEN_SOURCE <= $2',
+ `defined _XOPEN_SOURCE && $1 <= _XOPEN_SOURCE && _XOPEN_SOURCE <= $2')')',
+ `ifelse($1, 4, `defined _XOPEN_SOURCE',
+ `ifelse($1, 400, `XEXT())',
+ `defined _XOPEN_SOURCE && $1 <= _XOPEN_SOURCE')')')
+ ')