lkundrak / rpms / chrony

Forked from rpms/chrony 4 years ago
Clone
Blob Blame History Raw
commit 84cbeeadd1d3cbdd35a85f9866d08f5507fcaf62
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date:   Fri Jul 17 12:38:37 2009 +0200

    Add editline support
    
    GNU readline recently changed license to GPLv3+ which makes it
    incompatible with chrony (GPLv2). This patch adds support for editline
    library (BSD license).

diff --git a/client.c b/client.c
index b4f65f0..d034982 100644
--- a/client.c
+++ b/client.c
@@ -41,9 +41,13 @@
 #include "memory.h"
 
 #ifdef FEAT_READLINE
+#ifdef USE_EDITLINE
+#include <editline/readline.h>
+#else
 #include <readline/readline.h>
 #include <readline/history.h>
 #endif
+#endif
 
 #ifdef HAS_STDINT_H
 #include <stdint.h>
diff --git a/configure b/configure
index 1ff2bbf..3762903 100755
--- a/configure
+++ b/configure
@@ -129,6 +129,7 @@ for instance \`--prefix=$HOME'.
 
 For better control, use the options below.
   --disable-readline     Don't try to use GNU readline
+  --with-editline        Use editline library instead of readline
   --readline-dir=DIR     Specify parent of readline include and lib directories
   --readline-inc-dir=DIR Specify where readline include directory is
   --readline-lib-dir=DIR Specify where readline lib directory is
@@ -174,6 +175,7 @@ SYSDEFS=""
 
 # Support for readline (on by default)
 feat_readline=1
+use_editline=0
 feat_rtc=1
 feat_linuxcaps=0
 readline_lib=""
@@ -195,6 +197,9 @@ do
     --disable-readline )
       feat_readline=0
     ;;
+    --with-editline )
+      use_editline=1
+    ;;
     --with-readline-library=* )
       readline_lib=-L`echo $option | sed -e 's/^.*=//;'`
     ;;
@@ -341,8 +346,13 @@ else
 fi
 
 if [ $feat_readline = "1" ]; then
-  READLINE_COMPILE="-DFEAT_READLINE=1 $readline_inc"
-  READLINE_LINK="$readline_lib $ncurses_lib -lreadline -lncurses"
+  if [ $use_editline = "1" ]; then
+    READLINE_COMPILE="-DFEAT_READLINE=1 -DUSE_EDITLINE=1 $readline_inc"
+    READLINE_LINK="$readline_lib -ledit"
+  else
+    READLINE_COMPILE="-DFEAT_READLINE=1 $readline_inc"
+    READLINE_LINK="$readline_lib $ncurses_lib -lreadline -lncurses"
+  fi
 else
   READLINE_COMPILE=""
   READLINE_LINK=""