summaryrefslogtreecommitdiff
path: root/m4macros
diff options
context:
space:
mode:
authorBrian J. Tarricone <brian@tarricone.org>2009-09-18 16:16:13 -0700
committerBrian J. Tarricone <brian@tarricone.org>2009-09-18 16:16:13 -0700
commit104a024b94ae87ee87aedefd21b140505220a2c4 (patch)
tree87a02a3b03d48b87f83b094bfb6f58ec76a1e311 /m4macros
parent806ee07598a912c3e92498e98c29b35d29ea65ac (diff)
downloadxfce4-dev-tools-104a024b94ae87ee87aedefd21b140505220a2c4.tar.gz
add XDT_FEATURE_VISIBILITY
Diffstat (limited to 'm4macros')
-rw-r--r--m4macros/xdt-features.m451
1 files changed, 51 insertions, 0 deletions
diff --git a/m4macros/xdt-features.m4 b/m4macros/xdt-features.m4
index 9a35926..c2d2cd5 100644
--- a/m4macros/xdt-features.m4
+++ b/m4macros/xdt-features.m4
@@ -109,6 +109,57 @@ AC_HELP_STRING([--disable-debug], [Include no debugging support [default]]),
])
+dnl XDT_FEATURE_VISIBILITY()
+dnl
+dnl Checks to see if the compiler supports the 'visibility' attribute
+dnl If so, adds -DHAVE_GNUC_VISIBILTY to CPPFLAGS. Also sets the
+dnl automake conditional HAVE_GNUC_VISIBILITY.
+dnl
+AC_DEFUN([XDT_FEATURE_VISIBILITY],
+[
+ AC_ARG_ENABLE([visibility],
+ AC_HELP_STRING([--disable-visibility],
+ [Don't use ELF visibility attributes]),
+ [], [enable_visibility=yes])
+ have_gnuc_visibility=no
+ if test "x$enable_visibility" != "xno"; then
+ XDT_SUPPORTED_FLAGS([xdt_vis_test_cflags], [-Wall -Werror -Wno-unused-parameter])
+ saved_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $xdt_vis_test_cflags"
+ AC_MSG_CHECKING([whether $CC supports the GNUC visibility attribute])
+ AC_COMPILE_IFELSE(AC_LANG_SOURCE(
+ [
+ void test_default (void);
+ void test_hidden (void);
+
+ void __attribute__ ((visibility("default"))) test_default (void) {}
+ void __attribute__ ((visibility("hidden"))) test_hidden (void) {}
+
+ int main (int argc, char **argv) {
+ test_default ();
+ test_hidden ();
+ return 0;
+ }
+ ]),
+ [
+ have_gnuc_visibility=yes
+ AC_MSG_RESULT([yes])
+ ],
+ [
+ AC_MSG_RESULT([no])
+ ])
+ CFLAGS="$saved_CFLAGS"
+ fi
+
+ if test "x$have_gnuc_visibility" = "xyes"; then
+ CPPFLAGS="$CPPFLAGS -DHAVE_GNUC_VISIBILITY"
+ XDT_SUPPORTED_FLAGS([xdt_vis_hidden_cflags], [-fvisibility=hidden])
+ CFLAGS="$CFLAGS $xdt_vis_hidden_cflags"
+ fi
+
+ AM_CONDITIONAL([HAVE_GNUC_VISIBILITY], [test "x$have_gnuc_visibility" = "xyes"])
+])
+
dnl BM_DEBUG_SUPPORT()
dnl