Build: Add a check for __attribute__((__always_inline__)).
All even remotely relevant GCC and Clang versions support this attribute. The test is useful to detect support in compilers that don't define __GNUC__ or __clang__, for example, Solaris Studio.
This commit is contained in:
parent
4a1ef58ae7
commit
34aa4725ed
|
@ -829,6 +829,10 @@ calculation if supported by the system" ON)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Check for __attribute__((__always_inline__)) support.
|
||||||
|
tuklib_check_func_attribute_always_inline(HAVE_FUNC_ATTRIBUTE_ALWAYS_INLINE)
|
||||||
|
tuklib_add_definition_if(liblzma HAVE_FUNC_ATTRIBUTE_ALWAYS_INLINE)
|
||||||
|
|
||||||
# Symbol visibility support:
|
# Symbol visibility support:
|
||||||
#
|
#
|
||||||
# The C_VISIBILITY_PRESET property takes care of adding the compiler
|
# The C_VISIBILITY_PRESET property takes care of adding the compiler
|
||||||
|
|
|
@ -39,6 +39,14 @@ function(tuklib_check_attribute CODE RESULT)
|
||||||
": unknown attribute")
|
": unknown attribute")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(tuklib_check_func_attribute_always_inline RESULT)
|
||||||
|
tuklib_check_attribute("
|
||||||
|
__attribute__((__always_inline__))
|
||||||
|
static inline int my_inline_func(int x) { return x + 1; }
|
||||||
|
void my_func(void) { return my_inline_func(123); }
|
||||||
|
" "${RESULT}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
function(tuklib_check_func_attribute_constructor RESULT)
|
function(tuklib_check_func_attribute_constructor RESULT)
|
||||||
tuklib_check_attribute("
|
tuklib_check_attribute("
|
||||||
__attribute__((__constructor__))
|
__attribute__((__constructor__))
|
||||||
|
|
|
@ -844,6 +844,11 @@ AC_ARG_ENABLE([ifunc], [AS_HELP_STRING([--disable-ifunc],
|
||||||
[], [enable_ifunc=yes])
|
[], [enable_ifunc=yes])
|
||||||
AS_IF([test "x$enable_ifunc" = xyes], [AX_GCC_FUNC_ATTRIBUTE([ifunc])])
|
AS_IF([test "x$enable_ifunc" = xyes], [AX_GCC_FUNC_ATTRIBUTE([ifunc])])
|
||||||
|
|
||||||
|
# GCC >= 3.2 and Clang support the attribute always_inline but a few other
|
||||||
|
# compilers support it too. So it's better to check for the support here
|
||||||
|
# instead of just checking if __GNUC__ or __clang__ is defined.
|
||||||
|
AX_GCC_FUNC_ATTRIBUTE([always_inline])
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
|
|
Loading…
Reference in New Issue