|
From: Mo D. <md...@cy...> - 2000-07-17 08:43:20
|
I would like to remove the --enable-threads option from Tk
(and any other extensions for that matter). It does not
seem logical to be able to build Tcl without thread support
and Tk with thread support. Here is a patch that implements
this change, I want to make sure anyone that thinks it is
a bad idea gets a chance to object. This patch also
adds a TCL_THREADS variable to tclConfig.sh so that
extensions can find out if Tcl was compiled with
thread support.
Mo DeJong
Red Hat Inc
Index: unix/configure.in
===================================================================
RCS file: /cvsroot/tcl/unix/configure.in,v
retrieving revision 1.58
diff -u -r1.58 configure.in
--- configure.in 2000/05/03 00:15:10 1.58
+++ configure.in 2000/07/03 14:20:53
@@ -567,6 +567,7 @@
AC_SUBST(LDFLAGS)
AC_SUBST(MAKE_LIB)
AC_SUBST(TCL_SHARED_BUILD)
+AC_SUBST(TCL_THREADS)
AC_SUBST(SHLIB_CFLAGS)
AC_SUBST(SHLIB_LD)
AC_SUBST(STLIB_LD)
Index: unix/tcl.m4
===================================================================
RCS file: /cvsroot/tcl/unix/tcl.m4,v
retrieving revision 1.22
diff -u -r1.22 tcl.m4
--- tcl.m4 2000/04/14 06:42:41 1.22
+++ tcl.m4 2000/07/03 14:20:54
@@ -223,6 +223,27 @@
AC_SUBST(TCL_BIN_DIR)
AC_SUBST(TCL_SRC_DIR)
AC_SUBST(TCL_LIB_FILE)
+
+
+ # We need to find out if Tcl was compiled with thread
+ # support. We can not build an extension with thread
+ # support if Tcl is not built with thread support.
+
+ AC_MSG_CHECKING([to see if Tcl was compiled with thread support])
+
+ if test "$TCL_THREADS" = "1"; then
+ # Define the following option so that they will
+ # be passed in the CFLAGS variable. We do not
+ # need to worry about THREADS_LIBS because that
+ # gets added to the LIBS variable.
+
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(TCL_THREADS)
+ AC_DEFINE(_REENTRANT)
+ AC_DEFINE(_THREAD_SAFE)
+ else
+ AC_MSG_RESULT([no])
+ fi
])
#------------------------------------------------------------------------
@@ -331,7 +352,10 @@
#------------------------------------------------------------------------
# SC_ENABLE_THREADS --
#
-# Specify if thread support should be enabled
+# Specify if thread support should be enabled for Tcl. This
+# macro can not be called from an extension's configure.in
+# because it is not possible to build an extension with thread
+# support if Tcl itself is not compiled with thread support.
#
# Arguments:
# none
@@ -347,6 +371,7 @@
# Defines the following vars:
# TCL_THREADS
# _REENTRANT
+# _THREAD_SAFE
#
#------------------------------------------------------------------------
@@ -354,6 +379,13 @@
AC_MSG_CHECKING(for building with threads)
AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
[tcl_ok=$enableval], [tcl_ok=no])
+
+ # Make sure this macro is not getting include in an extensions
+ # configure.in by checking for the tcl.h include file.
+
+ if test ! -f ${TCL_SRC_DIR}/generic/tcl.h ; then
+ AC_MSG_ERROR([The --enable-threads macro can only be used in
Tcl's configure.in])
+ fi
if test "$tcl_ok" = "yes"; then
AC_MSG_RESULT(yes)
Index: unix/tclConfig.sh.in
===================================================================
RCS file: /cvsroot/tcl/unix/tclConfig.sh.in,v
retrieving revision 1.14
diff -u -r1.14 tclConfig.sh.in
--- tclConfig.sh.in 2000/06/20 21:30:34 1.14
+++ tclConfig.sh.in 2000/07/03 14:20:54
@@ -38,6 +38,9 @@
# Flag, 1: we built a shared lib, 0 we didn't
TCL_SHARED_BUILD=@TCL_SHARED_BUILD@
+# Flag, 1: we built Tcl with threads support, 0 we didn't
+TCL_THREADS=@TCL_THREADS@
+
# The name of the Tcl library (may be either a .a file or a shared library):
TCL_LIB_FILE='@TCL_LIB_FILE@'
--
The TclCore mailing list is sponsored by Ajuba Solutions
To unsubscribe: email tcl...@aj... with the
word UNSUBSCRIBE as the subject.
|