summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorRoland Hieber <rohieb@users.noreply.github.com>2021-02-09 01:05:25 (GMT)
committerGitHub <noreply@github.com>2021-02-09 01:05:25 (GMT)
commite1f77695132e814728cda982f11342a2e3c7272c (patch)
tree0257b7b939cedffc7dda48ef96b8e7bfdb8dc9fa /setup.py
parentbf2e7e55d7306b1e2fce7dce767e8df5ff42cf1c (diff)
downloadcpython-e1f77695132e814728cda982f11342a2e3c7272c.zip
cpython-e1f77695132e814728cda982f11342a2e3c7272c.tar.gz
cpython-e1f77695132e814728cda982f11342a2e3c7272c.tar.bz2
bpo-13501: allow choosing between readline and libedit (GH-24189)
In contrast to macOS, libedit is available as its own include file and library on Linux systems to prevent file name clashes. So if both libraries are available on the system, readline is currently chosen by default; and if only libedit is available, it is not found at all. This patch adds a way to link against libedit by adding the following arguments to configure: --with-readline link against libreadline (the default) --with-readline=editline link against libeditline --with-readline=no disable building the readline module --without-readline (same) The runtime detection of libedit vs. readline was already done in commit 7105319ada2e66365902 (2019-12-04, serge-sans-paille: "bpo-38634: Allow non-apple build to cope with libedit (GH-16986)"). Fixes: GH-12076 ("bpo-13501 Build or disable readline with Editline") Fixes: bpo-13501 ("Make libedit support more generic; port readline / libedit to FreeBSD") Co-authored-by: Enji Cooper (ngie-eign) Co-authored-by: Martin Panter (vadmium) Co-authored-by: Robert Marshall (kellinm)
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/setup.py b/setup.py
index c6a4e9b..0c4947f 100644
--- a/setup.py
+++ b/setup.py
@@ -1022,7 +1022,6 @@ class PyBuildExt(build_ext):
def detect_readline_curses(self):
# readline
- do_readline = self.compiler.find_library_file(self.lib_dirs, 'readline')
readline_termcap_library = ""
curses_library = ""
# Cannot use os.popen here in py3k.
@@ -1030,7 +1029,13 @@ class PyBuildExt(build_ext):
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
# Determine if readline is already linked against curses or tinfo.
- if do_readline:
+ if sysconfig.get_config_var('HAVE_LIBREADLINE'):
+ if sysconfig.get_config_var('WITH_EDITLINE'):
+ readline_lib = 'edit'
+ else:
+ readline_lib = 'readline'
+ do_readline = self.compiler.find_library_file(self.lib_dirs,
+ readline_lib)
if CROSS_COMPILING:
ret = run_command("%s -d %s | grep '(NEEDED)' > %s"
% (sysconfig.get_config_var('READELF'),
@@ -1053,6 +1058,8 @@ class PyBuildExt(build_ext):
break
if os.path.exists(tmpfile):
os.unlink(tmpfile)
+ else:
+ do_readline = False
# Issue 7384: If readline is already linked against curses,
# use the same library for the readline and curses modules.
if 'curses' in readline_termcap_library:
@@ -1092,7 +1099,7 @@ class PyBuildExt(build_ext):
else:
readline_extra_link_args = ()
- readline_libs = ['readline']
+ readline_libs = [readline_lib]
if readline_termcap_library:
pass # Issue 7384: Already linked against curses or tinfo.
elif curses_library: