diff options
author | Chris Wilson <chris+github@qwirx.com> | 2016-09-03 00:07:23 +0100 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2016-09-03 00:07:23 +0100 |
commit | c0125ee22e09a31ae291e42faa817835bd903dbc (patch) | |
tree | aca37c831ef9897f1b4898cbf8d2bef36112c5af /lib/common | |
parent | 0560d351665313fcdd503af213118eec46930cbe (diff) |
Update platform feature detection to work with CMake.
Rewrite some macros in forms that can be parsed by our parser written in CMake
language (fake m4 with regexps).
Fix incorrect conditional includes and incorrect #if/#ifdef assumptions.
Diffstat (limited to 'lib/common')
-rw-r--r-- | lib/common/BoxConfig-MSVC.h | 9 | ||||
-rw-r--r-- | lib/common/BoxPlatform.h | 23 | ||||
-rw-r--r-- | lib/common/DebugMemLeakFinder.cpp | 12 | ||||
-rw-r--r-- | lib/common/ExcludeList.cpp | 4 | ||||
-rw-r--r-- | lib/common/Logging.cpp | 14 |
5 files changed, 30 insertions, 32 deletions
diff --git a/lib/common/BoxConfig-MSVC.h b/lib/common/BoxConfig-MSVC.h index 82ab4997..2ec2edd7 100644 --- a/lib/common/BoxConfig-MSVC.h +++ b/lib/common/BoxConfig-MSVC.h @@ -2,9 +2,6 @@ /* lib/common/BoxConfig.h.in. Generated from configure.ac by autoheader. */ /* Hacked by hand to work for MSVC by Chris Wilson */ -// using std::min/max -#define NOMINMAX - /* Define to major version for BDB_VERSION */ /* #undef BDB_VERSION_MAJOR */ @@ -389,9 +386,6 @@ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ -/* Define to `int' if <sys/types.h> doesn't define. */ -#define gid_t int - /* Define to `int' if <sys/types.h> does not define. */ /* #undef mode_t */ @@ -403,6 +397,3 @@ /* Define to `unsigned' if <sys/types.h> does not define. */ /* #undef size_t */ - -/* Define to `int' if <sys/types.h> doesn't define. */ -#define uid_t int diff --git a/lib/common/BoxPlatform.h b/lib/common/BoxPlatform.h index 35ad7a2c..f8720587 100644 --- a/lib/common/BoxPlatform.h +++ b/lib/common/BoxPlatform.h @@ -96,16 +96,19 @@ #endif // Handle differing xattr APIs -#ifdef HAVE_SYS_XATTR_H - #if !defined(HAVE_LLISTXATTR) && defined(HAVE_LISTXATTR) && HAVE_DECL_XATTR_NOFOLLOW - #define llistxattr(a,b,c) listxattr(a,b,c,XATTR_NOFOLLOW) - #endif - #if !defined(HAVE_LGETXATTR) && defined(HAVE_GETXATTR) && HAVE_DECL_XATTR_NOFOLLOW - #define lgetxattr(a,b,c,d) getxattr(a,b,c,d,0,XATTR_NOFOLLOW) - #endif - #if !defined(HAVE_LSETXATTR) && defined(HAVE_SETXATTR) && HAVE_DECL_XATTR_NOFOLLOW - #define lsetxattr(a,b,c,d,e) setxattr(a,b,c,d,0,(e)|XATTR_NOFOLLOW) - #endif +#if !defined(HAVE_LLISTXATTR) && defined(HAVE_LISTXATTR) && HAVE_DECL_XATTR_NOFOLLOW + #define llistxattr(a,b,c) listxattr(a,b,c,XATTR_NOFOLLOW) + #define HAVE_LLISTXATTR +#endif + +#if !defined(HAVE_LGETXATTR) && defined(HAVE_GETXATTR) && HAVE_DECL_XATTR_NOFOLLOW + #define lgetxattr(a,b,c,d) getxattr(a,b,c,d,0,XATTR_NOFOLLOW) + #define HAVE_LGETXATTR +#endif + +#if !defined(HAVE_LSETXATTR) && defined(HAVE_SETXATTR) && HAVE_DECL_XATTR_NOFOLLOW + #define lsetxattr(a,b,c,d,e) setxattr(a,b,c,d,0,(e)|XATTR_NOFOLLOW) + #define HAVE_LSETXATTR #endif #if !HAVE_DECL_INFTIM diff --git a/lib/common/DebugMemLeakFinder.cpp b/lib/common/DebugMemLeakFinder.cpp index 81e999c4..58a82c0e 100644 --- a/lib/common/DebugMemLeakFinder.cpp +++ b/lib/common/DebugMemLeakFinder.cpp @@ -15,15 +15,19 @@ #undef realloc #undef free -#ifdef HAVE_UNISTD_H - #include <unistd.h> -#endif - #include <limits.h> #include <signal.h> #include <stdio.h> #include <string.h> +#ifdef HAVE_PROCESS_H +# include <process.h> +#endif + +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif + #include <cstdlib> // for std::atexit #include <map> #include <set> diff --git a/lib/common/ExcludeList.cpp b/lib/common/ExcludeList.cpp index f101782a..4d964021 100644 --- a/lib/common/ExcludeList.cpp +++ b/lib/common/ExcludeList.cpp @@ -10,9 +10,9 @@ #include "Box.h" #ifdef HAVE_REGEX_SUPPORT - #ifdef HAVE_PCREPOSIX_H + #if defined HAVE_PCREPOSIX_H #include <pcreposix.h> - #else + #elif defined HAVE_REGEX_H #include <regex.h> #endif #define EXCLUDELIST_IMPLEMENTATION_REGEX_T_DEFINED diff --git a/lib/common/Logging.cpp b/lib/common/Logging.cpp index a0d1ec8c..0928a4d4 100644 --- a/lib/common/Logging.cpp +++ b/lib/common/Logging.cpp @@ -13,19 +13,19 @@ #include <time.h> #include <string.h> // for stderror -// c.f. http://bugs.debian.org/512510 -#include <cstdio> +#ifdef HAVE_PROCESS_H +# include <process.h> +#endif #ifdef HAVE_SYSLOG_H - #include <syslog.h> +# include <syslog.h> #endif + #ifdef HAVE_UNISTD_H - #include <unistd.h> -#endif -#ifdef WIN32 - #include <process.h> +# include <unistd.h> #endif +#include <cstdio> #include <cstring> #include <iomanip> |