Add missing semaphore related configure checks to set HAVE_SEM_* variables.

Thanks for @patmarion for reporting the issue.
Merge branch 'add-semaphore-related-configure-checks' into next

* add-semaphore-related-configure-checks:
  Add missing semaphore related configure checks to set HAVE_SEM_* variables.