* debugger/mcs51/acinclude.m4, debugger/mcs51/aclocal.m4,
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 31 Oct 2006 19:19:25 +0000 (19:19 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 31 Oct 2006 19:19:25 +0000 (19:19 +0000)
  debugger/mcs51/configure: get readline version

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4452 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
debugger/mcs51/acinclude.m4
debugger/mcs51/aclocal.m4
debugger/mcs51/configure

index 684763c43032bd3a62f7bc9b35736a3e5ff5e34b..05a9532edb20579de2632cb54222b776e40bc883 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-10-31 Borut Razem <borut.razem AT siol.net>
+
+       * debugger/mcs51/acinclude.m4, debugger/mcs51/aclocal.m4,
+         debugger/mcs51/configure: get readline version
+
 2006-10-30 Borut Razem <borut.razem AT siol.net>
 
        * debugger/mcs51/sdcdb.c: replaced hardcoded "/" with DIR_SEPARATOR_STRING
index 64ea826cdd661e0bd79ede25786ccc316039e8f2..cad710b9c03d28f4375cacc6d4a879df1cc7e7bb 100644 (file)
@@ -7,9 +7,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 <<EOF
+#include <stdio.h>
+#include <readline/readline.h>
+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 +40,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"
 
@@ -31,7 +54,7 @@ AC_DEFUN([wi_LIB_READLINE], [
         rl_function_of_keyseq(NULL, NULL, NULL);
       ],[
         wi_cv_lib_readline=yes
-        wi_cv_lib_readline_result="$LIBREADLINE"
+        wi_cv_lib_readline_result=yes
       ],[
         wi_cv_lib_readline=no
         wi_cv_lib_readline_result=no
@@ -40,7 +63,7 @@ AC_DEFUN([wi_LIB_READLINE], [
       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
index 65d5badef54cba139c2aa89af00960c84bc42d43..e391550959f705167f6a1aa2bef6f64dd5f9cec9 100644 (file)
@@ -19,9 +19,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 <<EOF
+#include <stdio.h>
+#include <readline/readline.h>
+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"
@@ -29,7 +52,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"
 
@@ -43,7 +66,7 @@ AC_DEFUN([wi_LIB_READLINE], [
         rl_function_of_keyseq(NULL, NULL, NULL);
       ],[
         wi_cv_lib_readline=yes
-        wi_cv_lib_readline_result="$LIBREADLINE"
+        wi_cv_lib_readline_result=yes
       ],[
         wi_cv_lib_readline=no
         wi_cv_lib_readline_result=no
@@ -52,7 +75,7 @@ AC_DEFUN([wi_LIB_READLINE], [
       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
index 2e7b6a3b6ad994172efe8e63fc0ff86dc9352ef8..c1f88b7a26dae88fe5964d21f60174727a1fc3be 100644 (file)
@@ -3375,7 +3375,8 @@ done
 
 
 
-    if test "${ac_cv_header_readline_readline_h+set}" = set; then
+
+  if test "${ac_cv_header_readline_readline_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for readline/readline.h" >&5
 echo $ECHO_N "checking for readline/readline.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_readline_readline_h+set}" = set; then
@@ -3529,13 +3530,34 @@ fi
 
   if test "$ac_cv_header_readline_readline_h" = yes; then
 
+    cat > conftest.$ac_ext <<EOF
+#include <stdio.h>
+#include <readline/readline.h>
+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
+
+
     ac_save_LIBS="$LIBS"
     # Note: $LIBCURSES is permitted to be empty.
 
     for LIBREADLINE in "-lreadline.dll" "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses"
     do
-      { echo "$as_me:$LINENO: checking for GNU Readline library" >&5
-echo $ECHO_N "checking for GNU Readline library... $ECHO_C" >&6; }
+      { echo "$as_me:$LINENO: checking for GNU Readline library $LIBREADLINE" >&5
+echo $ECHO_N "checking for GNU Readline library $LIBREADLINE... $ECHO_C" >&6; }
 
       LIBS="$ac_save_LIBS $LIBREADLINE"
 
@@ -3598,7 +3620,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   (exit $ac_status); }; }; then
 
         wi_cv_lib_readline=yes
-        wi_cv_lib_readline_result="$LIBREADLINE"
+        wi_cv_lib_readline_result=yes
 
 else
   echo "$as_me: failed program was:" >&5
@@ -3619,7 +3641,7 @@ echo "${ECHO_T}$wi_cv_lib_readline_result" >&6; }
 
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBREADLINE 1
+#define HAVE_LIBREADLINE $wi_READLINE_VERSION
 _ACEOF
 
         break