File: configure.in

package info (click to toggle)
tclreadline 1.2.0-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 464 kB
  • ctags: 313
  • sloc: tcl: 5,956; sh: 1,544; ansic: 694; makefile: 203
file content (557 lines) | stat: -rw-r--r-- 15,935 bytes parent folder | download | duplicates (3)
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
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
494
495
496
497
498
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
551
552
553
554
555
556
557
dnl -*- autoconf -*-
dnl FILE: "/home/joze/src/tclreadline/configure.in"
dnl LAST MODIFICATION: "Sat, 25 Mar 2000 21:17:25 +0100 (joze)"
dnl (C) 1998 - 2000 by Johannes Zellner, <johannes@zellner.org>
dnl $Id: configure.in,v 2.17 2000/03/25 20:59:12 joze Exp $
dnl ---
dnl
dnl tclreadline -- gnu readline for tcl
dnl http://www.zellner.org/tclreadline/
dnl Copyright (c) 1998 - 2000, Johannes Zellner <johannes@zellner.org>
dnl
dnl This software is copyright under the BSD license.
dnl
dnl ================================================================== */  


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

TCLREADLINE_MAJOR_VERSION=1
TCLREADLINE_MINOR_VERSION=2
TCLREADLINE_PATCHLEVEL=0
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_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"


#--------------------------------------------------------------------
#   See if there was a command-line option for where Tcl is;  if
#   not, search for Tcl.
#--------------------------------------------------------------------

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.)
else
    . $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 tkConfig.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 $TCL_LIB_DIR /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
	. $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])
	AC_SUBST(TK_LIB_SPEC)
    fi
fi

#--------------------------------------------------------------------
#   Read in configuration information generated by Tcl for shared
#   libraries, and arrange for it to be substituted into our
#   Makefile.
#--------------------------------------------------------------------


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.
# -----------------------------------------------------------------------

# this is the default anyway:
# 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=${exec_prefix}/lib/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 test -z "$CFLAGS" ; then
    CFLAGS=$TCL_CFLAGS_OPTIMIZE
fi

dnl #--------------------------------------------------------------------
dnl #   If this is gcc, add some extra compile flags.
dnl #--------------------------------------------------------------------
dnl 
dnl AC_MSG_CHECKING([whether C compiler is gcc])
dnl AC_CACHE_VAL(tclreadline_cv_prog_gcc,
dnl     AC_EGREP_CPP(_cc_is_gcc_, [
dnl #ifdef __GNUC__
dnl _cc_is_gcc_
dnl #endif
dnl ],      [tclreadline_cv_prog_gcc=yes], [tclreadline_cv_prog_gcc=no]))
dnl AC_MSG_RESULT([$tclreadline_cv_prog_gcc])
dnl 
dnl if test -z "$CFLAGS" ; then
dnl     CFLAGS=$TCL_CFLAGS_OPTIMIZE
dnl fi
dnl if test "$tclreadline_cv_prog_gcc" = "yes" ; then
dnl     CFLAGS="$CFLAGS -Wshadow -Wtraditional -Wall"
dnl fi
dnl 
dnl AC_MSG_CHECKING([default compiler flags])
dnl AC_ARG_WITH(cflags, [  --with-cflags=FLAGS     set compiler flags to FLAGS],
dnl     [CFLAGS="$with_cflags"])
dnl 
dnl 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.],
    [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}.1"
    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
    SHLIB_CFLAGS=""
    eval "TCLREADLINE_LIB_FILE=libtclreadline${VERSION}.a"
    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
# 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="")

AC_MSG_CHECKING([where to look for readline.h])
READLINE_INCLUDE_DIR=""
for dir in $rl_includes /usr/local/include/readline /usr/local/include /usr/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)
	base="`(basename ${READLINE_INCLUDE_DIR}) 2>/dev/null`"
	if test "x${base}" != "xreadline"; then
		AC_DEFINE_UNQUOTED(READLINE_LIBRARY, 1, [ Define if we have libreadline. ])
	fi
fi



#--------------------------------------------------------------------
#   Check for libreadline
#--------------------------------------------------------------------

AC_ARG_WITH(readline-library,
            [  --with-readline-library=DIR
                          readline library files in DIR],
            rl_library=$withval, rl_library="")

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.4; then
        READLINE_VERSION_SUFFIX=".4"
        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
    if test -r $dir/libreadline$SHLIB_SUFFIX.3; then
        READLINE_VERSION_SUFFIX=".3"
        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
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

READLINE_LIB_DIR="-L${READLINE_LIB_DIR}"



# ---
# check for the terminal library.
# ---

olibs=${LIBS}
AC_ARG_WITH(tlib-library,
            [  --with-tlib-library=DIR
                          where to search for curses / termcap],
            tlib_library=$withval, tlib_library="")

AC_MSG_CHECKING([where to look for the terminal library])
TERMLIB_DIR=""
TERMLIB_VERSION_SUFFIX=""
for dir in $tlib_library $TCLREADLINE_LPATH $prefix/lib/; do
	for tlib in ncurses termlib termcap curses; do
		dnl It's possible that a library is found but it doesn't work
		dnl e.g., shared library that cannot be found
		dnl compile and run a test program to be sure
		dnl echo ""
		dnl echo ""
		LIBS="-L${dir} -l${tlib}"
		AC_TRY_RUN([
#ifdef HAVE_TERMCAP_H
# include <termcap.h>
#endif
main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
	res="OK", res="FAIL", res="FAIL")
		if test "$res" = "OK"; then
			TERMLIB_DIR=-L${dir}
			if test "`(uname) 2>/dev/null`" = SunOS &&
				uname -r | grep '^5' >/dev/null; then
				TERMLIB_DIR_R="${TERMLIB_DIR} -R${dir}"
			fi
			TERMLIB=-l${tlib}
			break
		fi
		if test "x${TERMLIB_DIR}" = "x"; then
			AC_MSG_RESULT($LIBS is unusable)
		else
			break
		fi
	done
	if test "x${TERMLIB_DIR}" != "x"; then
		break
	fi
done

if test "x$TERMLIB_DIR" = "x"; then
	AC_MSG_ERROR([
no terminal library found. Please retry with the --with-tlib argument.])
else
	AC_MSG_RESULT(${TERMLIB_DIR} ${TERMLIB})
fi


#--------------------------------------------------------------------
#   Check for appropriate version of gnu readline
#   (older versions of gnu readline don't have
#    rl_callback_read_char ()).
#--------------------------------------------------------------------

LIBS="${READLINE_LIB_DIR} ${TERMLIB_DIR} -lreadline $TERMLIB $olibs"
alternate=no
AC_CHECK_FUNC(
    rl_callback_read_char, alternate=yes, alternate=no
)
if test "$alternate" = "no"; then
    AC_MSG_ERROR(alternate interface not supported by this readline version.)
fi


# 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))




# 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(TCLREADLINE_PATCHLEVEL)
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)
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(TERMLIB)
AC_SUBST(TERMLIB_DIR)
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_OUTPUT(Makefile tclreadline.h tclreadlineInit.tcl tclreadlineSetup.tcl tclreadlineConfig.sh tclreadline.n pkgIndex.tcl)


#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'