diff options
author | nijtmans <nijtmans> | 2010-03-02 23:39:33 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-03-02 23:39:33 (GMT) |
commit | 618503676d9bd1174c263775d6a2aeef4a838ae1 (patch) | |
tree | 096796c0784d9508574b1e81e36e8f34a595a4bf /unix | |
parent | f73c7daa07ce0b9759ce82a413ebd06b5fa86003 (diff) | |
download | tcl-618503676d9bd1174c263775d6a2aeef4a838ae1.zip tcl-618503676d9bd1174c263775d6a2aeef4a838ae1.tar.gz tcl-618503676d9bd1174c263775d6a2aeef4a838ae1.tar.bz2 |
[Enh 2959069] Support for -fvisibility=hidden
Diffstat (limited to 'unix')
-rwxr-xr-x | unix/configure | 65 | ||||
-rw-r--r-- | unix/tcl.m4 | 18 |
2 files changed, 74 insertions, 9 deletions
diff --git a/unix/configure b/unix/configure index 3931b92..181bc7f 100755 --- a/unix/configure +++ b/unix/configure @@ -6434,6 +6434,63 @@ if test "${tcl_cv_cc_visibility_hidden+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fvisibility=hidden" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_cc_visibility_hidden=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_cc_visibility_hidden=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$hold_cflags +fi +echo "$as_me:$LINENO: result: $tcl_cv_cc_visibility_hidden" >&5 +echo "${ECHO_T}$tcl_cv_cc_visibility_hidden" >&6 + if test $tcl_cv_cc_visibility_hidden = yes; then + + CFLAGS="$CFLAGS -fvisibility=hidden" + +else + + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -6484,10 +6541,7 @@ fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags -fi -echo "$as_me:$LINENO: result: $tcl_cv_cc_visibility_hidden" >&5 -echo "${ECHO_T}$tcl_cv_cc_visibility_hidden" >&6 - if test $tcl_cv_cc_visibility_hidden = yes; then + if test $tcl_cv_cc_visibility_hidden = yes; then cat >>confdefs.h <<\_ACEOF @@ -6498,6 +6552,9 @@ _ACEOF fi +fi + + # Step 0.d: Disable -rpath support? echo "$as_me:$LINENO: checking if rpath support is requested" >&5 diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 34a06bd..c5045c7 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1052,16 +1052,24 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ AC_CACHE_CHECK([if compiler supports visibility "hidden"], tcl_cv_cc_visibility_hidden, [ + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fvisibility=hidden" + AC_TRY_COMPILE(,, tcl_cv_cc_visibility_hidden=yes, + tcl_cv_cc_visibility_hidden=no) + CFLAGS=$hold_cflags]) + AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [ + CFLAGS="$CFLAGS -fvisibility=hidden" + ], [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" AC_TRY_LINK([ extern __attribute__((__visibility__("hidden"))) void f(void); void f(void) {}], [f();], tcl_cv_cc_visibility_hidden=yes, tcl_cv_cc_visibility_hidden=no) - CFLAGS=$hold_cflags]) - AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [ - AC_DEFINE(MODULE_SCOPE, - [extern __attribute__((__visibility__("hidden")))], - [Compiler support for module scope symbols]) + CFLAGS=$hold_cflags + AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [ + AC_DEFINE(MODULE_SCOPE, + [extern __attribute__((__visibility__("hidden")))], + [Compiler support for module scope symbols]) + ]) ]) # Step 0.d: Disable -rpath support? |