# Use -Werror because some compilers accept unknown attributes and just
# give a warning. If it works this should give no warnings, even
# clang -Weverything should be fine.
-# dnl This doesn't need AC_LANG_SOURCE, minimal code is enough.
AC_MSG_CHECKING([if __attribute__((__constructor__)) can be used])
have_func_attribute_constructor=no
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
-AC_COMPILE_IFELSE([
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
__attribute__((__constructor__))
static void my_constructor_func(void) { return; }
-], [
+]])], [
AC_DEFINE([HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR], [1],
[Define to 1 if __attribute__((__constructor__))
is supported for functions.])
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_MSG_CHECKING([if __attribute__((__ifunc__())) can be used])
- AC_COMPILE_IFELSE([
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
static void func(void) { return; }
static void (*resolve_func (void)) (void) { return func; }
void func_ifunc (void)
__attribute__((__ifunc__("resolve_func")));
- ], [
+ ]])], [
AC_DEFINE([HAVE_FUNC_ATTRIBUTE_IFUNC], [1],
[Define to 1 if __attribute__((__ifunc__()))
is supported for functions.])