From: Ilya Dryomov Date: Tue, 1 Dec 2015 14:07:48 +0000 (+0100) Subject: cmake: define STRERROR_R_CHAR_P for GNU-specific strerror_r X-Git-Tag: v10.0.2~141^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F6751%2Fhead;p=ceph.git cmake: define STRERROR_R_CHAR_P for GNU-specific strerror_r This is what autotools does with AC_FUNC_STRERROR_R bit. It takes us from $ monmaptool --print nonexistant monmaptool: monmap file nonexistant monmaptool: couldn't open nonexistant: (2) to $ monmaptool --print nonexistant monmaptool: monmap file nonexistant monmaptool: couldn't open nonexistant: (2) No such file or directory on cmake - otherwise we end up using GNU-specific version as if it was the POSIX version. Signed-off-by: Ilya Dryomov --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1aff1ab9a315..cb41d3ea286b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,12 @@ CHECK_SYMBOL_EXISTS(__s64 "sys/types.h;linux/types.h" HAVE___S64) CHECK_SYMBOL_EXISTS(res_nquery "resolv.h" HAVE_RES_NQUERY) +include(CheckCXXSourceCompiles) +CHECK_CXX_SOURCE_COMPILES(" + #include + int main() { char x = *strerror_r(0, &x, sizeof(x)); return 0; } + " STRERROR_R_CHAR_P) + set(CEPH_MAN_DIR "share/man" CACHE STRING "Install location for man pages (relative to prefix).") option(ENABLE_SHARED "build shared libraries" ON) diff --git a/src/include/config-h.in.cmake b/src/include/config-h.in.cmake index 65921c60250c..1907a98ce998 100644 --- a/src/include/config-h.in.cmake +++ b/src/include/config-h.in.cmake @@ -176,6 +176,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_UTIME_H +/* Define to 1 if strerror_r returns char *. */ +#cmakedefine STRERROR_R_CHAR_P 1 + /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #cmakedefine LT_OBJDIR