[PATCH libXfont 2/2] configure: Use -fvisibility=hidden if available

Adam Jackson ajax at redhat.com
Wed May 18 15:52:27 UTC 2016


   text	   data	    bss	    dec	    hex	filename
 233732	   8168	   1616	 243516	  3b73c	.libs/libXfont2.so.2.before
 217113	   6816	   1616	 225545	  37109	.libs/libXfont2.so.2.after

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 configure.ac | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/configure.ac b/configure.ac
index 13c8c97..062f75d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -217,6 +217,23 @@ case $host_os in
         OS_CFLAGS=
         ;;
 esac
+
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -fvisibility=hidden"
+CFLAGS_VISIBILITY=
+AC_COMPILE_IFELSE(
+  [AC_LANG_SOURCE([[
+    #if defined(__CYGWIN__) || defined(__MINGW32__)
+    #error No visibility support
+    #endif
+    extern __attribute__((__visibility__("default"))) int x;
+  ]])],
+  [CFLAGS_VISIBILITY=-fvisibility=hidden],
+  []
+)
+CFLAGS="$save_CFLAGS"
+OS_CFLAGS="$OS_CFLAGS $CFLAGS_VISIBILITY"
+
 AC_SUBST([OS_CFLAGS])
 
 AC_CONFIG_FILES([Makefile
-- 
2.7.4



More information about the xorg-devel mailing list