FreeBSD doesn't have SOCK_CLOEXEC.
build.sh: work with POSIX compliant shells.

Also unset CC for scan builds to avoid overwriting CMAKE_C_COMPILER.