diff options
author | yorick <yorick> | 2019-03-27 15:25:33 (GMT) |
---|---|---|
committer | yorick <yorick> | 2019-03-27 15:25:33 (GMT) |
commit | 82357f3faeb159ca4a2784983f0a83998a546d02 (patch) | |
tree | 686a84f3b067b46287eb8ee7475be1d8b58e55cc | |
parent | 8bbc14293d2224c22250cce49da45f36c2ca72ae (diff) | |
parent | 3c306356f49d55b142cf859fd36a09c7cad486ae (diff) | |
download | tk-82357f3faeb159ca4a2784983f0a83998a546d02.zip tk-82357f3faeb159ca4a2784983f0a83998a546d02.tar.gz tk-82357f3faeb159ca4a2784983f0a83998a546d02.tar.bz2 |
merge buildtools
-rw-r--r-- | unix/Makefile.in | 16 | ||||
-rwxr-xr-x | unix/configure | 229 | ||||
-rw-r--r-- | unix/configure.ac | 4 | ||||
-rw-r--r-- | unix/tcl.m4 | 134 |
4 files changed, 325 insertions, 58 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in index 86a8a61..56c343b 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -100,11 +100,11 @@ DEMO_INSTALL_DIR = $(INSTALL_ROOT)$(TK_LIBRARY)/demos # The directory containing the Tcl sources and headers appropriate # for this version of Tk ("srcdir" will be replaced or has already # been replaced by the configure script): -TCL_GENERIC_DIR = @TCL_SRC_DIR@/generic +TCL_GENERIC_DIR = @TCL_ACTUAL_SRC_DIR@/generic # The directory containing the platform specific Tcl sources and headers # appropriate for this version of Tk: -TCL_PLATFORM_DIR = @TCL_SRC_DIR@/unix +TCL_PLATFORM_DIR = @TCL_ACTUAL_SRC_DIR@/unix # The directory containing the Tcl library archive file appropriate # for this version of Tk: @@ -310,7 +310,7 @@ GENERIC_DIR = $(TOP_DIR)/generic TTK_DIR = $(GENERIC_DIR)/ttk UNIX_DIR = $(TOP_DIR)/unix BMAP_DIR = $(TOP_DIR)/bitmaps -TOOL_DIR = @TCL_SRC_DIR@/tools +TOOL_DIR = @TCL_ACTUAL_SRC_DIR@/tools TEST_DIR = $(TOP_DIR)/tests MAC_OSX_DIR = $(TOP_DIR)/macosx XLIB_DIR = $(TOP_DIR)/xlib @@ -566,7 +566,7 @@ DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget SHELL_ENV = \ @LD_LIBRARY_PATH_VAR@="`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}"; \ export @LD_LIBRARY_PATH_VAR@; \ - TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \ + TCL_LIBRARY=@TCL_ACTUAL_SRC_DIR@/library; export TCL_LIBRARY; \ TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY; all: binaries libraries doc @@ -576,7 +576,7 @@ binaries: ${LIB_FILE} ${WISH_EXE} libraries: $(TOP_DIR)/doc/man.macros: - $(INSTALL_DATA) @TCL_SRC_DIR@/doc/man.macros $(TOP_DIR)/doc/man.macros + $(INSTALL_DATA) $(TCLDIR)/doc/man.macros $(TOP_DIR)/doc/man.macros doc: $(TOP_DIR)/doc/man.macros @@ -682,7 +682,7 @@ demo: # This target can be used to run wish inside either gdb or insight gdb: ${WISH_EXE} @echo "set env @LD_LIBRARY_PATH_VAR@=\"`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}\"" > gdb.run - @echo "set env TCL_LIBRARY=@TCL_SRC_DIR@/library" >> gdb.run + @echo "set env TCL_LIBRARY=@TCL_ACTUAL_SRC_DIR@/library" >> gdb.run @echo "set env TK_LIBRARY=@TK_SRC_DIR@/library" >> gdb.run gdb ./${WISH_EXE} --command=gdb.run rm gdb.run @@ -1534,7 +1534,7 @@ DISTROOT = /tmp/dist DISTNAME = tk${VERSION}${PATCH_LEVEL} ZIPNAME = tk${MAJOR_VERSION}${MINOR_VERSION}${PATCH_LEVEL}-src.zip DISTDIR = $(DISTROOT)/$(DISTNAME) -TCLDIR = @TCL_SRC_DIR@ +TCLDIR = @TCL_ACTUAL_SRC_DIR@ DIST_INSTALL_DATA = CPPROG='cp -p' $(INSTALL) -m 644 DIST_INSTALL_SCRIPT = CPPROG='cp -p' $(INSTALL) -m 755 @@ -1691,7 +1691,7 @@ BUILD_HTML = \ $(SHELL_ENV) TCLSH="$(BUILD_TCLSH)"; else \ TCLSH="$(TCL_EXE)"; fi ;\ "$${TCLSH}" $(TOOL_DIR)/tcltk-man2html.tcl --htmldir="$(HTML_INSTALL_DIR)" \ - --srcdir=$(TOP_DIR)/.. $(BUILD_HTML_FLAGS) + --tk --srcdir=$(TOP_DIR) $(BUILD_HTML_FLAGS) # # The list of all the targets that do not correspond to real files. This stops diff --git a/unix/configure b/unix/configure index cf5ce30..d7408c4 100755 --- a/unix/configure +++ b/unix/configure @@ -707,8 +707,6 @@ LDFLAGS CFLAGS CC MAN_FLAGS -BUILD_TCLSH -TCLSH_PROG TCL_STUB_LIB_SPEC TCL_STUB_LIB_FLAG TCL_STUB_LIB_FILE @@ -719,6 +717,11 @@ TCL_SRC_DIR TCL_BIN_DIR TCL_PATCH_LEVEL TCL_VERSION +TCL_ACTUAL_SRC_DIR +TCL_SOURCE_MINOR_VERSION +TCL_SOURCE_MAJOR_VERSION +BUILD_TCLSH +TCLSH_PROG target_alias host_alias build_alias @@ -2288,6 +2291,47 @@ LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" # Find and load the tclConfig.sh file #-------------------------------------------------------------------- + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5 +$as_echo_n "checking for tclsh... " >&6; } + if ${ac_cv_path_tclsh+:} false; then : + $as_echo_n "(cached) " >&6 +else + + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/tclsh[8-9]* 2> /dev/null` \ + `ls -r $dir/tclsh* 2> /dev/null` ; do + if test x"$ac_cv_path_tclsh" = x ; then + if test -f "$j" ; then + ac_cv_path_tclsh=$j + break + fi + fi + done + done + +fi + + + if test -f "$ac_cv_path_tclsh" ; then + TCLSH_PROG="$ac_cv_path_tclsh" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH_PROG" >&5 +$as_echo "$TCLSH_PROG" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: No tclsh avaliable" >&5 +$as_echo "No tclsh avaliable" >&6; } + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh in Tcl build directory" >&5 +$as_echo_n "checking for tclsh in Tcl build directory... " >&6; } + BUILD_TCLSH="${TCL_BIN_DIR}"/tclsh + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_TCLSH" >&5 +$as_echo "$BUILD_TCLSH" >&6; } + + + # # Ok, lets find the tcl configuration @@ -2469,6 +2513,144 @@ $as_echo "could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6; } eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" + 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 + as_fn_error $? "could not find Tcl sources" "$LINENO" 5 + else + TCL_SOURCE_MAJOR_VERSION=` <<-'EOF' "$TCLSH_PROG" - "$TCL_ACTUAL_SRC_DIR " "1" + 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 + ` + + + + + TCL_SOURCE_MINOR_VERSION=` <<-'EOF' "$TCLSH_PROG" - "$TCL_ACTUAL_SRC_DIR " "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 + ` + + + + + TCL_ACTUAL_SRC_DIR=` <<-'EOF' "$TCLSH_PROG" - "$TCL_ACTUAL_SRC_DIR " "0" + 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 + ` + + + + + fi + + + @@ -2494,49 +2676,6 @@ fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5 -$as_echo_n "checking for tclsh... " >&6; } - if ${ac_cv_path_tclsh+:} false; then : - $as_echo_n "(cached) " >&6 -else - - search_path=`echo ${PATH} | sed -e 's/:/ /g'` - for dir in $search_path ; do - for j in `ls -r $dir/tclsh[8-9]* 2> /dev/null` \ - `ls -r $dir/tclsh* 2> /dev/null` ; do - if test x"$ac_cv_path_tclsh" = x ; then - if test -f "$j" ; then - ac_cv_path_tclsh=$j - break - fi - fi - done - done - -fi - - - if test -f "$ac_cv_path_tclsh" ; then - TCLSH_PROG="$ac_cv_path_tclsh" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH_PROG" >&5 -$as_echo "$TCLSH_PROG" >&6; } - else - # It is not an error if an installed version of Tcl can't be located. - TCLSH_PROG="" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: No tclsh found on PATH" >&5 -$as_echo "No tclsh found on PATH" >&6; } - fi - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh in Tcl build directory" >&5 -$as_echo_n "checking for tclsh in Tcl build directory... " >&6; } - BUILD_TCLSH="${TCL_BIN_DIR}"/tclsh - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_TCLSH" >&5 -$as_echo "$BUILD_TCLSH" >&6; } - - - #------------------------------------------------------------------------ # Handle the --prefix=... option #------------------------------------------------------------------------ diff --git a/unix/configure.ac b/unix/configure.ac index 5f5213d..a8c403b 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -32,6 +32,8 @@ LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" #-------------------------------------------------------------------- # Find and load the tclConfig.sh file #-------------------------------------------------------------------- +SC_PROG_TCLSH +SC_BUILD_TCLSH SC_PATH_TCLCONFIG SC_LOAD_TCLCONFIG @@ -47,8 +49,6 @@ Found config for Tcl ${TCL_VERSION}]) fi fi -SC_PROG_TCLSH -SC_BUILD_TCLSH #------------------------------------------------------------------------ # Handle the --prefix=... option diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 2f114d7..99f5d29 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -336,6 +336,8 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [ eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" + SC_TCL_FIND_SOURCES() + AC_SUBST(TCL_VERSION) AC_SUBST(TCL_PATCH_LEVEL) AC_SUBST(TCL_BIN_DIR) @@ -432,6 +434,134 @@ AC_DEFUN([SC_LOAD_TKCONFIG], [ AC_SUBST(TK_STUB_LIB_SPEC) ]) + +#------------------------------------------------------------------------ +# SC_TCL_FIND_SOURCES +# Find a directory containing Tcl sources that match the version required by +# tclConfig.sh. The sources indicated by tclConfig.sh are preferred. +# +# Arguments: +# none +# +# Results: +# 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 @@ -473,9 +603,7 @@ AC_DEFUN([SC_PROG_TCLSH], [ TCLSH_PROG="$ac_cv_path_tclsh" AC_MSG_RESULT([$TCLSH_PROG]) else - # It is not an error if an installed version of Tcl can't be located. - TCLSH_PROG="" - AC_MSG_RESULT([No tclsh found on PATH]) + AC_MSG_RESULT([No tclsh avaliable]) fi AC_SUBST(TCLSH_PROG) ]) |