@@ -5,7 +5,7 @@ dnl All rights reserved.
55dnl Copyright (c) 2017 IBM Corporation. All rights reserved.
66dnl Copyright (c) 2017 Research Organization for Information Science
77dnl and Technology (RIST). All rights reserved.
8- dnl Copyright (c) 2017 Intel, Inc. All rights reserved.
8+ dnl Copyright (c) 2017-2020 Intel, Inc. All rights reserved.
99dnl $COPYRIGHT $
1010dnl
1111dnl Additional copyrights may follow
@@ -14,35 +14,61 @@ dnl $HEADER$
1414dnl
1515
1616AC_DEFUN([PMIX_CHECK_DSTOR_LOCK],[
17+
18+ PMIX_VAR_SCOPE_PUSH(orig_libs pmix_prefer_write_nonrecursive)
19+
1720 orig_libs= $LIBS
1821 LIBS= " -lpthread $LIBS "
1922
20- _x_ac_pthread_lock_found= " 0"
21- _x_ac_fcntl_lock_found= " 0"
23+ _x_ac_pthread_lock_found= 0
24+ _x_ac_fcntl_lock_found= 0
25+ pmix_prefer_write_nonrecursive= 0
2226
23- AC_CHECK_MEMBERS([struct flock.l_type],
24- [
25- AC_DEFINE([HAVE_FCNTL_FLOCK], [1],
26- [Define to 1 if you have the locking by fcntl.])
27- _x_ac_fcntl_lock_found=" 1"
28- ], [], [# include <fcntl.h>])
27+ AC_CHECK_MEMBER([struct flock.l_type],
28+ [pmix_fcntl_flock_happy= yes
29+ _x_ac_fcntl_lock_found= 1],
30+ [pmix_fcntl_flock_happy= no],
31+ [# include <fcntl.h>])
2932
3033 if test " $DSTORE_PTHREAD_LOCK " = " 1" ; then
34+
35+ AC_MSG_CHECKING([pthread_process_shared])
36+ AC_EGREP_CPP([yes],
37+ [# include <pthread.h>
38+ # ifdef PTHREAD_PROCESS_SHARED
39+ yes
40+ # endif
41+ ],
42+ [AC_MSG_RESULT(yes)
43+ pmix_pthread_process_shared= yes],
44+ [AC_MSG_RESULT(no)
45+ pmix_pthread_process_shared= no])
46+
3147 AC_CHECK_FUNC([pthread_rwlockattr_setkind_np],
32- [AC_EGREP_HEADER([PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP],
33- [pthread.h],[
34- AC_DEFINE([HAVE_PTHREAD_SETKIND], [1],
35- [Define to 1 if you have the ` pthread_rwlockattr_setkind_np` function.])])])
48+ [pmix_pthread_rwlockattr_setkind_np= yes
49+ AC_EGREP_CPP([yes],
50+ [# include <pthread.h>
51+ # ifdef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
52+ yes
53+ # endif
54+ ],
55+ [pmix_pthread_rwlock_prefer_writer_nonrecursive_np= yes],
56+ [pmix_pthread_rwlock_prefer_writer_nonrecursive_np= no])],
57+ [pmix_pthread_rwlockattr_setkind_np= no])
3658
3759 AC_CHECK_FUNC([pthread_rwlockattr_setpshared],
38- [AC_EGREP_HEADER([PTHREAD_PROCESS_SHARED],
39- [pthread.h],[
40- AC_DEFINE([HAVE_PTHREAD_SHARED], [1],
41- [Define to 1 if you have the ` PTHREAD_PROCESS_SHARED` definition.
42- ])
43- _x_ac_pthread_lock_found=" 1"
44- ])
45- ])
60+ [pmix_pthread_rwlockattr_setpshared= yes
61+ AS_IF([test " $pmix_pthread_process_shared " = " yes" ],
62+ [_x_ac_pthread_lock_found= 1]]),
63+ [pmix_pthread_rwlockattr_setpshared= no])
64+
65+ AC_CHECK_FUNC([pthread_mutexattr_setpshared],
66+ [pmix_pthread_mutexattr_setpshared= yes],
67+ [pmix_pthread_mutexattr_setpshared= no])
68+
69+ AS_IF([test " $pmix_pthread_rwlockattr_setkind_np " = " yes" && test " $pmix_pthread_rwlock_prefer_writer_nonrecursive_np " = " yes" ],
70+ [pmix_prefer_write_nonrecursive= 1],
71+ [pmix_prefer_write_nonrecursive= 0])
4672
4773 if test " $_x_ac_pthread_lock_found " = " 0" ; then
4874 if test " $_x_ac_fcntl_lock_found " = " 1" ; then
@@ -57,6 +83,12 @@ AC_DEFUN([PMIX_CHECK_DSTOR_LOCK],[
5783 fi
5884 fi
5985 LIBS= " $orig_libs "
86+
87+ AC_DEFINE_UNQUOTED([PMIX_PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP],
88+ [$pmix_prefer_write_nonrecursive ],
89+ [Whether or not we found the optional write_nonrecursive_np flag])
6090 AM_CONDITIONAL([HAVE_DSTORE_PTHREAD_LOCK], [test " $_x_ac_pthread_lock_found " = " 1" ])
6191 AM_CONDITIONAL([HAVE_DSTORE_FCNTL_LOCK], [test " $_x_ac_fcntl_lock_found " = " 1" ])
92+
93+ PMIX_VAR_SCOPE_POP
6294])
0 commit comments