]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: define STRERROR_R_CHAR_P for GNU-specific strerror_r 6751/head
authorIlya Dryomov <idryomov@gmail.com>
Tue, 1 Dec 2015 14:07:48 +0000 (15:07 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 1 Dec 2015 14:07:48 +0000 (15:07 +0100)
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 <idryomov@gmail.com>
CMakeLists.txt
src/include/config-h.in.cmake

index 1aff1ab9a315a983ead017deecb84353951d850f..cb41d3ea286bf5b0e583aad487ebba995e09fd61 100644 (file)
@@ -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 <string.h>
+  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)
index 65921c60250ce75f477306f77f2596eed1c7adef..1907a98ce9982f792417fcbd08f101274ac33aa1 100644 (file)
 /* Define to 1 if you have the <utime.h> 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