summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authordas <das>2007-02-04 02:51:47 (GMT)
committerdas <das>2007-02-04 02:51:47 (GMT)
commit6d263592fe38d64966acb937f9ddfb0162b7bd66 (patch)
treebe519e1bca00c1b4656352770ac97a0c25aaa048 /unix
parentd640c4f5c35bdb6c129d907f94ca28acf8802c74 (diff)
downloadtk-6d263592fe38d64966acb937f9ddfb0162b7bd66.zip
tk-6d263592fe38d64966acb937f9ddfb0162b7bd66.tar.gz
tk-6d263592fe38d64966acb937f9ddfb0162b7bd66.tar.bz2
* 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
Diffstat (limited to 'unix')
-rwxr-xr-xunix/configure105
-rw-r--r--unix/configure.in21
-rw-r--r--unix/tcl.m425
-rw-r--r--unix/tkConfig.h.in2
4 files changed, 126 insertions, 27 deletions
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? */