tweak build checks

- avoids linking against libzmq when checking for sys/un.h
  when zmq is unspecified and unavailable.
- avoids creating temp files outside build dir with `has_function` checks.
Merge pull request #349 from minrk/checks

tweak build checks

- avoids linking against libzmq when checking for sys/un.h
 when zmq is unspecified and unavailable.
- avoids creating temp files outside build dir with `has_function` checks.