From b813257b003fbf287623c943077a84e189cb4e85 Mon Sep 17 00:00:00 2001 From: "Dmitry E. Oboukhov" <unera@debian.org> Date: Sun, 8 Sep 2013 22:09:20 +0400 Subject: [PATCH] Fix build process on Debian/FreeBSD and BSD. * sys/prctl.h can be found only on Linux, but cmake recognizes Debian/kFreeBSD as Linux. * extern "C" for TIMEOUT_INFINITY (it is used in plugins) --- CMakeLists.txt | 1 + include/tarantool/config.h.cmake | 3 +++ src/tarantool.cc | 4 ++-- third_party/tarantool_ev.c | 8 ++++++++ third_party/tarantool_ev.h | 9 +++++++++ 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75e7850ea7..c3cbc93975 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,7 @@ check_symbol_exists(MAP_ANONYMOUS sys/mman.h HAVE_MAP_ANONYMOUS) check_include_file(sys/time.h HAVE_SYS_TIME_H) check_include_file(unwind.h HAVE_UNWIND_H) check_include_file(cpuid.h HAVE_CPUID_H) +check_include_file(sys/prctl.h HAVE_PRCTL_H) check_symbol_exists(O_DSYNC fcntl.h HAVE_O_DSYNC) check_function_exists(fdatasync HAVE_FDATASYNC) diff --git a/include/tarantool/config.h.cmake b/include/tarantool/config.h.cmake index d7d4bec5da..fd180127ad 100644 --- a/include/tarantool/config.h.cmake +++ b/include/tarantool/config.h.cmake @@ -97,6 +97,9 @@ #cmakedefine ENABLE_BUNDLED_LIBEIO 1 #cmakedefine ENABLE_BUNDLED_LIBCORO 1 + +#cmakedefine HAVE_PRCTL_H 1 + /* * predefined /etc directory prefix. */ diff --git a/src/tarantool.cc b/src/tarantool.cc index 8a14259d96..037dec3ba9 100644 --- a/src/tarantool.cc +++ b/src/tarantool.cc @@ -42,7 +42,7 @@ #include <getopt.h> #include <libgen.h> #include <sysexits.h> -#ifdef TARGET_OS_LINUX +#if defined(TARGET_OS_LINUX) && defined(HAVE_PRCTL_H) # include <sys/prctl.h> #endif #include <admin.h> @@ -800,7 +800,7 @@ main(int argc, char **argv) say_syserror("setrlimit"); exit(EX_OSERR); } -#ifdef TARGET_OS_LINUX +#if defined(TARGET_OS_LINUX) && defined(HAVE_PRCTL_H) if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0) { say_syserror("prctl"); exit(EX_OSERR); diff --git a/third_party/tarantool_ev.c b/third_party/tarantool_ev.c index 763de0292e..b004bf19f3 100644 --- a/third_party/tarantool_ev.c +++ b/third_party/tarantool_ev.c @@ -30,4 +30,12 @@ #include "tarantool_ev.h" #include "third_party/libev/ev.c" +#if defined(__cplusplus) +extern "C" { +#endif /* defined(__cplusplus) */ + const ev_tstamp TIMEOUT_INFINITY = 365*86400*100.0; + +#if defined(__cplusplus) +} /* extern "C" */ +#endif /* defined(__cplusplus) */ diff --git a/third_party/tarantool_ev.h b/third_party/tarantool_ev.h index ee9b6a37a2..e48e0bd1ff 100644 --- a/third_party/tarantool_ev.h +++ b/third_party/tarantool_ev.h @@ -52,6 +52,15 @@ #else /* !defined(ENABLE_BUNDLED_LIBEV) */ #include <ev.h> #endif + +#if defined(__cplusplus) +extern "C" { +#endif /* defined(__cplusplus) */ + extern const ev_tstamp TIMEOUT_INFINITY; +#if defined(__cplusplus) +} /* extern "C" */ +#endif /* defined(__cplusplus) */ + #endif /* TARANTOOL_EV_H_INCLUDED */ -- GitLab