~ubuntu-branches/debian/squeeze/ffcall/squeeze

« back to all changes in this revision

Viewing changes to src/m4/readline.m4

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2010-06-26 15:29:30 UTC
  • mfrom: (5.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100626152930-c09y01gk3szcnykn
Tags: 1.10+cvs20100619-2
Ship to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl -*- Autoconf -*-
2
 
dnl Copyright (C) 2002-2005 Sam Steingold, Bruno Haible
3
 
dnl This file is free software, distributed under the terms of the GNU
4
 
dnl General Public License.  As a special exception to the GNU General
5
 
dnl Public License, this file may be distributed as part of a program
6
 
dnl that contains a configuration script generated by Autoconf, under
7
 
dnl the same distribution terms as the rest of that program.
8
 
 
9
 
AC_PREREQ(2.57)
10
 
 
11
 
AC_DEFUN([CL_READLINE],[dnl
12
 
AC_ARG_WITH([readline],
13
 
AC_HELP_STRING([--with-readline],[use readline (default is YES, if present)]),
14
 
[ac_cv_use_readline=$withval], [ac_cv_use_readline=default])
15
 
ac_cv_have_readline=no
16
 
if test "$ac_cv_use_readline" = "no" ; then
17
 
AC_MSG_NOTICE([not checking for readline])
18
 
else
19
 
AC_REQUIRE([CL_TERMCAP])dnl
20
 
if test $ac_cv_search_tgetent != no ; then
21
 
 AC_LIB_LINKFLAGS_BODY(readline)
22
 
 ac_save_CPPFLAGS="$CPPFLAGS"
23
 
 CPPFLAGS="$CPPFLAGS $INCREADLINE"
24
 
 AC_CHECK_HEADERS(readline/readline.h)
25
 
 if test "$ac_cv_header_readline_readline_h" != yes; then
26
 
  CPPFLAGS="$ac_save_CPPFLAGS"
27
 
 else # have <readline/readline.h> => check library
28
 
  ac_save_LIBS="$LIBS"
29
 
  LIBS="$LIBREADLINE $LIBS"
30
 
  AC_CHECK_FUNC(readline)dnl do not define HAVE_READLINE
31
 
  AC_CHECK_FUNCS(rl_filename_completion_function)
32
 
  if test "$ac_cv_func_readline" != yes ; then
33
 
    LIBS="$ac_save_LIBS"
34
 
    CPPFLAGS="$ac_save_CPPFLAGS"
35
 
  else # have readline => check modern features
36
 
    if test $ac_cv_func_rl_filename_completion_function = no ;
37
 
    then RL_FCF=filename_completion_function
38
 
    else RL_FCF=rl_filename_completion_function
39
 
    fi
40
 
    dnl READLINE_CONST is necessary for C++ compilation of stream.d
41
 
    CL_PROTO([filename_completion_function], [
42
 
      CL_PROTO_CONST([
43
 
#include <stdio.h>
44
 
#include <readline/readline.h>
45
 
      ],[char* ${RL_FCF} (char *, int);], [char* ${RL_FCF}();],
46
 
      cl_cv_proto_readline_const) ],
47
 
      [extern char* ${RL_FCF}($cl_cv_proto_readline_const char*, int);])
48
 
    AC_CHECK_DECLS([rl_already_prompted, rl_readline_name, rl_gnu_readline_p],,,
49
 
[#include <stdio.h>
50
 
#include <readline/readline.h>])
51
 
    AC_MSG_CHECKING(for a modern readline)
52
 
    if test "$ac_cv_have_decl_rl_already_prompted" = yes \
53
 
         -a "$ac_cv_have_decl_rl_gnu_readline_p" = yes; then
54
 
      dnl LIBREADLINE has been added to LIBS.
55
 
      AC_MSG_RESULT([found a modern GNU readline])
56
 
      ac_cv_have_readline=yes
57
 
    else
58
 
      AC_MSG_RESULT([readline is too old and will not be used])
59
 
      LIBS="$ac_save_LIBS"
60
 
      CPPFLAGS="$ac_save_CPPFLAGS"
61
 
    fi
62
 
  fi
63
 
 fi
64
 
fi
65
 
if test "$ac_cv_have_readline" = yes; then
66
 
  AC_DEFINE_UNQUOTED(READLINE_FILE_COMPLETE,${RL_FCF},[The readline built-in filename completion function, either rl_filename_completion_function() or filename_completion_function()])
67
 
  AC_DEFINE_UNQUOTED(READLINE_CONST,$cl_cv_proto_readline_const,[declaration of filename_completion_function() needs const in the first argument])
68
 
  AC_DEFINE(HAVE_READLINE,,[have a working modern GNU readline])
69
 
elif test "$ac_cv_use_readline" = yes; then
70
 
  AC_MSG_FAILURE([despite --with-readline, GNU readline was not found (try --with-libreadline-prefix)])
71
 
fi
72
 
fi
73
 
])