configure, meson: move smbd options to meson_options.txt
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/configure b/configure
index 1cc836e..9230ebd 100755
--- a/configure
+++ b/configure
@@ -330,7 +330,6 @@
ninja=""
gio="$default_feature"
skip_meson=no
-slirp_smbd="$default_feature"
# The following Meson options are handled manually (still they
# are included in the automatically generated help message)
@@ -416,6 +415,7 @@
ld="${LD-${cross_prefix}ld}"
ranlib="${RANLIB-${cross_prefix}ranlib}"
nm="${NM-${cross_prefix}nm}"
+smbd="$SMBD"
strip="${STRIP-${cross_prefix}strip}"
windres="${WINDRES-${cross_prefix}windres}"
pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
@@ -535,7 +535,6 @@
sunos)
solaris="yes"
make="${MAKE-gmake}"
- smbd="${SMBD-/usr/sfw/sbin/smbd}"
# needed for CMSG_ macros in sys/socket.h
QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
# needed for TIOCWIN* defines in termios.h
@@ -1047,10 +1046,6 @@
;;
--disable-gio) gio=no
;;
- --enable-slirp-smbd) slirp_smbd=yes
- ;;
- --disable-slirp-smbd) slirp_smbd=no
- ;;
# backwards compatibility options
--enable-trace-backend=*) meson_option_parse "--enable-trace-backends=$optarg" "$optarg"
;;
@@ -1282,7 +1277,6 @@
opengl opengl support
tools build qemu-io, qemu-nbd and qemu-img tools
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
EOF
@@ -2725,19 +2719,6 @@
;;
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
@@ -2993,10 +2974,6 @@
if test "$guest_agent" = "yes" ; then
echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak
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_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
qemu_version=$(head $source_path/VERSION)
@@ -3355,6 +3332,7 @@
-Ddocdir="$docdir" \
-Dqemu_firmwarepath="$firmwarepath" \
-Dqemu_suffix="$qemu_suffix" \
+ -Dsmbd="$smbd" \
-Dsphinx_build="$sphinx_build" \
-Dtrace_file="$trace_file" \
-Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \
diff --git a/meson.build b/meson.build
index 79ceff6..7b3cfb6 100644
--- a/meson.build
+++ b/meson.build
@@ -1462,6 +1462,17 @@
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'))
+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('CONFIG_ATTR', libattr.found())
@@ -3333,8 +3344,8 @@
if targetos == 'windows' and config_host.has_key('CONFIG_GUEST_AGENT')
summary_info += {'wixl': wixl}
endif
-if slirp_opt != 'disabled' and 'CONFIG_SLIRP_SMBD' in config_host
- summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']}
+if slirp_opt != 'disabled' and have_system
+ summary_info += {'smbd': have_slirp_smbd ? smbd_path : false}
endif
summary(summary_info, bool_yn: true, section: 'Host binaries')
diff --git a/meson_options.txt b/meson_options.txt
index f5481be..368b2cf 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,6 +8,8 @@
description: 'Base directory for documentation installation (can be empty)')
option('qemu_firmwarepath', type : 'string', value : '',
description: 'search PATH for firmware files')
+option('smbd', type : 'string', value : '',
+ description: 'Path to smbd for slirp networking')
option('sphinx_build', type : 'string', value : '',
description: 'Use specified sphinx-build [$sphinx_build] for building document (default to be empty)')
option('default_devices', type : 'boolean', value : true,
@@ -258,3 +260,5 @@
description: 'QEMU profiling with gprof')
option('profiler', type: 'boolean', value: false,
description: 'profiler support')
+option('slirp_smbd', type : 'feature', value : 'auto',
+ description: 'use smbd (at path --smbd=*) in slirp networking')
diff --git a/net/slirp.c b/net/slirp.c
index ad3a838..bc5e9e4 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -27,7 +27,7 @@
#include "net/slirp.h"
-#if defined(CONFIG_SLIRP_SMBD)
+#if defined(CONFIG_SMBD_COMMAND)
#include <pwd.h>
#include <sys/wait.h>
#endif
@@ -91,7 +91,7 @@
Slirp *slirp;
Notifier poll_notifier;
Notifier exit_notifier;
-#if defined(CONFIG_SLIRP_SMBD)
+#if defined(CONFIG_SMBD_COMMAND)
gchar *smb_dir;
#endif
GSList *fwd;
@@ -104,7 +104,7 @@
static int slirp_hostfwd(SlirpState *s, const char *redir_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,
struct in_addr vserver_addr, Error **errp);
static void slirp_smb_cleanup(SlirpState *s);
@@ -377,7 +377,7 @@
struct in6_addr ip6_prefix;
struct in6_addr ip6_host;
struct in6_addr ip6_dns;
-#if defined(CONFIG_SLIRP_SMBD)
+#if defined(CONFIG_SMBD_COMMAND)
struct in_addr smbsrv = { .s_addr = 0 };
#endif
NetClientState *nc;
@@ -487,7 +487,7 @@
return -1;
}
-#if defined(CONFIG_SLIRP_SMBD)
+#if defined(CONFIG_SMBD_COMMAND)
if (vsmbserver && !inet_aton(vsmbserver, &smbsrv)) {
error_setg(errp, "Failed to parse SMB address");
return -1;
@@ -602,7 +602,7 @@
}
}
}
-#if defined(CONFIG_SLIRP_SMBD)
+#if defined(CONFIG_SMBD_COMMAND)
if (smb_export) {
if (slirp_smb(s, smb_export, smbsrv, errp) < 0) {
goto error;
@@ -794,7 +794,7 @@
}
-#if defined(CONFIG_SLIRP_SMBD)
+#if defined(CONFIG_SMBD_COMMAND)
/* automatic user mode samba server configuration */
static void slirp_smb_cleanup(SlirpState *s)
@@ -909,7 +909,7 @@
return 0;
}
-#endif /* defined(CONFIG_SLIRP_SMBD) */
+#endif /* defined(CONFIG_SMBD_COMMAND) */
static int guestfwd_can_read(void *opaque)
{
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 98ae944..01b10f7 100755
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -32,6 +32,7 @@
"fuzzing_engine",
"qemu_firmwarepath",
"qemu_suffix",
+ "smbd",
"sphinx_build",
"trace_file",
}
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 9a6e53a..fb88126 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -101,6 +101,7 @@
printf "%s\n" ' sdl-image SDL Image support for icons'
printf "%s\n" ' seccomp seccomp support'
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" ' snappy snappy compression support'
printf "%s\n" ' sparse sparse checker'
@@ -296,6 +297,8 @@
--enable-slirp) printf "%s" -Dslirp=enabled ;;
--disable-slirp) printf "%s" -Dslirp=disabled ;;
--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 ;;
--disable-smartcard) printf "%s" -Dsmartcard=disabled ;;
--enable-snappy) printf "%s" -Dsnappy=enabled ;;