summaryrefslogtreecommitdiff
path: root/tools/gen-sysdepsh.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gen-sysdepsh.sh')
-rwxr-xr-xtools/gen-sysdepsh.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/gen-sysdepsh.sh b/tools/gen-sysdepsh.sh
new file mode 100755
index 0000000..f6194f2
--- /dev/null
+++ b/tools/gen-sysdepsh.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+cat <<EOF
+/* ISC license. */
+
+#ifndef SYSDEPS_H
+#define SYSDEPS_H
+
+#undef SKALIBS_TARGET
+#define SKALIBS_TARGET "$1"
+
+EOF
+
+while read k v ; do
+ k=$(echo "${k%%:}" | tr a-z A-Z)
+ if test ${k} != ${k##SIGNED} ; then
+ echo "#undef SKALIBS_HASUN$k"
+ echo "#undef SKALIBS_HAS$k"
+ if test $v = yes ; then
+ echo "#define SKALIBS_HAS$k"
+ else
+ echo "#define SKALIBS_HASUN$k"
+ fi
+ elif test ${k} != ${k##SIZEOF} ; then
+ echo "#undef SKALIBS_HAS$k"
+ echo "#define SKALIBS_HAS$k $v"
+ elif test ${k} = ENDIANNESS ; then
+ echo '#undef SKALIBS_ENDIANNESS'
+ echo "#define SKALIBS_ENDIANNESS $v"
+ else
+ echo "#undef SKALIBS_HAS$k"
+ if test $v = yes ; then
+ echo "#define SKALIBS_HAS$k"
+ fi
+ fi
+ echo
+done
+
+echo '#endif'