summaryrefslogtreecommitdiff
path: root/scripts/probe-size.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/probe-size.sh')
-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