X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=debugger%2Fmcs51%2Facinclude.m4;h=c7383220b92d3e29012e95975127af2bd86891f7;hb=9575f3d72c4cf6b0a0068965d4bd01a1f8e5bef7;hp=64ea826cdd661e0bd79ede25786ccc316039e8f2;hpb=3abe9c9ebb6edf00418306f026fd256c52e42af4;p=fw%2Fsdcc diff --git a/debugger/mcs51/acinclude.m4 b/debugger/mcs51/acinclude.m4 index 64ea826c..c7383220 100644 --- a/debugger/mcs51/acinclude.m4 +++ b/debugger/mcs51/acinclude.m4 @@ -1,4 +1,8 @@ -dnl This macro will check for the presence of the readline library. +dnl Borut Razem +dnl +dnl This macro checks for the presence of the readline library. +dnl It works also in cross-compilation environment. +dnl dnl To get it into the aclocal.m4 dnl file, do this: dnl aclocal -I . --verbose dnl @@ -7,9 +11,32 @@ dnl for .m4 macros. AC_DEFUN([wi_LIB_READLINE], [ dnl check for the readline.h header file + AC_CHECK_HEADER(readline/readline.h) if test "$ac_cv_header_readline_readline_h" = yes; then + dnl check the readline version + + cat > conftest.$ac_ext < +#include +wi_LIB_READLINE_VERSION RL_VERSION_MAJOR RL_VERSION_MINOR +EOF + + 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") + rm -rf conftest* + + if test -n "$wi_READLINE_VERSION"; then + wi_MAJOR=$(expr $wi_READLINE_VERSION : '\([[0-9]][[0-9]]*\)\.') + wi_MINOR=$(expr $wi_READLINE_VERSION : '[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*$\)') + if test $wi_MINOR -lt 10; then + wi_MINOR=$(expr $wi_MINOR \* 10) + fi + wi_READLINE_VERSION=$(expr $wi_MAJOR \* 100 + $wi_MINOR) + else + wi_READLINE_VERSION=-1 + fi + dnl check for the readline library ac_save_LIBS="$LIBS" @@ -17,7 +44,7 @@ AC_DEFUN([wi_LIB_READLINE], [ for LIBREADLINE in "-lreadline.dll" "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses" do - AC_MSG_CHECKING([for GNU Readline library]) + AC_MSG_CHECKING([for GNU Readline library $LIBREADLINE]) LIBS="$ac_save_LIBS $LIBREADLINE" @@ -27,20 +54,19 @@ AC_DEFUN([wi_LIB_READLINE], [ #include ],[ /* function-body */ + int dummy = rl_completion_append_character; /* rl_completion_append_character appeared in version 2.1 */ readline(NULL); - rl_function_of_keyseq(NULL, NULL, NULL); ],[ wi_cv_lib_readline=yes - wi_cv_lib_readline_result="$LIBREADLINE" + AC_MSG_RESULT(yes) ],[ wi_cv_lib_readline=no - wi_cv_lib_readline_result=no + AC_MSG_RESULT(no) ]) if test "$wi_cv_lib_readline" = yes; then - AC_MSG_RESULT($wi_cv_lib_readline_result) AC_SUBST(LIBREADLINE) - AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, 1, [Readline]) + AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, $wi_READLINE_VERSION, [Readline]) break fi done