summaryrefslogtreecommitdiff
path: root/configure.cmake
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-02-15 22:50:59 +0100
committerSergei Golubchik <serg@mariadb.org>2016-02-15 22:50:59 +0100
commit271fed41061e25faa47b7a28108cf101ebb3551d (patch)
tree733bf84d468a1d47c71c87cfcee33098a090e3c5 /configure.cmake
parentff26d93a8c25d667709180ad13a090309631990d (diff)
parente1385f2083f782d7064db3c0059fcca45bfcb2a4 (diff)
downloadmariadb-git-271fed41061e25faa47b7a28108cf101ebb3551d.tar.gz
Merge branch '5.5' into 10.0
Diffstat (limited to 'configure.cmake')
-rw-r--r--configure.cmake26
1 files changed, 23 insertions, 3 deletions
diff --git a/configure.cmake b/configure.cmake
index 76946c40f82..fed27862b86 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -790,16 +790,36 @@ ENDIF()
#
# Test for how the C compiler does inline, if at all
#
+# SunPro is weird, apparently it only supports inline at -xO3 or -xO4.
+# And if CMAKE_C_FLAGS has -xO4 but CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} has -xO2
+# then CHECK_C_SOURCE_COMPILES will succeed but the built will fail.
+# We must test all flags here.
+# XXX actually, we can do this for all compilers, not only SunPro
+IF (CMAKE_CXX_COMPILER_ID MATCHES "SunPro" AND
+ CMAKE_GENERATOR MATCHES "Makefiles")
+ STRING(TOUPPER "CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}" flags)
+ SET(CMAKE_REQUIRED_FLAGS "${${flags}}")
+ENDIF()
CHECK_C_SOURCE_COMPILES("
-static inline int foo(){return 0;}
+extern int bar(int x);
+static inline int foo(){return bar(1);}
int main(int argc, char *argv[]){return 0;}"
C_HAS_inline)
IF(NOT C_HAS_inline)
CHECK_C_SOURCE_COMPILES("
- static __inline int foo(){return 0;}
+ extern int bar(int x);
+ static __inline int foo(){return bar(1);}
int main(int argc, char *argv[]){return 0;}"
C_HAS___inline)
- SET(C_INLINE __inline)
+ IF(C_HAS___inline)
+ SET(C_INLINE __inline)
+ ElSE()
+ SET(C_INLINE)
+ MESSAGE(WARNING "C compiler does not support funcion inlining")
+ IF(NOT NOINLINE)
+ MESSAGE(FATAL_ERROR "Use -DNOINLINE=TRUE to allow compilation without inlining")
+ ENDIF()
+ ENDIF()
ENDIF()
IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)