summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerome Soumagne <jsoumagne@hdfgroup.org>2015-10-22 16:23:01 (GMT)
committerJerome Soumagne <jsoumagne@hdfgroup.org>2015-10-22 16:23:01 (GMT)
commit779154925282f5240e792f9b2e5b242a91005abb (patch)
treecb0ffbc4e1fb999e65df191058df0d9bbaad5bfa
parent37ed7e8b5f3fc60a9816c84d1ed71c9ba50ade08 (diff)
downloadhdf5-779154925282f5240e792f9b2e5b242a91005abb.zip
hdf5-779154925282f5240e792f9b2e5b242a91005abb.tar.gz
hdf5-779154925282f5240e792f9b2e5b242a91005abb.tar.bz2
[svn-r28188] Fix inline/__inline__/__inline detection with CMake after autotools changes
-rw-r--r--config/cmake/H5pubconf.h.in15
-rw-r--r--config/cmake_ext_mod/ConfigureChecks.cmake26
-rw-r--r--config/cmake_ext_mod/HDFTests.c20
3 files changed, 24 insertions, 37 deletions
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index f01a9ff..5011b03 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -157,6 +157,9 @@
/* Define to 1 if you have the `gettimeofday' function. */
#cmakedefine H5_HAVE_GETTIMEOFDAY @H5_HAVE_GETTIMEOFDAY@
+/* Define if the compiler understands inline */
+#cmakedefine H5_HAVE_INLINE @H5_HAVE_INLINE@
+
/* Define if library will contain instrumentation to detect correct
optimization operation */
#cmakedefine H5_HAVE_INSTRUMENTED_LIBRARY @H5_HAVE_INSTRUMENTED_LIBRARY@
@@ -371,6 +374,12 @@
/* Define to 1 if you have the `_scrsize' function. */
#cmakedefine H5_HAVE__SCRSIZE @H5_HAVE__SCRSIZE@
+/* Define if the compiler understands __inline */
+#cmakedefine H5_HAVE___INLINE @H5_HAVE___INLINE@
+
+/* Define if the compiler understands __inline__ */
+#cmakedefine H5_HAVE___INLINE__ @H5_HAVE___INLINE__@
+
/* Define if HDF5's high-level library headers should be included in hdf5.h */
#cmakedefine H5_INCLUDE_HL @H5_INCLUDE_HL@
@@ -625,12 +634,6 @@
/* Define to empty if `const' does not conform to ANSI C. */
#cmakedefine H5_const
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
-#cmakedefine H5_inline @H5_inline@
-#endif
-
/* Define to `long int' if <sys/types.h> does not define. */
#cmakedefine H5_off_t
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index d41923e..fd502e5 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -141,10 +141,6 @@ MACRO (HDF_FUNCTION_TEST OTHER_TEST)
set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
endif (CMAKE_REQUIRED_LIBRARIES)
- foreach (def ${HDF_EXTRA_TEST_DEFINITIONS})
- set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}")
- endforeach (def)
-
foreach (def
HAVE_SYS_TIME_H
HAVE_UNISTD_H
@@ -570,10 +566,6 @@ MACRO (HDF_CXX_FUNCTION_TEST OTHER_TEST)
set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
endif (CMAKE_REQUIRED_LIBRARIES)
- foreach (def ${HDF_EXTRA_TEST_DEFINITIONS})
- set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}")
- endforeach (def)
-
foreach (def
HAVE_SYS_TIME_H
HAVE_UNISTD_H
@@ -696,25 +688,11 @@ endif (WINDOWS)
#-----------------------------------------------------------------------------
# Determine how 'inline' is used
#-----------------------------------------------------------------------------
-set (HDF_EXTRA_TEST_DEFINITIONS INLINE_TEST_INLINE)
foreach (inline_test inline __inline__ __inline)
- set (INLINE_TEST_INLINE ${inline_test})
- HDF_FUNCTION_TEST (INLINE_TEST_${inline_test})
+ string (TOUPPER ${inline_test} INLINE_TEST_MACRO)
+ HDF_FUNCTION_TEST (HAVE_${INLINE_TEST_MACRO})
endforeach (inline_test)
-set (HDF_EXTRA_TEST_DEFINITIONS)
-if (INLINE_TEST___inline__)
- set (${HDF_PREFIX}_inline __inline__)
-else (INLINE_TEST___inline__)
- if (INLINE_TEST___inline)
- set (${HDF_PREFIX}_inline __inline)
- else (INLINE_TEST___inline)
- if (INLINE_TEST_inline)
- set (${HDF_PREFIX}_inline inline)
- endif (INLINE_TEST_inline)
- endif (INLINE_TEST___inline)
-endif (INLINE_TEST___inline__)
-
#-----------------------------------------------------------------------------
# Check how to print a Long Long integer
#-----------------------------------------------------------------------------
diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c
index 5c4d360..8478d1b 100644
--- a/config/cmake_ext_mod/HDFTests.c
+++ b/config/cmake_ext_mod/HDFTests.c
@@ -454,13 +454,19 @@ SIMPLE_TEST(struct text_info w; w.screenwidth=0);
#endif /* HAVE_TM_GMTOFF */
-
-#if defined( INLINE_TEST_inline ) || defined( INLINE_TEST___inline__ ) || defined( INLINE_TEST___inline )
+#if defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE )
#ifndef __cplusplus
+#if defined( HAVE_INLINE )
+# define INLINE_KW inline
+#elif defined ( HAVE___INLINE__ )
+# define INLINE_KW __inline__
+#elif defined ( HAVE___INLINE )
+# define INLINE_KW __inline
+#endif /* HAVE_INLINE */
typedef int foo_t;
-static INLINE_TEST_INLINE foo_t static_foo () { return 0; }
-INLINE_TEST_INLINE foo_t foo () {return 0; }
-int main() { return 0; }
-#endif
+static INLINE_KW foo_t static_foo () { return 0; }
+INLINE_KW foo_t foo () {return 0; }
+int main(void) { return 0; }
+#endif /* __cplusplus */
+#endif /* defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE ) */
-#endif /* INLINE_TEST */