A bug fix for Windows: Use GetSystemTimeAsFileTime instead of GetSystemTime. SYSTEMTI...
[platform/upstream/glog.git] / m4 / ac_rwlock.m4
1 # TODO(csilvers): it would be better to actually try to link against
2 # -pthreads, to make sure it defines these methods, but that may be
3 # too hard, since pthread support is really tricky.
4
5 # Check for support for pthread_rwlock_init() etc.
6 # These aren't posix, but are widely supported.  To get them on linux,
7 # you need to define _XOPEN_SOURCE first, so this check assumes your
8 # application does that.
9 #
10 # Note: OS X (as of 6/1/06) seems to support pthread_rwlock, but
11 # doesn't define PTHREAD_RWLOCK_INITIALIZER.  Therefore, we don't test
12 # that particularly macro.  It's probably best if you don't use that
13 # macro in your code either.
14
15 AC_DEFUN([AC_RWLOCK],
16 [AC_CACHE_CHECK(support for pthread_rwlock_* functions,
17 ac_rwlock,
18 [AC_LANG_SAVE
19  AC_LANG_C
20  AC_TRY_COMPILE([#define _XOPEN_SOURCE 500
21                  #include <pthread.h>],
22                 [pthread_rwlock_t l; pthread_rwlock_init(&l, NULL);
23                  pthread_rwlock_rdlock(&l); 
24                  return 0;],
25                 ac_rwlock=yes, ac_rwlock=no)
26  AC_LANG_RESTORE
27 ])
28 if test "$ac_rwlock" = yes; then
29   AC_DEFINE(HAVE_RWLOCK,1,[define if the compiler implements pthread_rwlock_*])
30 fi
31 ])