Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-05
06:52 • Ticket [219092ffff] Tcl does not compile with mingw toolchain status still C... artifact: 300c3fe8db user: dgp
2000-10-26
08:34 • Closed ticket [219092ffff]. artifact: 82589061a4 user: welch
01:10 • New ticket [219092ffff]. artifact: f0f0373a59 user: nobody

Tcl does not compile with mingw toolchain

Closed / Fixed219092ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:10:36
OriginalBugID: 5499 Bug
Version: 8.4a1
SubmitDate: '2000-05-15'
LastModified: '2000-05-18'
Severity: MED
Status: Released
Submitter: techsupp
ChangedBy: hobbs
RelatedBugIDs: 5307 4234 4211
OS: Linux
FixedDate: '2000-05-18'
FixedInVersion: 8.4a1
ClosedDate: '2000-10-25'


Name: mo

Comments:
After this patch is applied, Tcl will compile with mingw.

ReproducibleScript:
I tried to compile Tcl with the mingw toolchain (gcc under windows), but
it did not work. The ChangeLog states:

* win/tcl.m4: Added support for gcc/mingw on Windows [Bug: 4234]

But in fact, this support has never really worked.

ObservedBehavior:
It does not compile.

DesiredBehavior:
I would like it to compile.

Patch:
Index: win/Makefile.in
===================================================================
RCS file: /cvsroot/tcl/win/Makefile.in,v
retrieving revision 1.34
diff -u -r1.34 Makefile.in
--- Makefile.in2000/05/02 22:02:371.34
+++ Makefile.in2000/05/17 23:42:50
@@ -156,8 +156,13 @@
 VPATH = $(GENERIC_DIR)@VPSEP@$(WIN_DIR)@VPSEP@$(COMPAT_DIR) # : 

 AR= @AR@
+RANLIB= @RANLIB@
 CC= @CC@
 RC= @RC@
+RC_OUT= @RC_OUT@
+RC_TYPE= @RC_TYPE@
+RC_INCLUDE= @RC_INCLUDE@
+RES= @RES@
 AC_FLAGS= @EXTRA_CFLAGS@ @DEFS@
 CPPFLAGS= @CPPFLAGS@
 LDFLAGS= @LDFLAGS@
@@ -313,19 +318,19 @@
 $(MAN2TCL): $(ROOT_DIR)/tools/man2tcl.c
 $(CC) $(CFLAGS_OPTIMIZE) $(MAN2TCLFLAGS) -o $(MAN2TCL) "$(ROOT_DIR_NATIVE)"/tools/man2tcl.c

-$(TCLSH): $(TCL_LIB_FILE) $(TCLSH_OBJS) tclsh.res
+$(TCLSH): $(TCL_LIB_FILE) $(TCLSH_OBJS) tclsh.$(RES)
 $(CC) $(CFLAGS) $(TCLSH_OBJS) $(TCL_LIB_FILE) $(LIBS)  -        tclsh.res $(CC_EXENAME) 
+        tclsh.$(RES) $(CC_EXENAME) 

-$(TCLTEST): $(TCL_LIB_FILE) $(TCLTEST_OBJS) $(CAT32) tclsh.res
+$(TCLTEST): $(TCL_LIB_FILE) $(TCLTEST_OBJS) $(CAT32) tclsh.$(RES)
 $(CC) $(CFLAGS) $(TCLTEST_OBJS) $(TCL_LIB_FILE) $(LIBS)  -        tclsh.res $(CC_EXENAME) 
+        tclsh.$(RES) $(CC_EXENAME) 

 cat32.${OBJEXT}: cat.c
 $(CC) -c $(CC_SWITCHES) $(DEPARG) $(CC_OBJNAME)

 $(CAT32): cat32.${OBJEXT}
-$(CC) $(CFLAGS) cat32.obj $(CC_EXENAME) -link $(LDFLAGS_CONSOLE)
+$(CC) $(CFLAGS) cat32.${OBJEXT} $(CC_EXENAME) $(LDFLAGS_CONSOLE)

 # The following targets are configured by autoconf to generate either
 # a shared library or static library
@@ -333,14 +338,16 @@
 ${TCL_STUB_LIB_FILE}: ${STUB_OBJS}
 @$(RM) ${TCL_STUB_LIB_FILE}
 @MAKE_LIB@ ${STUB_OBJS}
+@POST_MAKE_LIB@

-${TCL_DLL_FILE}: ${TCL_OBJS} tcl.res
+${TCL_DLL_FILE}: ${TCL_OBJS} tcl.$(RES)
 @$(RM) ${TCL_DLL_FILE}
-@MAKE_DLL@ ${TCL_OBJS} tcl.res
+@MAKE_DLL@ ${TCL_OBJS} tcl.$(RES)

 ${TCL_LIB_FILE}: ${TCL_OBJS}
 @$(RM) ${TCL_LIB_FILE}
 @MAKE_LIB@ ${TCL_OBJS}
+@POST_MAKE_LIB@

 ${DDE_DLL_FILE}: ${DDE_OBJS} ${TCL_STUB_LIB_FILE}
 @$(RM) ${DDE_DLL_FILE}
@@ -355,13 +362,13 @@

 ${PIPE_DLL_FILE}: ${PIPE_OBJS}
 @$(RM) ${PIPE_DLL_FILE}
-$(CC) $(CFLAGS) ${PIPE_OBJS} $(LIBS) -Fe$(PIPE_DLL_FILE) 
+@MAKE_EXE@ $(CFLAGS) ${PIPE_OBJS} $(LIBS)

 # Add the object extension to the implicit rules.  By default .obj is not
 # automatically added.

 .SUFFIXES: .${OBJEXT}
-.SUFFIXES: .res
+.SUFFIXES: .$(RES)
 .SUFFIXES: .rc

 # Special case object targets
@@ -404,10 +411,9 @@
 .c.${OBJEXT}:
 $(CC) -c $(CC_SWITCHES) -DBUILD_tcl ${DEPARG} $(CC_OBJNAME)

-.rc.res:
-$(RC) -fo $@ -r -i "$(GENERIC_DIR_NATIVE)" $(DEPARG)
+.rc.$(RES):
+$(RC) $(RC_OUT) $@ $(RC_TYPE) $(RC_INCLUDE) "$(GENERIC_DIR_NATIVE)" $(RC_INCLUDE) "$(WIN_DIR_NATIVE)" $(DEPARG)

-
 install: all install-binaries install-libraries install-doc

 install-binaries:
@@ -517,7 +523,7 @@
 $(RM) *.hlp *.cnt *.GID *.rtf man2tcl.exe

 clean: cleanhelp
-$(RM) *.lib *.exp *.dll *.res *.${OBJEXT} *~ \#* TAGS a.out
+$(RM) *.lib *.exp *.dll *.$(RES) *.${OBJEXT} *~ \#* TAGS a.out
 $(RM) $(TCLSH) $(TCLTEST) $(CAT32)
 $(RM) *.pch *.ilk *.pdb

Index: win/configure.in
===================================================================
RCS file: /cvsroot/tcl/win/configure.in,v
retrieving revision 1.21
diff -u -r1.21 configure.in
--- configure.in2000/05/03 00:15:101.21
+++ configure.in2000/05/17 23:42:50
@@ -134,13 +134,20 @@
 AC_SUBST(LDFLAGS_CONSOLE)
 AC_SUBST(LDFLAGS_WINDOW)
 AC_SUBST(AR)
+AC_SUBST(RANLIB)
 AC_SUBST(RC)
+AC_SUBST(RC_OUT)
+AC_SUBST(RC_TYPE)
+AC_SUBST(RC_INCLUDE)
+AC_SUBST(RES)
 AC_SUBST(DLLSUFFIX)
 AC_SUBST(LIBPREFIX)
 AC_SUBST(LIBSUFFIX)
 AC_SUBST(EXESUFFIX)
 AC_SUBST(LIBRARIES)
 AC_SUBST(MAKE_LIB)
+AC_SUBST(POST_MAKE_LIB)
 AC_SUBST(MAKE_DLL)
+AC_SUBST(MAKE_EXE)

 AC_OUTPUT(Makefile tclConfig.sh tcl.hpj)
Index: win/tcl.m4
===================================================================
RCS file: /cvsroot/tcl/win/tcl.m4,v
retrieving revision 1.10
diff -u -r1.10 tcl.m4
--- tcl.m42000/05/03 00:15:111.10
+++ tcl.m42000/05/17 23:42:50
@@ -171,8 +171,28 @@
     AC_ARG_ENABLE(gcc, [  --enable-gcc            allow use of gcc if available [--disable-gcc]],
 [ok=$enableval], [ok=no])
     if test "$ok" = "yes"; then
-CC=gcc
-AC_PROG_CC
+    # Quick hack to simulate a real cross check
+    # The right way to do this is to use AC_CHECK_TOOL
+    # correctly, but this is the minimal change
+    # we need until the real fix is ready.
+
+    if test "$host" != "$build" ; then
+        if test -z "$CC"; then
+            CC=${host}-gcc
+        fi
+        AC_PROG_CC
+        AC_CHECK_PROG(AR, ${host}-ar, ${host}-ar)
+        AC_CHECK_PROG(RANLIB, ${host}-ranlib, ${host}-ranlib)
+        AC_CHECK_PROG(RC, ${host}-windres, ${host}-windres)
+    else
+        if test -z "$CC"; then
+            CC=gcc
+        fi
+        AC_PROG_CC
+        AC_CHECK_PROG(AR, ar, ar)
+        AC_CHECK_PROG(RANLIB, ranlib, ranlib)
+        AC_CHECK_PROG(RC, windres, windres)
+    fi
     else
 # Allow user to override
 if test -z "$CC"; then
@@ -364,10 +384,13 @@
 SHLIB_LD_LIBS=""
 LIBS=""
 LIBS_GUI="-lgdi32 -lcomdlg32"
-AR="${AR-ar}"
-STLIB_LD="${AR-ar}"
-RC="${WINDRES-windres}"
+STLIB_LD="${AR}"
+RC_OUT=-o
+RC_TYPE=
+RC_INCLUDE=--include
+RES=res.o
 MAKE_LIB="\${AR} crv \[$]@"
+POST_MAKE_LIB="\${RANLIB} \[$]@"
 MAKE_EXE="\${CC} -o \[$]@"
 LIBPREFIX="lib"

@@ -463,7 +486,12 @@
 AR="lib -nologo"
 STLIB_LD="lib -nologo"
 RC="rc"
+RC_OUT=-fo
+RC_TYPE=-r
+RC_INCLUDE=-i
+RES=res
 MAKE_LIB="\${AR} -out:\[$]@"
+POST_MAKE_LIB=
 MAKE_EXE="\${CC} -Fe\[$]@"
 LIBPREFIX=""

@@ -501,8 +529,8 @@

 # Specify linker flags depending on the type of app being 
 # built -- Console vs. Window.
-LDFLAGS_CONSOLE="-subsystem:console"
-LDFLAGS_WINDOW="-subsystem:windows"
+LDFLAGS_CONSOLE="-link -subsystem:console"
+LDFLAGS_WINDOW="-link -subsystem:windows"
     fi
 ])

PatchFiles:
win/Makefile.in
    win/configure.in
    win/tcl.m4



This should override all other previous patches. 
-- 05/17/2000 hobbs
Added to 8.4a1. 
-- 05/18/2000 hobbs
welch Closed ticket [219092ffff]. [History diff]2000-10-26 08:34:55
dgp Ticket [219092ffff]: 3 changes [History diff]2001-04-05 06:52:47
Log in (anonymous is fine) to add a comment.