diff options
author | das <das> | 2005-05-14 20:46:43 (GMT) |
---|---|---|
committer | das <das> | 2005-05-14 20:46:43 (GMT) |
commit | 682791cc06ff9a97bb834ec6e43bbef12687d80a (patch) | |
tree | 8485c76ab6a0159bc2f9c1907dc085c2fc922e72 /unix | |
parent | a06d3d0df0e5b9d324676885c38f8b44c09dfa6a (diff) | |
download | tcl-682791cc06ff9a97bb834ec6e43bbef12687d80a.zip tcl-682791cc06ff9a97bb834ec6e43bbef12687d80a.tar.gz tcl-682791cc06ff9a97bb834ec6e43bbef12687d80a.tar.bz2 |
* generic/tclInt.decls:
* generic/tclTest.c:
* generic/tclUtil.c:
* win/tclWin32Dll.c: fixed link error due to direct access by
tclTest.c to the MODULE_SCOPE tclPlatform global: renamed existing
TclWinGetPlatform() accessor to TclGetPlatform() and moved it to
generic code so that it can be used by on all platforms where
MODULE_SCOPE is enforced.
* macosx/tclMacOSXBundle.c:
* unix/tclUnixInit.c:
* unix/tcl.m4 (Darwin): made use of CoreFoundation API configurable
and added test of CoreFoundation availablility to allow building on
ppc64, replaced HAVE_CFBUNDLE by HAVE_COREFOUNDATION; test for
availability of Tiger or later OSSpinLockLock API.
* unix/tclUnixNotfy.c:
* unix/Makefile.in:
* macosx/tclMacOSXNotify.c (new file): when CoreFoundation is
available, use new CFRunLoop based notifier: allows easy integration
with other event loops on Mac OS X, in particular the TkAqua Carbon
event loop is now integrated via a standard tcl event source (instead
of TkAqua upon loading having to finalize the exsting notifier and
replace it with its custom version). [Patch 1202052]
* tests/unixNotfy.test: don't run unthreaded tests on Darwin
since notifier may be using threads even in unthreaded core.
* unix/tclUnixPort.h:
* unix/tcl.m4 (Darwin): test for thread-unsafe realpath durning
configure, as Darwin 7 and later realpath is threadsafe.
* macosx/Makefile: enable configure caching.
* unix/configure.in: wrap tclConfig.h header in #ifndef _TCLCONFIG so
that it can be included more than once without warnings from gcc4.0
(as happens e.g. when including both tclInt.h and tclPort.h)
* macosx/tclMacOSXBundle.c:
* unix/tclUnixChan.c:
* unix/tclLoadDyld.c:
* unix/tclUnixInit.c: fixed gcc 4.0 warnings.
* unix/configure: autoconf-2.59
* unix/tclConfig.h.in: autoheader-2.59
* generic/tclIntDecls.h:
* generic/tclIntPlatDecls.h:
* generic/tclStubInit.c: make genstubs
Diffstat (limited to 'unix')
-rw-r--r-- | unix/Makefile.in | 13 | ||||
-rwxr-xr-x | unix/configure | 439 | ||||
-rw-r--r-- | unix/configure.in | 8 | ||||
-rw-r--r-- | unix/tcl.m4 | 39 | ||||
-rw-r--r-- | unix/tclConfig.h.in | 34 | ||||
-rw-r--r-- | unix/tclLoadDyld.c | 12 | ||||
-rw-r--r-- | unix/tclUnixChan.c | 20 | ||||
-rw-r--r-- | unix/tclUnixInit.c | 24 | ||||
-rw-r--r-- | unix/tclUnixNotfy.c | 6 | ||||
-rw-r--r-- | unix/tclUnixPort.h | 9 |
10 files changed, 544 insertions, 60 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in index c5f8da2..7245368 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -5,7 +5,7 @@ # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.166 2005/05/13 17:12:19 dgp Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.167 2005/05/14 20:46:46 das Exp $ VERSION = @TCL_VERSION@ MAJOR_VERSION = @TCL_MAJOR_VERSION@ @@ -323,7 +323,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ STUB_LIB_OBJS = tclStubLib.o ${COMPAT_OBJS} -MAC_OSX_OBJS = tclMacOSXBundle.o tclMacOSXFCmd.o +MAC_OSX_OBJS = tclMacOSXBundle.o tclMacOSXFCmd.o tclMacOSXNotify.o OBJS = ${GENERIC_OBJS} ${TOMMATH_OBJS} ${UNIX_OBJS} ${NOTIFY_OBJS} \ ${COMPAT_OBJS} @DL_OBJS@ @PLAT_OBJS@ @@ -504,7 +504,8 @@ DL_SRCS = \ MAC_OSX_SRCS = \ $(MAC_OSX_DIR)/tclMacOSXBundle.c \ - $(MAC_OSX_DIR)/tclMacOSXFCmd.c + $(MAC_OSX_DIR)/tclMacOSXFCmd.c \ + $(MAC_OSX_DIR)/tclMacOSXNotify.c # Note: don't include DL_SRCS or MAC_OSX_SRCS in SRCS: most of those # files won't compile on the current machine, and they will cause @@ -825,6 +826,9 @@ install-private-headers: libraries do \ $(INSTALL_DATA) $$i $(PRIVATE_INCLUDE_INSTALL_DIR); \ done; + @if test -f tclConfig.h; then\ + $(INSTALL_DATA) tclConfig.h $(PRIVATE_INCLUDE_INSTALL_DIR); \ + fi; Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in $(SHELL) config.status @@ -1352,6 +1356,9 @@ tclMacOSXBundle.o: $(MAC_OSX_DIR)/tclMacOSXBundle.c tclMacOSXFCmd.o: $(MAC_OSX_DIR)/tclMacOSXFCmd.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tclMacOSXFCmd.c +tclMacOSXNotify.o: $(MAC_OSX_DIR)/tclMacOSXNotify.c + $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tclMacOSXNotify.c + # The following targets are not completely general. They are provide # purely for documentation purposes so people who are interested in # the Xt based notifier can modify them to suit their own installation. diff --git a/unix/configure b/unix/configure index 3496807..95d4611 100755 --- a/unix/configure +++ b/unix/configure @@ -851,6 +851,7 @@ Optional Features: --enable-shared build and link with shared libraries --enable-shared --enable-64bit enable 64bit support (where applicable) --enable-64bit-vis enable 64bit Sparc VIS support + --enable-corefoundation use CoreFoundation API --enable-corefoundation --disable-load disallow dynamic loading and "load" command --enable-symbols build with debugging symbols --disable-symbols --enable-langinfo use nl_langinfo if possible to determine @@ -1322,6 +1323,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + TCL_VERSION=8.5 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=5 @@ -7913,19 +7915,344 @@ echo "${ECHO_T}$tcl_cv_ld_search_paths_first" >&6 CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" - PLAT_OBJS="\${MAC_OSX_OBJS}" - PLAT_SRCS="\${MAC_OSX_SRCS}" + PLAT_OBJS='${MAC_OSX_OBJS}' + PLAT_SRCS='${MAC_OSX_SRCS}' TCL_SHLIB_LD_EXTRAS='-compatibility_version ${VERSION} -current_version ${VERSION} -install_name ${DYLIB_INSTALL_DIR}/${TCL_LIB_FILE} -seg1addr 0xa000000' TK_SHLIB_LD_EXTRAS=' -compatibility_version ${VERSION} -current_version ${VERSION} -install_name ${DYLIB_INSTALL_DIR}/${TK_LIB_FILE} -seg1addr 0xb000000 -unexported_symbols_list $$(f=$(TCL_STUB_LIB_FILE).E && nm -gjp $(TCL_BIN_DIR)/$(TCL_STUB_LIB_FILE) | tail +3 > $$f && echo $$f)' - LIBS="$LIBS -framework CoreFoundation" + echo "$as_me:$LINENO: checking whether to use CoreFoundation" >&5 +echo $ECHO_N "checking whether to use CoreFoundation... $ECHO_C" >&6 + # Check whether --enable-corefoundation or --disable-corefoundation was given. +if test "${enable_corefoundation+set}" = set; then + enableval="$enable_corefoundation" + tcl_corefoundation=$enableval +else + tcl_corefoundation=yes +fi; + echo "$as_me:$LINENO: result: $tcl_corefoundation" >&5 +echo "${ECHO_T}$tcl_corefoundation" >&6 + if test $tcl_corefoundation = yes; then + echo "$as_me:$LINENO: checking for CoreFoundation.framework" >&5 +echo $ECHO_N "checking for CoreFoundation.framework... $ECHO_C" >&6 +if test "${tcl_cv_lib_corefoundation+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + hold_libs=$LIBS + LIBS="$LIBS -framework CoreFoundation" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <CoreFoundation/CoreFoundation.h> +int +main () +{ +CFBundleRef b = CFBundleGetMainBundle(); + ; + 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_lib_corefoundation=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_lib_corefoundation=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$hold_libs +fi +echo "$as_me:$LINENO: result: $tcl_cv_lib_corefoundation" >&5 +echo "${ECHO_T}$tcl_cv_lib_corefoundation" >&6 + if test $tcl_cv_lib_corefoundation = yes; then + LIBS="$LIBS -framework CoreFoundation" cat >>confdefs.h <<\_ACEOF -#define MAC_OSX_TCL 1 +#define HAVE_COREFOUNDATION 1 _ACEOF + fi + fi + +for ac_header in libkern/OSAtomic.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_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 + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------ ## +## Report this to the tcl lists. ## +## ------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in OSSpinLockLock +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + 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 + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + cat >>confdefs.h <<\_ACEOF -#define HAVE_CFBUNDLE 1 +#define MAC_OSX_TCL 1 _ACEOF @@ -7943,6 +8270,103 @@ cat >>confdefs.h <<\_ACEOF #define MODULE_SCOPE __private_extern__ _ACEOF + # prior to Darwin 7, realpath is not threadsafe, so don't + # use it when threads are enabled, c.f. bug # 711232: + echo "$as_me:$LINENO: checking for realpath" >&5 +echo $ECHO_N "checking for realpath... $ECHO_C" >&6 +if test "${ac_cv_func_realpath+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define realpath to an innocuous variant, in case <limits.h> declares realpath. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define realpath innocuous_realpath + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char realpath (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef realpath + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char realpath (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_realpath) || defined (__stub___realpath) +choke me +#else +char (*f) () = realpath; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != realpath; + ; + 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 + ac_cv_func_realpath=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_realpath=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_realpath" >&5 +echo "${ECHO_T}$ac_cv_func_realpath" >&6 + + if test "$ac_cv_func_realpath" = yes -a "${TCL_THREADS}" = 1 \ + -a `uname -r | awk -F. '{print $1}'` -lt 7 ; then + ac_cv_func_realpath=no + fi ;; NEXTSTEP-*) SHLIB_CFLAGS="" @@ -14904,6 +15328,11 @@ echo "${ECHO_T}framework" >&6 echo "$as_me: WARNING: \"Frameworks can only be built if --enable-shared is yes\"" >&2;} FRAMEWORK_BUILD=0 fi + if test $tcl_corefoundation = no; then + { echo "$as_me:$LINENO: WARNING: \"Frameworks can only be used when CoreFoundation is available\"" >&5 +echo "$as_me: WARNING: \"Frameworks can only be used when CoreFoundation is available\"" >&2;} + FRAMEWORK_BUILD=0 + fi else echo "$as_me:$LINENO: result: standard shared library" >&5 echo "${ECHO_T}standard shared library" >&6 diff --git a/unix/configure.in b/unix/configure.in index 7403e15..8c9a91c 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,12 +3,16 @@ 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.128 2005/05/10 18:35:26 kennykb Exp $ +# RCS: @(#) $Id: configure.in,v 1.129 2005/05/14 20:46:48 das Exp $ AC_INIT([tcl],[8.5]) AC_PREREQ(2.57) + dnl AC_CONFIG_HEADERS([tclConfig.h]) -dnl AC_CONFIG_COMMANDS_PRE([DEFS=-DHAVE_TCL_CONFIG_H]) +dnl AC_CONFIG_COMMANDS_PRE([DEFS="-DHAVE_TCL_CONFIG_H -imacros tclConfig.h"]) +dnl AH_TOP([#ifndef _TCLCONFIG +dnl #define _TCLCONFIG]) +dnl AH_BOTTOM([#endif /* _TCLCONFIG */]) TCL_VERSION=8.5 TCL_MAJOR_VERSION=8 diff --git a/unix/tcl.m4 b/unix/tcl.m4 index bbed997..fc4247f 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -402,6 +402,10 @@ AC_DEFUN(SC_ENABLE_FRAMEWORK, [ AC_MSG_WARN("Frameworks can only be built if --enable-shared is yes") FRAMEWORK_BUILD=0 fi + if test $tcl_corefoundation = no; then + AC_MSG_WARN("Frameworks can only be used when CoreFoundation is available") + FRAMEWORK_BUILD=0 + fi else AC_MSG_RESULT([standard shared library]) FRAMEWORK_BUILD=0 @@ -1406,17 +1410,42 @@ dnl AC_CHECK_TOOL(AR, ar) CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" - PLAT_OBJS="\${MAC_OSX_OBJS}" - PLAT_SRCS="\${MAC_OSX_SRCS}" + PLAT_OBJS='${MAC_OSX_OBJS}' + PLAT_SRCS='${MAC_OSX_SRCS}' TCL_SHLIB_LD_EXTRAS='-compatibility_version ${VERSION} -current_version ${VERSION} -install_name ${DYLIB_INSTALL_DIR}/${TCL_LIB_FILE} -seg1addr 0xa000000' TK_SHLIB_LD_EXTRAS=' -compatibility_version ${VERSION} -current_version ${VERSION} -install_name ${DYLIB_INSTALL_DIR}/${TK_LIB_FILE} -seg1addr 0xb000000 -unexported_symbols_list $$(f=$(TCL_STUB_LIB_FILE).E && nm -gjp $(TCL_BIN_DIR)/$(TCL_STUB_LIB_FILE) | tail +3 > $$f && echo $$f)' - LIBS="$LIBS -framework CoreFoundation" - AC_DEFINE(MAC_OSX_TCL, 1, ["Is this a Mac I see before me?"]) - AC_DEFINE(HAVE_CFBUNDLE, 1, [Do we have access to Mac bundles?]) + AC_MSG_CHECKING([whether to use CoreFoundation]) + AC_ARG_ENABLE(corefoundation, [ --enable-corefoundation use CoreFoundation API [--enable-corefoundation]], + [tcl_corefoundation=$enableval], [tcl_corefoundation=yes]) + AC_MSG_RESULT([$tcl_corefoundation]) + if test $tcl_corefoundation = yes; then + AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [ + hold_libs=$LIBS + LIBS="$LIBS -framework CoreFoundation" + AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>], + [CFBundleRef b = CFBundleGetMainBundle();], + tcl_cv_lib_corefoundation=yes, tcl_cv_lib_corefoundation=no) + LIBS=$hold_libs]) + if test $tcl_cv_lib_corefoundation = yes; then + LIBS="$LIBS -framework CoreFoundation" + AC_DEFINE(HAVE_COREFOUNDATION, 1, + [Do we have access to Darwin CoreFoundation.framework ?]) + fi + fi + AC_CHECK_HEADERS(libkern/OSAtomic.h) + AC_CHECK_FUNCS(OSSpinLockLock) + AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?]) AC_DEFINE(USE_VFORK, 1, [Should we use vfork() instead of fork()?]) AC_DEFINE(TCL_DEFAULT_ENCODING,"utf-8", [Are we to override what our default encoding is?]) AC_DEFINE(MODULE_SCOPE, __private_extern__, [Linker support for module scope symbols]) + # prior to Darwin 7, realpath is not threadsafe, so don't + # use it when threads are enabled, c.f. bug # 711232: + AC_CHECK_FUNC(realpath) + if test "$ac_cv_func_realpath" = yes -a "${TCL_THREADS}" = 1 \ + -a `uname -r | awk -F. '{print [$]1}'` -lt 7 ; then + ac_cv_func_realpath=no + fi ;; NEXTSTEP-*) SHLIB_CFLAGS="" diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index 1f83e5c..0806e0d 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -1,5 +1,8 @@ /* tclConfig.h.in. Generated from configure.in by autoheader. */ +#ifndef _TCLCONFIG +#define _TCLCONFIG + /* Is pthread_attr_get_np() declared in <pthread.h>? */ #undef ATTRGETNP_NOT_DECLARED @@ -12,12 +15,12 @@ /* Do we have BSDgettimeofday()? */ #undef HAVE_BSDGETTIMEOFDAY -/* Do we have access to Mac bundles? */ -#undef HAVE_CFBUNDLE - /* Define to 1 if you have the `chflags' function. */ #undef HAVE_CHFLAGS +/* Do we have access to Darwin CoreFoundation.framework ? */ +#undef HAVE_COREFOUNDATION + /* Define to 1 if you have the `getattrlist' function. */ #undef HAVE_GETATTRLIST @@ -33,12 +36,18 @@ /* Do we have nl_langinfo()? */ #undef HAVE_LANGINFO +/* Define to 1 if you have the <libkern/OSAtomic.h> header file. */ +#undef HAVE_LIBKERN_OSATOMIC_H + /* Do we have <limits.h>? */ #undef HAVE_LIMITS_H /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R +/* Define to 1 if you have the `lseek64' function. */ +#undef HAVE_LSEEK64 + /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H @@ -48,9 +57,15 @@ /* Do we have <net/errno.h>? */ #undef HAVE_NET_ERRNO_H +/* Define to 1 if you have the `open64' function. */ +#undef HAVE_OPEN64 + /* Define to 1 if you have the `opendir' function. */ #undef HAVE_OPENDIR +/* Define to 1 if you have the `OSSpinLockLock' function. */ +#undef HAVE_OSSPINLOCKLOCK + /* Do we want a BSD-like thread-attribute interface? */ #undef HAVE_PTHREAD_ATTR_GET_NP @@ -78,9 +93,6 @@ /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H -/* Define to 1 if you have the `strstr' function. */ -#undef HAVE_STRSTR - /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL @@ -159,9 +171,12 @@ /* Define to 1 if you have the `waitpid' function. */ #undef HAVE_WAITPID -/* "Is this a Mac I see before me?" */ +/* Is this a Mac I see before me? */ #undef MAC_OSX_TCL +/* Linker support for module scope symbols */ +#undef MODULE_SCOPE + /* Do we have <dirent.h>? */ #undef NO_DIRENT_H @@ -261,9 +276,6 @@ /* Are bytecode statistics enabled? */ #undef TCL_COMPILE_STATS -/* What extra letters do we insert for debugging binary code? */ -#undef TCL_DBGX - /* Are we to override what our default encoding is? */ #undef TCL_DEFAULT_ENCODING @@ -386,3 +398,5 @@ /* Define to `int' if <sys/types.h> doesn't define. */ #undef uid_t + +#endif /* _TCLCONFIG */ diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c index af14fd2..c131050 100644 --- a/unix/tclLoadDyld.c +++ b/unix/tclLoadDyld.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLoadDyld.c,v 1.15 2004/04/06 22:25:56 dgp Exp $ + * RCS: @(#) $Id: tclLoadDyld.c,v 1.16 2005/05/14 20:46:48 das Exp $ */ #include "tclInt.h" @@ -23,7 +23,7 @@ typedef struct Tcl_DyldModuleHandle { } Tcl_DyldModuleHandle; typedef struct Tcl_DyldLoadHandle { - const struct mach_header *dyld_lib; + CONST struct mach_header *dyld_lib; Tcl_DyldModuleHandle *firstModuleHandle; } Tcl_DyldLoadHandle; @@ -59,7 +59,7 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) * this file. */ { Tcl_DyldLoadHandle *dyldLoadHandle; - const struct mach_header *dyld_lib; + CONST struct mach_header *dyld_lib; CONST char *native; /* @@ -89,7 +89,7 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) if (!dyld_lib) { NSLinkEditErrors editError; - char *name, *msg; + CONST char *name, *msg; NSLinkEditError(&editError, &errno, &name, &msg); Tcl_AppendResult(interp, msg, (char *) NULL); return TCL_ERROR; @@ -152,7 +152,7 @@ TclpFindSymbol(interp, loadHandle, symbol) } } else { NSLinkEditErrors editError; - char *name, *msg; + CONST char *name, *msg; NSLinkEditError(&editError, &errno, &name, &msg); Tcl_AppendResult(interp, msg, (char *) NULL); } @@ -198,7 +198,7 @@ TclpUnloadFile(loadHandle) dyldModuleHandle = dyldModuleHandle->nextModuleHandle; ckfree(ptr); } - ckfree(dyldLoadHandle); + ckfree((char*) dyldLoadHandle); } /* diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index b6a5555..abc2edc 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixChan.c,v 1.56 2005/05/10 18:35:27 kennykb Exp $ + * RCS: @(#) $Id: tclUnixChan.c,v 1.57 2005/05/14 20:46:48 das Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ @@ -43,6 +43,13 @@ #define SUPPORTS_TTY +#undef DIRECT_BAUD +#ifdef B4800 +# if (B4800 == 4800) +# define DIRECT_BAUD +# endif /* B4800 == 4800 */ +#endif /* B4800 */ + #ifdef USE_TERMIOS # include <termios.h> # ifdef HAVE_SYS_IOCTL_H @@ -261,11 +268,15 @@ static int TtyCloseProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp)); static void TtyGetAttributes _ANSI_ARGS_((int fd, TtyAttrs *ttyPtr)); +#ifndef DIRECT_BAUD static int TtyGetBaud _ANSI_ARGS_((unsigned long speed)); +#endif static int TtyGetOptionProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp, CONST char *optionName, Tcl_DString *dsPtr)); +#ifndef DIRECT_BAUD static unsigned long TtyGetSpeed _ANSI_ARGS_((int baud)); +#endif static FileState * TtyInit _ANSI_ARGS_((int fd, int initialize)); static void TtyModemStatusStr _ANSI_ARGS_((int status, Tcl_DString *dsPtr)); @@ -1190,13 +1201,6 @@ TtyGetOptionProc(instanceData, interp, optionName, dsPtr) } } -#undef DIRECT_BAUD -#ifdef B4800 -# if (B4800 == 4800) -# define DIRECT_BAUD -# endif /* B4800 == 4800 */ -#endif /* B4800 */ - #ifdef DIRECT_BAUD # define TtyGetSpeed(baud) ((unsigned) (baud)) # define TtyGetBaud(speed) ((int) (speed)) diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 1cd06a4..ec708f2 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -7,7 +7,7 @@ * Copyright (c) 1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclUnixInit.c,v 1.56 2005/05/10 18:35:27 kennykb Exp $ + * RCS: @(#) $Id: tclUnixInit.c,v 1.57 2005/05/14 20:46:48 das Exp $ */ #include "tclInt.h" @@ -26,7 +26,7 @@ # include <dlfcn.h> # endif #endif -#ifdef HAVE_CFBUNDLE +#ifdef HAVE_COREFOUNDATION #include <CoreFoundation/CoreFoundation.h> #endif @@ -328,11 +328,11 @@ static CONST LocaleTable localeTable[] = { #ifndef TCL_NO_STACK_CHECK static int GetStackSize _ANSI_ARGS_((size_t *stackSizePtr)); #endif /* TCL_NO_STACK_CHECK */ -#ifdef HAVE_CFBUNDLE +#ifdef HAVE_COREFOUNDATION static int MacOSXGetLibraryPath _ANSI_ARGS_(( Tcl_Interp *interp, int maxPathLen, char *tclLibPath)); -#endif /* HAVE_CFBUNDLE */ +#endif /* HAVE_COREFOUNDATION */ /* @@ -511,13 +511,13 @@ TclpInitLibraryPath(valuePtr, lengthPtr, encodingPtr) */ { -#ifdef HAVE_CFBUNDLE +#ifdef HAVE_COREFOUNDATION char tclLibPath[MAXPATHLEN + 1]; if (MacOSXGetLibraryPath(NULL, MAXPATHLEN, tclLibPath) == TCL_OK) { str = tclLibPath; } else -#endif /* HAVE_CFBUNDLE */ +#endif /* HAVE_COREFOUNDATION */ { /* TODO: Pull this value from the TIP 59 table */ str = defaultLibraryDir; @@ -724,7 +724,7 @@ TclpSetVariables(interp) CONST char *user; Tcl_DString ds; -#ifdef HAVE_CFBUNDLE +#ifdef HAVE_COREFOUNDATION char tclLibPath[MAXPATHLEN + 1]; if (MacOSXGetLibraryPath(interp, MAXPATHLEN, tclLibPath) == TCL_OK) { @@ -756,7 +756,7 @@ TclpSetVariables(interp) Tcl_StatBuf statBuf; if((frameworksURL = CFBundleCopyPrivateFrameworksURL(bundleRef))) { if(CFURLGetFileSystemRepresentation(frameworksURL, TRUE, - tclLibPath, MAXPATHLEN) && + (unsigned char*) tclLibPath, MAXPATHLEN) && ! TclOSstat(tclLibPath, &statBuf) && S_ISDIR(statBuf.st_mode)) { Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, @@ -768,7 +768,7 @@ TclpSetVariables(interp) } if((frameworksURL = CFBundleCopySharedFrameworksURL(bundleRef))) { if(CFURLGetFileSystemRepresentation(frameworksURL, TRUE, - tclLibPath, MAXPATHLEN) && + (unsigned char*) tclLibPath, MAXPATHLEN) && ! TclOSstat(tclLibPath, &statBuf) && S_ISDIR(statBuf.st_mode)) { Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, @@ -782,7 +782,7 @@ TclpSetVariables(interp) Tcl_SetVar(interp, "tcl_pkgPath", pkgPath, TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); } else -#endif /* HAVE_CFBUNDLE */ +#endif /* HAVE_COREFOUNDATION */ { Tcl_SetVar(interp, "tcl_pkgPath", pkgPath, TCL_GLOBAL_ONLY); } @@ -1131,7 +1131,7 @@ GetStackSize(stackSizePtr) *---------------------------------------------------------------------- */ -#ifdef HAVE_CFBUNDLE +#ifdef HAVE_COREFOUNDATION static int MacOSXGetLibraryPath(Tcl_Interp *interp, int maxPathLen, char *tclLibPath) { @@ -1142,4 +1142,4 @@ MacOSXGetLibraryPath(Tcl_Interp *interp, int maxPathLen, char *tclLibPath) #endif return foundInFramework; } -#endif /* HAVE_CFBUNDLE */ +#endif /* HAVE_COREFOUNDATION */ diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 32e0e3d..c80e566 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -11,9 +11,11 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixNotfy.c,v 1.23 2005/05/10 18:35:28 kennykb Exp $ + * RCS: @(#) $Id: tclUnixNotfy.c,v 1.24 2005/05/14 20:46:48 das Exp $ */ +#ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier + * is in tclMacOSXNotify.c */ #include "tclInt.h" #include <signal.h> @@ -1080,3 +1082,5 @@ NotifierThreadProc(clientData) TclpThreadExit (0); } #endif + +#endif /* HAVE_COREFOUNDATION */ diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 59c9709..eb4dbda 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -19,7 +19,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixPort.h,v 1.41 2005/05/10 18:35:28 kennykb Exp $ + * RCS: @(#) $Id: tclUnixPort.h,v 1.42 2005/05/14 20:46:48 das Exp $ */ #ifndef _TCLUNIXPORT @@ -563,13 +563,6 @@ EXTERN char * TclpInetNtoa(struct in_addr); * #define gmtime(x) TclpGmtime(x) */ # undef inet_ntoa # define inet_ntoa(x) TclpInetNtoa(x) -# ifdef MAC_OSX_TCL -/* - * On Mac OS X, realpath is currently not - * thread safe, c.f. SF bug # 711232. - */ -# define NO_REALPATH -# endif # ifdef HAVE_PTHREAD_ATTR_GET_NP # define TclpPthreadGetAttrs pthread_attr_get_np # ifdef ATTRGETNP_NOT_DECLARED |