Changeset View
Changeset View
Standalone View
Standalone View
b/configure.ac
Context not available. | |||||
]) | ]) | ||||
LIBS=$gl_saved_libs | LIBS=$gl_saved_libs | ||||
AC_MSG_CHECKING([whether the sem_init created accessable semapore for child process]) | |||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <errno.h> | |||||
#include <semaphore.h> | |||||
#include <sys/wait.h> | |||||
static sem_t sceptre_buffer; | |||||
static sem_t *sceptre = &sceptre_buffer; | |||||
int main() | |||||
{ | |||||
int res; | |||||
// create semaphore | |||||
if(sem_init (sceptre, 0, 1)<0) { | |||||
return 1; | |||||
} | |||||
do { | |||||
// unlock | |||||
res = sem_wait (sceptre); | |||||
} while (res < 0 && errno == EINTR); | |||||
if(res) { | |||||
return 1; | |||||
} | |||||
pid_t pid; | |||||
pid = fork (); | |||||
if (pid == (pid_t)-1) | |||||
{ | |||||
return 1; | |||||
} | |||||
else if (pid) | |||||
{ | |||||
int status; | |||||
waitpid(-1,&status,0); | |||||
if(status) { | |||||
return 1; | |||||
} | |||||
} else { | |||||
// lock in child | |||||
if(sem_post (sceptre) != 0) | |||||
{ | |||||
return 1; | |||||
} | |||||
return 0; | |||||
} | |||||
return 0; | |||||
}]])], | |||||
[have_working_sem_init=yes], | |||||
[have_working_sem_init=no], | |||||
[ | |||||
changequote(,)dnl | |||||
case "$host_os" in | |||||
aix* ) have_working_sem_init=no ;; | |||||
*) have_working_sem_init=yes ;; | |||||
esac | |||||
changequote([,])dnl | |||||
]) | |||||
AC_MSG_RESULT($have_working_sem_init) | |||||
if test x"$have_working_sem_init" = xno ; then | |||||
AC_DEFINE(HAVE_BROKEN_SEM_INIT,1,[Define if sem_init can not create accessable semapore for child process.]) | |||||
fi | |||||
# | # | ||||
# Set NETLIBS | # Set NETLIBS | ||||
Context not available. |