Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe8e3d9

Browse files
committed
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.
1 parent 39cdfff commit fe8e3d9

3 files changed

Lines changed: 173 additions & 7 deletions

File tree

configure

Lines changed: 157 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 41923 .
2+
# From configure.in Revision: 41924 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.59 for python 2.5.
55
#
@@ -19694,14 +19694,167 @@ _ACEOF
1969419694

1969519695
fi
1969619696

19697+
# check where readline lives
19698+
19699+
echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
19700+
echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6
19701+
if test "${ac_cv_lib_readline_readline+set}" = set; then
19702+
echo $ECHO_N "(cached) $ECHO_C" >&6
19703+
else
19704+
ac_check_lib_save_LIBS=$LIBS
19705+
LIBS="-lreadline $LIBS"
19706+
cat >conftest.$ac_ext <<_ACEOF
19707+
/* confdefs.h. */
19708+
_ACEOF
19709+
cat confdefs.h >>conftest.$ac_ext
19710+
cat >>conftest.$ac_ext <<_ACEOF
19711+
/* end confdefs.h. */
19712+
19713+
/* Override any gcc2 internal prototype to avoid an error. */
19714+
#ifdef __cplusplus
19715+
extern "C"
19716+
#endif
19717+
/* We use char because int might match the return type of a gcc2
19718+
builtin and then its argument prototype would still apply. */
19719+
char readline ();
19720+
int
19721+
main ()
19722+
{
19723+
readline ();
19724+
;
19725+
return 0;
19726+
}
19727+
_ACEOF
19728+
rm -f conftest.$ac_objext conftest$ac_exeext
19729+
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
19730+
(eval $ac_link) 2>conftest.er1
19731+
ac_status=$?
19732+
grep -v '^ *+' conftest.er1 >conftest.err
19733+
rm -f conftest.er1
19734+
cat conftest.err >&5
19735+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
19736+
(exit $ac_status); } &&
19737+
{ ac_try='test -z "$ac_c_werror_flag"
19738+
|| test ! -s conftest.err'
19739+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19740+
(eval $ac_try) 2>&5
19741+
ac_status=$?
19742+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
19743+
(exit $ac_status); }; } &&
19744+
{ ac_try='test -s conftest$ac_exeext'
19745+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19746+
(eval $ac_try) 2>&5
19747+
ac_status=$?
19748+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
19749+
(exit $ac_status); }; }; then
19750+
ac_cv_lib_readline_readline=yes
19751+
else
19752+
echo "$as_me: failed program was:" >&5
19753+
sed 's/^/| /' conftest.$ac_ext >&5
19754+
19755+
ac_cv_lib_readline_readline=no
19756+
fi
19757+
rm -f conftest.err conftest.$ac_objext \
19758+
conftest$ac_exeext conftest.$ac_ext
19759+
LIBS=$ac_check_lib_save_LIBS
19760+
fi
19761+
echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
19762+
echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6
19763+
if test $ac_cv_lib_readline_readline = yes; then
19764+
cat >>confdefs.h <<_ACEOF
19765+
#define HAVE_LIBREADLINE 1
19766+
_ACEOF
19767+
19768+
LIBS="-lreadline $LIBS"
19769+
19770+
fi
19771+
19772+
if test "$ac_cv_have_readline_readline" = no
19773+
then
19774+
19775+
echo "$as_me:$LINENO: checking for readline in -ltermcap" >&5
19776+
echo $ECHO_N "checking for readline in -ltermcap... $ECHO_C" >&6
19777+
if test "${ac_cv_lib_termcap_readline+set}" = set; then
19778+
echo $ECHO_N "(cached) $ECHO_C" >&6
19779+
else
19780+
ac_check_lib_save_LIBS=$LIBS
19781+
LIBS="-ltermcap $LIBS"
19782+
cat >conftest.$ac_ext <<_ACEOF
19783+
/* confdefs.h. */
19784+
_ACEOF
19785+
cat confdefs.h >>conftest.$ac_ext
19786+
cat >>conftest.$ac_ext <<_ACEOF
19787+
/* end confdefs.h. */
19788+
19789+
/* Override any gcc2 internal prototype to avoid an error. */
19790+
#ifdef __cplusplus
19791+
extern "C"
19792+
#endif
19793+
/* We use char because int might match the return type of a gcc2
19794+
builtin and then its argument prototype would still apply. */
19795+
char readline ();
19796+
int
19797+
main ()
19798+
{
19799+
readline ();
19800+
;
19801+
return 0;
19802+
}
19803+
_ACEOF
19804+
rm -f conftest.$ac_objext conftest$ac_exeext
19805+
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
19806+
(eval $ac_link) 2>conftest.er1
19807+
ac_status=$?
19808+
grep -v '^ *+' conftest.er1 >conftest.err
19809+
rm -f conftest.er1
19810+
cat conftest.err >&5
19811+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
19812+
(exit $ac_status); } &&
19813+
{ ac_try='test -z "$ac_c_werror_flag"
19814+
|| test ! -s conftest.err'
19815+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19816+
(eval $ac_try) 2>&5
19817+
ac_status=$?
19818+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
19819+
(exit $ac_status); }; } &&
19820+
{ ac_try='test -s conftest$ac_exeext'
19821+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
19822+
(eval $ac_try) 2>&5
19823+
ac_status=$?
19824+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
19825+
(exit $ac_status); }; }; then
19826+
ac_cv_lib_termcap_readline=yes
19827+
else
19828+
echo "$as_me: failed program was:" >&5
19829+
sed 's/^/| /' conftest.$ac_ext >&5
19830+
19831+
ac_cv_lib_termcap_readline=no
19832+
fi
19833+
rm -f conftest.err conftest.$ac_objext \
19834+
conftest$ac_exeext conftest.$ac_ext
19835+
LIBS=$ac_check_lib_save_LIBS
19836+
fi
19837+
echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_readline" >&5
19838+
echo "${ECHO_T}$ac_cv_lib_termcap_readline" >&6
19839+
if test $ac_cv_lib_termcap_readline = yes; then
19840+
cat >>confdefs.h <<_ACEOF
19841+
#define HAVE_LIBTERMCAP 1
19842+
_ACEOF
19843+
19844+
LIBS="-ltermcap $LIBS"
19845+
19846+
fi
19847+
19848+
fi
19849+
1969719850
# check for readline 2.1
1969819851
echo "$as_me:$LINENO: checking for rl_callback_handler_install in -lreadline" >&5
1969919852
echo $ECHO_N "checking for rl_callback_handler_install in -lreadline... $ECHO_C" >&6
1970019853
if test "${ac_cv_lib_readline_rl_callback_handler_install+set}" = set; then
1970119854
echo $ECHO_N "(cached) $ECHO_C" >&6
1970219855
else
1970319856
ac_check_lib_save_LIBS=$LIBS
19704-
LIBS="-lreadline -ltermcap $LIBS"
19857+
LIBS="-lreadline $LIBS"
1970519858
cat >conftest.$ac_ext <<_ACEOF
1970619859
/* confdefs.h. */
1970719860
_ACEOF
@@ -19833,7 +19986,7 @@ if test "${ac_cv_lib_readline_rl_pre_input_hook+set}" = set; then
1983319986
echo $ECHO_N "(cached) $ECHO_C" >&6
1983419987
else
1983519988
ac_check_lib_save_LIBS=$LIBS
19836-
LIBS="-lreadline -ltermcap $LIBS"
19989+
LIBS="-lreadline $LIBS"
1983719990
cat >conftest.$ac_ext <<_ACEOF
1983819991
/* confdefs.h. */
1983919992
_ACEOF
@@ -19907,7 +20060,7 @@ if test "${ac_cv_lib_readline_rl_completion_matches+set}" = set; then
1990720060
echo $ECHO_N "(cached) $ECHO_C" >&6
1990820061
else
1990920062
ac_check_lib_save_LIBS=$LIBS
19910-
LIBS="-lreadline -ltermcap $LIBS"
20063+
LIBS="-lreadline $LIBS"
1991120064
cat >conftest.$ac_ext <<_ACEOF
1991220065
/* confdefs.h. */
1991320066
_ACEOF

configure.in

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2871,10 +2871,17 @@ then
28712871
[Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
28722872
fi
28732873

2874+
# check where readline lives
2875+
AC_CHECK_LIB(readline, readline)
2876+
if test "$ac_cv_have_readline_readline" = no
2877+
then
2878+
AC_CHECK_LIB(termcap, readline)
2879+
fi
2880+
28742881
# check for readline 2.1
28752882
AC_CHECK_LIB(readline, rl_callback_handler_install,
28762883
AC_DEFINE(HAVE_RL_CALLBACK, 1,
2877-
[Define if you have readline 2.1]), , -ltermcap)
2884+
[Define if you have readline 2.1]), , )
28782885

28792886
# check for readline 2.2
28802887
AC_TRY_CPP([#include <readline/readline.h>],
@@ -2890,12 +2897,12 @@ fi
28902897
# check for readline 4.0
28912898
AC_CHECK_LIB(readline, rl_pre_input_hook,
28922899
AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
2893-
[Define if you have readline 4.0]), , -ltermcap)
2900+
[Define if you have readline 4.0]), , )
28942901

28952902
# check for readline 4.2
28962903
AC_CHECK_LIB(readline, rl_completion_matches,
28972904
AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
2898-
[Define if you have readline 4.2]), , -ltermcap)
2905+
[Define if you have readline 4.2]), , )
28992906

29002907
# also in readline 4.2
29012908
AC_TRY_CPP([#include <readline/readline.h>],

pyconfig.h.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,15 @@
275275
/* Define to 1 if you have the <libintl.h> header file. */
276276
#undef HAVE_LIBINTL_H
277277

278+
/* Define to 1 if you have the `readline' library (-lreadline). */
279+
#undef HAVE_LIBREADLINE
280+
278281
/* Define to 1 if you have the `resolv' library (-lresolv). */
279282
#undef HAVE_LIBRESOLV
280283

284+
/* Define to 1 if you have the `termcap' library (-ltermcap). */
285+
#undef HAVE_LIBTERMCAP
286+
281287
/* Define to 1 if you have the <libutil.h> header file. */
282288
#undef HAVE_LIBUTIL_H
283289

0 commit comments

Comments
 (0)