]> sjero.net Git - linphone/commitdiff
Fix readline dependency
authorYann Diorcet <yann.diorcet@belledonne-communications.com>
Mon, 15 Oct 2012 15:10:54 +0000 (17:10 +0200)
committerYann Diorcet <yann.diorcet@belledonne-communications.com>
Mon, 15 Oct 2012 15:10:54 +0000 (17:10 +0200)
console/linphonec.h
m4/readline.m4

index ba7d346f8408d3999b0a836be6ebc3db98b756c3..3265d42ac3de2ed191342815cdc3ab99026edd03 100644 (file)
 #include "config.h"
 #endif
 
+#ifdef HAVE_READLINE
 #ifdef HAVE_READLINE_H
 #include <readline.h>
-#define HAVE_READLINE
 #else
 #ifdef HAVE_READLINE_READLINE_H
 #include <readline/readline.h>
-#define HAVE_READLINE
 #endif
 #endif
 #ifdef HAVE_HISTORY_H
@@ -45,6 +44,7 @@
 #include <readline/history.h>
 #endif
 #endif
+#endif
 
 #undef PARAMS
 /**************************************************************************
index 13a217fda4dbdec5062b78cb449dc16f5d7846c9..ebb7656cd00dfc159e1f3384a72abeec5311d655 100644 (file)
@@ -22,15 +22,22 @@ if test "$readline_prefix" != "none"; then
        AC_CHECK_HEADERS(readline.h readline/readline.h, readline_h_found=yes)
        AC_CHECK_HEADERS(history.h readline/history.h)
        
-       AC_CHECK_LIB(readline, readline, [readline_libs_found=yes],[],[])
-       
+       for termcap_lib in "" -ltermcap -lcurses -lncurses; do
+               unset ac_cv_lib_readline_readline
+               AC_CHECK_LIB(readline, readline, [readline_libs_found=yes],[],[$termcap_lib])
+               if test "x$readline_libs_found" = "xyes" ; then
+                       READLINE_LIBS="$READLINE_LIBS -lreadline $termcap_lib"
+                       break
+               fi
+       done
+
        LIBS=$LIBS_save
        CPPFLAGS=$CPPFLAGS_save
        
        if test "$readline_libs_found$readline_h_found" != "yesyes" ; then
                AC_MSG_WARN([Could not find libreadline headers or library, linphonec will have limited prompt features])
        else
-               READLINE_LIBS="$READLINE_LIBS -lreadline "
+               AC_DEFINE([HAVE_READLINE],1,[defined when compiling with readline support])
        fi