Discussion:
[Python-3000-checkins] r66285 - in python/branches/py3k: configure configure.in pyconfig.h.in
gregory.p.smith
2008-09-07 06:24:50 UTC
Permalink
Author: gregory.p.smith
Date: Sun Sep 7 08:24:49 2008
New Revision: 66285

Log:
Merged revisions 66179,66283 via svnmerge from
svn+ssh://pythondev at svn.python.org/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).
........


Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/configure
python/branches/py3k/configure.in
python/branches/py3k/pyconfig.h.in

Modified: python/branches/py3k/configure
==============================================================================
--- python/branches/py3k/configure (original)
+++ python/branches/py3k/configure Sun Sep 7 08:24:49 2008
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 65857 .
+# From configure.in Revision: 66187 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for python 3.0.
#
@@ -22631,14 +22631,20 @@
# save the value of LIBS so we don't actually link Python with readline
LIBS_no_readline=$LIBS

-{ 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
+# On some systems we need to link readline to a termcap compatible
+# library. NOTE: Keep the precedence of listed libraries synchronised
+# with setup.py.
+py_cv_lib_readline=no
+{ echo "$as_me:$LINENO: checking how to link readline libs" >&5
+echo $ECHO_N "checking how to link readline libs... $ECHO_C" >&6; }
+for py_libtermcap in "" ncursesw ncurses curses termcap; do
+ if test -z "$py_libtermcap"; then
+ READLINE_LIBS="-lreadline"
+ else
+ READLINE_LIBS="-lreadline -l$py_libtermcap"
+ fi
+ LIBS="$READLINE_LIBS $LIBS_no_readline"
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -22678,102 +22684,33 @@
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
- ac_cv_lib_readline_readline=yes
+ py_cv_lib_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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
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 GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char readline ();
-int
-main ()
-{
-return readline ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
- ac_cv_lib_termcap_readline=yes
+ if test $py_cv_lib_readline = yes; then
+ break
+ fi
+done
+# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
+#AC_SUBST([READLINE_LIBS])
+if test $py_cv_lib_readline = !yes; then
+ { echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6; }
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ { echo "$as_me:$LINENO: result: $READLINE_LIBS" >&5
+echo "${ECHO_T}$READLINE_LIBS" >&6; }

- ac_cv_lib_termcap_readline=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- 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
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBREADLINE 1
_ACEOF

- LIBS="-ltermcap $LIBS"
-
-fi
-
fi

# check for readline 2.1
@@ -22783,7 +22720,7 @@
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $LIBS"
+LIBS="-lreadline $READLINE_LIBS $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -22911,7 +22848,7 @@
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $LIBS"
+LIBS="-lreadline $READLINE_LIBS $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -22982,7 +22919,7 @@
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $LIBS"
+LIBS="-lreadline $READLINE_LIBS $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -23053,7 +22990,7 @@
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $LIBS"
+LIBS="-lreadline $READLINE_LIBS $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF

Modified: python/branches/py3k/configure.in
==============================================================================
--- python/branches/py3k/configure.in (original)
+++ python/branches/py3k/configure.in Sun Sep 7 08:24:49 2008
@@ -3220,16 +3220,40 @@
# check where readline lives
# save the value of LIBS so we don't actually link Python with readline
LIBS_no_readline=$LIBS
-AC_CHECK_LIB(readline, readline)
-if test "$ac_cv_have_readline_readline" = no
-then
- AC_CHECK_LIB(termcap, readline)
+
+# On some systems we need to link readline to a termcap compatible
+# library. NOTE: Keep the precedence of listed libraries synchronised
+# with setup.py.
+py_cv_lib_readline=no
+AC_MSG_CHECKING([how to link readline libs])
+for py_libtermcap in "" ncursesw ncurses curses termcap; do
+ if test -z "$py_libtermcap"; then
+ READLINE_LIBS="-lreadline"
+ else
+ READLINE_LIBS="-lreadline -l$py_libtermcap"
+ fi
+ LIBS="$READLINE_LIBS $LIBS_no_readline"
+ AC_LINK_IFELSE(
+ [AC_LANG_CALL([],[readline])],
+ [py_cv_lib_readline=yes])
+ if test $py_cv_lib_readline = yes; then
+ break
+ fi
+done
+# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
+#AC_SUBST([READLINE_LIBS])
+if test $py_cv_lib_readline = !yes; then
+ AC_MSG_RESULT([none])
+else
+ AC_MSG_RESULT([$READLINE_LIBS])
+ AC_DEFINE(HAVE_LIBREADLINE, 1,
+ [Define if you have the readline library (-lreadline).])
fi

# check for readline 2.1
AC_CHECK_LIB(readline, rl_callback_handler_install,
AC_DEFINE(HAVE_RL_CALLBACK, 1,
- [Define if you have readline 2.1]), , )
+ [Define if you have readline 2.1]), ,$READLINE_LIBS)

# check for readline 2.2
AC_TRY_CPP([#include <readline/readline.h>],
@@ -3245,17 +3269,17 @@
# check for readline 4.0
AC_CHECK_LIB(readline, rl_pre_input_hook,
AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
- [Define if you have readline 4.0]), , )
+ [Define if you have readline 4.0]), ,$READLINE_LIBS)

# also in 4.0
AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
- [Define if you have readline 4.0]), , )
+ [Define if you have readline 4.0]), ,$READLINE_LIBS)

# check for readline 4.2
AC_CHECK_LIB(readline, rl_completion_matches,
AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
- [Define if you have readline 4.2]), , )
+ [Define if you have readline 4.2]), ,$READLINE_LIBS)

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

Modified: python/branches/py3k/pyconfig.h.in
==============================================================================
--- python/branches/py3k/pyconfig.h.in (original)
+++ python/branches/py3k/pyconfig.h.in Sun Sep 7 08:24:49 2008
@@ -363,9 +363,6 @@
/* Define to 1 if you have the `resolv' library (-lresolv). */
#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. */
#undef HAVE_LIBUTIL_H

Loading...