Go through the really awkward dance required to delete the memory
allocated by setupterm. Without this, some folks are seeing leaked
memory whenever this routine is called more than once. Thanks to Craig
Topper for the report.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188615 91177308-0d34-0410-b5e6-96231b3b80d8
Update the sample project autoconf setup to include support for
detecting terminfo. Requested by Craig Topper, and probably should be
done much more systematically.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188616 91177308-0d34-0410-b5e6-96231b3b80d8
Add support for linking librt and using clock_gettime to the sample
autoconf setup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188617 91177308-0d34-0410-b5e6-96231b3b80d8
Port the detection of zlib from the main autoconf system to the sample
project's autoconf. This is the last of the missing optional checks used
by libSupport that seemed to be missing from the sample project, but
I could easily have missed some as this was done by inspection when
Craig asked me to add the terminfo support.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188618 91177308-0d34-0410-b5e6-96231b3b80d8