#!/bin/sh ccopts="" cclibs="" rm -f hasgot.c while : ; do case "$1" in -i) echo "#include <$2>" >> hasgot.c; shift;; -l*) cclibs="$cclibs $1";; -*) ccopts="$ccopts $1";; *) break;; esac shift done (echo "main() {" for f in $*; do echo " $f();"; done echo "}") >> hasgot.c exec $cc $ccopts -o tst hasgot.c $cclibs > /dev/null 2>/dev/null