source: trunk/m4/pthread_condattr.m4 @ 704

Revision 508, 1.5 KB checked in by dcarter, 4 years ago (diff)

Merge 0.7 development branch

Line 
1# Copyright (c) 2005-2008 David Carter <dcarter@arm4.org> and others.
2# All rights reserved.   This program and the accompanying materials
3# are made available under the terms of the Eclipse Public License v1.0
4# which accompanies this distribution, and is available at
5# http://www.eclipse.org/legal/epl-v10.html
6
7# Macros to check wether pthread mutexes can be used across processes
8
9AC_DEFUN([ARM4_PTHREAD_CONDATTR_PROCESS],
10[
11  pthread_mutex_ok="no"
12  no_pthread=""
13  AC_MSG_CHECKING(for POSIX mutex condattr setpshared support)
14  ac_save_LIBS="$LIBS"
15  LIBS="$LIBS -lpthread"
16  AC_RUN_IFELSE([
17#include <stdio.h>
18#include <pthread.h>
19
20int main (void)
21{
22  pthread_condattr_t mattr;
23  int shared;
24       
25  /* Sequence semaphore */
26  pthread_condattr_init (&mattr);
27  if (pthread_condattr_setpshared (&mattr, PTHREAD_PROCESS_SHARED) != 0)
28  {
29    /* Function is not supported */
30    exit (1);
31  }
32
33  /* Get the shared setting to ensure it's correct */
34  if (pthread_condattr_getpshared (&mattr, &shared) != 0)
35  {
36    /* Function is not supported */
37    exit (1);
38  }
39
40  if (shared == PTHREAD_PROCESS_SHARED)
41  {
42    /* Supported! */
43    exit (0);
44  }
45
46  /* Not supported */
47  exit (1);
48}
49],, no_pthread=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
50  LIBS="$ac_save_libs"
51  if test "x$no_pthread" = x ; then
52    pthread_mutex_ok="yes"
53    AC_DEFINE(HAVE_PTHREAD_CONDATTR_SETPSHARED, 1,
54      [Define wether the pthread_condattr_setpshared is implemented on this platform])
55  fi
56  AC_MSG_RESULT($pthread_mutex_ok)
57])
58
Note: See TracBrowser for help on using the repository browser.