summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFumitoshi Ukai <fumitoshi.ukai@gmail.com>2015-08-06 07:53:55 (GMT)
committerFumitoshi Ukai <fumitoshi.ukai@gmail.com>2015-08-06 07:53:55 (GMT)
commitfe136448ff77395f270f84570131bb673340a3d7 (patch)
tree45637f26c739f426226b88352681f4a744ae3874 /src
parent454906f44b051554d6e11f63d60f0f092d4173d3 (diff)
parent8453b0856b4b35083820bf6e6abf5feb193b02c9 (diff)
downloadglog-fe136448ff77395f270f84570131bb673340a3d7.zip
glog-fe136448ff77395f270f84570131bb673340a3d7.tar.gz
glog-fe136448ff77395f270f84570131bb673340a3d7.tar.bz2
Merge pull request #7 from sergiud/master
Add CMake support. closes #4
Diffstat (limited to 'src')
-rw-r--r--src/config.h.cmake.in181
-rw-r--r--src/config.h.in9
-rw-r--r--src/demangle.h2
-rw-r--r--src/demangle_unittest.cc5
-rw-r--r--src/glog/logging.h.in25
-rw-r--r--src/googletest.h2
-rw-r--r--src/logging_unittest.cc1
-rw-r--r--src/signalhandler_unittest.cc5
-rw-r--r--src/stl_logging_unittest.cc9
-rw-r--r--src/symbolize_unittest.cc5
-rw-r--r--src/utilities_unittest.cc6
-rwxr-xr-xsrc/windows/port.cc2
-rwxr-xr-xsrc/windows/port.h8
13 files changed, 244 insertions, 16 deletions
diff --git a/src/config.h.cmake.in b/src/config.h.cmake.in
new file mode 100644
index 0000000..0094a09
--- /dev/null
+++ b/src/config.h.cmake.in
@@ -0,0 +1,181 @@
+/* define if glog doesn't use RTTI */
+#cmakedefine DISABLE_RTTI
+
+/* Namespace for Google classes */
+#cmakedefine GOOGLE_NAMESPACE ${GOOGLE_NAMESPACE}
+
+/* Define if you have the `dladdr' function */
+#cmakedefine HAVE_DLADDR
+
+/* Define if you have the `snprintf' function */
+#cmakedefine HAVE_SNPRINTF
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+#cmakedefine HAVE_EXECINFO_H
+
+/* Define if you have the `fcntl' function */
+#cmakedefine HAVE_FCNTL
+
+/* Define to 1 if you have the <glob.h> header file. */
+#cmakedefine HAVE_GLOB_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H}
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#cmakedefine HAVE_LIBPTHREAD
+
+/* Define to 1 if you have the <libunwind.h> header file. */
+#cmakedefine HAVE_LIBUNWIND_H
+
+/* define if you have google gflags library */
+#cmakedefine HAVE_LIB_GFLAGS
+
+/* define if you have google gmock library */
+#cmakedefine HAVE_LIB_GMOCK
+
+/* define if you have google gtest library */
+#cmakedefine HAVE_LIB_GTEST
+
+/* define if you have libunwind */
+#cmakedefine HAVE_LIB_UNWIND
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H
+
+/* define if the compiler implements namespaces */
+#cmakedefine HAVE_NAMESPACES
+
+/* Define if you have the 'pread' function */
+#cmakedefine HAVE_PREAD
+
+/* Define if you have POSIX threads libraries and header files. */
+#cmakedefine HAVE_PTHREAD
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#cmakedefine HAVE_PWD_H
+
+/* Define if you have the 'pwrite' function */
+#cmakedefine HAVE_PWRITE
+
+/* define if the compiler implements pthread_rwlock_* */
+#cmakedefine HAVE_RWLOCK
+
+/* Define if you have the 'sigaction' function */
+#cmakedefine HAVE_SIGACTION
+
+/* Define if you have the `sigaltstack' function */
+#cmakedefine HAVE_SIGALTSTACK
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H}
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H
+
+/* Define to 1 if you have the <syscall.h> header file. */
+#cmakedefine HAVE_SYSCALL_H
+
+/* Define to 1 if you have the <syslog.h> header file. */
+#cmakedefine HAVE_SYSLOG_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/syscall.h> header file. */
+#cmakedefine HAVE_SYS_SYSCALL_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#cmakedefine HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}
+
+/* Define to 1 if you have the <sys/ucontext.h> header file. */
+#cmakedefine HAVE_SYS_UCONTEXT_H
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#cmakedefine HAVE_SYS_UTSNAME_H
+
+/* Define to 1 if you have the <ucontext.h> header file. */
+#cmakedefine HAVE_UCONTEXT_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H}
+
+/* Define to 1 if you have the <unwind.h> header file. */
+#cmakedefine HAVE_UNWIND_H ${HAVE_UNWIND_H}
+
+/* define if the compiler supports using expression for operator */
+#cmakedefine HAVE_USING_OPERATOR
+
+/* define if your compiler has __attribute__ */
+#cmakedefine HAVE___ATTRIBUTE__
+
+/* define if your compiler has __builtin_expect */
+#cmakedefine HAVE___BUILTIN_EXPECT ${HAVE___BUILTIN_EXPECT}
+
+/* define if your compiler has __sync_val_compare_and_swap */
+#cmakedefine HAVE___SYNC_VAL_COMPARE_AND_SWAP
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#cmakedefine LT_OBJDIR
+
+/* Name of package */
+#cmakedefine PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#cmakedefine PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#cmakedefine PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#cmakedefine PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#cmakedefine PACKAGE_URL
+
+/* Define to the version of this package. */
+#cmakedefine PACKAGE_VERSION
+
+/* How to access the PC from a struct ucontext */
+#cmakedefine PC_FROM_UCONTEXT
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+ your system. */
+#cmakedefine PTHREAD_CREATE_JOINABLE
+
+/* The size of `void *', as computed by sizeof. */
+#cmakedefine SIZEOF_VOID_P ${SIZEOF_VOID_P}
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine STDC_HEADERS
+
+/* the namespace where STL code like vector<> is defined */
+#cmakedefine STL_NAMESPACE ${STL_NAMESPACE}
+
+/* location of source code */
+#cmakedefine TEST_SRC_DIR ${TEST_SRC_DIR}
+
+/* Version number of package */
+#cmakedefine VERSION
+
+/* Stops putting the code inside the Google namespace */
+#cmakedefine _END_GOOGLE_NAMESPACE_ ${_END_GOOGLE_NAMESPACE_}
+
+/* Puts following code inside the Google namespace */
+#cmakedefine _START_GOOGLE_NAMESPACE_ ${_START_GOOGLE_NAMESPACE_}
diff --git a/src/config.h.in b/src/config.h.in
index 8190f23..e41635a 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -178,3 +178,12 @@
/* Puts following code inside the Google namespace */
#undef _START_GOOGLE_NAMESPACE_
+
+// Annoying stuff for windows -- makes sure clients can import these functions
+#ifndef GOOGLE_GLOG_DLL_DECL
+# if defined(_WIN32) && !defined(__CYGWIN__)
+# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
+# else
+# define GOOGLE_GLOG_DLL_DECL
+# endif
+#endif
diff --git a/src/demangle.h b/src/demangle.h
index 9c75915..2653029 100644
--- a/src/demangle.h
+++ b/src/demangle.h
@@ -77,7 +77,7 @@ _START_GOOGLE_NAMESPACE_
// Demangle "mangled". On success, return true and write the
// demangled symbol name to "out". Otherwise, return false.
// "out" is modified even if demangling is unsuccessful.
-bool Demangle(const char *mangled, char *out, int out_size);
+bool GOOGLE_GLOG_DLL_DECL Demangle(const char *mangled, char *out, int out_size);
_END_GOOGLE_NAMESPACE_
diff --git a/src/demangle_unittest.cc b/src/demangle_unittest.cc
index 9d219e6..32f3221 100644
--- a/src/demangle_unittest.cc
+++ b/src/demangle_unittest.cc
@@ -41,6 +41,11 @@
#include "googletest.h"
#include "config.h"
+#ifdef HAVE_LIB_GFLAGS
+#include <gflags/gflags.h>
+using namespace GFLAGS_NAMESPACE;
+#endif
+
GLOG_DEFINE_bool(demangle_filter, false,
"Run demangle_unittest in filter mode");
diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in
index b4229d0..d1ac52b 100644
--- a/src/glog/logging.h.in
+++ b/src/glog/logging.h.in
@@ -48,14 +48,6 @@
#endif
#include <vector>
-// Annoying stuff for windows -- makes sure clients can import these functions
-#ifndef GOOGLE_GLOG_DLL_DECL
-# if defined(_WIN32) && !defined(__CYGWIN__)
-# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
-# else
-# define GOOGLE_GLOG_DLL_DECL
-# endif
-#endif
#if defined(_MSC_VER)
#define GLOG_MSVC_PUSH_DISABLE_WARNING(n) __pragma(warning(push)) \
__pragma(warning(disable:n))
@@ -65,6 +57,15 @@
#define GLOG_MSVC_POP_WARNING()
#endif
+// Annoying stuff for windows -- makes sure clients can import these functions
+#ifndef GOOGLE_GLOG_DLL_DECL
+# if defined(_WIN32) && !defined(__CYGWIN__)
+# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
+# else
+# define GOOGLE_GLOG_DLL_DECL
+# endif
+#endif
+
// We care a lot about number of bits things take up. Unfortunately,
// systems define their bit-specific ints in a lot of different ways.
// We use our own way, and have a typedef to get there.
@@ -1164,6 +1165,8 @@ public:
char* str() const { return pbase(); }
private:
+ LogStream(const LogStream&);
+ LogStream& operator=(const LogStream&);
base_logging::LogStreamBuf streambuf_;
int ctr_; // Counter hack (for the LOG_EVERY_X() macro)
LogStream *self_; // Consistency check hack
@@ -1231,7 +1234,7 @@ public:
void SendToSyslogAndLog(); // Actually dispatch to syslog and the logs
// Call abort() or similar to perform LOG(FATAL) crash.
- static void Fail() @ac_cv___attribute___noreturn@;
+ static void @ac_cv___attribute___noreturn@ Fail();
std::ostream& stream();
@@ -1279,7 +1282,7 @@ class GOOGLE_GLOG_DLL_DECL LogMessageFatal : public LogMessage {
public:
LogMessageFatal(const char* file, int line);
LogMessageFatal(const char* file, int line, const CheckOpString& result);
- ~LogMessageFatal() @ac_cv___attribute___noreturn@;
+ @ac_cv___attribute___noreturn@ ~LogMessageFatal();
};
// A non-macro interface to the log facility; (useful
@@ -1583,7 +1586,7 @@ class GOOGLE_GLOG_DLL_DECL NullStreamFatal : public NullStream {
NullStreamFatal() { }
NullStreamFatal(const char* file, int line, const CheckOpString& result) :
NullStream(file, line, result) { }
- @ac_cv___attribute___noreturn@ ~NullStreamFatal() { _exit(1); }
+ @ac_cv___attribute___noreturn@ ~NullStreamFatal() throw () { _exit(1); }
};
// Install a signal handler that will dump signal information and a stack
diff --git a/src/googletest.h b/src/googletest.h
index 2525bc3..b4677b2 100644
--- a/src/googletest.h
+++ b/src/googletest.h
@@ -81,7 +81,7 @@ static inline string GetTempDir() {
#endif
}
-#if defined(OS_WINDOWS) && defined(_MSC_VER)
+#if defined(OS_WINDOWS) && defined(_MSC_VER) && !defined(TEST_SRC_DIR)
// The test will run in glog/vsproject/<project name>
// (e.g., glog/vsproject/logging_unittest).
static const char TEST_SRC_DIR[] = "../..";
diff --git a/src/logging_unittest.cc b/src/logging_unittest.cc
index fa6afce..e180567 100644
--- a/src/logging_unittest.cc
+++ b/src/logging_unittest.cc
@@ -61,6 +61,7 @@ DECLARE_string(log_backtrace_at); // logging.cc
#ifdef HAVE_LIB_GFLAGS
#include <gflags/gflags.h>
+using namespace GFLAGS_NAMESPACE;
#endif
#ifdef HAVE_LIB_GMOCK
diff --git a/src/signalhandler_unittest.cc b/src/signalhandler_unittest.cc
index 1cd0fa0..8dae5f5 100644
--- a/src/signalhandler_unittest.cc
+++ b/src/signalhandler_unittest.cc
@@ -41,6 +41,11 @@
#include <string>
#include "glog/logging.h"
+#ifdef HAVE_LIB_GFLAGS
+#include <gflags/gflags.h>
+using namespace gflags;
+#endif
+
using namespace GOOGLE_NAMESPACE;
void* DieInThread(void*) {
diff --git a/src/stl_logging_unittest.cc b/src/stl_logging_unittest.cc
index 20f23b3..89fd6a1 100644
--- a/src/stl_logging_unittest.cc
+++ b/src/stl_logging_unittest.cc
@@ -31,6 +31,7 @@
#ifdef HAVE_USING_OPERATOR
+#include <functional>
#include <iostream>
#include <map>
#include <ostream>
@@ -41,11 +42,19 @@
// C++0x isn't enabled by default in GCC and libc++ does not have
// non-standard ext/* and tr1/unordered_*.
# if defined(_LIBCPP_VERSION)
+# ifndef GLOG_STL_LOGGING_FOR_UNORDERED
# define GLOG_STL_LOGGING_FOR_UNORDERED
+# endif
# else
+# ifndef GLOG_STL_LOGGING_FOR_EXT_HASH
# define GLOG_STL_LOGGING_FOR_EXT_HASH
+# endif
+# ifndef GLOG_STL_LOGGING_FOR_EXT_SLIST
# define GLOG_STL_LOGGING_FOR_EXT_SLIST
+# endif
+# ifndef GLOG_STL_LOGGING_FOR_TR1_UNORDERED
# define GLOG_STL_LOGGING_FOR_TR1_UNORDERED
+# endif
# endif
#endif
diff --git a/src/symbolize_unittest.cc b/src/symbolize_unittest.cc
index f25909d..05cb8a1 100644
--- a/src/symbolize_unittest.cc
+++ b/src/symbolize_unittest.cc
@@ -41,6 +41,11 @@
#include "googletest.h"
#include "config.h"
+#ifdef HAVE_LIB_GFLAGS
+#include <gflags/gflags.h>
+using namespace GFLAGS_NAMESPACE;
+#endif
+
using namespace std;
using namespace GOOGLE_NAMESPACE;
diff --git a/src/utilities_unittest.cc b/src/utilities_unittest.cc
index 7b79619..38e847d 100644
--- a/src/utilities_unittest.cc
+++ b/src/utilities_unittest.cc
@@ -28,11 +28,15 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: Shinichiro Hamaji
-
#include "utilities.h"
#include "googletest.h"
#include "glog/logging.h"
+#ifdef HAVE_LIB_GFLAGS
+#include <gflags/gflags.h>
+using namespace GFLAGS_NAMESPACE;
+#endif
+
using namespace GOOGLE_NAMESPACE;
TEST(utilities, sync_val_compare_and_swap) {
diff --git a/src/windows/port.cc b/src/windows/port.cc
index bfa6e70..d994325 100755
--- a/src/windows/port.cc
+++ b/src/windows/port.cc
@@ -55,6 +55,7 @@ int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
return _vsnprintf(str, size-1, format, ap);
}
+#ifndef HAVE_SNPRINTF
int snprintf(char *str, size_t size, const char *format, ...) {
va_list ap;
va_start(ap, format);
@@ -62,3 +63,4 @@ int snprintf(char *str, size_t size, const char *format, ...) {
va_end(ap);
return r;
}
+#endif
diff --git a/src/windows/port.h b/src/windows/port.h
index 24d7677..d78a185 100755
--- a/src/windows/port.h
+++ b/src/windows/port.h
@@ -111,12 +111,16 @@ enum { STDIN_FILENO = 0, STDOUT_FILENO = 1, STDERR_FILENO = 2 };
* because they don't always NUL-terminate. :-( We also can't use the
* name vsnprintf, since windows defines that (but not snprintf (!)).
*/
-extern int snprintf(char *str, size_t size,
+#ifndef HAVE_SNPRINTF
+extern int GOOGLE_GLOG_DLL_DECL snprintf(char *str, size_t size,
const char *format, ...);
-extern int safe_vsnprintf(char *str, size_t size,
+#endif
+extern int GOOGLE_GLOG_DLL_DECL safe_vsnprintf(char *str, size_t size,
const char *format, va_list ap);
#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap)
+#ifndef va_copy
#define va_copy(dst, src) (dst) = (src)
+#endif
/* Windows doesn't support specifying the number of buckets as a
* hash_map constructor arg, so we leave this blank.