summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2016-05-18 11:52:27 -0400
committerAdam Jackson <ajax@redhat.com>2016-06-08 14:03:36 -0400
commit7557fe152d9948bcb4b805bb7b6b6f8121bd34fb (patch)
tree154f38c1d1cb83bbfd019bae7508a9817ca23863
parent6972ea08ee5b2ef1cfbdc2fcaf14f06bbd391561 (diff)
configure: Use -fvisibility=hidden if available
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@redhat.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
-rw-r--r--configure.ac17
1 files changed, 17 insertions, 0 deletions
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