diff options
-rw-r--r-- | autoconf/ast_gcc_attribute.m4 | 13 | ||||
-rwxr-xr-x | configure | 121 | ||||
-rw-r--r-- | configure.ac | 2 |
3 files changed, 110 insertions, 26 deletions
diff --git a/autoconf/ast_gcc_attribute.m4 b/autoconf/ast_gcc_attribute.m4 index 806b39019..f08b2545b 100644 --- a/autoconf/ast_gcc_attribute.m4 +++ b/autoconf/ast_gcc_attribute.m4 @@ -1,5 +1,5 @@ # Helper function to check for gcc attributes. -# AST_GCC_ATTRIBUTE([attribute name], [attribute syntax]) +# AST_GCC_ATTRIBUTE([attribute name], [attribute syntax], [attribute scope]) AC_DEFUN([AST_GCC_ATTRIBUTE], [ @@ -7,10 +7,17 @@ AC_MSG_CHECKING(for compiler 'attribute $1' support) saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" +if test "x$3" = "x" +then +attribute_scope="static" +else +attribute_scope="$3" +fi + if test "x$2" = "x" then AC_COMPILE_IFELSE( - AC_LANG_PROGRAM([static void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}], + AC_LANG_PROGRAM([$attribute_scope void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}], []), AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]), @@ -18,7 +25,7 @@ AC_COMPILE_IFELSE( ) else AC_COMPILE_IFELSE( - AC_LANG_PROGRAM([static void __attribute__(($2)) *test(void *muffin, ...) {return (void *) 0;}], + AC_LANG_PROGRAM([$attribute_scope void __attribute__(($2)) *test(void *muffin, ...) {return (void *) 0;}], []), AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]), @@ -17942,13 +17942,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then +attribute_scope="static" +else +attribute_scope="" +fi + +if test "x" = "x" +then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__((pure)) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__((pure)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -17999,7 +18006,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18056,13 +18063,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then +attribute_scope="static" +else +attribute_scope="" +fi + +if test "x" = "x" +then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__((malloc)) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__((malloc)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18113,7 +18127,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18170,13 +18184,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then +attribute_scope="static" +else +attribute_scope="" +fi + +if test "x" = "x" +then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__((const)) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__((const)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18227,7 +18248,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18284,13 +18305,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then +attribute_scope="static" +else +attribute_scope="" +fi + +if test "x" = "x" +then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__((unused)) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__((unused)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18341,7 +18369,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18398,13 +18426,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then +attribute_scope="static" +else +attribute_scope="" +fi + +if test "x" = "x" +then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__((always_inline)) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__((always_inline)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18455,7 +18490,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18512,13 +18547,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then +attribute_scope="static" +else +attribute_scope="" +fi + +if test "x" = "x" +then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__((deprecated)) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__((deprecated)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18569,7 +18611,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18626,13 +18668,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then +attribute_scope="static" +else +attribute_scope="" +fi + +if test "x" = "x" +then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__((sentinel)) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__((sentinel)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18683,7 +18732,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18740,13 +18789,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then +attribute_scope="static" +else +attribute_scope="" +fi + +if test "x" = "x" +then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__((warn_unused_result)) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__((warn_unused_result)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18797,7 +18853,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18854,13 +18910,20 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" if test "x" = "x" then +attribute_scope="static" +else +attribute_scope="" +fi + +if test "x" = "x" +then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__((weak)) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__((weak)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18911,7 +18974,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -18966,6 +19029,13 @@ $as_echo_n "checking for compiler 'attribute weak_import' support... " >&6; } saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" +if test "x""" = "x" +then +attribute_scope="static" +else +attribute_scope="""" +fi + if test "x" = "x" then cat >conftest.$ac_ext <<_ACEOF @@ -18974,7 +19044,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__((weak_import)) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__((weak_import)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -19025,7 +19095,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -19080,6 +19150,13 @@ $as_echo_n "checking for compiler 'attribute alias' support... " >&6; } saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wall -Wno-unused -Werror" +if test "x" = "x" +then +attribute_scope="static" +else +attribute_scope="" +fi + if test "xalias("foo")" = "x" then cat >conftest.$ac_ext <<_ACEOF @@ -19088,7 +19165,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__((alias)) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__((alias)) *test(void *muffin, ...) {return (void *) 0;} int main () { @@ -19139,7 +19216,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -static void __attribute__((alias("foo"))) *test(void *muffin, ...) {return (void *) 0;} +$attribute_scope void __attribute__((alias("foo"))) *test(void *muffin, ...) {return (void *) 0;} int main () { diff --git a/configure.ac b/configure.ac index a73d68b6c..8a8020dbc 100644 --- a/configure.ac +++ b/configure.ac @@ -513,7 +513,7 @@ AST_GCC_ATTRIBUTE(deprecated) AST_GCC_ATTRIBUTE(sentinel) AST_GCC_ATTRIBUTE(warn_unused_result) AST_GCC_ATTRIBUTE(weak) -AST_GCC_ATTRIBUTE(weak_import) +AST_GCC_ATTRIBUTE(weak_import, , "") AST_GCC_ATTRIBUTE(alias, [alias("foo")]) AC_MSG_CHECKING(for -ffunction-sections support) |