X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=m4%2Fattribute.m4;fp=m4%2Fattribute.m4;h=58b8346723f1ba7bf7d25c02530da2579f703a4b;hp=0000000000000000000000000000000000000000;hb=da3078c63a3b658573f6e2f986f69ed4d7993b3a;hpb=d798b8b3d832f8c69769e08cfd64a4d8355faf0e diff --git a/m4/attribute.m4 b/m4/attribute.m4 new file mode 100644 index 00000000..58b83467 --- /dev/null +++ b/m4/attribute.m4 @@ -0,0 +1,25 @@ +dnl Check to find out whether function attributes are supported. +dnl If they are not, #define them to be nothing. + +AC_DEFUN(tinc_ATTRIBUTE, +[ + AC_CACHE_CHECK([for working $1 attribute], tinc_cv_attribute_$1, + [ + tempcflags="$CFLAGS" + CFLAGS="$CFLAGS -Wall -Werror" + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [void test(void) __attribute__ (($1)); + void test(void) { return; } + ], + )], + [tinc_cv_attribute_$1=yes], + [tinc_cv_attribute_$1=no] + ) + CFLAGS="$tempcflags" + ]) + + if test ${tinc_cv_attribute_$1} = no; then + AC_DEFINE([$1], [], [Defined if the $1 attribute is not supported.]) + fi +])