File: acinclude.m4

package info (click to toggle)
osiris 4.2.3-4
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 11,588 kB
  • ctags: 12,012
  • sloc: ansic: 114,200; sh: 14,677; cpp: 2,038; makefile: 1,775; awk: 1,385; perl: 611; tcl: 27; asm: 14; python: 12
file content (49 lines) | stat: -rw-r--r-- 1,260 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

AC_DEFUN([CHECK_READLINE],
[
  AC_ARG_WITH(readline,
     AC_HELP_STRING([--with-readline=DIR],
	[look for the readline library in DIR]),
     [_do_readline=$withval],[_do_readline=yes])

  if test "$_do_readline" != "no" ; then
     if test -d "$withval" ; then
        CPPFLAGS="${CPPFLAGS} -I$withval/include"
        LDFLAGS="${LDFLAGS} -L$withval/lib"
     fi

     for _termcap in "" "-ltermcap" "-lcurses" "-lncurses" ; do
        _readline_save_libs=$LIBS
        _combo="-lreadline${_termcap:+ $_termcap}"
        LIBS="$LIBS $_combo"

        AC_MSG_CHECKING([whether readline via \"$_combo\" is present and sane])

        AC_LINK_IFELSE(AC_LANG_PROGRAM([
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
],[
add_history("foobar");
rl_catch_signals=0;
]),_found_readline=yes,_found_readline=no)

        AC_MSG_RESULT([$_found_readline])

        LIBS=$_readline_save_libs

        if test $_found_readline = yes ; then
           AC_DEFINE(HAVE_LIBREADLINE,1,
	      [Define to 1 if you have a fully functional readline library.])
           AC_SUBST(LIBREADLINE,$_combo)
           break
        fi
     done

     unset _termcap
     unset _readline_save_libs
     unset _combo
     unset _found_readline
  fi
])