[svn-r28188] Fix inline/__inline__/__inline detection with CMake after autotools changes

This commit is contained in:
Jerome Soumagne 2015-10-22 11:23:01 -05:00
parent 37ed7e8b5f
commit 7791549252
3 changed files with 24 additions and 37 deletions

View File

@ -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

View File

@ -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
#-----------------------------------------------------------------------------

View File

@ -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 */