I am using ./configure to configure one of the projects. I get the following error from it.
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... no
checking whether pthreads work with -pthreads... no
checking whether pthreads work with -mthreads... no
checking for the pthreads library -lpthread... no
checking whether pthreads work with --thread-safe... no
checking whether pthreads work with -mt... no
checking for pthread-config... no
configure: error: POSIX threads support is required
When I check the configure file, I see that it is using the following code to check for pthread support:
#include <pthread.h>
int main ()
{
pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0);
;
return 0;
}
When I compile it seperately, it does compile. But with warnings from pthread_create.
test_pthread.c:5:22: warning: null argument where non-null required (argument 1) [-Wnonnull]
pthread_attr_init(0); pthread_cleanup_push(0, 0);
^
test_pthread.c:6:22: warning: null argument where non-null required (argument 1) [-Wnonnull]
pthread_create(0,0,0,0); pthread_cleanup_pop(0);
^
test_pthread.c:6:22: warning: null argument where non-null required (argument 3) [-Wnonnull]
Is this a bug in the way configure is checking for -pthread support with the compiler? How can I fix this?
I am using autoreconf -i before I run ./configure. What is a clean way to fix this issue?
------------ EDIT: Adding More Info ----------
I am using the following Lines in the configure.ac file to check for pthread. I just got it from a config online.
# Check for POSIX thread support
ACX_PTHREAD([
LIBS="$LIBS $PTHREAD_LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS -g -Wall"
CC="$PTHREAD_CC"
AC_SUBST([LIBS])
AC_SUBST([CFLAGS])
AC_SUBST([CC])
],
[AC_MSG_ERROR([POSIX threads support is required])])