configure, meson: move smbd options to meson_options.txt

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2021-10-13 13:43:36 +02:00
parent 728c0a2ff8
commit 35acbb3058
6 changed files with 31 additions and 34 deletions

26
configure vendored
View File

@ -330,7 +330,6 @@ meson_args=""
ninja="" ninja=""
gio="$default_feature" gio="$default_feature"
skip_meson=no skip_meson=no
slirp_smbd="$default_feature"
# The following Meson options are handled manually (still they # The following Meson options are handled manually (still they
# are included in the automatically generated help message) # are included in the automatically generated help message)
@ -416,6 +415,7 @@ objcopy="${OBJCOPY-${cross_prefix}objcopy}"
ld="${LD-${cross_prefix}ld}" ld="${LD-${cross_prefix}ld}"
ranlib="${RANLIB-${cross_prefix}ranlib}" ranlib="${RANLIB-${cross_prefix}ranlib}"
nm="${NM-${cross_prefix}nm}" nm="${NM-${cross_prefix}nm}"
smbd="$SMBD"
strip="${STRIP-${cross_prefix}strip}" strip="${STRIP-${cross_prefix}strip}"
windres="${WINDRES-${cross_prefix}windres}" windres="${WINDRES-${cross_prefix}windres}"
pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
@ -535,7 +535,6 @@ darwin)
sunos) sunos)
solaris="yes" solaris="yes"
make="${MAKE-gmake}" make="${MAKE-gmake}"
smbd="${SMBD-/usr/sfw/sbin/smbd}"
# needed for CMSG_ macros in sys/socket.h # needed for CMSG_ macros in sys/socket.h
QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
# needed for TIOCWIN* defines in termios.h # needed for TIOCWIN* defines in termios.h
@ -1047,10 +1046,6 @@ for opt do
;; ;;
--disable-gio) gio=no --disable-gio) gio=no
;; ;;
--enable-slirp-smbd) slirp_smbd=yes
;;
--disable-slirp-smbd) slirp_smbd=no
;;
# backwards compatibility options # backwards compatibility options
--enable-trace-backend=*) meson_option_parse "--enable-trace-backends=$optarg" "$optarg" --enable-trace-backend=*) meson_option_parse "--enable-trace-backends=$optarg" "$optarg"
;; ;;
@ -1282,7 +1277,6 @@ cat << EOF
opengl opengl support opengl opengl support
tools build qemu-io, qemu-nbd and qemu-img tools tools build qemu-io, qemu-nbd and qemu-img tools
gio libgio support gio libgio support
slirp-smbd use smbd (at path --smbd=*) in slirp networking
NOTE: The object files are built at the place where configure is launched NOTE: The object files are built at the place where configure is launched
EOF EOF
@ -2725,19 +2719,6 @@ case "$slirp" in
;; ;;
esac esac
# Check for slirp smbd dupport
: ${smbd=${SMBD-/usr/sbin/smbd}}
if test "$slirp_smbd" != "no" ; then
if test "$mingw32" = "yes" ; then
if test "$slirp_smbd" = "yes" ; then
error_exit "Host smbd not supported on this platform."
fi
slirp_smbd=no
else
slirp_smbd=yes
fi
fi
########################################## ##########################################
# check for usable __NR_keyctl syscall # check for usable __NR_keyctl syscall
@ -2993,10 +2974,6 @@ fi
if test "$guest_agent" = "yes" ; then if test "$guest_agent" = "yes" ; then
echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak
fi fi
if test "$slirp_smbd" = "yes" ; then
echo "CONFIG_SLIRP_SMBD=y" >> $config_host_mak
echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
fi
echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
qemu_version=$(head $source_path/VERSION) qemu_version=$(head $source_path/VERSION)
@ -3355,6 +3332,7 @@ if test "$skip_meson" = no; then
-Ddocdir="$docdir" \ -Ddocdir="$docdir" \
-Dqemu_firmwarepath="$firmwarepath" \ -Dqemu_firmwarepath="$firmwarepath" \
-Dqemu_suffix="$qemu_suffix" \ -Dqemu_suffix="$qemu_suffix" \
-Dsmbd="$smbd" \
-Dsphinx_build="$sphinx_build" \ -Dsphinx_build="$sphinx_build" \
-Dtrace_file="$trace_file" \ -Dtrace_file="$trace_file" \
-Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \ -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \

View File

@ -1462,6 +1462,17 @@ config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefix') /
config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir) config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir)
config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir')) config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir'))
have_slirp_smbd = get_option('slirp_smbd') \
.require(targetos != 'windows', error_message: 'Host smbd not supported on this platform.') \
.allowed()
if have_slirp_smbd
smbd_path = get_option('smbd')
if smbd_path == ''
smbd_path = (targetos == 'solaris' ? '/usr/sfw/sbin/smbd' : '/usr/sbin/smbd')
endif
config_host_data.set_quoted('CONFIG_SMBD_COMMAND', smbd_path)
endif
config_host_data.set('HOST_' + host_arch.to_upper(), 1) config_host_data.set('HOST_' + host_arch.to_upper(), 1)
config_host_data.set('CONFIG_ATTR', libattr.found()) config_host_data.set('CONFIG_ATTR', libattr.found())
@ -3333,8 +3344,8 @@ summary_info += {'genisoimage': config_host['GENISOIMAGE']}
if targetos == 'windows' and config_host.has_key('CONFIG_GUEST_AGENT') if targetos == 'windows' and config_host.has_key('CONFIG_GUEST_AGENT')
summary_info += {'wixl': wixl} summary_info += {'wixl': wixl}
endif endif
if slirp_opt != 'disabled' and 'CONFIG_SLIRP_SMBD' in config_host if slirp_opt != 'disabled' and have_system
summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']} summary_info += {'smbd': have_slirp_smbd ? smbd_path : false}
endif endif
summary(summary_info, bool_yn: true, section: 'Host binaries') summary(summary_info, bool_yn: true, section: 'Host binaries')

View File

@ -8,6 +8,8 @@ option('docdir', type : 'string', value : 'doc',
description: 'Base directory for documentation installation (can be empty)') description: 'Base directory for documentation installation (can be empty)')
option('qemu_firmwarepath', type : 'string', value : '', option('qemu_firmwarepath', type : 'string', value : '',
description: 'search PATH for firmware files') description: 'search PATH for firmware files')
option('smbd', type : 'string', value : '',
description: 'Path to smbd for slirp networking')
option('sphinx_build', type : 'string', value : '', option('sphinx_build', type : 'string', value : '',
description: 'Use specified sphinx-build [$sphinx_build] for building document (default to be empty)') description: 'Use specified sphinx-build [$sphinx_build] for building document (default to be empty)')
option('default_devices', type : 'boolean', value : true, option('default_devices', type : 'boolean', value : true,
@ -258,3 +260,5 @@ option('gprof', type: 'boolean', value: false,
description: 'QEMU profiling with gprof') description: 'QEMU profiling with gprof')
option('profiler', type: 'boolean', value: false, option('profiler', type: 'boolean', value: false,
description: 'profiler support') description: 'profiler support')
option('slirp_smbd', type : 'feature', value : 'auto',
description: 'use smbd (at path --smbd=*) in slirp networking')

View File

@ -27,7 +27,7 @@
#include "net/slirp.h" #include "net/slirp.h"
#if defined(CONFIG_SLIRP_SMBD) #if defined(CONFIG_SMBD_COMMAND)
#include <pwd.h> #include <pwd.h>
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif
@ -91,7 +91,7 @@ typedef struct SlirpState {
Slirp *slirp; Slirp *slirp;
Notifier poll_notifier; Notifier poll_notifier;
Notifier exit_notifier; Notifier exit_notifier;
#if defined(CONFIG_SLIRP_SMBD) #if defined(CONFIG_SMBD_COMMAND)
gchar *smb_dir; gchar *smb_dir;
#endif #endif
GSList *fwd; GSList *fwd;
@ -104,7 +104,7 @@ static QTAILQ_HEAD(, SlirpState) slirp_stacks =
static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **errp); static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **errp);
static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **errp); static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **errp);
#if defined(CONFIG_SLIRP_SMBD) #if defined(CONFIG_SMBD_COMMAND)
static int slirp_smb(SlirpState *s, const char *exported_dir, static int slirp_smb(SlirpState *s, const char *exported_dir,
struct in_addr vserver_addr, Error **errp); struct in_addr vserver_addr, Error **errp);
static void slirp_smb_cleanup(SlirpState *s); static void slirp_smb_cleanup(SlirpState *s);
@ -377,7 +377,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
struct in6_addr ip6_prefix; struct in6_addr ip6_prefix;
struct in6_addr ip6_host; struct in6_addr ip6_host;
struct in6_addr ip6_dns; struct in6_addr ip6_dns;
#if defined(CONFIG_SLIRP_SMBD) #if defined(CONFIG_SMBD_COMMAND)
struct in_addr smbsrv = { .s_addr = 0 }; struct in_addr smbsrv = { .s_addr = 0 };
#endif #endif
NetClientState *nc; NetClientState *nc;
@ -487,7 +487,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
return -1; return -1;
} }
#if defined(CONFIG_SLIRP_SMBD) #if defined(CONFIG_SMBD_COMMAND)
if (vsmbserver && !inet_aton(vsmbserver, &smbsrv)) { if (vsmbserver && !inet_aton(vsmbserver, &smbsrv)) {
error_setg(errp, "Failed to parse SMB address"); error_setg(errp, "Failed to parse SMB address");
return -1; return -1;
@ -602,7 +602,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
} }
} }
} }
#if defined(CONFIG_SLIRP_SMBD) #if defined(CONFIG_SMBD_COMMAND)
if (smb_export) { if (smb_export) {
if (slirp_smb(s, smb_export, smbsrv, errp) < 0) { if (slirp_smb(s, smb_export, smbsrv, errp) < 0) {
goto error; goto error;
@ -794,7 +794,7 @@ void hmp_hostfwd_add(Monitor *mon, const QDict *qdict)
} }
#if defined(CONFIG_SLIRP_SMBD) #if defined(CONFIG_SMBD_COMMAND)
/* automatic user mode samba server configuration */ /* automatic user mode samba server configuration */
static void slirp_smb_cleanup(SlirpState *s) static void slirp_smb_cleanup(SlirpState *s)
@ -909,7 +909,7 @@ static int slirp_smb(SlirpState* s, const char *exported_dir,
return 0; return 0;
} }
#endif /* defined(CONFIG_SLIRP_SMBD) */ #endif /* defined(CONFIG_SMBD_COMMAND) */
static int guestfwd_can_read(void *opaque) static int guestfwd_can_read(void *opaque)
{ {

View File

@ -32,6 +32,7 @@ SKIP_OPTIONS = {
"fuzzing_engine", "fuzzing_engine",
"qemu_firmwarepath", "qemu_firmwarepath",
"qemu_suffix", "qemu_suffix",
"smbd",
"sphinx_build", "sphinx_build",
"trace_file", "trace_file",
} }

View File

@ -101,6 +101,7 @@ meson_options_help() {
printf "%s\n" ' sdl-image SDL Image support for icons' printf "%s\n" ' sdl-image SDL Image support for icons'
printf "%s\n" ' seccomp seccomp support' printf "%s\n" ' seccomp seccomp support'
printf "%s\n" ' selinux SELinux support in qemu-nbd' printf "%s\n" ' selinux SELinux support in qemu-nbd'
printf "%s\n" ' slirp-smbd use smbd (at path --smbd=*) in slirp networking'
printf "%s\n" ' smartcard CA smartcard emulation support' printf "%s\n" ' smartcard CA smartcard emulation support'
printf "%s\n" ' snappy snappy compression support' printf "%s\n" ' snappy snappy compression support'
printf "%s\n" ' sparse sparse checker' printf "%s\n" ' sparse sparse checker'
@ -296,6 +297,8 @@ _meson_option_parse() {
--enable-slirp) printf "%s" -Dslirp=enabled ;; --enable-slirp) printf "%s" -Dslirp=enabled ;;
--disable-slirp) printf "%s" -Dslirp=disabled ;; --disable-slirp) printf "%s" -Dslirp=disabled ;;
--enable-slirp=*) quote_sh "-Dslirp=$2" ;; --enable-slirp=*) quote_sh "-Dslirp=$2" ;;
--enable-slirp-smbd) printf "%s" -Dslirp_smbd=enabled ;;
--disable-slirp-smbd) printf "%s" -Dslirp_smbd=disabled ;;
--enable-smartcard) printf "%s" -Dsmartcard=enabled ;; --enable-smartcard) printf "%s" -Dsmartcard=enabled ;;
--disable-smartcard) printf "%s" -Dsmartcard=disabled ;; --disable-smartcard) printf "%s" -Dsmartcard=disabled ;;
--enable-snappy) printf "%s" -Dsnappy=enabled ;; --enable-snappy) printf "%s" -Dsnappy=enabled ;;