diff options
Diffstat (limited to 'autoconf/m4/pa_func_attribute_error.m4')
-rw-r--r-- | autoconf/m4/pa_func_attribute_error.m4 | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/autoconf/m4/pa_func_attribute_error.m4 b/autoconf/m4/pa_func_attribute_error.m4 new file mode 100644 index 00000000..5f87a3b2 --- /dev/null +++ b/autoconf/m4/pa_func_attribute_error.m4 @@ -0,0 +1,24 @@ +dnl -------------------------------------------------------------------------- +dnl PA_FUNC_ATTRIBUTE_ERROR +dnl +dnl See if this compiler supports __attribute__((error("foo"))) +dnl The generic version of this doesn't work as it makes the compiler +dnl throw an error by design. +dnl -------------------------------------------------------------------------- +AC_DEFUN([PA_FUNC_ATTRIBUTE_ERROR], +[AC_MSG_CHECKING([if $CC supports the error function attribute]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +AC_INCLUDES_DEFAULT +extern void __attribute__((error("message"))) barf(void); +void foo(void); +void foo(void) +{ + if (0) + barf(); +} + ])], + [AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_FUNC_ATTRIBUTE_ERROR], 1, + [Define to 1 if your compiler supports __attribute__((error)) on functions])], + [AC_MSG_RESULT([no])]) +]) |