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
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
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
| # -*- autoconf -*-
# FILE: "/krispc6/home/joze/src/tclreadline/configure.in"
# LAST MODIFICATION: "Fri May 14 14:47:38 1999 (joze)"
# (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
# $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 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)
TCLREADLINE_MAJOR_VERSION=0
TCLREADLINE_MINOR_VERSION=8
TCLREADLINE_VERSION=$TCLREADLINE_MAJOR_VERSION.$TCLREADLINE_MINOR_VERSION
VERSION=$TCLREADLINE_VERSION
AC_PREREQ(2.13)
AC_CONFIG_AUX_DIR(./aux)
AC_CANONICAL_HOST
TCLREADLINE_LPATH=""
for path in $LD_LIBRARY_PATH $LD_RUN_PATH $LPATH; do
nocolon_path=`echo $path | sed 's/:/ /g'`
TCLREADLINE_LPATH="$TCLREADLINE_LPATH $nocolon_path"
done
TCLREADLINE_LPATH="$TCLREADLINE_LPATH /lib /usr/lib /usr/local/lib"
#--------------------------------------------------------------------
# See if there was a command-line option for where Tcl is; if
# not, search for Tcl.
#--------------------------------------------------------------------
AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.x binaries from DIR],
tcl_search=$withval, tcl_search=/usr/local/lib)
AC_MSG_CHECKING([which tclConfig.sh to use])
TCL_LIB_DIR=""
for dir in $tcl_search $exec_prefix/lib /usr/local/lib/unix /usr/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.)
else
AC_MSG_RESULT($TCL_LIB_DIR/tclConfig.sh)
fi
#--------------------------------------------------------------------
# Read in configuration information generated by Tcl for shared
# libraries, and arrange for it to be substituted into our
# Makefile.
#--------------------------------------------------------------------
file=$TCL_LIB_DIR/tclConfig.sh
. $file
SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
SHLIB_LD=$TCL_SHLIB_LD
if test $TCL_SHLIB_SUFFIX = ""; then
AC_MSG_ERROR(TCL_SHLIB_SUFFIX not defined -- should be something like .so or .sl on unix.)
else
SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
fi
DL_LIBS=$TCL_DL_LIBS
LD_FLAGS=$TCL_LD_FLAGS
SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS
TCLREADLINE_PACKAGE_PATH=$TCL_PACKAGE_PATH
#--------------------------------------------------------------------
# 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.
# -----------------------------------------------------------------------
AC_PREFIX_DEFAULT(/usr/local)
if test "${prefix}" = "NONE"; then
prefix=$TCL_PREFIX
fi
if test "${exec_prefix}" = "NONE"; then
exec_prefix=$TCL_EXEC_PREFIX
else
TCLREADLINE_PACKAGE_PATH=${exec_prefix}/lib
fi
TCLREADLINE_LIBRARY=$TCLREADLINE_PACKAGE_PATH/tclreadline$TCLREADLINE_VERSION
# -----------------------------------------------------------------------
# Check for some programs here.
# -----------------------------------------------------------------------
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_LN_S
# -----------------------------------------------------------------------
# Prefer the compiler, which was used
# to build tcl.
# -----------------------------------------------------------------------
AC_ARG_ENABLE(gcc, [ --enable-gcc allow use of gcc if available],
[gcc_ok=$enableval], [gcc_ok=no])
if test "$gcc_ok" = "yes"; then
AC_PROG_CC
else
CC=$TCL_CC
AC_SUBST(CC)
fi
# -----------------------------------------------------------------------
# checking for the preprocessor.
# FIXME: do we need this ?
# -----------------------------------------------------------------------
AC_PROG_CPP
#--------------------------------------------------------------------
# If this is gcc, add some extra compile flags.
#--------------------------------------------------------------------
AC_MSG_CHECKING([whether C compiler is gcc])
AC_CACHE_VAL(tclreadline_cv_prog_gcc,
AC_EGREP_CPP(_cc_is_gcc_, [
#ifdef __GNUC__
_cc_is_gcc_
#endif
], [tclreadline_cv_prog_gcc=yes], [tclreadline_cv_prog_gcc=no]))
AC_MSG_RESULT([$tclreadline_cv_prog_gcc])
if test -z "$CFLAGS" ; then
CFLAGS=$TCL_CFLAGS_OPTIMIZE
fi
if test "$tclreadline_cv_prog_gcc" = "yes" ; then
CFLAGS="$CFLAGS -Wshadow -Wtraditional -Wall"
fi
AC_MSG_CHECKING([default compiler flags])
AC_ARG_WITH(cflags, [ --with-cflags=FLAGS set compiler flags to FLAGS],
[CFLAGS="$with_cflags"])
AC_MSG_RESULT([$CFLAGS])
if test "$TCL_CC" != "$CC" ; then
echo ""
echo "WARNING: Compiler is $CC but Tcl was compiled with $TCL_CC"
echo ""
fi
#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# 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).],
[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
SHLIB_CFLAGS="${SHLIB_CFLAGS}"
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=""
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
# AIX remembers this path and will attempt to use it at run-time to look
# up the Tcl library.
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
TCLREADLINE_BUILD_LIB_SPEC="-L`pwd` -ltclreadline${VERSION}"
TCLREADLINE_LIB_SPEC="-L${TCLREADLINE_LIBRARY} -ltclreadline${VERSION}"
else
TCLREADLINE_BUILD_LIB_SPEC="-L`pwd` -ltclreadline`echo ${VERSION} | tr -d .`"
TCLREADLINE_LIB_SPEC="-L${TCLREADLINE_LIBRARY} -ltclreadline`echo ${VERSION} | tr -d .`"
fi
# HEADER CHECKS
#
AC_HEADER_STDC
#--------------------------------------------------------------------
# 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=$prefix/include)
AC_MSG_CHECKING([where to look for readline.h])
READLINE_INCLUDE_DIR=""
for dir in $rl_includes $prefix/include/readline /usr/include; do
if test -r $dir/readline.h; then
READLINE_INCLUDE_DIR=$dir
break
fi
done
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.])
else
AC_MSG_RESULT($READLINE_INCLUDE_DIR/readline.h)
fi
#--------------------------------------------------------------------
# Check for libreadline
#--------------------------------------------------------------------
AC_ARG_WITH(readline-library,
[ --with-readline-library=DIR
readline library files in DIR],
rl_library=$withval, rl_library=$exec_prefix/lib)
AC_MSG_CHECKING([where to look for libreadline$SHLIB_SUFFIX])
READLINE_LIB_DIR=""
READLINE_VERSION_SUFFIX=""
for dir in $rl_library $TCLREADLINE_LPATH $prefix/lib/readline; do
if test -r $dir/libreadline$SHLIB_SUFFIX; then
READLINE_LIB_DIR=$dir
break
fi
if test -r $dir/libreadline$SHLIB_SUFFIX.3.0; then
READLINE_VERSION_SUFFIX=".3.0"
READLINE_LIB_DIR=$dir
break
fi
if test -r $dir/libreadline$SHLIB_SUFFIX.4.0; then
READLINE_VERSION_SUFFIX=".4.0"
READLINE_LIB_DIR=$dir
break
fi
done
if test -z "$READLINE_LIB_DIR"; then
AC_MSG_ERROR([
Can't find libreadline$SHLIB_SUFFIX.
Use --with-readline-library to specify the directory
containing libreadline$SHLIB_SUFFIX on your system.])
else
AC_MSG_RESULT({READLINE_LIB_DIR}/libreadline${SHLIB_SUFFIX}${READLINE_VERSION_SUFFIX})
fi
#--------------------------------------------------------------------
# Specify termlib or curses library
#--------------------------------------------------------------------
opt_curses=no
AC_ARG_WITH(curses,
[ --with-curses force using the curses library instead of termcap],
opt_curses=$withval)
if test "$opt_curses" = "yes"; then
TERMCAP_CHECK="curses ncurses"
else
TERMCAP_CHECK="termcap curses ncurses"
fi
#--------------------------------------------------------------------
# Check for termlib / curses / ncurses library.
#--------------------------------------------------------------------
AC_ARG_WITH(termcap-library,
[ --with-termcap-library=DIR
search termcap (or curses / ncurses) library in DIR],
termcap_lib=$withval, termcap_lib=$exec_prefix/lib)
tcheck_path="$termcap_lib $TCLREADLINE_LPATH $prefix/lib"
for tcheck in $TERMCAP_CHECK; do
AC_MSG_CHECKING([whether we use lib$tcheck$SHLIB_SUFFIX])
TERMCAP_LIB_DIR=""
for dir in $tcheck_path; do
if test -r $dir/lib$tcheck$SHLIB_SUFFIX; then
TERMCAP_LIB_DIR=$dir
break
fi
done
if test -z "$TERMCAP_LIB_DIR"; then
AC_MSG_RESULT(no)
else
TERMCAP_LIB=$tcheck
TERMCAP_LOAD_PATH=${TERMCAP_LIB_DIR}/lib${tcheck}${SHLIB_SUFFIX}
AC_MSG_RESULT(yes: $TERMCAP_LOAD_PATH)
break
fi
done
if test -z "$TERMCAP_LIB_DIR"; then
AC_MSG_ERROR([
None of "$TERMCAP_CHECK" found in:
$tcheck_path
Use --with-termcap-library to specify the directory containing
lib$TERMCAP_LIB$SHLIB_SUFFIX on your system.])
fi
#--------------------------------------------------------------------
# Check for appropriate version of gnu readline
# (older versions of gnu readline don't have
# rl_callback_read_char ()).
#--------------------------------------------------------------------
save=$LIBS
LIBS="-L$READLINE_LIB_DIR -lreadline -L$TERMCAP_LIB_DIR -l$TERMCAP_LIB"
alternate=no
AC_CHECK_LIB(readline, rl_callback_read_char, alternate=yes, alternate=no, -l$TERMCAP_LIB)
if test $alternate = "no"; then
AC_MSG_ERROR(alternate interface not supported by this readline version.)
fi
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))
LIBS=$LIBS
# This is a test
#AC_C_BIGENDIAN
# TODO: check for readline version
# (link testprogram with -lreadline)
AC_SUBST(TCLREADLINE_MAJOR_VERSION)
AC_SUBST(TCLREADLINE_MINOR_VERSION)
AC_SUBST(TCLREADLINE_VERSION)
AC_SUBST(TCL_LIB_DIR)
AC_SUBST(TCL_INCLUDE_DIR)
AC_SUBST(READLINE_INCLUDE_DIR)
AC_SUBST(CFLAGS)
AC_SUBST(DL_LIBS)
AC_SUBST(LD_FLAGS)
AC_SUBST(RANLIB)
AC_SUBST(MAKE_LIB)
AC_SUBST(SHLIB_CFLAGS)
AC_SUBST(SHLIB_LD)
AC_SUBST(SHLIB_LD_LIBS)
AC_SUBST(SHLIB_SUFFIX)
AC_SUBST(TERMCAP_LIB_DIR)
AC_SUBST(TERMCAP_LIB)
AC_SUBST(READLINE_LIB_DIR)
AC_SUBST(TCLREADLINE_LIB_FILE)
AC_SUBST(TCLREADLINE_BUILD_LIB_SPEC)
AC_SUBST(TCLREADLINE_LIB_SPEC)
AC_SUBST(TCLREADLINE_LIB_DIR)
AC_SUBST(TCLREADLINE_PKG_FILE)
AC_SUBST(TCLREADLINE_PACKAGE_PATH)
AC_SUBST(TCLREADLINE_LIBRARY)
AC_OUTPUT(Makefile tclreadline.h tclreadlineInit.tcl tclreadlineSetup.tcl tclreadlineConfig.sh tclreadline.n)
#TCL_CC='cc'
#TCL_CFLAGS_DEBUG='-g'
#TCL_CFLAGS_OPTIMIZE='-O'
#TCL_SHARED_BUILD=1
#
#TCL_PREFIX='/usr/local'
#TCL_EXEC_PREFIX='/usr/local'
#
#TCL_SHLIB_CFLAGS='-fPIC'
#TCL_SHLIB_LD='cc -shared'
#TCL_SHLIB_SUFFIX='.so'
#TCL_DL_LIBS='-ldl'
#TCL_LD_FLAGS='-rdynamic'
#TCL_LD_SEARCH_FLAGS=''
#TCL_RANLIB=':'
#TCL_PACKAGE_PATH='/usr/local/lib'
|