Tk Source Code

Check-in [84b404a0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix indentation of previous commit, and move one character into quotations in SC_TCL_LINDEX.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | buildtools
Files: files | file ages | folders
SHA3-256: 84b404a00c8f49c8fc49201917e44ebb5eca54ff9386332d61a81113c71cab51
User & Date: yorick 2019-03-27 08:41:35.555
Context
2019-03-27
15:22
regenerate unix/configure Closed-Leaf check-in: 9aa8c497 user: yorick tags: buildtools
09:06
merge buildtools

dgp -- Pushed this commit off the trunk, it breaks the build.

Symptoms suggest that a working tcl.h is not found (some broken one is found in stead?) and then compile of Tk fails quickly. Closed-Leaf check-in: f3d8527b user: yorick tags: mistake

08:41
Fix indentation of previous commit, and move one character into quotations in SC_TCL_LINDEX. check-in: 84b404a0 user: yorick tags: buildtools
08:30
Improve ability to find Tcl sources at build time. This introduces a new build-time dependency: A working tclsh version 8.6 or higher must be available in the build environment. check-in: e73977c5 user: yorick tags: buildtools
Changes
Unified Diff Ignore Whitespace Patch
Changes to unix/tcl.m4.
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559

560
561
562
563
564
565
566
567
568
#	Substitutes the following vars:
#		TCL_SOURCE_MAJOR_VERSION
#		TCL_SOURCE_MINOR_VERSION
#		TCL_ACTUAL_SRC_DIR
#------------------------------------------------------------------------

AC_DEFUN([SC_TCL_FIND_SOURCES],[
	[TCL_ACTUAL_SRC_DIR=` <<-'EOF' "$TCLSH_PROG" - "$srcdir" "$TCL_SRC_DIR" \
		"$TCL_MAJOR_VERSION" "$TCL_MINOR_VERSION"

	proc cat fname {
		set chan [open $fname]
		try {
			read $chan
		} finally {
			close $chan
		}
	}

	proc main {argv0 argv} {
		try {
			lassign $argv -> srcdir tcl_src_dir majortarget minortarget
			lappend candidates $tcl_src_dir
			set srcdir [file dirname [file normalize $srcdir/...]]
			set topsrcdir [file dirname $srcdir]
			set sources [file dirname $topsrcdir]
			foreach dirname [glob -nocomplain -directory $sources *] {
				if {$dirname ni $candidates} {
					lappend candidates $dirname
				}
			}
			foreach candidate $candidates {
				set res [check $candidate $majortarget $minortarget]
				if {$res eq {}} continue else {
					puts -nonewline $res
					break
				}
			}
			set status 0
		} on error {tres topts} {
			puts stderr [dict get $topts -errorinfo]
			set status 1
		}
		exit $status
	}

	proc check {candidate majortarget minortarget} {
		set tclh $candidate/generic/tcl.h

		if {![file exists $tclh]} {
			return {} 
		}

		set version [tclhversion [cat $tclh]]
		if {[llength $version]} {
			lassign $version major minor
			if {[package vcompare $major.$minor \
				$majortarget.$minortarget] >= 0} {
				return [list $candidate $major $minor]
			}
		}

		return {} 
	}

	proc tclhversion data {
		if {[regexp -line {^#define\s+_TCL} $data]} {
			if {[
				regexp -line {^#define\s+TCL_VERSION\s+\"([^.])+\.([^.\"]+)} \
					$data -> major minor
			]} {
				return [list $major $minor]
			}
		}
		return {}
	}
	main $argv0 $argv
	EOF
	]
	`

	if test "x${TCL_ACTUAL_SRC_DIR}" = x; then
		AC_MSG_ERROR([could not find Tcl sources])
	else
		TCL_SOURCE_MAJOR_VERSION=SC_TCL_LINDEX([$TCL_ACTUAL_SRC_DIR] ,1)
		AC_SUBST(TCL_SOURCE_MAJOR_VERSION)
		TCL_SOURCE_MINOR_VERSION=SC_TCL_LINDEX([$TCL_ACTUAL_SRC_DIR] ,2)
		AC_SUBST(TCL_SOURCE_MINOR_VERSION)
		TCL_ACTUAL_SRC_DIR=SC_TCL_LINDEX([$TCL_ACTUAL_SRC_DIR] ,0)
		AC_SUBST(TCL_ACTUAL_SRC_DIR)
	fi
])


#------------------------------------------------------------------------
# SC_TCL_LINDEX
#------------------------------------------------------------------------

AC_DEFUN([SC_TCL_LINDEX],
	[[` <<-'EOF' "$TCLSH_PROG" - "$1" "$2"
		proc main {argv0 argv} {
			try {
				lassign $argv -> list index
				puts -nonewline [lindex $list $index]
				set status 0
			} on error {tres topts} {
				puts stderr [dict get $topts -errorinfo]
				set status 1
			}
			exit $status
		}
		main $argv0 $argv
		EOF

	]]
	`
)

#------------------------------------------------------------------------
# SC_PROG_TCLSH
#	Locate a tclsh shell installed on the system path. This macro
#	will only find a Tcl shell that already exists on the system.
#	It will not find a Tcl shell in the Tcl build directory or







|
|

|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|

|
|
|

|
|
|
|
|
|
|
|

|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|








|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
|







447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
#	Substitutes the following vars:
#		TCL_SOURCE_MAJOR_VERSION
#		TCL_SOURCE_MINOR_VERSION
#		TCL_ACTUAL_SRC_DIR
#------------------------------------------------------------------------

AC_DEFUN([SC_TCL_FIND_SOURCES],[
    [TCL_ACTUAL_SRC_DIR=` <<-'EOF' "$TCLSH_PROG" - "$srcdir" "$TCL_SRC_DIR" \
	"$TCL_MAJOR_VERSION" "$TCL_MINOR_VERSION"

    proc cat fname {
	set chan [open $fname]
	try {
	    read $chan
	} finally {
	    close $chan
	}
    }

    proc main {argv0 argv} {
	try {
	    lassign $argv -> srcdir tcl_src_dir majortarget minortarget
	    lappend candidates $tcl_src_dir
	    set srcdir [file dirname [file normalize $srcdir/...]]
	    set topsrcdir [file dirname $srcdir]
	    set sources [file dirname $topsrcdir]
	    foreach dirname [glob -nocomplain -directory $sources *] {
		if {$dirname ni $candidates} {
		    lappend candidates $dirname
		}
	    }
	    foreach candidate $candidates {
		set res [check $candidate $majortarget $minortarget]
		if {$res eq {}} continue else {
		    puts -nonewline $res
		    break
		}
	    }
	    set status 0
	} on error {tres topts} {
	    puts stderr [dict get $topts -errorinfo]
	    set status 1
	}
	exit $status
    }

    proc check {candidate majortarget minortarget} {
	set tclh $candidate/generic/tcl.h

	if {![file exists $tclh]} {
	    return {} 
	}

	set version [tclhversion [cat $tclh]]
	if {[llength $version]} {
	    lassign $version major minor
	    if {[package vcompare $major.$minor \
		$majortarget.$minortarget] >= 0} {
		return [list $candidate $major $minor]
	    }
	}

	return {} 
    }

    proc tclhversion data {
	if {[regexp -line {^#define\s+_TCL} $data]} {
	    if {[
		regexp -line {^#define\s+TCL_VERSION\s+\"([^.])+\.([^.\"]+)} \
		    $data -> major minor
	    ]} {
		return [list $major $minor]
	    }
	}
	return {}
    }
    main $argv0 $argv
    EOF
    ]
    `

    if test "x${TCL_ACTUAL_SRC_DIR}" = x; then
	AC_MSG_ERROR([could not find Tcl sources])
    else
	TCL_SOURCE_MAJOR_VERSION=SC_TCL_LINDEX([$TCL_ACTUAL_SRC_DIR] ,1)
	AC_SUBST(TCL_SOURCE_MAJOR_VERSION)
	TCL_SOURCE_MINOR_VERSION=SC_TCL_LINDEX([$TCL_ACTUAL_SRC_DIR] ,2)
	AC_SUBST(TCL_SOURCE_MINOR_VERSION)
	TCL_ACTUAL_SRC_DIR=SC_TCL_LINDEX([$TCL_ACTUAL_SRC_DIR] ,0)
	AC_SUBST(TCL_ACTUAL_SRC_DIR)
    fi
])


#------------------------------------------------------------------------
# SC_TCL_LINDEX
#------------------------------------------------------------------------

AC_DEFUN([SC_TCL_LINDEX],
    [[` <<-'EOF' "$TCLSH_PROG" - "$1" "$2"
	proc main {argv0 argv} {
	    try {
		lassign $argv -> list index
		puts -nonewline [lindex $list $index]
		set status 0
	    } on error {tres topts} {
		puts stderr [dict get $topts -errorinfo]
		set status 1
	    }
	    exit $status
	}
	main $argv0 $argv
	EOF
    `
    ]]
    
)

#------------------------------------------------------------------------
# SC_PROG_TCLSH
#	Locate a tclsh shell installed on the system path. This macro
#	will only find a Tcl shell that already exists on the system.
#	It will not find a Tcl shell in the Tcl build directory or