diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2002-04-04 21:25:05 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2002-04-04 21:25:05 +0000 |
commit | 1e32785274394dbb790c9ad658bede60794954c7 (patch) | |
tree | a68ecf1fa729f68921db8d69d21d3ab27119d856 /configure.in | |
parent | 552c6c9ee4c74670e1b5d4fd8f98d5599bef64f5 (diff) | |
download | libapr-1e32785274394dbb790c9ad658bede60794954c7.tar.gz |
fix some typos in existing posixsem logic
make sure sem_open actually works before deciding that
we can use it; some popular levels of Linux have a stub
sem_open that returns ENOSYS
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63223 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/configure.in b/configure.in index 9484bd0b2..1551a1cc5 100644 --- a/configure.in +++ b/configure.in @@ -1241,7 +1241,29 @@ echo $ac_n "${nl}Checking for Locking...${nl}" AC_CHECK_FUNCS(semget semctl flock) APR_CHECK_FILE(/dev/zero) AC_CHECK_HEADERS(semaphore.h) -AC_CHECK_FUNCS(sem_open sem_close sem_unlink sem_post sem_wait) +AC_CHECK_FUNCS(sem_close sem_unlink sem_post sem_wait) + +dnl Some systems return ENOSYS from sem_open. +AC_CACHE_CHECK(for working sem_open,ac_cv_func_sem_open,[ +AC_TRY_RUN([ +#include <errno.h> +#include <stdlib.h> +#include <fcntl.h> +#include <semaphore.h> +main() +{ + sem_t *psem; + const char *sem_name = "/apr_autoconf"; + + psem = sem_open(sem_name, O_CREAT, 0644, 1); + if (psem == (sem_t *)SEM_FAILED) { + exit(1); + } + sem_close(psem); + sem_unlink(sem_name); + exit(0); +}], [ac_cv_func_sem_open=yes], [ac_cv_func_sem_open=no], +[ac_cv_func_sem_open=no])]) # It's stupid, but not all platforms have union semun, even those that need it. AC_MSG_CHECKING(for union semun in sys/sem.h) @@ -1328,8 +1350,8 @@ if test "$threads" = "1"; then fi # See which lock mechanisms we can support on this system. -APR_IFALLYES(header:semaphore.h func:sem_open func_sem_close dnl - func_sem_unlink func:sem_post func_sem_wait, +APR_IFALLYES(header:semaphore.h func:sem_open func:sem_close dnl + func_sem_unlink func:sem_post func:sem_wait, hasposixser="1", hasposixser="0") APR_IFALLYES(func:semget func:semctl define:SEM_UNDO, hassysvser="1", hassysvser="0") |