summaryrefslogtreecommitdiff
path: root/m4/curl-compilers.m4
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2012-04-11 19:33:54 +0200
committerYang Tse <yangsita@gmail.com>2012-04-11 19:33:54 +0200
commit9e24b9c7afbcb81120af4cf3f6cdee49a06d8224 (patch)
tree0c671c32f59daa6848636e7f34c6071ed2bcae37 /m4/curl-compilers.m4
parenta144bb8b767b1c9ae40a0e7853db88ed67c9e8c3 (diff)
downloadcurl-9e24b9c7afbcb81120af4cf3f6cdee49a06d8224.tar.gz
build adjustments: CURL_HIDDEN_SYMBOLS no longer defined in config files
configure script now provides conditional definitions for Makefile.am that result in CURL_HIDDEN_SYMBOLS being defined by resulting makefiles when appropriate. Additionally, configure script option for symbol hiding control is now named --enable-symbol-hiding --disable-symbol-hiding. While still valid, old option name --enable-hidden-symbols --disable-hidden-symbols will be deprecated in some future release.
Diffstat (limited to 'm4/curl-compilers.m4')
-rw-r--r--m4/curl-compilers.m4112
1 files changed, 110 insertions, 2 deletions
diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4
index c0f18c897..9b212e462 100644
--- a/m4/curl-compilers.m4
+++ b/m4/curl-compilers.m4
@@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
-# Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
@@ -21,7 +21,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 58
+# serial 59
dnl CURL_CHECK_COMPILER
@@ -1375,6 +1375,114 @@ AC_DEFUN([CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE], [
])
+dnl CURL_CHECK_COMPILER_SYMBOL_HIDING
+dnl -------------------------------------------------
+dnl Verify if compiler supports hiding library internal symbols, setting
+dnl shell variable supports_symbol_hiding value as appropriate, as well as
+dnl variables symbol_hiding_CFLAGS and symbol_hiding_EXTERN when supported.
+
+AC_DEFUN([CURL_CHECK_COMPILER_SYMBOL_HIDING], [
+ AC_REQUIRE([CURL_CHECK_COMPILER])dnl
+ AC_BEFORE([$0],[CURL_CONFIGURE_SYMBOL_HIDING])dnl
+ AC_MSG_CHECKING([if compiler supports hiding library internal symbols])
+ supports_symbol_hiding="no"
+ symbol_hiding_CFLAGS=""
+ symbol_hiding_EXTERN=""
+ tmp_CFLAGS=""
+ tmp_EXTERN=""
+ case "$compiler_id" in
+ CLANG)
+ dnl All versions of clang support -fvisibility=
+ tmp_EXTERN="__attribute__ ((visibility (\"default\")))"
+ tmp_CFLAGS="-fvisibility=hidden"
+ supports_symbol_hiding="yes"
+ ;;
+ GNU_C)
+ dnl Only gcc 3.4 or later
+ if test "$compiler_num" -ge "304"; then
+ if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
+ tmp_EXTERN="__attribute__ ((visibility (\"default\")))"
+ tmp_CFLAGS="-fvisibility=hidden"
+ supports_symbol_hiding="yes"
+ fi
+ fi
+ ;;
+ INTEL_UNIX_C)
+ dnl Only icc 9.0 or later
+ if test "$compiler_num" -ge "900"; then
+ if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
+ tmp_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fvisibility=hidden"
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[
+# include <stdio.h>
+ ]],[[
+ printf("icc fvisibility bug test");
+ ]])
+ ],[
+ tmp_EXTERN="__attribute__ ((visibility (\"default\")))"
+ tmp_CFLAGS="-fvisibility=hidden"
+ supports_symbol_hiding="yes"
+ ])
+ CFLAGS="$tmp_save_CFLAGS"
+ fi
+ fi
+ ;;
+ SUNPRO_C)
+ if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
+ tmp_EXTERN="__global"
+ tmp_CFLAGS="-xldscope=hidden"
+ supports_symbol_hiding="yes"
+ fi
+ ;;
+ esac
+ if test "$supports_symbol_hiding" = "yes"; then
+ tmp_save_CFLAGS="$CFLAGS"
+ CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
+ squeeze CFLAGS
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $tmp_EXTERN char *dummy(char *buff);
+ char *dummy(char *buff)
+ {
+ if(buff)
+ return ++buff;
+ else
+ return buff;
+ }
+ ]],[[
+ char b[16];
+ char *r = dummy(&b[0]);
+ if(r)
+ return (int)*r;
+ ]])
+ ],[
+ supports_symbol_hiding="yes"
+ if test -f conftest.err; then
+ grep 'visibility' conftest.err >/dev/null
+ if test "$?" -eq "0"; then
+ supports_symbol_hiding="no"
+ fi
+ fi
+ ],[
+ supports_symbol_hiding="no"
+ echo " " >&6
+ sed 's/^/cc-src: /' conftest.$ac_ext >&6
+ sed 's/^/cc-err: /' conftest.err >&6
+ echo " " >&6
+ ])
+ CFLAGS="$tmp_save_CFLAGS"
+ fi
+ if test "$supports_symbol_hiding" = "yes"; then
+ AC_MSG_RESULT([yes])
+ symbol_hiding_CFLAGS="$tmp_CFLAGS"
+ symbol_hiding_EXTERN="$tmp_EXTERN"
+ else
+ AC_MSG_RESULT([no])
+ fi
+])
+
+
dnl CURL_VAR_MATCH (VARNAME, VALUE)
dnl -------------------------------------------------
dnl Verifies if shell variable VARNAME contains VALUE.