Imported Upstream version 2.9.0
[debian/cc1111] / debugger / mcs51 / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p6
2
3 dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl This macro will check for the presence of the readline library.
14 dnl To get it into the aclocal.m4 dnl file, do this:
15 dnl   aclocal -I . --verbose
16 dnl
17 dnl The --verbose will show all of the files that are searched
18 dnl for .m4 macros.
19
20 AC_DEFUN([wi_LIB_READLINE], [
21   dnl check for the readline.h header file
22
23   AC_CHECK_HEADER(readline/readline.h)
24
25   if test "$ac_cv_header_readline_readline_h" = yes; then
26     dnl check the readline version
27
28     cat > conftest.$ac_ext <<EOF
29 #include <stdio.h>
30 #include <readline/readline.h>
31 wi_LIB_READLINE_VERSION RL_VERSION_MAJOR RL_VERSION_MINOR
32 EOF
33
34     wi_READLINE_VERSION=$($CPP $CPPFLAGS conftest.$ac_ext | sed -n -e "s/^wi_LIB_READLINE_VERSION  *\([[0-9\]][[0-9\]]*\)  *\([[0-9\]][[0-9\]]*\)$/\1.\2/p")
35     rm -rf conftest*
36
37     if test -n "$wi_READLINE_VERSION"; then
38       wi_MAJOR=$(expr $wi_READLINE_VERSION : '\([[0-9]][[0-9]]*\)\.')
39       wi_MINOR=$(expr $wi_READLINE_VERSION : '[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*$\)')
40       if test $wi_MINOR -lt 10; then
41         wi_MINOR=$(expr $wi_MINOR \* 10)
42       fi
43       wi_READLINE_VERSION=$(expr $wi_MAJOR \* 100 + $wi_MINOR)
44     else
45       wi_READLINE_VERSION=-1
46     fi
47
48     dnl check for the readline library
49
50     ac_save_LIBS="$LIBS"
51     # Note: $LIBCURSES is permitted to be empty.
52
53     for LIBREADLINE in "-lreadline.dll" "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses"
54     do
55       AC_MSG_CHECKING([for GNU Readline library $LIBREADLINE])
56
57       LIBS="$ac_save_LIBS $LIBREADLINE"
58
59       AC_TRY_LINK([
60         /* includes */
61         #include <stdio.h>
62         #include <readline/readline.h>
63       ],[
64         /* function-body */
65         int dummy = rl_completion_append_character; /* rl_completion_append_character appeared in version 2.1 */
66         readline(NULL);
67       ],[
68         wi_cv_lib_readline=yes
69         AC_MSG_RESULT(yes)
70       ],[
71         wi_cv_lib_readline=no
72         AC_MSG_RESULT(no)
73       ])
74
75       if test "$wi_cv_lib_readline" = yes; then
76         AC_SUBST(LIBREADLINE)
77         AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, $wi_READLINE_VERSION, [Readline])
78         break
79       fi
80     done
81
82     LIBS="$ac_save_LIBS"
83   fi
84 ])
85