From bcecd677f63905d4254703c0046e3f03eeff9793 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Mon, 25 Feb 2002 13:54:52 +0000 Subject: [PATCH] Make restore compile with old versions of readline library. --- CHANGES | 9 ++- THANKS | 5 +- config.h.in | 6 ++ configure | 158 +++++++++++++++++++++++++++++++++--------- configure.in | 16 +++++ restore/interactive.c | 8 ++- 6 files changed, 167 insertions(+), 35 deletions(-) diff --git a/CHANGES b/CHANGES index 574b022..776bedf 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.164 2002/02/21 14:07:14 stelian Exp $ +$Id: CHANGES,v 1.165 2002/02/25 13:54:52 stelian Exp $ Changes between versions 0.4b27 and 0.4b28 (released ?????????????????) ======================================================================= @@ -11,6 +11,13 @@ Changes between versions 0.4b27 and 0.4b28 (released ?????????????????) there should be no white space between the option letter and the -j or -z parameter, thanks to Kenneth Porter +3. Made restore work with older versions of the readline library, + by checking in configure for several extended symbols. Restore + can now be compiled with a readline as old as the 2.0 release + (though it may be a good idea to upgrade it to a more recent + version...). Thanks to Andrew Donkin for + reporting the build failures. + Changes between versions 0.4b26 and 0.4b27 (released February 15, 2002) ======================================================================= diff --git a/THANKS b/THANKS index 385510d..5658e4c 100644 --- a/THANKS +++ b/THANKS @@ -1,4 +1,4 @@ -$Id: THANKS,v 1.53 2002/01/25 14:59:53 stelian Exp $ +$Id: THANKS,v 1.54 2002/02/25 13:54:52 stelian Exp $ Dump and restore were written by the people of the CSRG at the University of California, Berkeley. @@ -35,6 +35,7 @@ Abhijit Dasgupta abhijit@ans.net John R. Dennison gerdesas@users.sourceforge.net Eugenio Diaz getnito@yahoo.com Andreas Dilger adilger@turbolinux.com +Andrew Donkin ard@waikato.ac.nz Bernhard Erdmann bernhard.erdmann@gmx.de Jason Fearon jasonf@netrider.org.au Jeremy Fitzhardinge jeremy@goop.org @@ -89,4 +90,4 @@ Jason Venner jason@idiom.com Christian Weisgerber naddy@mips.rhein-neckar.de Kim Yong-jun loveyou@hackerslab.org John Yu jky@it.bu.edu -Ian Zimmerman itz@speakeasy.org> +Ian Zimmerman itz@speakeasy.org diff --git a/config.h.in b/config.h.in index 7bb86b6..9564cc5 100644 --- a/config.h.in +++ b/config.h.in @@ -73,3 +73,9 @@ /* Define this if you want to include Quick File Access debugging code */ #undef DEBUG_QFA + +/* Define this if your readline libs have the rl_completion_append_character variable */ +#undef HAVE_READLINE_CAC + +/* Define this if your readline libs have the rl_completion_matches library */ +#undef HAVE_READLINE_RLCM diff --git a/configure b/configure index a8bc54e..750475d 100755 --- a/configure +++ b/configure @@ -1965,19 +1965,115 @@ if test "$readline_h" = no -o "$readline_lib" = no; then fi fi +echo $ac_n "checking for rl_completion_matches in -lreadline""... $ac_c" 1>&6 +echo "configure:1970: checking for rl_completion_matches in -lreadline" >&5 +ac_lib_var=`echo readline'_'rl_completion_matches | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lreadline "-ltermcap" $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + rlcm=yes +else + echo "$ac_t""no" 1>&6 +rlcm=no +fi + +if test "$rlcm" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_READLINE_RLCM 1 +EOF + +fi + +echo $ac_n "checking for rl_completion_append_character in -lreadline""... $ac_c" 1>&6 +echo "configure:2018: checking for rl_completion_append_character in -lreadline" >&5 +ac_lib_var=`echo readline'_'rl_completion_append_character | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lreadline "-ltermcap" $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + rcac=yes +else + echo "$ac_t""no" 1>&6 +rcac=no +fi + +if test "$rcac" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_READLINE_CAC 1 +EOF + +fi + ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for zlib.h""... $ac_c" 1>&6 -echo "configure:1971: checking for zlib.h" >&5 +echo "configure:2067: checking for zlib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1981: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2077: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2000,7 +2096,7 @@ zlib_h=no fi echo $ac_n "checking for compress2 in -lz""... $ac_c" 1>&6 -echo "configure:2004: checking for compress2 in -lz" >&5 +echo "configure:2100: checking for compress2 in -lz" >&5 ac_lib_var=`echo z'_'compress2 | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2008,7 +2104,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2053,17 +2149,17 @@ fi ac_safe=`echo "bzlib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for bzlib.h""... $ac_c" 1>&6 -echo "configure:2057: checking for bzlib.h" >&5 +echo "configure:2153: checking for bzlib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2067: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2163: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2086,7 +2182,7 @@ bzlib_h=no fi echo $ac_n "checking for BZ2_bzBuffToBuffCompress in -lbz2""... $ac_c" 1>&6 -echo "configure:2090: checking for BZ2_bzBuffToBuffCompress in -lbz2" >&5 +echo "configure:2186: checking for BZ2_bzBuffToBuffCompress in -lbz2" >&5 ac_lib_var=`echo bz2'_'BZ2_bzBuffToBuffCompress | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2094,7 +2190,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbz2 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2140,12 +2236,12 @@ fi for ac_func in err errx verr verrx vwarn vwarnx warn warnx realpath lchown do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2144: checking for $ac_func" >&5 +echo "configure:2240: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2193,12 +2289,12 @@ fi done echo $ac_n "checking for glob""... $ac_c" 1>&6 -echo "configure:2197: checking for glob" >&5 +echo "configure:2293: checking for glob" >&5 if eval "test \"`echo '$''{'ac_cv_func_glob'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_glob=yes" else @@ -2242,10 +2338,10 @@ fi echo $ac_n "checking for extended glob routines""... $ac_c" 1>&6 -echo "configure:2246: checking for extended glob routines" >&5 +echo "configure:2342: checking for extended glob routines" >&5 if test "$ac_cv_func_glob" = "yes"; then cat > conftest.$ac_ext < @@ -2276,12 +2372,12 @@ rm -f conftest* fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2280: checking for ANSI C header files" >&5 +echo "configure:2376: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2289,7 +2385,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2293: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2389: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2306,7 +2402,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2324,7 +2420,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2345,7 +2441,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2356,7 +2452,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2456: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2380,12 +2476,12 @@ EOF fi echo $ac_n "checking for quad_t""... $ac_c" 1>&6 -echo "configure:2384: checking for quad_t" >&5 +echo "configure:2480: checking for quad_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_quad_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2413,12 +2509,12 @@ EOF fi echo $ac_n "checking for u_quad_t""... $ac_c" 1>&6 -echo "configure:2417: checking for u_quad_t" >&5 +echo "configure:2513: checking for u_quad_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_u_quad_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS diff --git a/configure.in b/configure.in index c681be2..3166457 100644 --- a/configure.in +++ b/configure.in @@ -356,6 +356,22 @@ if test "$readline_h" = no -o "$readline_lib" = no; then fi fi +dnl +dnl Check for rl_completion_matches +dnl +AC_CHECK_LIB(readline, rl_completion_matches, [rlcm=yes], [rlcm=no], "-ltermcap") +if test "$rlcm" = yes; then + AC_DEFINE(HAVE_READLINE_RLCM) +fi + +dnl +dnl Check for rl_completion_append_character +dnl +AC_CHECK_LIB(readline, rl_completion_append_character, [rcac=yes], [rcac=no], "-ltermcap") +if test "$rcac" = yes; then + AC_DEFINE(HAVE_READLINE_CAC) +fi + dnl dnl Check for zlib headers and libraries dnl diff --git a/restore/interactive.c b/restore/interactive.c index 473c113..f252fc8 100644 --- a/restore/interactive.c +++ b/restore/interactive.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: interactive.c,v 1.22 2002/02/04 12:07:38 stelian Exp $"; + "$Id: interactive.c,v 1.23 2002/02/25 13:54:53 stelian Exp $"; #endif /* not lint */ #include @@ -836,6 +836,10 @@ onintr(int signo) #if HAVE_READLINE +#if !HAVE_READLINE_RLCM +#define rl_completion_matches completion_matches +#endif + /* A static variable for holding the line. */ static char *line_read = NULL; @@ -1024,7 +1028,9 @@ initialize_readline(void) rl_readline_name = "dump"; rl_attempted_completion_function = restore_completion; rl_completion_entry_function = NULL; +#if HAVE_READLINE_CAC /* compile with readline 2.0 */ rl_completion_append_character = '\0'; +#endif rl_instream = terminal; } -- 2.39.5