#!/bin/sh set -eu echo > config.mk compiles () { stage="$(mktemp -d)" echo "$2" > "$stage/test.c" (cc -Werror "$1" -o "$stage/test" "$stage/test.c" >/dev/null 2>&1) cc_success=$? rm -rf "$stage" return $cc_success } if compiles "-D_POSIX_C_SOURCE=200112L" " #include int main(void) { return (ssize_t)0; }" then echo "CFLAGS += -DHAVE_SSIZE_T" >> config.mk fi