From 04f025dd5746fca83c6c32f1729b3449721dd60e Mon Sep 17 00:00:00 2001
From: shiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925>
Date: Tue, 2 Dec 2008 23:35:18 +0000
Subject: [PATCH] Fixes compatibility with Linux IA-64.  By Rainer
 Klaffenboeck.

---
 include/gtest/internal/gtest-port.h | 37 +++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 10 deletions(-)

diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h
index 2c1d17e3..f04d8465 100644
--- a/include/gtest/internal/gtest-port.h
+++ b/include/gtest/internal/gtest-port.h
@@ -40,22 +40,24 @@
 // control Google Test's behavior.  If the user doesn't define a macro
 // in this list, Google Test will define it.
 //
-//   GTEST_HAS_STD_STRING     - Define it to 1/0 to indicate that
-//                              std::string does/doesn't work (Google Test can
-//                              be used where std::string is unavailable).
+//   GTEST_HAS_CLONE          - Define it to 1/0 to indicate that clone(2)
+//                              is/isn't available.
 //   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string
 //                              is/isn't available (some systems define
 //                              ::string, which is different to std::string).
-//   GTEST_HAS_STD_WSTRING    - Define it to 1/0 to indicate that
-//                              std::wstring does/doesn't work (Google Test can
-//                              be used where std::wstring is unavailable).
 //   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
 //                              is/isn't available (some systems define
 //                              ::wstring, which is different to std::wstring).
-//   GTEST_HAS_RTTI           - Define it to 1/0 to indicate that RTTI is/isn't
-//                              enabled.
 //   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h>
 //                              is/isn't available.
+//   GTEST_HAS_RTTI           - Define it to 1/0 to indicate that RTTI is/isn't
+//                              enabled.
+//   GTEST_HAS_STD_STRING     - Define it to 1/0 to indicate that
+//                              std::string does/doesn't work (Google Test can
+//                              be used where std::string is unavailable).
+//   GTEST_HAS_STD_WSTRING    - Define it to 1/0 to indicate that
+//                              std::wstring does/doesn't work (Google Test can
+//                              be used where std::wstring is unavailable).
 //   GTEST_HAS_TR1_TUPLE 1    - Define it to 1/0 to indicate tr1::tuple
 //                              is/isn't available.
 
@@ -315,8 +317,23 @@
 #endif  // __GNUC__
 #endif  // GTEST_HAS_TR1_TUPLE
 
+// Determines whether clone(2) is supported.
+// Usually it will only be available on Linux, excluding
+// Linux on the Itanium architecture.
+// Also see http://linux.die.net/man/2/clone.
+#ifndef GTEST_HAS_CLONE
+// The user didn't tell us, so we need to figure it out.
+
+#if defined(GTEST_OS_LINUX) && !defined(__ia64__)
+#define GTEST_HAS_CLONE 1
+#else
+#define GTEST_HAS_CLONE 0
+#endif  // defined(GTEST_OS_LINUX) && !defined(__ia64__)
+
+#endif  // GTEST_HAS_CLONE
+
 // Determines whether to support death tests.
-#if GTEST_HAS_STD_STRING && defined(GTEST_OS_LINUX)
+#if GTEST_HAS_STD_STRING && GTEST_HAS_CLONE
 #define GTEST_HAS_DEATH_TEST
 // On some platforms, <regex.h> needs someone to define size_t, and
 // won't compile otherwise.  We can #include it here as we already
@@ -326,7 +343,7 @@
 #include <vector>
 #include <fcntl.h>
 #include <sys/mman.h>
-#endif  // GTEST_HAS_STD_STRING && defined(GTEST_OS_LINUX)
+#endif  // GTEST_HAS_STD_STRING && GTEST_HAS_CLONE
 
 // Determines whether to support value-parameterized tests.