From 53fc98d09198a2058aa933c8848921ecd211861f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 24 Mar 2007 02:36:52 +0000 Subject: Improve tests for visibility attribute support; Mach-O supports default visibility but not protected (as the default is actually kinda like protected), thanks to Matt Messier in bug #1686194 for pointing me at that. CVS patchset: 8744 CVS date: 2007/03/24 02:36:52 --- m4/attributes.m4 | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'm4') diff --git a/m4/attributes.m4 b/m4/attributes.m4 index 2d52cebc4..1901cc2c8 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -136,28 +136,23 @@ AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [ ]) AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [ - AC_REQUIRE([CC_CHECK_WERROR]) - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" - AC_CACHE_CHECK([if compiler supports __attribute__((visibility("...")))], - [cc_cv_attribute_visibility], - [AC_COMPILE_IFELSE([ - void __attribute__((visibility("internal"))) internal_function() { } - void __attribute__((visibility("hidden"))) hidden_function() { } - void __attribute__((visibility("default"))) external_function() { } - ], - [cc_cv_attribute_visibility=yes], - [cc_cv_attribute_visibility=no]) - ]) - CFLAGS="$ac_save_CFLAGS" - - if test "x$cc_cv_attribute_visibility" = "xyes"; then - AC_DEFINE([SUPPORT_ATTRIBUTE_VISIBILITY], 1, [Define this if the compiler supports the visibility attribute]) - $1 - else - true - $2 - fi + AC_REQUIRE([CC_CHECK_WERROR]) + AC_CACHE_CHECK([if $CC supports __attribute__((visibility("$1")))], + AS_TR_SH([cc_cv_attribute_visibility_$1]), + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + AC_COMPILE_IFELSE([void __attribute__((visibility("$1"))) $1_function() { }], + [eval "AS_TR_SH([cc_cv_attribute_visibility_$1])='yes'"], + [eval "AS_TR_SH([cc_cv_attribute_visibility_$1])='no'"]) + CFLAGS="$ac_save_CFLAGS" + ]) + + if eval test [x$]AS_TR_SH([cc_cv_attribute_visibility_$1]); then + AC_DEFINE(AS_TR_CPP([SUPPORT_ATTRIBUTE_VISIBILITY_$1]), 1, [Define this if the compiler supports __attribute__((visibility("$1")))]) + ifelse([$2], , [:], [$2]) + else + ifelse([$3], , [:], [$3]) + fi ]) AC_DEFUN([CC_FLAG_VISIBILITY], [ -- cgit v1.2.3