If there is no libtermcap all the readline tests failed.

This inappropriately disabled some capabilities which exist.

Now test for readline in -lreadline, if not found there, try it
in -ltermcap only if not in -lreadline.  If both libraries are
required, there will need to be more work, but I'm not sure
under what conditions both libraries would be required.
This commit is contained in:
Neal Norwitz 2006-01-07 21:07:20 +00:00
parent 39cdfff691
commit fe8e3d918e
3 changed files with 173 additions and 7 deletions

161
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# From configure.in Revision: 41923 . # From configure.in Revision: 41924 .
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for python 2.5. # Generated by GNU Autoconf 2.59 for python 2.5.
# #
@ -19694,6 +19694,159 @@ _ACEOF
fi fi
# check where readline lives
echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6
if test "${ac_cv_lib_readline_readline+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lreadline $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char readline ();
int
main ()
{
readline ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_readline_readline=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_readline_readline=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6
if test $ac_cv_lib_readline_readline = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBREADLINE 1
_ACEOF
LIBS="-lreadline $LIBS"
fi
if test "$ac_cv_have_readline_readline" = no
then
echo "$as_me:$LINENO: checking for readline in -ltermcap" >&5
echo $ECHO_N "checking for readline in -ltermcap... $ECHO_C" >&6
if test "${ac_cv_lib_termcap_readline+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltermcap $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char readline ();
int
main ()
{
readline ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_termcap_readline=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_termcap_readline=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_readline" >&5
echo "${ECHO_T}$ac_cv_lib_termcap_readline" >&6
if test $ac_cv_lib_termcap_readline = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBTERMCAP 1
_ACEOF
LIBS="-ltermcap $LIBS"
fi
fi
# check for readline 2.1 # check for readline 2.1
echo "$as_me:$LINENO: checking for rl_callback_handler_install in -lreadline" >&5 echo "$as_me:$LINENO: checking for rl_callback_handler_install in -lreadline" >&5
echo $ECHO_N "checking for rl_callback_handler_install in -lreadline... $ECHO_C" >&6 echo $ECHO_N "checking for rl_callback_handler_install in -lreadline... $ECHO_C" >&6
@ -19701,7 +19854,7 @@ if test "${ac_cv_lib_readline_rl_callback_handler_install+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6 echo $ECHO_N "(cached) $ECHO_C" >&6
else else
ac_check_lib_save_LIBS=$LIBS ac_check_lib_save_LIBS=$LIBS
LIBS="-lreadline -ltermcap $LIBS" LIBS="-lreadline $LIBS"
cat >conftest.$ac_ext <<_ACEOF cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */ /* confdefs.h. */
_ACEOF _ACEOF
@ -19833,7 +19986,7 @@ if test "${ac_cv_lib_readline_rl_pre_input_hook+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6 echo $ECHO_N "(cached) $ECHO_C" >&6
else else
ac_check_lib_save_LIBS=$LIBS ac_check_lib_save_LIBS=$LIBS
LIBS="-lreadline -ltermcap $LIBS" LIBS="-lreadline $LIBS"
cat >conftest.$ac_ext <<_ACEOF cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */ /* confdefs.h. */
_ACEOF _ACEOF
@ -19907,7 +20060,7 @@ if test "${ac_cv_lib_readline_rl_completion_matches+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6 echo $ECHO_N "(cached) $ECHO_C" >&6
else else
ac_check_lib_save_LIBS=$LIBS ac_check_lib_save_LIBS=$LIBS
LIBS="-lreadline -ltermcap $LIBS" LIBS="-lreadline $LIBS"
cat >conftest.$ac_ext <<_ACEOF cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */ /* confdefs.h. */
_ACEOF _ACEOF

View File

@ -2871,10 +2871,17 @@ then
[Define this if you have flockfile(), getc_unlocked(), and funlockfile()]) [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
fi fi
# check where readline lives
AC_CHECK_LIB(readline, readline)
if test "$ac_cv_have_readline_readline" = no
then
AC_CHECK_LIB(termcap, readline)
fi
# check for readline 2.1 # check for readline 2.1
AC_CHECK_LIB(readline, rl_callback_handler_install, AC_CHECK_LIB(readline, rl_callback_handler_install,
AC_DEFINE(HAVE_RL_CALLBACK, 1, AC_DEFINE(HAVE_RL_CALLBACK, 1,
[Define if you have readline 2.1]), , -ltermcap) [Define if you have readline 2.1]), , )
# check for readline 2.2 # check for readline 2.2
AC_TRY_CPP([#include <readline/readline.h>], AC_TRY_CPP([#include <readline/readline.h>],
@ -2890,12 +2897,12 @@ fi
# check for readline 4.0 # check for readline 4.0
AC_CHECK_LIB(readline, rl_pre_input_hook, AC_CHECK_LIB(readline, rl_pre_input_hook,
AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1, AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
[Define if you have readline 4.0]), , -ltermcap) [Define if you have readline 4.0]), , )
# check for readline 4.2 # check for readline 4.2
AC_CHECK_LIB(readline, rl_completion_matches, AC_CHECK_LIB(readline, rl_completion_matches,
AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1, AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
[Define if you have readline 4.2]), , -ltermcap) [Define if you have readline 4.2]), , )
# also in readline 4.2 # also in readline 4.2
AC_TRY_CPP([#include <readline/readline.h>], AC_TRY_CPP([#include <readline/readline.h>],

View File

@ -275,9 +275,15 @@
/* Define to 1 if you have the <libintl.h> header file. */ /* Define to 1 if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H #undef HAVE_LIBINTL_H
/* Define to 1 if you have the `readline' library (-lreadline). */
#undef HAVE_LIBREADLINE
/* Define to 1 if you have the `resolv' library (-lresolv). */ /* Define to 1 if you have the `resolv' library (-lresolv). */
#undef HAVE_LIBRESOLV #undef HAVE_LIBRESOLV
/* Define to 1 if you have the `termcap' library (-ltermcap). */
#undef HAVE_LIBTERMCAP
/* Define to 1 if you have the <libutil.h> header file. */ /* Define to 1 if you have the <libutil.h> header file. */
#undef HAVE_LIBUTIL_H #undef HAVE_LIBUTIL_H