-# Checking for pthreads
-pthread_arg="not_available"
-AC_MSG_CHECKING([which argument is required to compile pthreads])
-
-pthread_header="#include<pthread.h>"
-pthread_body="pthread_create(0,0,0,0)"
-# Check if compile with no extra argument
-AC_LINK_IFELSE([AC_LANG_PROGRAM($pthread_header, $pthread_body)],
-pthread_arg="")
-
-if test x"$pthread_arg" = x"not_available"; then
- # At first, only -pthread was tested, but this is the place
- # to add extra pthread flags if someone can test them
- bkp_LDFLAGS="$LDFLAGS"
- for altheader in -pthread; do
- LDFLAGS="$bkp_LDFLAGS $altheader"
- AC_LINK_IFELSE([AC_LANG_PROGRAM($pthread_header, $pthread_body)],
- pthread_arg="$altheader")
- LDFLAGS="$bkp_LDFLAGS"
- done
-fi
-
-if test x"$pthread_arg" = x"not_available"; then
- AC_MSG_FAILURE([Cannot find a proper pthread library])
-else
- if test x"$pthread_arg" = x; then
- AC_MSG_RESULT([none])
- else
- AC_MSG_RESULT([$pthread_arg])
- fi
- LDFLAGS="$LDFLAGS $pthread_arg"
-fi