Fix style of HAVE_BROKEN_{POSIX_SEMAPHORES/PTHREAD_SIGMASK} cmakedefine

Also remove extra end-of-line space
Fix test associated with HAVE_EPOLL by checking for the correct function.
Fix POSIX_SEMAPHORES_NOT_ENABLED and HAVE_BROKEN_SEM_GETVALUE test

The double quote were not escaped and the check state was poped to early
which was preventing the threading library from being associated
with the test.
Tweak test associated with thread and set _REENTRANT when appropriate.