File: 03_editline.patch

package info (click to toggle)
db5.3 5.3.28%2Bdfsg1-0.5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 158,360 kB
  • sloc: ansic: 448,411; java: 111,824; tcl: 80,544; sh: 44,326; cs: 33,697; cpp: 21,604; perl: 14,557; xml: 10,799; makefile: 4,077; yacc: 1,003; awk: 965; sql: 801; erlang: 342; python: 216; php: 24; asm: 14
file content (504 lines) | stat: -rw-r--r-- 19,004 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
--- Makefile.in
+++ Makefile.in
@@ -49,7 +49,7 @@ LIBTCL = @TCL_LIB_SPEC@ @TCL_LIBS@
 
 # Compiler options needed for programs that use the readline() library.
 #
-READLINE_FLAGS = -DHAVE_READLINE=@TARGET_HAVE_READLINE@ @TARGET_READLINE_INC@
+READLINE_FLAGS = -DHAVE_EDITLINE=@TARGET_HAVE_EDITLINE@ -DHAVE_READLINE=@TARGET_HAVE_READLINE@ @TARGET_READLINE_INC@
 
 # The library that programs using readline() must link against.
 #
--- configure
+++ configure
@@ -890,6 +890,7 @@ TCL_STUB_LIB_SPEC
 HAVE_TCL
 TARGET_READLINE_LIBS
 TARGET_READLINE_INC
+TARGET_HAVE_EDITLINE
 TARGET_HAVE_READLINE
 TARGET_DEBUG
 USE_AMALGAMATION
@@ -3734,13 +3735,13 @@ if test "${lt_cv_nm_interface+set}" = se
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:3737: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:3738: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:3740: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:3741: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:3743: output\"" >&5)
+  (eval echo "\"\$as_me:3744: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -4962,7 +4963,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 4965 "configure"' > conftest.$ac_ext
+  echo '#line 4966 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -6831,11 +6832,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6834: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6835: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6838: \$? = $ac_status" >&5
+   echo "$as_me:6839: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7170,11 +7171,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7173: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7174: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7177: \$? = $ac_status" >&5
+   echo "$as_me:7178: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7275,11 +7276,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7278: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7279: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7282: \$? = $ac_status" >&5
+   echo "$as_me:7283: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -7330,11 +7331,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7333: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7334: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7337: \$? = $ac_status" >&5
+   echo "$as_me:7338: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -10143,7 +10144,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10146 "configure"
+#line 10147 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10239,7 +10240,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10242 "configure"
+#line 10243 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12920,6 +12921,7 @@ fi
 #
 TARGET_READLINE_LIBS=""
 TARGET_READLINE_INC=""
+TARGET_HAVE_EDITLINE=0
 TARGET_HAVE_READLINE=0
 # Check whether --enable-readline was given.
 if test "${enable_readline+set}" = set; then
@@ -12930,6 +12932,7 @@ fi
 
 
 if test x"$with_readline" != xno; then
+	header=readline.h
 	found="yes"
 
 
@@ -12941,9 +12944,12 @@ else
 fi
 
 	if test "x$with_readline_lib" = xauto; then
-		save_LIBS="$LIBS"
-		LIBS=""
-		{ $as_echo "$as_me:$LINENO: checking for library containing tgetent" >&5
+		for rl_lib in edit readline; do
+			found="yes"
+			save_LIBS="$LIBS"
+			LIBS=""
+			$as_unset ac_cv_search_tgetent || test "${ac_cv_search_tgetent+set}" != set || { ac_cv_search_tgetent=; export ac_cv_search_tgetent; }
+			{ $as_echo "$as_me:$LINENO: checking for library containing tgetent" >&5
 $as_echo_n "checking for library containing tgetent... " >&6; }
 if test "${ac_cv_search_tgetent+set}" = set; then
   $as_echo_n "(cached) " >&6
@@ -12971,7 +12977,7 @@ return tgetent ();
   return 0;
 }
 _ACEOF
-for ac_lib in '' readline ncurses curses termcap; do
+for ac_lib in '' $rl_lib ncurses curses termcap; do
   if test -z "$ac_lib"; then
     ac_res="none required"
   else
@@ -13032,13 +13038,14 @@ else
   term_LIBS=""
 fi
 
-		{ $as_echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
-$as_echo_n "checking for readline in -lreadline... " >&6; }
-if test "${ac_cv_lib_readline_readline+set}" = set; then
+			as_ac_Lib=`$as_echo "ac_cv_lib_$rl_lib''_readline" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for readline in -l$rl_lib" >&5
+$as_echo_n "checking for readline in -l$rl_lib... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline  $LIBS"
+LIBS="-l$rl_lib  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -13082,12 +13089,12 @@ eval ac_try_echo="\"\$as_me:$LINENO: $ac
 	 test "$cross_compiling" = yes ||
 	 $as_test_x conftest$ac_exeext
        }; then
-  ac_cv_lib_readline_readline=yes
+  eval "$as_ac_Lib=yes"
 else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_readline_readline=no
+	eval "$as_ac_Lib=no"
 fi
 
 rm -rf conftest.dSYM
@@ -13095,16 +13102,28 @@ rm -f core conftest.err conftest.$ac_obj
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
-$as_echo "$ac_cv_lib_readline_readline" >&6; }
-if test $ac_cv_lib_readline_readline = yes; then
-  TARGET_READLINE_LIBS="-lreadline"
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
+		 $as_echo "$as_val"'`
+	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_Lib'}
+		 $as_echo "$as_val"'` = yes; then
+  TARGET_READLINE_LIBS="-l$rl_lib"
 else
   found="no"
 fi
 
-		TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
-		LIBS="$save_LIBS"
+			TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
+			LIBS="$save_LIBS"
+			if test "$found" = "yes"; then
+				break
+			fi
+		done
+
+		if test "$rl_lib" = "edit"; then
+			header="editline/readline.h"
+			TARGET_HAVE_EDITLINE=1
+		fi
 	else
 		TARGET_READLINE_LIBS="$with_readline_lib"
 	fi
@@ -13118,18 +13137,21 @@ else
 fi
 
 	if test "x$with_readline_inc" = xauto; then
-		if test "${ac_cv_header_readline_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for readline.h" >&5
-$as_echo_n "checking for readline.h... " >&6; }
-if test "${ac_cv_header_readline_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_readline_h" >&5
-$as_echo "$ac_cv_header_readline_h" >&6; }
+		as_ac_Header=`$as_echo "ac_cv_header_$header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { $as_echo "$as_me:$LINENO: checking for $header" >&5
+$as_echo_n "checking for $header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'`
+	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 else
   # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking readline.h usability" >&5
-$as_echo_n "checking readline.h usability... " >&6; }
+{ $as_echo "$as_me:$LINENO: checking $header usability" >&5
+$as_echo_n "checking $header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -13137,7 +13159,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <readline.h>
+#include <$header>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -13170,15 +13192,15 @@ rm -f core conftest.err conftest.$ac_obj
 $as_echo "$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ $as_echo "$as_me:$LINENO: checking readline.h presence" >&5
-$as_echo_n "checking readline.h presence... " >&6; }
+{ $as_echo "$as_me:$LINENO: checking $header presence" >&5
+$as_echo_n "checking $header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <readline.h>
+#include <$header>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -13212,40 +13234,43 @@ rm -f conftest.err conftest.$ac_ext
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: readline.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: readline.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: readline.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: readline.h: proceeding with the compiler's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $header: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: readline.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: readline.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: readline.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: readline.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: readline.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: readline.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: readline.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: readline.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: readline.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: readline.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: readline.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: readline.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for readline.h" >&5
-$as_echo_n "checking for readline.h... " >&6; }
-if test "${ac_cv_header_readline_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_readline_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_readline_h" >&5
-$as_echo "$ac_cv_header_readline_h" >&6; }
-
-fi
-if test $ac_cv_header_readline_h = yes; then
+    { $as_echo "$as_me:$LINENO: WARNING: $header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $header: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $header" >&5
+$as_echo_n "checking for $header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'`
+	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'` = yes; then
   found="yes"
 else
 
@@ -13253,9 +13278,9 @@ else
 			if test "$cross_compiling" != yes; then
 				for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
 					for subdir in include include/readline; do
-						as_ac_File=`$as_echo "ac_cv_file_$dir/$subdir/readline.h" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $dir/$subdir/readline.h" >&5
-$as_echo_n "checking for $dir/$subdir/readline.h... " >&6; }
+						as_ac_File=`$as_echo "ac_cv_file_$dir/$subdir/$header" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $dir/$subdir/$header" >&5
+$as_echo_n "checking for $dir/$subdir/$header... " >&6; }
 if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then
   $as_echo_n "(cached) " >&6
 else
@@ -13263,7 +13288,7 @@ else
   { { $as_echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
 $as_echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
    { (exit 1); exit 1; }; }
-if test -r "$dir/$subdir/readline.h"; then
+if test -r "$dir/$subdir/$header"; then
   eval "$as_ac_File=yes"
 else
   eval "$as_ac_File=no"
@@ -13297,6 +13322,7 @@ fi
 	if test x"$found" = xno; then
 		TARGET_READLINE_LIBS=""
 		TARGET_READLINE_INC=""
+		TARGET_HAVE_EDITLINE=0
 		TARGET_HAVE_READLINE=0
 	else
 		TARGET_HAVE_READLINE=1
@@ -13307,6 +13333,7 @@ fi
 
 
 
+
 ##########
 # Figure out what C libraries are required to compile programs
 # that use "fdatasync()" function.
--- configure.ac
+++ configure.ac
@@ -524,6 +524,7 @@ AC_SUBST(HAVE_TCL)
 #
 TARGET_READLINE_LIBS=""
 TARGET_READLINE_INC=""
+TARGET_HAVE_EDITLINE=0
 TARGET_HAVE_READLINE=0
 AC_ARG_ENABLE([readline],
 	[AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
@@ -531,6 +532,7 @@ AC_ARG_ENABLE([readline],
 	[with_readline=auto])
 
 if test x"$with_readline" != xno; then
+	header=readline.h
 	found="yes"
 
 	AC_ARG_WITH([readline-lib],
@@ -538,12 +540,24 @@ if test x"$with_readline" != xno; then
 		[with_readline_lib=$withval],
 		[with_readline_lib="auto"])
 	if test "x$with_readline_lib" = xauto; then
-		save_LIBS="$LIBS"
-		LIBS=""
-		AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
-		AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
-		TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
-		LIBS="$save_LIBS"
+		for rl_lib in edit readline; do
+			found="yes"
+			save_LIBS="$LIBS"
+			LIBS=""
+			AS_UNSET(ac_cv_search_tgetent)
+			AC_SEARCH_LIBS(tgetent, [$rl_lib ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
+			AC_CHECK_LIB([$rl_lib], [readline], [TARGET_READLINE_LIBS="-l$rl_lib"], [found="no"])
+			TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
+			LIBS="$save_LIBS"
+			if test "$found" = "yes"; then
+				break
+			fi
+		done
+
+		if test "$rl_lib" = "edit"; then
+			header="editline/readline.h"
+			TARGET_HAVE_EDITLINE=1
+		fi
 	else
 		TARGET_READLINE_LIBS="$with_readline_lib"
 	fi
@@ -553,12 +567,12 @@ if test x"$with_readline" != xno; then
 		[with_readline_inc=$withval],
 		[with_readline_inc="auto"])
 	if test "x$with_readline_inc" = xauto; then
-		AC_CHECK_HEADER(readline.h, [found="yes"], [
+		AC_CHECK_HEADER($header, [found="yes"], [
 			found="no"
 			if test "$cross_compiling" != yes; then
 				for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
 					for subdir in include include/readline; do
-						AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
+						AC_CHECK_FILE($dir/$subdir/$header, found=yes)
 						if test "$found" = "yes"; then
 							TARGET_READLINE_INC="-I$dir/$subdir"
 							break
@@ -575,6 +589,7 @@ if test x"$with_readline" != xno; then
 	if test x"$found" = xno; then
 		TARGET_READLINE_LIBS=""
 		TARGET_READLINE_INC=""
+		TARGET_HAVE_EDITLINE=0
 		TARGET_HAVE_READLINE=0
 	else
 		TARGET_HAVE_READLINE=1
@@ -583,6 +598,7 @@ fi
 
 AC_SUBST(TARGET_READLINE_LIBS)
 AC_SUBST(TARGET_READLINE_INC)
+AC_SUBST(TARGET_HAVE_EDITLINE)
 AC_SUBST(TARGET_HAVE_READLINE)
 
 ##########
--- src/shell.c
+++ src/shell.c
@@ -38,14 +38,13 @@
 # include <unistd.h>
 #endif
 
-#ifdef HAVE_EDITLINE
+#if defined (HAVE_EDITLINE) && HAVE_EDITLINE==1
 # include <editline/editline.h>
-#endif
-#if defined(HAVE_READLINE) && HAVE_READLINE==1
+#elif defined(HAVE_READLINE) && HAVE_READLINE==1
 # include <readline/readline.h>
 # include <readline/history.h>
 #endif
-#if !defined(HAVE_EDITLINE) && (!defined(HAVE_READLINE) || HAVE_READLINE!=1)
+#if (!defined(HAVE_EDITLINE) || HAVE_EDITLINE!=1) && (!defined(HAVE_READLINE) || HAVE_READLINE!=1)
 # define readline(p) local_getline(p,stdin)
 # define add_history(X)
 # define read_history(X)