libreadline only used with psql?

Started by Chris Campbellover 19 years ago3 messages
#1Chris Campbell
chris@bignerdranch.com

I've grepped through the source code, and the only thing I can find
that uses readline (or libedit) is psql.

Is that correct?

If that's the case, how hard would it be to link only psql with
readline (or libedit)?

Currently, if you ./configure with readline support, -lreadine (or -
ledit) is added to the used-by-everything LIBS variable. Can we
create a PSQL_LIBS variable and have ./configure populate that with
libraries that will only be needed by psql? That way, ./configure can
put -lreadline there and keep it out of LIBS so all the other
binaries (postmaster, pg_ctl, pg_dump, pg_restore, etc) won't require
it.

This request would be accompanied by a patch, but I wanted to ask
about the feasibility of a PSQL_LIBS variable before going down that
road.

Thanks!

- Chris

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Chris Campbell (#1)
Re: libreadline only used with psql?

Chris Campbell wrote:

If that's the case, how hard would it be to link only psql with
readline (or libedit)?

This is already addressed, more or less, in 8.2.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#2)
Re: libreadline only used with psql?

Peter Eisentraut <peter_e@gmx.net> writes:

Chris Campbell wrote:

If that's the case, how hard would it be to link only psql with
readline (or libedit)?

This is already addressed, more or less, in 8.2.

We've suppressed libreadline in the backend, but not in any of the other
client programs (eg, pg_dump still has it). Not sure whether Chris
really cares about those. In any case, I think it's inappropriate
for configure to know exactly which programs need which libraries.
It'd probably be more maintainable in the long run to propagate
src/backend/Makefile's technique into the other Makefiles:

# The backend doesn't need everything that's in LIBS, however
LIBS := $(filter-out -lz -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS))

with suitable adjustment of the filter list for each program.
(But possibly "-lreadline -ledit -ltermcap -lncurses -lcurses"
should be factored out as a READLINE_LIBS variable or some such.)

regards, tom lane