summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2014-05-23 15:28:55 +0000
committerXavier Roche <xroche@users.noreply.github.com>2014-05-23 15:28:55 +0000
commit6ba50a2001bcfa1b467f69985a002fc064d8c807 (patch)
tree286e3d8e4c7a3cd3b426563187a6c0f371c4538d /configure
parent9315f64b6e8b6c1d986d90ffa207008d29b45c06 (diff)
Added symbol visibility features to the build to hide internal symbols (GCC)
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure92
1 files changed, 92 insertions, 0 deletions
diff --git a/configure b/configure
index c108720..ebc1661 100755
--- a/configure
+++ b/configure
@@ -646,6 +646,9 @@ LFS_FLAG
V6_FLAG
OPENSSL_LIBS
HTTPS_SUPPORT
+AM_CFLAGS
+HAVE_VISIBILITY
+CFLAG_VISIBILITY
VERSION_INFO
DEFAULT_CFLAGS
LT_CV_OBJDIR
@@ -15317,6 +15320,95 @@ DEFAULT_CFLAGS="-Wall -Wcast-align -Wstrict-prototypes \
+### Check for -fvisibility=hidden support
+
+
+ CFLAG_VISIBILITY=
+ HAVE_VISIBILITY=0
+ if test -n "$GCC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5
+$as_echo_n "checking whether the -Werror option is usable... " >&6; }
+ if ${gl_cv_cc_vis_werror+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ gl_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gl_cv_cc_vis_werror=yes
+else
+ gl_cv_cc_vis_werror=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$gl_save_CFLAGS"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5
+$as_echo "$gl_cv_cc_vis_werror" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5
+$as_echo_n "checking for simple visibility declarations... " >&6; }
+ if ${gl_cv_cc_visibility+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ gl_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fvisibility=hidden"
+ if test $gl_cv_cc_vis_werror = yes; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+extern __attribute__((__visibility__("hidden"))) int hiddenvar;
+ extern __attribute__((__visibility__("default"))) int exportedvar;
+ extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
+ extern __attribute__((__visibility__("default"))) int exportedfunc (void);
+ void dummyfunc (void) {}
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gl_cv_cc_visibility=yes
+else
+ gl_cv_cc_visibility=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$gl_save_CFLAGS"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5
+$as_echo "$gl_cv_cc_visibility" >&6; }
+ if test $gl_cv_cc_visibility = yes; then
+ CFLAG_VISIBILITY="-fvisibility=hidden"
+ HAVE_VISIBILITY=1
+ fi
+ fi
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_VISIBILITY $HAVE_VISIBILITY
+_ACEOF
+
+
+AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"
+
+
### Check for platform
#case $host in
#AIX) AC_DEFINE(HTS_PLATFORM, 1, [Defined to build under AIX]);;