Tcl Source Code

View Ticket
Bounty program for improvements to Tcl and certain Tcl packages.
Ticket UUID: 9080d6a8719acefd900daf3e8105d27ad7780b5a
Title: Build fix for tcl on macOS on Apple Silicon
Type: Bug Version: 8.5.19
Submitter: jeremyhu Created on: 2020-06-24 05:50:57
Subsystem: - New Builtin Commands Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Pending Last Modified: 2020-06-24 14:47:37
Resolution: Fixed Closed By: nobody
    Closed on:
Implicit functions are errors on darwin/arm64, so the following changes are needed to tcl's configure scripts (in addition to the changes in to build correctly on darwin/arm64:

diff --git a/vendor/tcl8.5.19/unix/ b/vendor/tcl8.5.19/unix/
index e4255b6df..af2a26a14 100755
--- a/unix/
+++ b/unix/
@@ -453,6 +453,7 @@ fi
 AC_CACHE_CHECK([for a putenv() that copies the buffer], tcl_cv_putenv_copy, [
 	#include <stdlib.h>
+	#include <string.h>
 	#define OURVAR "havecopy=yes"
 	int main (int argc, char *argv[])
diff --git a/vendor/tcl8.5.19/unix/tcl.m4 b/vendor/tcl8.5.19/unix/tcl.m4
index a7faae550..f482460ce 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -2587,6 +2587,7 @@ AC_DEFUN([SC_BUGGY_STRTOD], [
     if test "$tcl_strtod" = 1; then
 	AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
+		#include <stdlib.h>
 		extern double strtod();
 		int main() {
 		    char *infString="Inf", *nanString="NaN", *spaceString=" ";
@@ -2864,7 +2865,10 @@ AC_DEFUN([SC_TCL_CHECK_BROKEN_FUNC],[
     AC_CHECK_FUNC($1, tcl_ok=1, tcl_ok=0)
     if test ["$tcl_ok"] = 1; then
 	AC_CACHE_CHECK([proper ]$1[ implementation], [tcl_cv_]$1[_unbroken],
-	    AC_TRY_RUN([[int main() {]$2[}]],[tcl_cv_]$1[_unbroken]=ok,
+	    AC_TRY_RUN([[
+#include <stdlib.h>
+#include <string.h>
+int main() {]$2[}]],[tcl_cv_]$1[_unbroken]=ok,
 	if test ["$tcl_cv_]$1[_unbroken"] = "ok"; then
User Comments: jan.nijtmans added on 2020-06-24 14:47:37:

Merged to core-8-5-branch. Tomorrow (After Travis gives current build results) I'll continue merging the same thing up to the other branches (core-8-6-branch, core-8-branch and trunk)

Thanks for the report and the patch!