mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-05 16:33:50 +00:00
meson: add readline build option
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
parent
1e952c20da
commit
d4be1919cd
@ -137,7 +137,6 @@ LIBVIRT_ARG_OPENWSMAN
|
|||||||
LIBVIRT_ARG_PCIACCESS
|
LIBVIRT_ARG_PCIACCESS
|
||||||
LIBVIRT_ARG_PM_UTILS
|
LIBVIRT_ARG_PM_UTILS
|
||||||
LIBVIRT_ARG_POLKIT
|
LIBVIRT_ARG_POLKIT
|
||||||
LIBVIRT_ARG_READLINE
|
|
||||||
LIBVIRT_ARG_SANLOCK
|
LIBVIRT_ARG_SANLOCK
|
||||||
LIBVIRT_ARG_SASL
|
LIBVIRT_ARG_SASL
|
||||||
LIBVIRT_ARG_SELINUX
|
LIBVIRT_ARG_SELINUX
|
||||||
@ -177,7 +176,6 @@ LIBVIRT_CHECK_PCIACCESS
|
|||||||
LIBVIRT_CHECK_PM_UTILS
|
LIBVIRT_CHECK_PM_UTILS
|
||||||
LIBVIRT_CHECK_POLKIT
|
LIBVIRT_CHECK_POLKIT
|
||||||
LIBVIRT_CHECK_PTHREAD
|
LIBVIRT_CHECK_PTHREAD
|
||||||
LIBVIRT_CHECK_READLINE
|
|
||||||
LIBVIRT_CHECK_SANLOCK
|
LIBVIRT_CHECK_SANLOCK
|
||||||
LIBVIRT_CHECK_SASL
|
LIBVIRT_CHECK_SASL
|
||||||
LIBVIRT_CHECK_SELINUX
|
LIBVIRT_CHECK_SELINUX
|
||||||
@ -500,7 +498,6 @@ LIBVIRT_RESULT_PCIACCESS
|
|||||||
LIBVIRT_RESULT_PM_UTILS
|
LIBVIRT_RESULT_PM_UTILS
|
||||||
LIBVIRT_RESULT_POLKIT
|
LIBVIRT_RESULT_POLKIT
|
||||||
LIBVIRT_RESULT_RBD
|
LIBVIRT_RESULT_RBD
|
||||||
LIBVIRT_RESULT_READLINE
|
|
||||||
LIBVIRT_RESULT_SANLOCK
|
LIBVIRT_RESULT_SANLOCK
|
||||||
LIBVIRT_RESULT_SASL
|
LIBVIRT_RESULT_SASL
|
||||||
LIBVIRT_RESULT_SELINUX
|
LIBVIRT_RESULT_SELINUX
|
||||||
|
@ -1,86 +0,0 @@
|
|||||||
dnl The readline library
|
|
||||||
dnl
|
|
||||||
dnl Copyright (C) 2005-2013 Red Hat, Inc.
|
|
||||||
dnl
|
|
||||||
dnl This library is free software; you can redistribute it and/or
|
|
||||||
dnl modify it under the terms of the GNU Lesser General Public
|
|
||||||
dnl License as published by the Free Software Foundation; either
|
|
||||||
dnl version 2.1 of the License, or (at your option) any later version.
|
|
||||||
dnl
|
|
||||||
dnl This library is distributed in the hope that it will be useful,
|
|
||||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
dnl Lesser General Public License for more details.
|
|
||||||
dnl
|
|
||||||
dnl You should have received a copy of the GNU Lesser General Public
|
|
||||||
dnl License along with this library. If not, see
|
|
||||||
dnl <http://www.gnu.org/licenses/>.
|
|
||||||
dnl
|
|
||||||
|
|
||||||
AC_DEFUN([LIBVIRT_ARG_READLINE],[
|
|
||||||
LIBVIRT_ARG_WITH_FEATURE([READLINE], [readline], [check])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([LIBVIRT_CHECK_READLINE],[
|
|
||||||
|
|
||||||
# We have to check for readline.pc's presence beforehand because for
|
|
||||||
# the longest time the library didn't ship a .pc file at all
|
|
||||||
PKG_CHECK_EXISTS([readline], [use_pkgconfig=1], [use_pkgconfig=0])
|
|
||||||
|
|
||||||
if test $use_pkgconfig = 1; then
|
|
||||||
# readline 7.0 is the first version which includes pkg-config support
|
|
||||||
LIBVIRT_CHECK_PKG([READLINE], [readline], [7.0])
|
|
||||||
else
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# The normal library check...
|
|
||||||
LIBVIRT_CHECK_LIB([READLINE], [readline], [readline], [readline/readline.h])
|
|
||||||
fi
|
|
||||||
|
|
||||||
# We need this to avoid compilation issues with modern compilers.
|
|
||||||
# See 9ea3424a178 for a more detailed explanation
|
|
||||||
if test "$with_readline" = "yes" ; then
|
|
||||||
case "$READLINE_CFLAGS" in
|
|
||||||
*-D_FUNCTION_DEF*) ;;
|
|
||||||
*) READLINE_CFLAGS="-D_FUNCTION_DEF $READLINE_CFLAGS" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Gross kludge for readline include path obtained through pkg-config.
|
|
||||||
#
|
|
||||||
# As of 8.0, upstream readline.pc has -I${includedir}/readline among
|
|
||||||
# its Cflags, which is clearly wrong. This does not affect Linux
|
|
||||||
# because ${includedir} is already part of the default include path,
|
|
||||||
# but on other platforms that's not the case and the result is that
|
|
||||||
# <readline/readline.h> can't be located, causing the build to fail.
|
|
||||||
# A patch solving this issue has already been posted upstream, so once
|
|
||||||
# the fix has landed in FreeBSD ports and macOS homebrew we can safely
|
|
||||||
# drop the kludge and rely on pkg-config alone on those platforms.
|
|
||||||
#
|
|
||||||
# [1] http://lists.gnu.org/archive/html/bug-readline/2019-04/msg00007.html
|
|
||||||
case "$READLINE_CFLAGS" in
|
|
||||||
*include/readline*) READLINE_CFLAGS=$(echo $READLINE_CFLAGS | sed s,include/readline,include,g) ;;
|
|
||||||
*) ;;
|
|
||||||
esac
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([LIBVIRT_RESULT_READLINE],[
|
|
||||||
LIBVIRT_RESULT_LIB([READLINE])
|
|
||||||
])
|
|
64
meson.build
64
meson.build
@ -981,6 +981,69 @@ if audit_dep.found()
|
|||||||
conf.set('WITH_AUDIT', 1)
|
conf.set('WITH_AUDIT', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# readline 7.0 is the first version which includes pkg-config support
|
||||||
|
readline_version = '7.0'
|
||||||
|
readline_dep = dependency('readline', version: '>=' + readline_version, required: false)
|
||||||
|
if not readline_dep.found()
|
||||||
|
readline_dep = cc.find_library('readline', required: get_option('readline'))
|
||||||
|
|
||||||
|
if readline_dep.found()
|
||||||
|
# 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.
|
||||||
|
correct_rl = cc.has_function('rl_completion_quote_character', prefix: '#include <readline/readline.h>')
|
||||||
|
if not correct_rl and get_option('readline').enabled()
|
||||||
|
error('readline is missing rl_completion_quote_character')
|
||||||
|
else
|
||||||
|
readline_dep = dependency('', required: false)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
if readline_dep.found()
|
||||||
|
# Gross kludge for readline include path obtained through pkg-config.
|
||||||
|
#
|
||||||
|
# As of 8.0, upstream readline.pc has -I${includedir}/readline among
|
||||||
|
# its Cflags, which is clearly wrong. This does not affect Linux
|
||||||
|
# because ${includedir} is already part of the default include path,
|
||||||
|
# but on other platforms that's not the case and the result is that
|
||||||
|
# <readline/readline.h> can't be located, causing the build to fail.
|
||||||
|
# A patch solving this issue has already been posted upstream, so once
|
||||||
|
# the fix has landed in FreeBSD ports and macOS homebrew we can safely
|
||||||
|
# drop the kludge and rely on pkg-config alone on those platforms.
|
||||||
|
#
|
||||||
|
# [1] http://lists.gnu.org/archive/html/bug-readline/2019-04/msg00007.html
|
||||||
|
if readline_dep.type_name() == 'pkgconfig' and host_machine.system() != 'linux'
|
||||||
|
pkg_config_prog = find_program('pkg-config')
|
||||||
|
rc = run_command(pkg_config_prog, '--cflags', 'readline', check: true)
|
||||||
|
cflags = rc.stdout().strip()
|
||||||
|
if cflags.contains('include/readline')
|
||||||
|
rc = run_command(
|
||||||
|
'python3', '-c',
|
||||||
|
'print("@0@".replace("@1@", "@2@"))'.format(
|
||||||
|
cflags, 'include/readline', 'include',
|
||||||
|
),
|
||||||
|
check: true,
|
||||||
|
)
|
||||||
|
readline_dep = declare_dependency(
|
||||||
|
compile_args: rc.stdout().strip().split(),
|
||||||
|
dependencies: [ readline_dep ],
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# We need this to avoid compilation issues with modern compilers.
|
||||||
|
# See 9ea3424a178 for a more detailed explanation
|
||||||
|
readline_dep = declare_dependency(
|
||||||
|
compile_args: [ '-D_FUNCTION_DEF' ],
|
||||||
|
dependencies: [ readline_dep ],
|
||||||
|
)
|
||||||
|
|
||||||
|
conf.set('WITH_READLINE', 1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
# define top include directory
|
# define top include directory
|
||||||
|
|
||||||
@ -1005,6 +1068,7 @@ libs_summary = {
|
|||||||
'apparmor': apparmor_dep.found(),
|
'apparmor': apparmor_dep.found(),
|
||||||
'attr': attr_dep.found(),
|
'attr': attr_dep.found(),
|
||||||
'audit': audit_dep.found(),
|
'audit': audit_dep.found(),
|
||||||
|
'readline': readline_dep.found(),
|
||||||
}
|
}
|
||||||
summary(libs_summary, section: 'Libraries', bool_yn: true)
|
summary(libs_summary, section: 'Libraries', bool_yn: true)
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ option('git_werror', type: 'feature', value: 'auto', description: 'use -Werror i
|
|||||||
option('apparmor', type: 'feature', value: 'auto', description: 'apparmor support')
|
option('apparmor', type: 'feature', value: 'auto', description: 'apparmor support')
|
||||||
option('attr', type: 'feature', value: 'auto', description: 'attr support')
|
option('attr', type: 'feature', value: 'auto', description: 'attr support')
|
||||||
option('audit', type: 'feature', value: 'auto', description: 'audit support')
|
option('audit', type: 'feature', value: 'auto', description: 'audit support')
|
||||||
|
option('readline', type: 'feature', value: 'auto', description: 'readline support')
|
||||||
|
|
||||||
|
|
||||||
# build driver options
|
# build driver options
|
||||||
|
Loading…
Reference in New Issue
Block a user