Check-in [f61c58e424]
Not logged in
Overview
Comment:Apply the Gentoo patchset Gentoo ebuild: dev-tcltk/tclreadline-2.1.0-r4 Fully applied patches: * direct sed patches from the ebuild * tclreadline-2.1.0-gold.patch * tclreadline-2.1.0-rl-executing-macro.patch * tclreadline-2.1.0-rl-history-expand.patch * tclreadline-2.1.0-rl-prompt.patch Partially applied patches: * tclreadline-2.1.0-alloc-free.patch
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | origin/devel
Files: files | file ages | folders
SHA1: f61c58e4243a1769dcabdc8d2a628792a79c6cc1
User & Date: quentin@minster.io on 2014-02-19 00:07:34
Other Links: branch diff | manifest | tags
Context
2014-02-26
00:38
Harmonize file headers, indent and whitespace in all files check-in: 5f3ab55c4a user: quentin@minster.io tags: trunk, origin/devel
2014-02-19
00:07
Apply the Gentoo patchset Gentoo ebuild: dev-tcltk/tclreadline-2.1.0-r4 Fully applied patches: * direct sed patches from the ebuild * tclreadline-2.1.0-gold.patch * tclreadline-2.1.0-rl-executing-macro.patch * tclreadline-2.1.0-rl-history-expand.patch * tclreadline-2.1.0-rl-prompt.patch Partially applied patches: * tclreadline-2.1.0-alloc-free.patch check-in: f61c58e424 user: quentin@minster.io tags: trunk, origin/devel
2014-02-18
23:09
Apply the Debian patchset Debian source package: tcl-tclreadline 2.1.0-12 Fully applied patches: * complete_nontcl.patch * completion_matches.patch * completion_pbug.patch * memuse.patch * tclshpath.patch * varnames.patch Partially applied patches: * manpage.patch * tinfo.patch Dropped patches: * kfreebsd.patch * link.patch * tclrldir.patch check-in: 41d16f099d user: quentin@minster.io tags: trunk, origin/devel
Changes

Modified Makefile.am from [9010d007ac] to [e10a890a98].

16
17
18
19
20
21
22

23
24
25
26
27
28
29

libtclreadline_la_SOURCES = config.h tclreadline.c tclreadline.h
include_HEADERS = tclreadline.h

INCLUDES = -I$(TCL_INCLUDE_DIR) -I$(READLINE_INCLUDE_DIR)

## libtclreadline_la_LIBADD = $(LIBS)

libtclreadline_la_LDFLAGS = -release $(MAJOR).$(MINOR).$(PATCHLEVEL)

tclrldir = @TCLRL_DIR@
tclrl_SCRIPTS = pkgIndex.tcl tclreadlineCompleter.tcl tclreadlineInit.tcl tclreadlineSetup.tcl
INSTALL_SCRIPT = ${INSTALL_DATA}

EXTRA_DIST =                 \







>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

libtclreadline_la_SOURCES = config.h tclreadline.c tclreadline.h
include_HEADERS = tclreadline.h

INCLUDES = -I$(TCL_INCLUDE_DIR) -I$(READLINE_INCLUDE_DIR)

## libtclreadline_la_LIBADD = $(LIBS)
libtclreadline_la_LIBADD = $(TCL_LIB_SPEC) -lreadline
libtclreadline_la_LDFLAGS = -release $(MAJOR).$(MINOR).$(PATCHLEVEL)

tclrldir = @TCLRL_DIR@
tclrl_SCRIPTS = pkgIndex.tcl tclreadlineCompleter.tcl tclreadlineInit.tcl tclreadlineSetup.tcl
INSTALL_SCRIPT = ${INSTALL_DATA}

EXTRA_DIST =                 \

Added configure.ac version [84c8e6ef95].





















































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
dnl -*- autoconf -*-
dnl FILE: "/home/joze/src/tclreadline/configure.in"
dnl LAST MODIFICATION: "Mit, 10 Jan 2001 06:26:43 +0100 (joze)"
dnl (C) 1998 - 2001 by Johannes Zellner, <johannes@zellner.org>
dnl $Id$
dnl ---
dnl tclreadline -- gnu readline for tcl
dnl http://www.zellner.org/tclreadline/
dnl Copyright (c) 1998 - 2001, Johannes Zellner <johannes@zellner.org>
dnl This software is copyright under the BSD license.

AC_INIT(tclreadline.c)
AC_CONFIG_HEADERS(config.h)
AC_PREREQ(2.13)
AC_REVISION($Revision$)
AC_CONFIG_AUX_DIR(./aux)

MAJOR=2
MINOR=1
PATCHLEVEL=1
VERSION=$MAJOR.$MINOR
PATCHLEVEL_STR=$VERSION.$PATCHLEVEL

AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(PATCHLEVEL)
AC_SUBST(VERSION)
AC_SUBST(PATCHLEVEL_STR)

AM_INIT_AUTOMAKE(tclreadline, $PATCHLEVEL_STR)


AC_PROG_MAKE_SET

dnl AM_INIT_AUTOMAKE(tclreadline, $VERSION)

AC_CANONICAL_HOST
AC_PROG_CC
AC_EXEEXT
dnl AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)

AC_C_CONST
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_LN_S


# -- WHICH TCL TO USE
AC_ARG_WITH(
    tcl,
    [  --with-tcl=DIR          where to look for tclConfig.sh],
    tcl_search=$withval,
    tcl_search=""
)

AC_MSG_CHECKING([which tclConfig.sh to use])
TCL_LIB_DIR=""
for dir in $tcl_search /usr/lib /usr/local/lib $exec_prefix/lib /usr/local/lib/unix /opt/tcl/lib; do
    if test -r $dir/tclConfig.sh; then
        TCL_LIB_DIR=$dir
        break
    fi
done

if test -z "$TCL_LIB_DIR"; then
    AC_MSG_ERROR(Can't find Tcl libraries.  Use --with-tcl to specify the directory containing tclConfig.sh on your system.)
fi

. $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])

# Check, if tcl_version is > 8.0
if test $TCL_MAJOR_VERSION -lt 8; then
    AC_MSG_ERROR(need tcl 8.0 or higher.)
fi


# -----------------------------------------------------------------------
#   Set up a new default --prefix.
# -----------------------------------------------------------------------

# this is the default anyway:
# AC_PREFIX_DEFAULT(/usr/local)

if test "${prefix}" = "NONE"; then
    prefix=$TCL_PREFIX
fi
TCLRL_LIBDIR="${prefix}/lib"
AC_SUBST(TCLRL_LIBDIR)
TCLRL_DIR="${TCLRL_LIBDIR}/tclreadline$VERSION"
AC_SUBST(TCLRL_DIR)

# HEADERS
AC_HEADER_STDC
AC_CHECK_HEADERS(string.h)

#--------------------------------------------------------------------
#   Check for tcl.h
#--------------------------------------------------------------------

AC_ARG_WITH(tcl-includes,
            [  --with-tcl-includes=DIR where to look for tcl.h],
            tcl_includes=$withval, tcl_includes=$prefix/include)

AC_MSG_CHECKING([where to look for tcl.h])
TCL_INCLUDE_DIR=""
for dir in $tcl_includes $prefix/include/ /usr/include; do
    if test -r $dir/tcl.h; then
        TCL_INCLUDE_DIR=$dir
        break
    fi
done

if test -z "$TCL_INCLUDE_DIR"; then
    AC_MSG_ERROR([
  Can't find tcl.h.  Use --with-tcl-includes to specify the directory
  containing tcl.h on your system.])
else
    AC_MSG_RESULT($TCL_INCLUDE_DIR/tcl.h)
fi
#--------------------------------------------------------------------
#   Check for readline.h
#--------------------------------------------------------------------

AC_ARG_WITH(readline-includes,
            [  --with-readline-includes=DIR readline include files in DIR],
            rl_includes=$withval, rl_includes="")

dnl look for readline/readline.h
dnl          ^^^^^^^^
AC_MSG_CHECKING([where to look for readline.h])
READLINE_INCLUDE_DIR=""
for dir in $rl_includes /usr/local/include /usr/include ; do
    if test -r $dir/readline/readline.h; then
        READLINE_INCLUDE_DIR=$dir
        break
    fi
done

dnl look directly in the include dirs for readline.h
if test -z "$READLINE_INCLUDE_DIR"; then
    for dir in $rl_includes /usr/local/include /usr/include ; do
	if test -r $dir/readline.h; then
	    READLINE_INCLUDE_DIR=$dir
	    AC_DEFINE_UNQUOTED(READLINE_LIBRARY, 1, [ Define if we have libreadline. ])
	    break
	fi
    done
fi

if test -z "$READLINE_INCLUDE_DIR"; then
    AC_MSG_ERROR([
  Can't find readline.h.
  Use --with-readline-includes to specify the directory
  containing readline.h on your system.])
fi

AC_ARG_WITH(readline-library,
    [  --with-readline-library=DIR
		  lib spec to readline (e.g. '-L/usr/local/lib -lreadline')],
    LIBS="$LIBS $withval",
    AC_SEARCH_LIBS(rl_callback_read_char, readline, ,
		AC_MSG_RESULT([
			Your readline version does not support readline's alternate interface.
			Please upgrade to readline >= 2.2 and retry.
		])
		exit
    )
)



# check for readline's rl_executing_macro
# (could be macro.c's private variable _rl_executing_macro).

AC_CHECK_DECL(rl_executing_macro
, AC_DEFINE(EXECUTING_MACRO_NAME, rl_executing_macro,
  [ Define the name of the executing macro variable in libreadline. ])
, 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(EXECUTING_MACRO_HACK, 1,
    [ Define if EXECUTING_MACRO_NAME is resolved in libreadline. ])
    AC_DEFINE(EXECUTING_MACRO_NAME, _rl_executing_macro,
    [ Define the name of the executing macro variable in libreadline. ])
  , AC_MSG_RESULT(no))
, [AC_INCLUDES_DEFAULT
#include "$READLINE_INCLUDE_DIR/readline.h"])

# 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(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([
#include <stdio.h>
int main () {
    FILE *fp = fopen("conftestversion", "w");
    extern char *rl_library_version;
    fprintf(fp, "%s", rl_library_version);
    close(fp);
    return 0;
}],
    READLINE_VERSION=`cat conftestversion`
    AC_MSG_RESULT($READLINE_VERSION),
    AC_MSG_RESULT(failed),
    AC_MSG_RESULT(no cross compiling)
)


AC_ARG_ENABLE(tclshrl,
    [  --enable-tclshrl        build statically linked tclshrl],
    [dnl action if given
	case "${enableval}" in
	    yes) enable_static=true ;;
	    no)  enable_static=false ;;
	    *)   AC_MSG_ERROR(bad value ${enableval} for --enable-static) ;;
	esac
    ],
    [dnl action if not given
	enable_static=false
    ]
)
AM_CONDITIONAL(STATIC_TCLSHRL, test x$enable_static = xtrue)

AC_ARG_ENABLE(wishrl,
    [  --enable-wishrl         build statically linked wishrl],
    [dnl action if given
	case "${enableval}" in
	    yes)
		enable_static=true
		dnl source the tkConfig.sh which defines TK_LIB_SPEC
		. $TCL_LIB_DIR/tkConfig.sh
		AC_SUBST(TK_LIB_SPEC)
	    ;;
	    no)  enable_static=false ;;
	    *)   AC_MSG_ERROR(bad value ${enableval} for --enable-static) ;;
	esac
    ],
    [dnl action if not given
	enable_static=false
    ]
)
AM_CONDITIONAL(STATIC_WISHRL, test x$enable_static = xtrue)


AC_SUBST(TCL_INCLUDE_DIR)
AC_SUBST(TCL_LIB_SPEC)
AC_SUBST(READLINE_INCLUDE_DIR)
AC_OUTPUT(Makefile tclreadline.h tclreadlineInit.tcl tclreadlineSetup.tcl tclreadline.n pkgIndex.tcl)

Deleted configure.in version [72c6a348ad].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
dnl -*- autoconf -*-
dnl FILE: "/home/joze/src/tclreadline/configure.in"
dnl LAST MODIFICATION: "Mit, 10 Jan 2001 06:26:43 +0100 (joze)"
dnl (C) 1998 - 2001 by Johannes Zellner, <johannes@zellner.org>
dnl $Id$
dnl ---
dnl tclreadline -- gnu readline for tcl
dnl http://www.zellner.org/tclreadline/
dnl Copyright (c) 1998 - 2001, Johannes Zellner <johannes@zellner.org>
dnl This software is copyright under the BSD license.

AC_INIT(tclreadline.c)
AM_CONFIG_HEADER(config.h)
AC_PREREQ(2.13)
AC_REVISION($Revision$)
AC_CONFIG_AUX_DIR(./aux)

MAJOR=2
MINOR=1
PATCHLEVEL=1
VERSION=$MAJOR.$MINOR
PATCHLEVEL_STR=$VERSION.$PATCHLEVEL

AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(PATCHLEVEL)
AC_SUBST(VERSION)
AC_SUBST(PATCHLEVEL_STR)

AM_INIT_AUTOMAKE(tclreadline, $PATCHLEVEL_STR)


AC_PROG_MAKE_SET

dnl AM_INIT_AUTOMAKE(tclreadline, $VERSION)

AC_CANONICAL_HOST
AC_PROG_CC
AC_EXEEXT
dnl AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)

AC_C_CONST
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_LN_S


# -- WHICH TCL TO USE
AC_ARG_WITH(
    tcl,
    [  --with-tcl=DIR          where to look for tclConfig.sh],
    tcl_search=$withval,
    tcl_search=""
)

AC_MSG_CHECKING([which tclConfig.sh to use])
TCL_LIB_DIR=""
for dir in $tcl_search /usr/lib /usr/local/lib $exec_prefix/lib /usr/local/lib/unix /opt/tcl/lib; do
    if test -r $dir/tclConfig.sh; then
        TCL_LIB_DIR=$dir
        break
    fi
done

if test -z "$TCL_LIB_DIR"; then
    AC_MSG_ERROR(Can't find Tcl libraries.  Use --with-tcl to specify the directory containing tclConfig.sh on your system.)
fi

. $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])

# Check, if tcl_version is > 8.0
if test $TCL_MAJOR_VERSION -lt 8; then
    AC_MSG_ERROR(need tcl 8.0 or higher.)
fi


# -----------------------------------------------------------------------
#   Set up a new default --prefix.
# -----------------------------------------------------------------------

# this is the default anyway:
# AC_PREFIX_DEFAULT(/usr/local)

if test "${prefix}" = "NONE"; then
    prefix=$TCL_PREFIX
fi
TCLRL_LIBDIR="${prefix}/lib"
AC_SUBST(TCLRL_LIBDIR)
TCLRL_DIR="${TCLRL_LIBDIR}/tclreadline$VERSION"
AC_SUBST(TCLRL_DIR)

# HEADERS
AC_HEADER_STDC
AC_CHECK_HEADERS(string.h)

#--------------------------------------------------------------------
#   Check for tcl.h
#--------------------------------------------------------------------

AC_ARG_WITH(tcl-includes,
            [  --with-tcl-includes=DIR where to look for tcl.h],
            tcl_includes=$withval, tcl_includes=$prefix/include)

AC_MSG_CHECKING([where to look for tcl.h])
TCL_INCLUDE_DIR=""
for dir in $tcl_includes $prefix/include/ /usr/include; do
    if test -r $dir/tcl.h; then
        TCL_INCLUDE_DIR=$dir
        break
    fi
done

if test -z "$TCL_INCLUDE_DIR"; then
    AC_MSG_ERROR([
  Can't find tcl.h.  Use --with-tcl-includes to specify the directory
  containing tcl.h on your system.])
else
    AC_MSG_RESULT($TCL_INCLUDE_DIR/tcl.h)
fi
#--------------------------------------------------------------------
#   Check for readline.h
#--------------------------------------------------------------------

AC_ARG_WITH(readline-includes,
            [  --with-readline-includes=DIR readline include files in DIR],
            rl_includes=$withval, rl_includes="")

dnl look for readline/readline.h
dnl          ^^^^^^^^
AC_MSG_CHECKING([where to look for readline.h])
READLINE_INCLUDE_DIR=""
for dir in $rl_includes /usr/local/include /usr/include ; do
    if test -r $dir/readline/readline.h; then
        READLINE_INCLUDE_DIR=$dir
        break
    fi
done

dnl look directly in the include dirs for readline.h
if test -z "$READLINE_INCLUDE_DIR"; then
    for dir in $rl_includes /usr/local/include /usr/include ; do
	if test -r $dir/readline.h; then
	    READLINE_INCLUDE_DIR=$dir
	    AC_DEFINE_UNQUOTED(READLINE_LIBRARY, 1, [ Define if we have libreadline. ])
	    break
	fi
    done
fi

if test -z "$READLINE_INCLUDE_DIR"; then
    AC_MSG_ERROR([
  Can't find readline.h.
  Use --with-readline-includes to specify the directory
  containing readline.h on your system.])
fi

AC_ARG_WITH(readline-library,
    [  --with-readline-library=DIR
		  lib spec to readline (e.g. '-L/usr/local/lib -lreadline')],
    LIBS="$LIBS $withval",
    AC_CHECK_LIB(readline, rl_callback_read_char, ,
	AC_MSG_RESULT([
	    Your readline version does not support readline's alternate interface.
	    Please upgrade to readline >= 2.2 and retry.
	])
	exit
    )
)



# check for readline's (macro.c) private variable
# _rl_executing_macro.

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(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(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([
#include <stdio.h>
int main () {
    FILE *fp = fopen("conftestversion", "w");
    extern char *rl_library_version;
    fprintf(fp, "%s", rl_library_version);
    close(fp);
    return 0;
}],
    READLINE_VERSION=`cat conftestversion`
    AC_MSG_RESULT($READLINE_VERSION),
    AC_MSG_RESULT(failed),
    AC_MSG_RESULT(no cross compiling)
)


AC_ARG_ENABLE(tclshrl,
    [  --enable-tclshrl        build statically linked tclshrl],
    [dnl action if given
	case "${enableval}" in
	    yes) enable_static=true ;;
	    no)  enable_static=false ;;
	    *)   AC_MSG_ERROR(bad value ${enableval} for --enable-static) ;;
	esac
    ],
    [dnl action if not given
	enable_static=false
    ]
)
AM_CONDITIONAL(STATIC_TCLSHRL, test x$enable_static = xtrue)

AC_ARG_ENABLE(wishrl,
    [  --enable-wishrl         build statically linked wishrl],
    [dnl action if given
	case "${enableval}" in
	    yes)
		enable_static=true
		dnl source the tkConfig.sh which defines TK_LIB_SPEC
		. $TCL_LIB_DIR/tkConfig.sh
		AC_SUBST(TK_LIB_SPEC)
	    ;;
	    no)  enable_static=false ;;
	    *)   AC_MSG_ERROR(bad value ${enableval} for --enable-static) ;;
	esac
    ],
    [dnl action if not given
	enable_static=false
    ]
)
AM_CONDITIONAL(STATIC_WISHRL, test x$enable_static = xtrue)


AC_SUBST(TCL_INCLUDE_DIR)
AC_SUBST(TCL_LIB_SPEC)
AC_SUBST(READLINE_INCLUDE_DIR)
AC_OUTPUT(Makefile tclreadline.h tclreadlineInit.tcl tclreadlineSetup.tcl tclreadline.n pkgIndex.tcl)
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































Modified tclreadline.c from [8df3bd02ad] to [fb738417f9].

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

#ifdef EXECUTING_MACRO_HACK
/**
 * this prototype is private in readline's file `macro.c'.
 * We need it here to decide, if we should read more
 * characters from a macro. Dirty, but it should work.
 */
extern char* _rl_executing_macro;
#endif

#include "tclreadline.h"
static const char* tclrl_library = TCLRL_LIBRARY;
static const char* tclrl_version_str = TCLRL_VERSION_STR;
static const char* tclrl_patchlevel_str = TCLRL_PATCHLEVEL_STR;








|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

#ifdef EXECUTING_MACRO_HACK
/**
 * this prototype is private in readline's file `macro.c'.
 * We need it here to decide, if we should read more
 * characters from a macro. Dirty, but it should work.
 */
extern char* EXECUTING_MACRO_NAME;
#endif

#include "tclreadline.h"
static const char* tclrl_library = TCLRL_LIBRARY;
static const char* tclrl_version_str = TCLRL_VERSION_STR;
static const char* tclrl_patchlevel_str = TCLRL_PATCHLEVEL_STR;

230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266

    switch (obj_idx) {

	case TCLRL_READ:

	    rl_callback_handler_install(
			       objc == 3 ? Tcl_GetStringFromObj(objv[2], 0)
			       : "%", TclReadlineLineCompleteHandler);

	    Tcl_CreateFileHandler(0, TCL_READABLE,
		TclReadlineReadHandler, (ClientData) NULL);

	    /**
	     * Main Loop.
	     * XXX each modification of the global variables
	     *     which terminates the main loop must call
	     *     rl_callback_handler_remove() to leave
	     *     readline in a defined state.          XXX
	     */
	    tclrl_state = LINE_PENDING;

	    while (!TclReadlineLineComplete()) {
#ifdef EXECUTING_MACRO_HACK
		/**
		 * check first, if more characters are
		 * available from _rl_executing_macro,
		 * because Tcl_DoOneEvent() will (naturally)
		 * not detect this `event'.
		 */
		if (_rl_executing_macro)
		    TclReadlineReadHandler((ClientData) NULL, TCL_READABLE);
		else
#endif
		    Tcl_DoOneEvent(TCL_ALL_EVENTS);
	    }

	    Tcl_DeleteFileHandler(0);







|














|






|







230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266

    switch (obj_idx) {

	case TCLRL_READ:

	    rl_callback_handler_install(
			       objc == 3 ? Tcl_GetStringFromObj(objv[2], 0)
			       : "% ", TclReadlineLineCompleteHandler);

	    Tcl_CreateFileHandler(0, TCL_READABLE,
		TclReadlineReadHandler, (ClientData) NULL);

	    /**
	     * Main Loop.
	     * XXX each modification of the global variables
	     *     which terminates the main loop must call
	     *     rl_callback_handler_remove() to leave
	     *     readline in a defined state.          XXX
	     */
	    tclrl_state = LINE_PENDING;

	    while (!TclReadlineLineComplete()) {
#ifdef EXECUTING_MACRO_NAME
		/**
		 * check first, if more characters are
		 * available from _rl_executing_macro,
		 * because Tcl_DoOneEvent() will (naturally)
		 * not detect this `event'.
		 */
		if (EXECUTING_MACRO_NAME)
		    TclReadlineReadHandler((ClientData) NULL, TCL_READABLE);
		else
#endif
		    Tcl_DoOneEvent(TCL_ALL_EVENTS);
	    }

	    Tcl_DeleteFileHandler(0);
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

}

static void
TclReadlineReadHandler(ClientData clientData, int mask)
{
    if (mask & TCL_READABLE) {
#ifdef EXECUTING_MACRO_HACK
	do {
#endif
	    rl_callback_read_char();
#ifdef EXECUTING_MACRO_HACK
	    /**
	     * check, if we're inside a macro and
	     * if so, read all macro characters
	     * until the next eol.
	     */
	} while (_rl_executing_macro && !TclReadlineLineComplete());
#endif
    }
}

static void
TclReadlineLineCompleteHandler(char* ptr)
{







|



|





|







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

}

static void
TclReadlineReadHandler(ClientData clientData, int mask)
{
    if (mask & TCL_READABLE) {
#ifdef EXECUTING_MACRO_NAME
	do {
#endif
	    rl_callback_read_char();
#ifdef EXECUTING_MACRO_NAME
	    /**
	     * check, if we're inside a macro and
	     * if so, read all macro characters
	     * until the next eol.
	     */
	} while (EXECUTING_MACRO_NAME && !TclReadlineLineComplete());
#endif
    }
}

static void
TclReadlineLineCompleteHandler(char* ptr)
{
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
	 * The calling script is responsible for handling
	 * empty strings.
	 */

	char* expansion = (char*) NULL;
	int status = history_expand(ptr, &expansion);

	if (status >= 1) {
	    /* TODO: make this a valid tcl output */
	    printf("%s\n", expansion);



	} else if (-1 == status) {
	    Tcl_AppendResult
	    (tclrl_interp, "error in history expansion\n", (char*) NULL);
	    TclReadlineTerminate(TCL_ERROR);
	}
	/**


	 * TODO: status == 2 ...
	 */

	Tcl_AppendResult(tclrl_interp, expansion, (char*) NULL);


#ifdef EXECUTING_MACRO_HACK
	/**
	 * don't stuff macro lines
	 * into readline's history.
	 */
	if(!_rl_executing_macro) {
#endif
	    /**
	     * don't stuff empty lines
	     * into readline's history.
	     * don't stuff twice the same
	     * line into readline's history.
	     */
	    if (expansion && *expansion && (!tclrl_last_line ||
		    strcmp(tclrl_last_line, expansion))) {
		add_history(expansion);
	    }
	    if (tclrl_last_line)
		free(tclrl_last_line);
	    tclrl_last_line = strdup(expansion);
#ifdef EXECUTING_MACRO_HACK
	}
#endif
	/**
	 * tell the calling routines to terminate.
	 */
	TclReadlineTerminate(LINE_COMPLETE);
	FREE(ptr);







|


>
>
>
|

|

<
<
>
>
|
<
|
|
|
>
|




|














|







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
	 * The calling script is responsible for handling
	 * empty strings.
	 */

	char* expansion = (char*) NULL;
	int status = history_expand(ptr, &expansion);

	if (status >= 2) {
	    /* TODO: make this a valid tcl output */
	    printf("%s\n", expansion);
		free(ptr);
		free(expansion);
		return;
	} else if (status <= -1) {
	    Tcl_AppendResult
	    (tclrl_interp, "error in history expansion: ", expansion, "\n", (char*) NULL);
	    TclReadlineTerminate(TCL_ERROR);


		free(ptr);
		free(expansion);
		return;

	} else {
        Tcl_AppendResult(tclrl_interp, expansion, (char*) NULL);
    }

#ifdef EXECUTING_MACRO_NAME
	/**
	 * don't stuff macro lines
	 * into readline's history.
	 */
	if(!EXECUTING_MACRO_NAME) {
#endif
	    /**
	     * don't stuff empty lines
	     * into readline's history.
	     * don't stuff twice the same
	     * line into readline's history.
	     */
	    if (expansion && *expansion && (!tclrl_last_line ||
		    strcmp(tclrl_last_line, expansion))) {
		add_history(expansion);
	    }
	    if (tclrl_last_line)
		free(tclrl_last_line);
	    tclrl_last_line = strdup(expansion);
#ifdef EXECUTING_MACRO_NAME
	}
#endif
	/**
	 * tell the calling routines to terminate.
	 */
	TclReadlineTerminate(LINE_COMPLETE);
	FREE(ptr);
695
696
697
698
699
700
701
702
703
704
705
706
707
708


709
710




711
712
713
714
715
716
717
	char* quoted_rl_line_buffer = TclReadlineQuote(rl_line_buffer, "$[]{}\"");
	sprintf(start_s, "%d", start);
	sprintf(end_s, "%d", end);
	Tcl_ResetResult(tclrl_interp); /* clear result space */
	state = Tcl_VarEval(tclrl_interp, tclrl_custom_completer,
	    " \"", quoted_text, "\" ", start_s, " ", end_s,
	    " \"", quoted_rl_line_buffer, "\"", (char*) NULL);
	FREE(quoted_text);
	FREE(quoted_rl_line_buffer);
	if (TCL_OK != state) {
	    Tcl_AppendResult (tclrl_interp, " `", tclrl_custom_completer,
		" \"", quoted_text, "\" ", start_s, " ", end_s,
		" \"", quoted_rl_line_buffer, "\"' failed.", (char*) NULL);
	    TclReadlineTerminate(state);


	    return matches;
	}




	obj = Tcl_GetObjResult(tclrl_interp);
	status = Tcl_ListObjGetElements(tclrl_interp, obj, &objc, &objv);
	if (TCL_OK != status)
	    return matches;

	if (objc) {
	    int i, length;







<
<





>
>


>
>
>
>







698
699
700
701
702
703
704


705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
	char* quoted_rl_line_buffer = TclReadlineQuote(rl_line_buffer, "$[]{}\"");
	sprintf(start_s, "%d", start);
	sprintf(end_s, "%d", end);
	Tcl_ResetResult(tclrl_interp); /* clear result space */
	state = Tcl_VarEval(tclrl_interp, tclrl_custom_completer,
	    " \"", quoted_text, "\" ", start_s, " ", end_s,
	    " \"", quoted_rl_line_buffer, "\"", (char*) NULL);


	if (TCL_OK != state) {
	    Tcl_AppendResult (tclrl_interp, " `", tclrl_custom_completer,
		" \"", quoted_text, "\" ", start_s, " ", end_s,
		" \"", quoted_rl_line_buffer, "\"' failed.", (char*) NULL);
	    TclReadlineTerminate(state);
		free(quoted_text);
		free(quoted_rl_line_buffer);
	    return matches;
	}
	free(quoted_text);
	quoted_text = NULL;
	free(quoted_rl_line_buffer);
	quoted_rl_line_buffer = NULL;
	obj = Tcl_GetObjResult(tclrl_interp);
	status = Tcl_ListObjGetElements(tclrl_interp, obj, &objc, &objv);
	if (TCL_OK != status)
	    return matches;

	if (objc) {
	    int i, length;