65d5badef54cba139c2aa89af00960c84bc42d43
[fw/sdcc] / 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   AC_CHECK_HEADER(readline/readline.h)
23
24   if test "$ac_cv_header_readline_readline_h" = yes; then
25     dnl check for the readline library
26
27     ac_save_LIBS="$LIBS"
28     # Note: $LIBCURSES is permitted to be empty.
29
30     for LIBREADLINE in "-lreadline.dll" "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses"
31     do
32       AC_MSG_CHECKING([for GNU Readline library])
33
34       LIBS="$ac_save_LIBS $LIBREADLINE"
35
36       AC_TRY_LINK([
37         /* includes */
38         #include <stdio.h>
39         #include <readline/readline.h>
40       ],[
41         /* function-body */
42         readline(NULL);
43         rl_function_of_keyseq(NULL, NULL, NULL);
44       ],[
45         wi_cv_lib_readline=yes
46         wi_cv_lib_readline_result="$LIBREADLINE"
47       ],[
48         wi_cv_lib_readline=no
49         wi_cv_lib_readline_result=no
50       ])
51
52       if test "$wi_cv_lib_readline" = yes; then
53         AC_MSG_RESULT($wi_cv_lib_readline_result)
54         AC_SUBST(LIBREADLINE)
55         AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, 1, [Readline])
56         break
57       fi
58     done
59
60     LIBS="$ac_save_LIBS"
61   fi
62 ])
63