- configure.ac: Add -lpthread only if acx_pthread_ok is yes. In cygwin, we use Windows' thread so that we don't need -lpthread.
- base/mutex.h: Define NOMINMAX before we include windows.h.
- glog/*.h: Make sure that dllimport doesn't appear in cygwin. Note that windows.h may define _WIN32 macro.
- utilities.h: Define OS_CYGWIN.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@30
eb4d4688-79bd-11dd-afb4-
1d65580434c0
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-# To make libglog depend on libpthread on Linux, we need to add
-# -lpthread in addition to -pthread.
+if test x"$acx_pthread_ok" = x"yes"; then
+ # To make libglog depend on libpthread on Linux, we need to add
+ # -lpthread in addition to -pthread.
{ echo "$as_me:$LINENO: checking for pthread_self in -lpthread" >&5
echo $ECHO_N "checking for pthread_self in -lpthread... $ECHO_C" >&6; }
fi
+fi
# Check if there is google-gflags library installed.
{ echo "$as_me:$LINENO: checking for main in -lgflags" >&5
# Some of the code in this directory depends on pthreads
ACX_PTHREAD
-# To make libglog depend on libpthread on Linux, we need to add
-# -lpthread in addition to -pthread.
-AC_CHECK_LIB(pthread, pthread_self)
+if test x"$acx_pthread_ok" = x"yes"; then
+ # To make libglog depend on libpthread on Linux, we need to add
+ # -lpthread in addition to -pthread.
+ AC_CHECK_LIB(pthread, pthread_self)
+fi
# Check if there is google-gflags library installed.
AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=1, ac_cv_have_libgflags=0)
#elif defined(HAVE_PTHREAD)
# include <pthread.h>
typedef pthread_mutex_t MutexType;
-#elif defined(OS_WINDOWS)
+#elif defined(OS_WINDOWS) || defined(OS_CYGWIN)
# define WIN32_LEAN_AND_MEAN // We only need minimal includes
# ifdef GMUTEX_TRYLOCK
// We need Windows NT or later for TryEnterCriticalSection(). If you
# endif
// To avoid macro definition of ERROR.
# define NOGDI
+// To avoid macro definition of min/max.
+# define NOMINMAX
# include <windows.h>
typedef CRITICAL_SECTION MutexType;
#else
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
-# ifdef _WIN32
+# if defined(_WIN32) && !defined(__CYGWIN__)
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
-# ifdef _WIN32
+# if defined(_WIN32) && !defined(__CYGWIN__)
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
-# ifdef _WIN32
+# if defined(_WIN32) && !defined(__CYGWIN__)
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
-# ifdef _WIN32
+# if defined(_WIN32) && !defined(__CYGWIN__)
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
#endif
#define GOOGLETEST_H__
+#include "utilities.h"
+
#include <ctype.h>
#include <setjmp.h>
#include <time.h>
void Join() {
pthread_join(th_, NULL);
}
-#elif defined(OS_WINDOWS)
+#elif defined(OS_WINDOWS) || defined(OS_CYGWIN)
void Start() {
handle_ = CreateThread(NULL,
0,
return NULL;
}
- pthread_t th_;
-#ifdef OS_WINDOWS
+#if defined(OS_WINDOWS) || defined(OS_CYGWIN)
HANDLE handle_;
+ DWORD th_;
+#else
+ pthread_t th_;
#endif
};
#ifndef UTILITIES_H__
#define UTILITIES_H__
-#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) || defined(__CYGWIN32__)
+#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# define OS_WINDOWS
+#elif defined(__CYGWIN__) || defined(__CYGWIN32__)
+# define OS_CYGWIN
#elif defined(linux) || defined(__linux) || defined(__linux__)
# define OS_LINUX
#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
#include <string>
-#if defined(OS_WINDOWS) && !defined(__CYGWIN__)
+#if defined(OS_WINDOWS)
# include "port.h"
#endif