pthread: Add enough so that coreutils/src/sort.c compiles.
[gnulib.git] / m4 / pthread.m4
1 # pthread.m4
2 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 AC_DEFUN([gl_PTHREAD_CHECK],
8   [AC_CHECK_HEADERS_ONCE([pthread.h])
9
10    LIB_PTHREAD=
11    PTHREAD_H=
12    if test "$ac_cv_header_pthread_h" = yes; then
13      gl_saved_libs=$LIBS
14      AC_SEARCH_LIBS([pthread_create], [pthread],
15        [if test "$ac_cv_search_pthread_create" != "none required"; then
16           LIB_PTHREAD="$ac_cv_search_pthread_create"
17         fi])
18      LIBS="$gl_saved_libs"
19    else
20      AC_CHECK_TYPES([pthread_t])
21      PTHREAD_H='pthread.h'
22    fi
23
24    AC_SUBST([LIB_PTHREAD])
25    AC_SUBST([PTHREAD_H])
26
27    AC_REQUIRE([AC_C_INLINE])
28    AC_REQUIRE([AC_C_RESTRICT])
29 ])