[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdelibs/KDE/4.14] /: Fix HAVE_TRUNC cmake check
From:       Albert Astals Cid <aacid () kde ! org>
Date:       2016-10-19 12:48:57
Message-ID: E1bwqIj-0003lk-Kw () code ! kde ! org
[Download RAW message or body]

Git commit 0c642ae95dacf894e50630ffcc1961ad1e4e0322 by Albert Astals Cid.
Committed on 19/10/2016 at 12:44.
Pushed by aacid into branch 'KDE/4.14'.

Fix HAVE_TRUNC cmake check

On newer distros the check fails because trunc is ambiguous, so tell sizeof exactly \
which trunc we're speaking about.

REVIEW: 129119

M  +1    -1    ConfigureChecks.cmake
M  +8    -1    cmake/modules/CheckPrototypeExists.cmake

http://commits.kde.org/kdelibs/0c642ae95dacf894e50630ffcc1961ad1e4e0322

diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 2729adb..25c869e 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -244,7 +244,7 @@ check_prototype_exists(unsetenv stdlib.h            \
HAVE_UNSETENV_PROTO)  check_prototype_exists(usleep unistd.h              \
HAVE_USLEEP_PROTO)  check_prototype_exists(initgroups \
"unistd.h;sys/types.h;unistd.h;grp.h" HAVE_INITGROUPS_PROTO)  \
                check_prototype_exists(setreuid unistd.h            \
                HAVE_SETREUID_PROTO)
-check_prototype_exists(trunc math.h                 HAVE_TRUNC)
+check_prototype_exists(trunc math.h                 HAVE_TRUNC "(double \
(*)(double))")  
 # check for existing datatypes
 
diff --git a/cmake/modules/CheckPrototypeExists.cmake \
b/cmake/modules/CheckPrototypeExists.cmake index 811d648..7e0669e 100644
--- a/cmake/modules/CheckPrototypeExists.cmake
+++ b/cmake/modules/CheckPrototypeExists.cmake
@@ -21,6 +21,13 @@
 INCLUDE(CheckCXXSourceCompiles)
 
 MACRO (CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT)
+   SET(extra_macro_args ${ARGN})
+   LIST(LENGTH extra_macro_args num_extra_args)
+   SET(_PROTOTYPE "")
+   IF (${num_extra_args} EQUAL 1)
+      LIST(GET extra_macro_args 0 _PROTOTYPE)
+   ENDIF ()
+
    SET(_INCLUDE_FILES)
    FOREACH (it ${_HEADER})
       SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
@@ -31,7 +38,7 @@ ${_INCLUDE_FILES}
 int main()
 {
 #ifndef ${_SYMBOL}
-   int i = sizeof(&${_SYMBOL});
+   int i = sizeof(${_PROTOTYPE}&${_SYMBOL});
 #endif
   return 0;
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic