summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2018-10-16 20:01:52 -0700
committerMichael Forney <mforney@mforney.org>2018-10-18 12:58:46 -0700
commit96bcd25021135928929e629fb9d3a86571e11e26 (patch)
treedc763da0a4a311d461e95ae0d1a30c097d83e3c4 /scripts
parent171fc7752185f5a24293d995966999f06d23448b (diff)
Add mechanism to probe for size of type
Diffstat (limited to 'scripts')
-rw-r--r--scripts/probe-size.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/probe-size.sh b/scripts/probe-size.sh
new file mode 100644
index 00000000..eabfe3b9
--- /dev/null
+++ b/scripts/probe-size.sh
@@ -0,0 +1,13 @@
+set -e
+
+var=$1
+shift
+for size in 8 4 2 1 ; do
+ if "$@" -D "$var=$size" 2>/dev/null ; then
+ echo "#define $var $size"
+ exit 0
+ fi
+done
+
+printf "%s: could not determine %s\n" "$0" "$var" >&2
+exit 1