Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -1,8 +1,8 @@ # -*- make -*- -# FILE: "/disk01/home/joze/src/tclreadline/Makefile.in" -# LAST MODIFICATION: "Wed Sep 29 10:57:20 1999 (joze)" +# FILE: "/home/joze/src/tclreadline/Makefile.in" +# LAST MODIFICATION: "Thu Dec 16 22:09:55 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, # $Id$ # --- # # tclreadline -- gnu readline for tcl @@ -56,10 +56,12 @@ # at configure-time with the --exec-prefix and --prefix options # to the "configure" script. prefix = @prefix@ exec_prefix = @exec_prefix@ + +bindir = @bindir@ # The following definition can be set to non-null for special systems # like AFS with replication. It allows the pathnames used for installation # to be different than those used for actually reference files at # run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix @@ -136,10 +138,12 @@ #---------------------------------------------------------------- RANLIB = @RANLIB@ TOP_DIR = $(srcdir) TCL_INCLUDE_DIR = @TCL_INCLUDE_DIR@ +TCL_LIB_SPEC = @TCL_LIB_SPEC@ +TK_LIB_SPEC = @TK_LIB_SPEC@ READLINE_INCLUDE_DIR = @READLINE_INCLUDE_DIR@ TCLREADLINE_LIB_FILE = @TCLREADLINE_LIB_FILE@ READLINE_LIB = -L@READLINE_LIB_DIR@ -lreadline TERMLIB = @TERMLIB@ @@ -176,11 +180,13 @@ tclreadline.h.in \ tclreadline.n.in \ tclreadlineConfig.sh.in \ tclreadlineInit.tcl.in \ tclreadlineSetup.tcl.in \ - tclreadlineCompleter.tcl + tclreadlineCompleter.tcl \ + tclshrl.c \ + wishrl.c MISC = TODO AUXILIARY = \ aux/config.guess \ @@ -193,10 +199,11 @@ HTML = tclreadline.n.html CIFLAGS = -f -t-"gnu readline for tcl" -m"before initial relase" all: $(TCLREADLINE_LIB_FILE) + .PHONY: clean distclean ctags tcltags vimtags tags ci co .SUFFIXES: .c .o .so .sl .tcl @@ -205,11 +212,30 @@ @TCLREADLINE_LIB_FILE@: ${OBJS} rm -f $(TCLREADLINE_LIB_FILE) @MAKE_LIB@ $(TERMLIB_DIR) $(READLINE_LIB) $(TERMLIB) $(RANLIB) $(TCLREADLINE_LIB_FILE) +shells: tclshrl wishrl + +tclshrl: $(OBJS) tclshrl.o + $(CC) -o tclshrl tclshrl.o $(OBJS) $(TERMLIB_DIR) $(READLINE_LIB) $(TERMLIB) $(TCL_LIB_SPEC) + +wishrl: $(OBJS) wishrl.o + $(CC) -o wishrl wishrl.o $(OBJS) $(TERMLIB_DIR) $(READLINE_LIB) $(TERMLIB) $(TK_LIB_SPEC) + install: install-binaries install-libraries install-man + +install-shells: install-tclshrl install-wishrl + +install-tclshrl: + $(MKINSTALLDIRS) $(bindir) + $(INSTALL_PROGRAM) tclshrl $(bindir)/tclshrl + +install-wishrl: + $(MKINSTALLDIRS) $(bindir) + $(INSTALL_PROGRAM) wishrl $(bindir)/wishrl + install-man: $(MANN_INSTALL_DIR)/$(MAN) install-binaries: $(TCLREADLINE_LIB_FILE) @$(MKINSTALLDIRS) $(LIBRARY_INSTALL_DIR) @echo "Installing $(TCLREADLINE_LIB_FILE)" @@ -259,10 +285,16 @@ autoconf tclreadline.o: $(TOP_DIR)/tclreadline.c Makefile $(CC) -c $(CC_SWITCHES) $(DEFS) $(TOP_DIR)/tclreadline.c +tclshrl.o: $(TOP_DIR)/tclshrl.c Makefile + $(CC) -c $(CC_SWITCHES) $(DEFS) $(TOP_DIR)/tclshrl.c + +wishrl.o: $(TOP_DIR)/wishrl.c Makefile + $(CC) -c $(CC_SWITCHES) $(DEFS) $(TOP_DIR)/wishrl.c + ctags: ctags -R tcltags: ctags tclreadlineInit.tcl.in tclreadlineSetup.tcl.in \ tclreadlineCompleter.tcl Index: README ================================================================== --- README +++ README @@ -1,8 +1,8 @@ FILE: "/home/joze/src/tclreadline/README" - LAST MODIFICATION: "Tue Sep 21 21:21:36 1999 (joze)" + LAST MODIFICATION: "Thu Dec 16 22:17:39 1999 (joze)" (C) 1998, 1999 by Johannes Zellner, $Id$ --- tclreadline -- gnu readline for tcl @@ -58,11 +58,29 @@ (b) Make sure you have gnu readline 2.2 or higher. tclreadline uses the gnu readline callback handler, which wasn't implemented in early releases. -The usual ./configure; make; make install sequence should do the rest. + (c) The usual ./configure; make; make install sequence should do the rest. + + (d) Optionally (or additionally) you can build the executables + tclshrl and / or wishrl which are a readline enhanced replacement + for tclsh and wish. To compile these executable you should type + make tclshrl + or + make wishrl + or + make shells + the latter will compile both shells. To install these shells + you should type + make install-tclshrl + or + make install-wishrl + or + make install-shells + Building these executables is discouraged but necessary + on systems which don't support shared libs. 4. Using tclreadline for interactive tcl scripting. --------------------------------------------------- Index: configure.in ================================================================== --- configure.in +++ configure.in @@ -1,53 +1,54 @@ -# -*- autoconf -*- -# FILE: "/home/joze/src/tclreadline/configure.in" -# LAST MODIFICATION: "Tue Sep 28 22:51:45 1999 (joze)" -# (C) 1998, 1999 by Johannes Zellner, -# $Id$ -# --- -# -# tclreadline -- gnu readline for tcl -# Copyright (C) 1999 Johannes Zellner -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# johannes@zellner.org -# http://www.zellner.org/tclreadline/ -# -# ================================================================== */ +dnl -*- autoconf -*- +dnl FILE: "/home/joze/src/tclreadline/configure.in" +dnl LAST MODIFICATION: "Thu Dec 16 22:01:33 1999 (joze)" +dnl (C) 1998, 1999 by Johannes Zellner, +dnl $Id$ +dnl --- +dnl +dnl tclreadline -- gnu readline for tcl +dnl Copyright (C) 1999 Johannes Zellner +dnl +dnl This program is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU General Public License +dnl as published by the Free Software Foundation; either version 2 +dnl of the License, or (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl +dnl johannes@zellner.org +dnl http://www.zellner.org/tclreadline/ +dnl +dnl ================================================================== */ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. -AC_REVISION($Revision$) AC_INIT(tclreadline.c) AC_CONFIG_HEADER(config.h) +AC_PREREQ(2.13) +AC_REVISION($Revision$) +AC_CONFIG_AUX_DIR(./aux) TCLREADLINE_MAJOR_VERSION=1 TCLREADLINE_MINOR_VERSION=0 -TCLREADLINE_PATCHLEVEL=3 +TCLREADLINE_PATCHLEVEL=5 TCLREADLINE_VERSION=$TCLREADLINE_MAJOR_VERSION.$TCLREADLINE_MINOR_VERSION TCLREADLINE_PATCHLEVEL_STR=${TCLREADLINE_VERSION}.${TCLREADLINE_PATCHLEVEL} VERSION=$TCLREADLINE_VERSION +dnl AM_INIT_AUTOMAKE(tclreadline, $VERSION) -AC_PREREQ(2.13) -AC_CONFIG_AUX_DIR(./aux) AC_CANONICAL_HOST TCLREADLINE_LPATH=`echo $LD_LIBRARY_PATH $LD_RUN_PATH $LPATH | sed 's/:/ /g'` TCLREADLINE_LPATH="$TCLREADLINE_LPATH /usr/local/lib /lib /usr/lib /usr/shlib" @@ -80,10 +81,43 @@ . $TCL_LIB_DIR/tclConfig.sh AC_MSG_RESULT($TCL_LIB_DIR/tclConfig.sh) AC_MSG_CHECKING([for your tcl version]) AC_MSG_RESULT([$TCL_VERSION, patchlevel $TCL_PATCH_LEVEL]) fi + +#-------------------------------------------------------------------- +# eventually check for tkConfig.sh +#-------------------------------------------------------------------- + +tk_search="no" +AC_ARG_WITH( + tk, + [ --with-tk=DIR where to look for tclConfig.sh], + tk_search=$withval, + tk_search="yes" +) + +if test "$tk_search" != "no"; then + AC_MSG_CHECKING([which tkConfig.sh to use]) + TK_LIB_DIR="" + for dir in $tk_search /usr/lib /usr/local/lib $exec_prefix/lib /usr/local/lib/unix /opt/tcl/lib; do + if test -r $dir/tkConfig.sh; then + TK_LIB_DIR=$dir + break + fi + done + + if test -z "$TK_LIB_DIR"; then + AC_MSG_ERROR(Can't find Tk libraries.) + else + . $TK_LIB_DIR/tkConfig.sh + AC_MSG_RESULT($TK_LIB_DIR/tkConfig.sh) + AC_MSG_CHECKING([for your tk version]) + AC_MSG_RESULT([$TK_VERSION, patchlevel $TK_PATCH_LEVEL]) + fi + AC_SUBST(TK_LIB_SPEC) +fi #-------------------------------------------------------------------- # Read in configuration information generated by Tcl for shared # libraries, and arrange for it to be substituted into our # Makefile. @@ -205,12 +239,11 @@ # building libtclreadline as a shared library instead of a static library. # (static is not implemented yet anyway). #-------------------------------------------------------------------- AC_ARG_ENABLE(shared, - [ --disable-shared don't build libtclreadline as a shared library - (not implemented -- probably never).], + [ --disable-shared don't build libtclreadline as a shared library.], [ok=$enableval], [ok=yes]) if test "$ok" = "yes"; then if test ${TCL_SHARED_BUILD} = 0; then AC_MSG_ERROR(Tcl was not built with --enable-shared, so you can't use shared libraries.) fi @@ -218,14 +251,13 @@ eval "TCLREADLINE_LIB_FILE=libtclreadline${VERSION}${SHLIB_SUFFIX}" TCLREADLINE_PKG_FILE="[[file join [file dirname \$dir] ${TCLREADLINE_LIB_FILE}]]" MAKE_LIB="\$(SHLIB_LD) -o ${TCLREADLINE_LIB_FILE} \$(OBJS) ${SHLIB_LD_LIBS}" RANLIB=":" else - AC_MSG_ERROR(non-shared not implemented yet. (probably never)) SHLIB_CFLAGS="" eval "TCLREADLINE_LIB_FILE=libtclreadline${VERSION}.a" - TCLREADLINE_PKG_FILE="" + TCLREADLINE_PKG_FILE="[[file join [file dirname \$dir] ${TCLREADLINE_LIB_FILE}]]" MAKE_LIB="ar cr ${TCLREADLINE_LIB_FILE} \${OBJS}" fi # Note: in the following variable, it's important to use the absolute # path name of the Tcl directory rather than "..": this is because @@ -300,11 +332,11 @@ containing readline.h on your system.]) else AC_MSG_RESULT($READLINE_INCLUDE_DIR/readline.h) base="`(basename ${READLINE_INCLUDE_DIR}) 2>/dev/null`" if test "x${base}" != "xreadline"; then - AC_DEFINE_UNQUOTED(READLINE_LIBRARY, 1) + AC_DEFINE_UNQUOTED(READLINE_LIBRARY, 1, [ Define if we have libreadline. ]) fi fi @@ -425,21 +457,21 @@ AC_MSG_CHECKING([for _rl_executing_macro in -lreadline]) AC_TRY_LINK(,[ extern char* _rl_executing_macro; _rl_executing_macro = (char*) 0; ], - AC_MSG_RESULT(yes); AC_DEFINE_UNQUOTED(EXECUTING_MACRO_HACK, 1), + AC_MSG_RESULT(yes); AC_DEFINE_UNQUOTED(EXECUTING_MACRO_HACK, 1, [define, if _rl_executing_macro is resolved in libreadline]), AC_MSG_RESULT(no)) # check for readline's rl_cleanup_after_signal AC_MSG_CHECKING([for rl_cleanup_after_signal() in -lreadline]) AC_TRY_LINK(,[ extern void rl_cleanup_after_signal(); rl_cleanup_after_signal(); ], - AC_MSG_RESULT(yes); AC_DEFINE_UNQUOTED(CLEANUP_AFER_SIGNAL, 1), + AC_MSG_RESULT(yes); AC_DEFINE_UNQUOTED(CLEANUP_AFER_SIGNAL, 1, [define, if rl_cleanup_after_signal is resolved in libreadline]), AC_MSG_RESULT(no)) AC_MSG_CHECKING([for the readline version number]) AC_TRY_RUN([ @@ -472,10 +504,11 @@ AC_SUBST(TCLREADLINE_LIBRARY) AC_SUBST(TCLREADLINE_PATCHLEVEL_STR) AC_SUBST(TCL_LIB_DIR) +AC_SUBST(TCL_LIB_SPEC) AC_SUBST(TCL_INCLUDE_DIR) AC_SUBST(READLINE_INCLUDE_DIR) AC_SUBST(CFLAGS) AC_SUBST(DL_LIBS) Index: tclreadlineInit.tcl.in ================================================================== --- tclreadlineInit.tcl.in +++ tclreadlineInit.tcl.in @@ -1,8 +1,8 @@ #!/usr/local/bin/tclsh -# FILE: "/disk01/home/joze/src/tclreadline/tclreadlineInit.tcl.in" -# LAST MODIFICATION: "Wed Sep 15 15:23:16 1999 (joze)" +# FILE: "/home/joze/src/tclreadline/tclreadlineInit.tcl.in" +# LAST MODIFICATION: "Thu Dec 16 21:44:31 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, # $Id$ # --- # # tclreadline -- gnu readline for tcl @@ -32,19 +32,22 @@ namespace eval tclreadline:: { namespace export Init } proc ::tclreadline::Init {} { - - if [catch {load @TCLREADLINE_LIBRARY@/@TCLREADLINE_LIB_FILE@} msg] { + uplevel #0 { + if ![info exists tclreadline::library] { + if [catch {load /usr/lib/tclreadline1.0/libtclreadline1.0.so} msg] { puts stderr $msg exit 2 + } } + } } tclreadline::Init ::tclreadline::readline customcompleter ::tclreadline::ScriptCompleter source [file join [file dirname [info script]] tclreadlineSetup.tcl] set auto_index(::tclreadline::ScriptCompleter) \ [list source [file join [file dirname [info script]] tclreadlineCompleter.tcl]]