From 9e82d733ad8686a5be07242f19d30fd459df5bd9 Mon Sep 17 00:00:00 2001 From: das Date: Sun, 4 Feb 2007 02:51:47 +0000 Subject: * unix/tcl.m4: use gcc4's __attribute__((__visibility__("hidden"))) if available to define MODULE_SCOPE effective on all platforms. * unix/configure.in: add caching to -pipe check. * unix/configure: autoconf-2.59 * unix/tkConfig.h.in: autoheader-2.59 --- ChangeLog | 8 ++++ unix/configure | 105 ++++++++++++++++++++++++++++++++++++++++++++++------- unix/configure.in | 21 +++++------ unix/tcl.m4 | 25 ++++++++++++- unix/tkConfig.h.in | 2 +- 5 files changed, 134 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 767ea04..87d5f5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-02-04 Daniel Steffen + + * unix/tcl.m4: use gcc4's __attribute__((__visibility__("hidden"))) if + available to define MODULE_SCOPE effective on all platforms. + * unix/configure.in: add caching to -pipe check. + * unix/configure: autoconf-2.59 + * unix/tkConfig.h.in: autoheader-2.59 + 2007-02-03 Joe Mistachkin * win/rules.vc: Fix platform specific file copy macros for downlevel diff --git a/unix/configure b/unix/configure index f062a2d..d9d80cc 100755 --- a/unix/configure +++ b/unix/configure @@ -3469,13 +3469,15 @@ fi # It makes compiling go faster. (This is only a performance feature.) #------------------------------------------------------------------------ -if test -z "$no_pipe"; then -if test -n "$GCC"; then - echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5 +if test -z "$no_pipe" && test -n "$GCC"; then + echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5 echo $ECHO_N "checking if the compiler understands -pipe... $ECHO_C" >&6 - OLDCC="$CC" - CC="$CC -pipe" - cat >conftest.$ac_ext <<_ACEOF +if test "${tcl_cv_cc_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3512,18 +3514,21 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + tcl_cv_cc_pipe=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -CC="$OLDCC" - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 +tcl_cv_cc_pipe=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$hold_cflags fi +echo "$as_me:$LINENO: result: $tcl_cv_cc_pipe" >&5 +echo "${ECHO_T}$tcl_cv_cc_pipe" >&6 + if test $tcl_cv_cc_pipe = yes; then + CFLAGS="$CFLAGS -pipe" + fi fi #------------------------------------------------------------------------ @@ -4619,6 +4624,78 @@ echo "${ECHO_T}$do64bitVIS" >&6 do64bit=yes fi + # Step 0.c: Check if gcc visibility support is available. Do this here so + # that platform specific alternatives can be used below if this fails. + + if test "$GCC" = "yes" ; then + echo "$as_me:$LINENO: checking if gcc supports visibility \"hidden\"" >&5 +echo $ECHO_N "checking if gcc supports visibility \"hidden\"... $ECHO_C" >&6 +if test "${tcl_cv_cc_visibility_hidden+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + extern __attribute__((__visibility__("hidden"))) void f(void); + void f(void) {} +int +main () +{ +f(); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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_exeext' + { (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_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 + +cat >>confdefs.h <<\_ACEOF +#define MODULE_SCOPE extern __attribute__((__visibility__("hidden"))) +_ACEOF + + fi + fi + # Step 1: set the variable "system" to hold the name and version number # for the system. @@ -6081,14 +6158,16 @@ _ACEOF fi fi fi + if test "$tcl_cv_cc_visibility_hidden" != yes; then cat >>confdefs.h <<\_ACEOF -#define MAC_OSX_TCL 1 +#define MODULE_SCOPE __private_extern__ _ACEOF + fi cat >>confdefs.h <<\_ACEOF -#define MODULE_SCOPE __private_extern__ +#define MAC_OSX_TCL 1 _ACEOF ;; diff --git a/unix/configure.in b/unix/configure.in index 703a605..d7d308a 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.130 2006/12/06 16:22:04 kennykb Exp $ +# RCS: @(#) $Id: configure.in,v 1.131 2007/02/04 02:51:48 das Exp $ AC_INIT([tk],[8.5]) AC_PREREQ(2.59) @@ -103,16 +103,15 @@ fi # It makes compiling go faster. (This is only a performance feature.) #------------------------------------------------------------------------ -if test -z "$no_pipe"; then -if test -n "$GCC"; then - AC_MSG_CHECKING([if the compiler understands -pipe]) - OLDCC="$CC" - CC="$CC -pipe" - AC_TRY_COMPILE(,, - AC_MSG_RESULT([yes]), - CC="$OLDCC" - AC_MSG_RESULT([no])) -fi +if test -z "$no_pipe" && test -n "$GCC"; then + AC_CACHE_CHECK([if the compiler understands -pipe], + tcl_cv_cc_pipe, [ + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" + AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no) + CFLAGS=$hold_cflags]) + if test $tcl_cv_cc_pipe = yes; then + CFLAGS="$CFLAGS -pipe" + fi fi #------------------------------------------------------------------------ diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 4e90aaf..1a19fce 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1086,6 +1086,25 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ do64bit=yes fi + # Step 0.c: Check if gcc visibility support is available. Do this here so + # that platform specific alternatives can be used below if this fails. + + if test "$GCC" = "yes" ; then + AC_CACHE_CHECK([if gcc supports visibility "hidden"], + tcl_cv_cc_visibility_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]) + if test $tcl_cv_cc_visibility_hidden = yes; then + AC_DEFINE(MODULE_SCOPE, + [extern __attribute__((__visibility__("hidden")))], + [Compiler support for module scope symbols]) + fi + fi + # Step 1: set the variable "system" to hold the name and version number # for the system. @@ -1691,9 +1710,11 @@ dnl AC_CHECK_TOOL(AR, ar) fi fi fi + if test "$tcl_cv_cc_visibility_hidden" != yes; then + AC_DEFINE(MODULE_SCOPE, [__private_extern__], + [Compiler support for module scope symbols]) + fi AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?]) - AC_DEFINE(MODULE_SCOPE, __private_extern__, - [Linker support for module scope symbols]) ;; NEXTSTEP-*) SHLIB_CFLAGS="" diff --git a/unix/tkConfig.h.in b/unix/tkConfig.h.in index e28ef01..74c271f 100644 --- a/unix/tkConfig.h.in +++ b/unix/tkConfig.h.in @@ -94,7 +94,7 @@ /* Are we building TkAqua? */ #undef MAC_OSX_TK -/* Linker support for module scope symbols */ +/* Compiler support for module scope symbols */ #undef MODULE_SCOPE /* Is Darwin CoreFoundation unavailable for 64-bit? */ -- cgit v0.12