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

Skip to content

Commit 1882094

Browse files
committed
Merged revisions 66179,66283 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r66179 | gregory.p.smith | 2008-09-02 22:57:48 -0700 (Tue, 02 Sep 2008) Fix issue 3645: OpenBSD required -lcurses when linking with readline to get the correct completion_matches function to avoid crashes on x86_64 (amd64). ........ r66283 | gregory.p.smith | 2008-09-06 22:15:18 -0700 (Sat, 06 Sep 2008) - Issue #1204: The configure script now tests for additional libraries that may be required when linking against readline. This fixes issues with x86_64 builds on some platforms (at least a few Linux flavors as well as OpenBSD/amd64). ........
1 parent d43029b commit 1882094

3 files changed

Lines changed: 66 additions & 108 deletions

File tree

configure

Lines changed: 34 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 65857 .
2+
# From configure.in Revision: 66187 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.61 for python 3.0.
55
#
@@ -22631,14 +22631,20 @@ fi
2263122631
# save the value of LIBS so we don't actually link Python with readline
2263222632
LIBS_no_readline=$LIBS
2263322633

22634-
{ echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
22635-
echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6; }
22636-
if test "${ac_cv_lib_readline_readline+set}" = set; then
22637-
echo $ECHO_N "(cached) $ECHO_C" >&6
22638-
else
22639-
ac_check_lib_save_LIBS=$LIBS
22640-
LIBS="-lreadline $LIBS"
22641-
cat >conftest.$ac_ext <<_ACEOF
22634+
# On some systems we need to link readline to a termcap compatible
22635+
# library. NOTE: Keep the precedence of listed libraries synchronised
22636+
# with setup.py.
22637+
py_cv_lib_readline=no
22638+
{ echo "$as_me:$LINENO: checking how to link readline libs" >&5
22639+
echo $ECHO_N "checking how to link readline libs... $ECHO_C" >&6; }
22640+
for py_libtermcap in "" ncursesw ncurses curses termcap; do
22641+
if test -z "$py_libtermcap"; then
22642+
READLINE_LIBS="-lreadline"
22643+
else
22644+
READLINE_LIBS="-lreadline -l$py_libtermcap"
22645+
fi
22646+
LIBS="$READLINE_LIBS $LIBS_no_readline"
22647+
cat >conftest.$ac_ext <<_ACEOF
2264222648
/* confdefs.h. */
2264322649
_ACEOF
2264422650
cat confdefs.h >>conftest.$ac_ext
@@ -22678,102 +22684,33 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2267822684
test ! -s conftest.err
2267922685
} && test -s conftest$ac_exeext &&
2268022686
$as_test_x conftest$ac_exeext; then
22681-
ac_cv_lib_readline_readline=yes
22687+
py_cv_lib_readline=yes
2268222688
else
2268322689
echo "$as_me: failed program was:" >&5
2268422690
sed 's/^/| /' conftest.$ac_ext >&5
2268522691

22686-
ac_cv_lib_readline_readline=no
22692+
2268722693
fi
2268822694

2268922695
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
2269022696
conftest$ac_exeext conftest.$ac_ext
22691-
LIBS=$ac_check_lib_save_LIBS
22692-
fi
22693-
{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
22694-
echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6; }
22695-
if test $ac_cv_lib_readline_readline = yes; then
22696-
cat >>confdefs.h <<_ACEOF
22697-
#define HAVE_LIBREADLINE 1
22698-
_ACEOF
22699-
22700-
LIBS="-lreadline $LIBS"
22701-
22702-
fi
22703-
22704-
if test "$ac_cv_have_readline_readline" = no
22705-
then
22706-
22707-
{ echo "$as_me:$LINENO: checking for readline in -ltermcap" >&5
22708-
echo $ECHO_N "checking for readline in -ltermcap... $ECHO_C" >&6; }
22709-
if test "${ac_cv_lib_termcap_readline+set}" = set; then
22710-
echo $ECHO_N "(cached) $ECHO_C" >&6
22711-
else
22712-
ac_check_lib_save_LIBS=$LIBS
22713-
LIBS="-ltermcap $LIBS"
22714-
cat >conftest.$ac_ext <<_ACEOF
22715-
/* confdefs.h. */
22716-
_ACEOF
22717-
cat confdefs.h >>conftest.$ac_ext
22718-
cat >>conftest.$ac_ext <<_ACEOF
22719-
/* end confdefs.h. */
22720-
22721-
/* Override any GCC internal prototype to avoid an error.
22722-
Use char because int might match the return type of a GCC
22723-
builtin and then its argument prototype would still apply. */
22724-
#ifdef __cplusplus
22725-
extern "C"
22726-
#endif
22727-
char readline ();
22728-
int
22729-
main ()
22730-
{
22731-
return readline ();
22732-
;
22733-
return 0;
22734-
}
22735-
_ACEOF
22736-
rm -f conftest.$ac_objext conftest$ac_exeext
22737-
if { (ac_try="$ac_link"
22738-
case "(($ac_try" in
22739-
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22740-
*) ac_try_echo=$ac_try;;
22741-
esac
22742-
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22743-
(eval "$ac_link") 2>conftest.er1
22744-
ac_status=$?
22745-
grep -v '^ *+' conftest.er1 >conftest.err
22746-
rm -f conftest.er1
22747-
cat conftest.err >&5
22748-
echo "$as_me:$LINENO: \$? = $ac_status" >&5
22749-
(exit $ac_status); } && {
22750-
test -z "$ac_c_werror_flag" ||
22751-
test ! -s conftest.err
22752-
} && test -s conftest$ac_exeext &&
22753-
$as_test_x conftest$ac_exeext; then
22754-
ac_cv_lib_termcap_readline=yes
22697+
if test $py_cv_lib_readline = yes; then
22698+
break
22699+
fi
22700+
done
22701+
# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
22702+
#AC_SUBST([READLINE_LIBS])
22703+
if test $py_cv_lib_readline = !yes; then
22704+
{ echo "$as_me:$LINENO: result: none" >&5
22705+
echo "${ECHO_T}none" >&6; }
2275522706
else
22756-
echo "$as_me: failed program was:" >&5
22757-
sed 's/^/| /' conftest.$ac_ext >&5
22707+
{ echo "$as_me:$LINENO: result: $READLINE_LIBS" >&5
22708+
echo "${ECHO_T}$READLINE_LIBS" >&6; }
2275822709

22759-
ac_cv_lib_termcap_readline=no
22760-
fi
22761-
22762-
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22763-
conftest$ac_exeext conftest.$ac_ext
22764-
LIBS=$ac_check_lib_save_LIBS
22765-
fi
22766-
{ echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_readline" >&5
22767-
echo "${ECHO_T}$ac_cv_lib_termcap_readline" >&6; }
22768-
if test $ac_cv_lib_termcap_readline = yes; then
22769-
cat >>confdefs.h <<_ACEOF
22770-
#define HAVE_LIBTERMCAP 1
22710+
cat >>confdefs.h <<\_ACEOF
22711+
#define HAVE_LIBREADLINE 1
2277122712
_ACEOF
2277222713

22773-
LIBS="-ltermcap $LIBS"
22774-
22775-
fi
22776-
2277722714
fi
2277822715

2277922716
# check for readline 2.1
@@ -22783,7 +22720,7 @@ if test "${ac_cv_lib_readline_rl_callback_handler_install+set}" = set; then
2278322720
echo $ECHO_N "(cached) $ECHO_C" >&6
2278422721
else
2278522722
ac_check_lib_save_LIBS=$LIBS
22786-
LIBS="-lreadline $LIBS"
22723+
LIBS="-lreadline $READLINE_LIBS $LIBS"
2278722724
cat >conftest.$ac_ext <<_ACEOF
2278822725
/* confdefs.h. */
2278922726
_ACEOF
@@ -22911,7 +22848,7 @@ if test "${ac_cv_lib_readline_rl_pre_input_hook+set}" = set; then
2291122848
echo $ECHO_N "(cached) $ECHO_C" >&6
2291222849
else
2291322850
ac_check_lib_save_LIBS=$LIBS
22914-
LIBS="-lreadline $LIBS"
22851+
LIBS="-lreadline $READLINE_LIBS $LIBS"
2291522852
cat >conftest.$ac_ext <<_ACEOF
2291622853
/* confdefs.h. */
2291722854
_ACEOF
@@ -22982,7 +22919,7 @@ if test "${ac_cv_lib_readline_rl_completion_display_matches_hook+set}" = set; th
2298222919
echo $ECHO_N "(cached) $ECHO_C" >&6
2298322920
else
2298422921
ac_check_lib_save_LIBS=$LIBS
22985-
LIBS="-lreadline $LIBS"
22922+
LIBS="-lreadline $READLINE_LIBS $LIBS"
2298622923
cat >conftest.$ac_ext <<_ACEOF
2298722924
/* confdefs.h. */
2298822925
_ACEOF
@@ -23053,7 +22990,7 @@ if test "${ac_cv_lib_readline_rl_completion_matches+set}" = set; then
2305322990
echo $ECHO_N "(cached) $ECHO_C" >&6
2305422991
else
2305522992
ac_check_lib_save_LIBS=$LIBS
23056-
LIBS="-lreadline $LIBS"
22993+
LIBS="-lreadline $READLINE_LIBS $LIBS"
2305722994
cat >conftest.$ac_ext <<_ACEOF
2305822995
/* confdefs.h. */
2305922996
_ACEOF

configure.in

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3220,16 +3220,40 @@ fi
32203220
# check where readline lives
32213221
# save the value of LIBS so we don't actually link Python with readline
32223222
LIBS_no_readline=$LIBS
3223-
AC_CHECK_LIB(readline, readline)
3224-
if test "$ac_cv_have_readline_readline" = no
3225-
then
3226-
AC_CHECK_LIB(termcap, readline)
3223+
3224+
# On some systems we need to link readline to a termcap compatible
3225+
# library. NOTE: Keep the precedence of listed libraries synchronised
3226+
# with setup.py.
3227+
py_cv_lib_readline=no
3228+
AC_MSG_CHECKING([how to link readline libs])
3229+
for py_libtermcap in "" ncursesw ncurses curses termcap; do
3230+
if test -z "$py_libtermcap"; then
3231+
READLINE_LIBS="-lreadline"
3232+
else
3233+
READLINE_LIBS="-lreadline -l$py_libtermcap"
3234+
fi
3235+
LIBS="$READLINE_LIBS $LIBS_no_readline"
3236+
AC_LINK_IFELSE(
3237+
[AC_LANG_CALL([],[readline])],
3238+
[py_cv_lib_readline=yes])
3239+
if test $py_cv_lib_readline = yes; then
3240+
break
3241+
fi
3242+
done
3243+
# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
3244+
#AC_SUBST([READLINE_LIBS])
3245+
if test $py_cv_lib_readline = !yes; then
3246+
AC_MSG_RESULT([none])
3247+
else
3248+
AC_MSG_RESULT([$READLINE_LIBS])
3249+
AC_DEFINE(HAVE_LIBREADLINE, 1,
3250+
[Define if you have the readline library (-lreadline).])
32273251
fi
32283252

32293253
# check for readline 2.1
32303254
AC_CHECK_LIB(readline, rl_callback_handler_install,
32313255
AC_DEFINE(HAVE_RL_CALLBACK, 1,
3232-
[Define if you have readline 2.1]), , )
3256+
[Define if you have readline 2.1]), ,$READLINE_LIBS)
32333257

32343258
# check for readline 2.2
32353259
AC_TRY_CPP([#include <readline/readline.h>],
@@ -3245,17 +3269,17 @@ fi
32453269
# check for readline 4.0
32463270
AC_CHECK_LIB(readline, rl_pre_input_hook,
32473271
AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
3248-
[Define if you have readline 4.0]), , )
3272+
[Define if you have readline 4.0]), ,$READLINE_LIBS)
32493273

32503274
# also in 4.0
32513275
AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
32523276
AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
3253-
[Define if you have readline 4.0]), , )
3277+
[Define if you have readline 4.0]), ,$READLINE_LIBS)
32543278

32553279
# check for readline 4.2
32563280
AC_CHECK_LIB(readline, rl_completion_matches,
32573281
AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
3258-
[Define if you have readline 4.2]), , )
3282+
[Define if you have readline 4.2]), ,$READLINE_LIBS)
32593283

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

pyconfig.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,6 @@
363363
/* Define to 1 if you have the `resolv' library (-lresolv). */
364364
#undef HAVE_LIBRESOLV
365365

366-
/* Define to 1 if you have the `termcap' library (-ltermcap). */
367-
#undef HAVE_LIBTERMCAP
368-
369366
/* Define to 1 if you have the <libutil.h> header file. */
370367
#undef HAVE_LIBUTIL_H
371368

0 commit comments

Comments
 (0)