Diff
Not logged in

Differences From Artifact [0c9810d5e7]:

To Artifact [c631e8e0d8]:


1
2
3

4
5
6
7
8
9
10
1
2

3
4
5
6
7
8
9
10


-
+







# -*- autoconf -*-
# FILE: "/home/joze/src/tclreadline/configure.in"
# LAST MODIFICATION: "Sun Sep 19 23:15:53 1999 (joze)"
# LAST MODIFICATION: "Mon Sep 20 00:55:51 1999 (joze)"
# (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
#
# tclreadline -- gnu readline for tcl
# Copyright (C) 1999  Johannes Zellner
#
46
47
48
49
50
51
52
53

54
55
56
57
58
59
60
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60







-
+








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 /lib /usr/lib /usr/local/lib"
TCLREADLINE_LPATH="$TCLREADLINE_LPATH /usr/local/lib /lib /usr/lib"


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

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







-
-
+
+



-
-
+
+


















-
-


-
+
-
-
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+





-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
-
+
-
-
-
-
-
-
-
+
+
-
-
-
-
+
+
+

-
+


-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







-
-
+







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"
    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.4.0; then
        READLINE_VERSION_SUFFIX=".4.0"
    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



# ---
# check for the terminal library.
# This part was shamelessly stolen from
# the vim-5.5 configure.in.
# ---

olibs="$LIBS"
olibs=${LIBS}
AC_MSG_CHECKING(--with-tlib argument)
AC_ARG_WITH(tlib, [  --with-tlib=library     terminal library to be used ],)
AC_ARG_WITH(tlib-library,
if test -n "$with_tlib"; then
	AC_MSG_RESULT($with_tlib)
	LIBS="$LIBS -l$with_tlib"
else
	AC_MSG_RESULT([automatic terminal library selection])
            [  --with-tlib-library=DIR
                          where to search for curses / termcap],
            tlib_library=$withval, tlib_library=$exec_prefix/lib)

AC_MSG_CHECKING([where to look for the terminal library])
	dnl  Newer versions of ncurses are preferred over anything.
	dnl  Older versions of ncurses have bugs, get a new one!
	dnl  Digital Unix (OSF1) should use curses (Ronald Schild).
	case "`uname -s 2>/dev/null`" in
		OSF1) tlibs="ncurses curses termlib termcap";;
		*)    tlibs="ncurses termlib termcap curses";;
	esac
TERMLIB_DIR=""
TERMLIB_VERSION_SUFFIX=""
for dir in $tlib_library $TCLREADLINE_LPATH $prefix/lib/; do
	for tlib in ncurses termlib termcap curses; do
        dnl echo "(ls ${dir}/lib${tlib}${SHLIB_SUFFIX}*) 2>/dev/null"
        result="`(ls -r ${dir}/lib${tlib}${SHLIB_SUFFIX}*) 2>/dev/null`"
		dnl echo result = $result
	for libname in $tlibs; do
		AC_CHECK_LIB($libname, tgetent,,)
		if test "x$olibs" != "x$LIBS"; then
			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
			AC_TRY_RUN([
		if test "x$result" != "x"; then
			for lib in ${tlib}; 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
				LIBS=-l${lib}
				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
			  break
			fi
			AC_MSG_RESULT($libname library is not usable)
			LIBS="$olibs"
		fi
				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="$TERMLIB_DIR -R ${dir}"
					fi
					TERMLIB=-l${tlib}
					break
				fi
			done
			if test "x${TERMLIB_DIR}" = "x"; then
				AC_MSG_RESULT(none of $libname is usable)
	        else
				break
			fi
		fi
	done
	if test "x${TERMLIB_DIR}" != "x"; then
		break
fi
	fi
if test "x$olibs" != "x$LIBS"; then
	AC_MSG_CHECKING(whether we talk terminfo)
	AC_TRY_RUN([
#ifdef HAVE_TERMCAP_H
# include <termcap.h>
#endif
main()
done

{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }],
	AC_MSG_RESULT([no -- we are in termcap land]),
	AC_MSG_RESULT([yes -- terminfo spoken here]); AC_DEFINE(TERMINFO),
	AC_MSG_ERROR(failed to compile test program.))
if test "x$TERMLIB_DIR" = "x"; then
	AC_MSG_ERROR([
no terminal library found. Please retry with the --with-tlib argument.])
else
	AC_MSG_ERROR(none found. Please retry with the --with-tlib argument)
	AC_MSG_RESULT(${TERMLIB_DIR} ${TERMLIB})
fi

AC_MSG_CHECKING(whether termcap.h contains ospeed)
AC_TRY_LINK([
#ifdef HAVE_TERMCAP_H
# include <termcap.h>
#endif
			], [ospeed = 20000],
	AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
	[AC_MSG_RESULT(no)
	AC_MSG_CHECKING(whether ospeed can be extern)
	AC_TRY_LINK([
#ifdef HAVE_TERMCAP_H
# include <termcap.h>
#endif
extern short ospeed;
			], [ospeed = 20000],
		AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
		AC_MSG_RESULT(no))]
)

AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
AC_TRY_LINK([
#ifdef HAVE_TERMCAP_H
# include <termcap.h>
#endif
			], [if (UP == 0 && BC == 0) PC = 1],
	AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
	[AC_MSG_RESULT(no)
	AC_MSG_CHECKING([whether UP, BC and PC can be extern])
	AC_TRY_LINK([
#ifdef HAVE_TERMCAP_H
# include <termcap.h>
#endif
extern char *UP, *BC, PC;
			], [if (UP == 0 && BC == 0) PC = 1],
		AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
		AC_MSG_RESULT(no))]
	)

AC_MSG_CHECKING(whether tputs() uses outfuntype)
AC_TRY_COMPILE([
#ifdef HAVE_TERMCAP_H
# include <termcap.h>
#endif
			], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
	AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
	AC_MSG_RESULT(no))


#--------------------------------------------------------------------
#   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 $TERM_LIB"
LIBS="-L$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
526
527
528
529
530
531
532

533

534
535
536
537
538
539
540
481
482
483
484
485
486
487
488

489
490
491
492
493
494
495
496







+
-
+







AC_SUBST(SHLIB_CFLAGS)

AC_SUBST(SHLIB_LD)
AC_SUBST(SHLIB_LD_LIBS)

AC_SUBST(SHLIB_SUFFIX)

AC_SUBST(TERMLIB)
AC_SUBST(TERM_LIB)
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)