[PATCH] build-aux/tcltk.m4: Simplify tclConfig.sh searching

Lee Duhem <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.gnu.general
Message-ID <CAOSer0CGZ4RnCiw0=iYVcuMDvibNeOX3bQVY35eSKd+g3p2KHA@mail.gmail.com>
Hi,

Even if my building system already has tclConfig.sh, configure script
still cannot find it,
because it is looking at the wrong places.

According to Tcl wiki article [1], the following Tcl code can give the
location of tclConfig.sh
directly:

[::tcl::pkgconfig get libdir,install]

So we can use it to simplify the searching rules in build-aux/tcltk.m4.

Tested on Fedora 25 and Ubuntu 14.04, looks like working on both systems.

Regards,
libin

ChangeLog

+2017-02-27  Lee Duhem  <[email protected]>
+
+ * build-aux/tcltk.m4: Simplify tclConfig.sh searching


[1] http://wiki.tcl.tk/12968

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
0001-build-aux-tcltk.m4-Simplify-tclConfig.sh-searching.patch (text/x-patch, 2.6 KB)
From 56326c9bb1e0d42ccd49c99ffc3a8b7fb3121cc2 Mon Sep 17 00:00:00 2001
From: Lee Duhem <[email protected]>
Date: Mon, 27 Feb 2017 16:03:13 +0800
Subject: [PATCH] build-aux/tcltk.m4: Simplify tclConfig.sh searching

Instead of searching tclConfig.sh semi-manually, Tcl code
'[::tcl::pkgconfig get libdir,install]' can give its location
directly.
---
 ChangeLog          |  4 ++++
 build-aux/tcltk.m4 | 25 +------------------------
 2 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a40b68d..5147343 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-02-27  Lee Duhem  <[email protected]>
+
+	* build-aux/tcltk.m4: Simplify tclConfig.sh searching
+
 2015-11-07  Holger Hans Peter Freyther  <[email protected]>
 
 	* build-aux/overflow-builtins.m4: Add new macro.
diff --git a/build-aux/tcltk.m4 b/build-aux/tcltk.m4
index 29a2ff9..e9bf04b 100644
--- a/build-aux/tcltk.m4
+++ b/build-aux/tcltk.m4
@@ -13,36 +13,13 @@ if test "x$with_tcl" = x || test "$with_tcl" = yes; then
   exec AS_MESSAGE_FD([])>/dev/null
   AC_PATH_PROG(TCLSH, tclsh)
 
-  case $libdir in
-    $bindir | $prefix | '${prefix}') libpath=lib ;;
-    *) libpath=`echo ${libdir} | sed s:.*/::` ;;
-  esac
-
-  dataroot2lib='s,\(.*\)/'`echo ${datarootdir} | sed s:.*/::`,'\1'/$libpath,
   test "$silent" != yes && exec AS_MESSAGE_FD([])>&1
   if test -n "$TCLSH"; then
     for i in ${TCLSH}*; do
       if test -x $i; then
-        with_tcl=`echo 'puts $tcl_library' | $i 2> /dev/null`
+        with_tcl=`echo 'puts [[::tcl::pkgconfig get libdir,install]]' | $i 2> /dev/null`
         if test "x$with_tcl" != x; then
-          # Assign the name we found to the TCLSH variable, and try
-	  # to remove the last component from the path and to change
-	  # /usr/share to /usr/lib
 	  TCLSH=$i
-          test -f "$with_tcl/../../tclConfig.sh" && with_tcl="$with_tcl/../.." && break
-          test -f "$with_tcl/../tclConfig.sh" && with_tcl="$with_tcl/.." && break
-          test -f "$with_tcl/tclConfig.sh" && break
-          with_tcl=`echo "$with_tcl" | sed $dataroot2lib`
-	  # Do not bother testing /usr/lib/tcl8.5/tclConfig.sh if there is one
-	  # in /usr/lib.
-          if test -f "$with_tcl/../tclConfig.sh"; then :; else
-            test -f "$with_tcl/tclConfig.sh" && break
-          fi
-          with_tcl=`echo "$with_tcl" | sed 's:/[[^/]]*/\{0,1\}$::'`
-          if test -f "$with_tcl/../tclConfig.sh"; then :; else
-            test -f "$with_tcl/tclConfig.sh" && break
-          fi
-          with_tcl=`echo "$with_tcl" | sed 's:/[[^/]]*/\{0,1\}$::'`
           test -f "$with_tcl/tclConfig.sh" && break
         fi
 	with_tcl=no
-- 
2.9.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.