On 01/15/2018 05:39 PM, Andrea Bolognani wrote:
On Mon, 2018-01-15 at 16:36 +0100, Michal Privoznik wrote:
>> So, one way to solve this once and for all would be to:
>>
>> * try looking up readline through pkg-config. If that works,
>> then we already know we're compiling against a recent
>> readline version and everything will work;
>
> I just found out that this will not work - even though there is
> readline.pc.in in the readline repo, they are lacking rule to install
> the .pc file. So nobody ships that. For instance, on my rawhide box:
>
> [root@fedora ~]# rpm -q readline
> readline-7.0-5.fc26.x86_64
> [root@fedora ~]# rpm -ql readline | grep \.pc
> [root@fedora ~]#
Ouch.
(Note the .pc file would be in the readline-devel package, not in
the runtime one. Still, I've checked on my Rawhide guest and it's
not there.)
Ah, right.
At least FreeBSD ships it, though:
# pkg list readline | grep pc$
/usr/local/libdata/pkgconfig/readline.pc
is this GNU readline? I've heard that FreeBSD is ditching GNU software.
Not sure about brew. Not having access to a macOS box is really
annoying in this kind of scenario.
>> * if readline's pkg-config file is not available, try linking
>> against it the old way. This will succeed on oldish versions
>> like the one shipped with CentOS but fail because of missing
>> functions on macOS.
1: ^^^
>
> I should have commented earlier too - what good it is to switch to
> pkg-config if we're keeping the old way of detecting the library (with
> this patch included) anyway?
We wouldn't need to include this patch: we could just assume
a readline new enough to provide a .pc file contains all the
functionality we need.
Well, what if isn't? We would just disable readline? We can't because
you're advocating for linking the old way [1]. However, that wouldn't
work on systems where we require more than just -lreadline (which is
current situation). Currently, the problem is that my code requires this
rl_completion_quote_character variable from readline.h. It's not a
function, it's a variable. And if not present, compilation fails. So
what should we do if pkg-config fails?
> Therefore I think we should merge this patch and switch to pkg-config
> later (when distros have it).
Well, we're running out of time for 4.0.0 anyway, so
Reviewed-by: Andrea Bolognani <abologna(a)redhat.com>
Agreed, pushed. Thanks.
Michal