mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
m4: readline: Use pkg-config where possible
With the 7.0 release, readline has finally started shipping pkg-config support in the form of a readline.pc file. Unfortunately, most downstreams have yet to catch up with this change: among Linux distributions in particular, Fedora Rawhide seems to be the only one installing it at the moment. Non-Linux operating systems have been faring much better in this regard: both FreeBSD (through ports) and macOS (through homebrew) include pkg-config support in their readline package. This is great news for us, since those are the platforms where pkg-config is more useful on account of them installing headers and libraries outside of the respective default search paths. Our implementation checks whether readline is registered as a pkg-config package, and if so obtains CFLAGS and LIBS using the tool; if not, we just keep using the existing logic. This commit is best viewed with 'git show -w'. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
c6921fd0be
commit
c98de2173e
@ -23,27 +23,36 @@ AC_DEFUN([LIBVIRT_ARG_READLINE],[
|
|||||||
|
|
||||||
AC_DEFUN([LIBVIRT_CHECK_READLINE],[
|
AC_DEFUN([LIBVIRT_CHECK_READLINE],[
|
||||||
|
|
||||||
# This function is present in all reasonable (5.0+) readline versions;
|
# We have to check for readline.pc's presence beforehand because for
|
||||||
# however, the macOS base system contains a library called libedit which
|
# the longest time the library didn't ship a .pc file at all
|
||||||
# takes over the readline name despite lacking many of its features. We
|
PKG_CHECK_EXISTS([readline], [use_pkgconfig=1], [use_pkgconfig=0])
|
||||||
# want to make sure we only enable readline support when linking against
|
|
||||||
# the actual readline library, and the availability of this specific
|
|
||||||
# functions is as good a witness for that fact as any.
|
|
||||||
AC_CHECK_DECLS([rl_completion_quote_character],
|
|
||||||
[], [],
|
|
||||||
[[#include <stdio.h>
|
|
||||||
#include <readline/readline.h>]])
|
|
||||||
|
|
||||||
if test "$ac_cv_have_decl_rl_completion_quote_character" = "no" ; then
|
if test $use_pkgconfig = 1; then
|
||||||
if test "$with_readline" = "yes" ; then
|
# readline 7.0 is the first version which includes pkg-config support
|
||||||
AC_MSG_ERROR([readline is missing rl_completion_quote_character])
|
LIBVIRT_CHECK_PKG([READLINE], [readline], [7.0])
|
||||||
else
|
else
|
||||||
with_readline=no;
|
# This function is present in all reasonable (5.0+) readline versions;
|
||||||
|
# however, the macOS base system contains a library called libedit which
|
||||||
|
# takes over the readline name despite lacking many of its features. We
|
||||||
|
# want to make sure we only enable readline support when linking against
|
||||||
|
# the actual readline library, and the availability of this specific
|
||||||
|
# functions is as good a witness for that fact as any.
|
||||||
|
AC_CHECK_DECLS([rl_completion_quote_character],
|
||||||
|
[], [],
|
||||||
|
[[#include <stdio.h>
|
||||||
|
#include <readline/readline.h>]])
|
||||||
|
|
||||||
|
if test "$ac_cv_have_decl_rl_completion_quote_character" = "no" ; then
|
||||||
|
if test "$with_readline" = "yes" ; then
|
||||||
|
AC_MSG_ERROR([readline is missing rl_completion_quote_character])
|
||||||
|
else
|
||||||
|
with_readline=no;
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# The normal library check...
|
# The normal library check...
|
||||||
LIBVIRT_CHECK_LIB([READLINE], [readline], [readline], [readline/readline.h])
|
LIBVIRT_CHECK_LIB([READLINE], [readline], [readline], [readline/readline.h])
|
||||||
|
fi
|
||||||
|
|
||||||
# We need this to avoid compilation issues with modern compilers.
|
# We need this to avoid compilation issues with modern compilers.
|
||||||
# See 9ea3424a178 for a more detailed explanation
|
# See 9ea3424a178 for a more detailed explanation
|
||||||
|
Loading…
Reference in New Issue
Block a user