build: default to using -O2 for release builds

The -O3 optimization level can often lead to dangerous (and sometimes
incorrect) optimizations being performed.  So let's use a level that's
more stable.
Revert "build: don't download and extract tarball if source is already present"

This reverts commit 90658982644b76a9e8e4abfbcd16450df26b0a32.

It failed to work correctly on a fresh clone.  See #1433.
build: don't download and extract tarball if source is already present

When building under Homebrew, we want to let Homebrew manage
downloading and extracting the tarballs. See PR #1411.

Also make sure to skip only if directory is not empty. Fix #1433.
Merge pull request #1434 from xu-cheng/fix-1433

DownloadAndExtractFile.cmake: only skip if directory is not empty.
Merge pull request #1426 from jszakmeister/change-release-opt-default

build: default to using -O2 for release builds
move file IO functions from misc2.c to fileio.c