--- /dev/null
+#!/bin/sh
+
+if [ $# -lt 1 ]; then
+ echo "usage: sztest [-H HEADER] TYPE [CCFLAGS...]" >&2
+ exit 1
+fi
+
+headers=
+while [ "${1:0:1}" = "-" ]; do
+ opt="$1"
+ shift
+ case "$opt" in
+ "-H")
+ headers="$headers $1"
+ shift
+ ;;
+ esac
+done
+type="$1"
+shift
+file="$(mktemp /tmp/sztestXXXXXX)"
+cat >"$file.c" <<EOF
+#include <stdio.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/stat.h>
+EOF
+for header in $headers; do
+ echo "#include <$header>" >>"$file.c"
+done
+cat >>"$file.c" <<EOF
+int main(int argc, char **argv)
+{
+ printf("%zi\n", sizeof($type));
+ return(0);
+}
+EOF
+
+if ! gcc "$@" -g -Wall -o "$file" "$file.c"; then
+ rm -f "$file" "$file.c"
+ exit 1
+fi
+"$file"
+rm "$file" "$file.c"