Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
G
gflags
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
gflags
Commits
a4c4a01a
Commit
a4c4a01a
authored
Mar 15, 2014
by
Andreas Schuh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if pthread_rwlock_t is available and use it if so.
parent
8477f317
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
+9
-6
CMakeLists.txt
CMakeLists.txt
+5
-5
gflags_declare.h.in
src/gflags_declare.h.in
+3
-0
mutex.h
src/mutex.h
+1
-1
No files found.
CMakeLists.txt
View file @
a4c4a01a
...
...
@@ -60,11 +60,13 @@ endif ()
# ----------------------------------------------------------------------------
# system checks
include
(
CheckTypeSize
)
include
(
CheckIncludeFileCXX
)
include
(
CheckCxxSymbolExists
)
set
(
GFLAGS_INTTYPES_FORMAT
""
CACHE STRING
"Format of integer types:
\"
C99
\"
(uint32_t),
\"
BSD
\"
(u_int32_t),
\"
VC7
\"
(__int32)"
)
mark_as_advanced
(
GFLAGS_INTTYPES_FORMAT
)
if
(
NOT GFLAGS_INTTYPES_FORMAT
)
include
(
CheckTypeSize
)
foreach
(
type IN ITEMS uint32_t u_int32_t __int32
)
check_type_size
(
${
type
}
SIZE LANGUAGE CXX
)
if
(
SIZE
)
...
...
@@ -87,17 +89,14 @@ if (NOT GFLAGS_INTTYPES_FORMAT)
" Set GFLAGS_INTTYPES_FORMAT to either C99, BSD, or VC7 and try again."
)
endif
()
endif
()
set
(
"GFLAGS_INTTYPES_FORMAT_
${
GFLAGS_INTTYPES_FORMAT
}
"
TRUE
)
include
(
CheckIncludeFileCXX
)
foreach
(
fname IN ITEMS stdint sys/types fnmatch inttypes unistd sys/stat
)
string
(
TOUPPER
"
${
fname
}
"
FNAME
)
string
(
REGEX REPLACE
"/"
"_"
FNAME
"
${
FNAME
}
"
)
check_include_file_cxx
(
"
${
fname
}
.h"
GFLAGS_HAVE_
${
FNAME
}
_H
)
endforeach
()
include
(
CheckCxxSymbolExists
)
foreach
(
fname IN ITEMS strtoll strtoq
)
string
(
TOUPPER
"
${
fname
}
"
FNAME
)
check_cxx_symbol_exists
(
"
${
fname
}
"
stdlib.h GFLAGS_HAVE_
${
FNAME
}
)
...
...
@@ -107,6 +106,7 @@ set (CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package
(
ThreadsCxx
)
if
(
Threads_FOUND AND CMAKE_USE_PTHREADS_INIT
)
set
(
GFLAGS_HAVE_PTHREAD TRUE
)
check_type_size
(
pthread_rwlock_t GFLAGS_HAVE_RWLOCK LANGUAGE CXX
)
else
()
set
(
GFLAGS_HAVE_PTHREAD FALSE
)
endif
()
...
...
src/gflags_declare.h.in
View file @
a4c4a01a
...
...
@@ -126,6 +126,9 @@
// Define if you have the <pthread.h> header file.
#cmakedefine GFLAGS_HAVE_PTHREAD
// Define if your pthread library defines the type pthread_rwlock_t
#cmakedefine GFLAGS_HAVE_RWLOCK
// Backwards compatibility in case users defined these macros themselves
// or allow users to use these more general macros if the gflags library
// is build as part of a user project, e.g., included as Git submodule
...
...
src/mutex.h
View file @
a4c4a01a
...
...
@@ -129,7 +129,7 @@
typedef
CRITICAL_SECTION
MutexType
;
#elif defined(GFLAGS_HAVE_PTHREAD) && defined(GFLAGS_HAVE_RWLOCK)
// Needed for pthread_rwlock_*. If it causes problems, you could take it
// out, but then you'd have to unset
GFLAGS_
HAVE_RWLOCK (at least on linux -- it
// out, but then you'd have to unset HAVE_RWLOCK (at least on linux -- it
// *does* cause problems for FreeBSD, or MacOSX, but isn't needed
// for locking there.)
# ifdef __linux__
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment