From 88cd3810ef18b4e05cae8aebda92c41155ce7f1a Mon Sep 17 00:00:00 2001 From: das Date: Sun, 4 Feb 2007 02:51:21 +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 and zoneinfo checks. * unix/configure: autoconf-2.59 * unix/tclConfig.h.in: autoheader-2.59 --- ChangeLog | 8 +++ unix/configure | 165 ++++++++++++++++++++++++++++++++++++++++------------ unix/configure.in | 82 +++++++++++++------------- unix/tcl.m4 | 25 +++++++- unix/tclConfig.h.in | 2 +- 5 files changed, 202 insertions(+), 80 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8708415..56d18d9 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 and zoneinfo checks. + * unix/configure: autoconf-2.59 + * unix/tclConfig.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 be430fc..36f9740 100755 --- a/unix/configure +++ b/unix/configure @@ -4233,13 +4233,15 @@ done # 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 @@ -4276,18 +4278,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 #------------------------------------------------------------------------ @@ -6343,6 +6348,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. @@ -7805,14 +7882,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 ;; @@ -17479,39 +17558,49 @@ fi; # search path in ::tcl::clock::Initialize (library/clock.tcl). # case $tcl_ok in - no) - echo "$as_me:$LINENO: result: supplied by OS vendor" >&5 + no) + echo "$as_me:$LINENO: result: supplied by OS vendor" >&5 echo "${ECHO_T}supplied by OS vendor" >&6 - ;; - yes) - # nothing to do here - ;; - auto*) - tcl_ok=yes - for dir in /usr/share/zoneinfo \ - /usr/share/lib/zoneinfo \ - /usr/lib/zoneinfo - do - if test -f $dir/UTC -o -f $dir/GMT - then - tcl_ok=no - echo "$as_me:$LINENO: result: $dir" >&5 + ;; + yes) + # nothing to do here + ;; + auto*) + if test "${tcl_cv_dir_zoneinfo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + for dir in /usr/share/zoneinfo \ + /usr/share/lib/zoneinfo \ + /usr/lib/zoneinfo + do + if test -f $dir/UTC -o -f $dir/GMT + then + tcl_cv_dir_zoneinfo="$dir" + break + fi + done +fi + + if test -n "$tcl_cv_dir_zoneinfo"; then + tcl_ok=no + echo "$as_me:$LINENO: result: $dir" >&5 echo "${ECHO_T}$dir" >&6 - break - fi - done - ;; - *) - { { echo "$as_me:$LINENO: error: invalid argument: $tcl_ok" >&5 + else + tcl_ok=yes + fi + ;; + *) + { { echo "$as_me:$LINENO: error: invalid argument: $tcl_ok" >&5 echo "$as_me: error: invalid argument: $tcl_ok" >&2;} { (exit 1); exit 1; }; } - ;; + ;; esac if test $tcl_ok = yes then - echo "$as_me:$LINENO: result: supplied by Tcl" >&5 + echo "$as_me:$LINENO: result: supplied by Tcl" >&5 echo "${ECHO_T}supplied by Tcl" >&6 - INSTALL_TZDATA=install-tzdata + INSTALL_TZDATA=install-tzdata fi diff --git a/unix/configure.in b/unix/configure.in index 81fc77b..1ea3758 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 Tcl installation dnl to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.154 2007/01/19 01:04:01 das Exp $ +# RCS: @(#) $Id: configure.in,v 1.155 2007/02/04 02:51:24 das Exp $ AC_INIT([tcl],[8.5]) AC_PREREQ(2.59) @@ -78,16 +78,15 @@ SC_MISSING_POSIX_HEADERS # 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 #------------------------------------------------------------------------ @@ -587,42 +586,47 @@ AC_MSG_RESULT([$tcl_ok]) #------------------------------------------------------------------------ AC_MSG_CHECKING([for timezone data]) AC_ARG_WITH(tzdata, - AC_HELP_STRING([--with-tzdata], - [install timezone data (default: autodetect)]), - [tcl_ok=$withval], [tcl_ok=auto]) + AC_HELP_STRING([--with-tzdata], + [install timezone data (default: autodetect)]), + [tcl_ok=$withval], [tcl_ok=auto]) # # Any directories that get added here must also be added to the # search path in ::tcl::clock::Initialize (library/clock.tcl). # case $tcl_ok in - no) - AC_MSG_RESULT([supplied by OS vendor]) - ;; - yes) - # nothing to do here - ;; - auto*) - tcl_ok=yes - for dir in /usr/share/zoneinfo \ - /usr/share/lib/zoneinfo \ - /usr/lib/zoneinfo - do - if test -f $dir/UTC -o -f $dir/GMT - then - tcl_ok=no - AC_MSG_RESULT([$dir]) - break - fi - done - ;; - *) - AC_MSG_ERROR([invalid argument: $tcl_ok]) - ;; + no) + AC_MSG_RESULT([supplied by OS vendor]) + ;; + yes) + # nothing to do here + ;; + auto*) + AC_CACHE_VAL([tcl_cv_dir_zoneinfo], [ + for dir in /usr/share/zoneinfo \ + /usr/share/lib/zoneinfo \ + /usr/lib/zoneinfo + do + if test -f $dir/UTC -o -f $dir/GMT + then + tcl_cv_dir_zoneinfo="$dir" + break + fi + done]) + if test -n "$tcl_cv_dir_zoneinfo"; then + tcl_ok=no + AC_MSG_RESULT([$dir]) + else + tcl_ok=yes + fi + ;; + *) + AC_MSG_ERROR([invalid argument: $tcl_ok]) + ;; esac if test $tcl_ok = yes then - AC_MSG_RESULT([supplied by Tcl]) - INSTALL_TZDATA=install-tzdata + AC_MSG_RESULT([supplied by Tcl]) + INSTALL_TZDATA=install-tzdata fi AC_SUBST(INSTALL_TZDATA) 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/tclConfig.h.in b/unix/tclConfig.h.in index 6fc1306..4ce32be 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -265,7 +265,7 @@ /* Is this a Mac I see before me? */ #undef MAC_OSX_TCL -/* Linker support for module scope symbols */ +/* Compiler support for module scope symbols */ #undef MODULE_SCOPE /* Default libtommath precision. */ -- cgit v0.12