From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 17/30] configure, meson: move smbd options to meson_options.txt
Date: Tue, 15 Feb 2022 10:32:10 +0100	[thread overview]
Message-ID: <20220215093223.110827-18-pbonzini@redhat.com> (raw)
In-Reply-To: <20220215093223.110827-1-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 26 ++------------------------
 meson.build                   | 15 +++++++++++++--
 meson_options.txt             |  4 ++++
 net/slirp.c                   | 16 ++++++++--------
 scripts/meson-buildoptions.py |  1 +
 scripts/meson-buildoptions.sh |  3 +++
 6 files changed, 31 insertions(+), 34 deletions(-)
diff --git a/configure b/configure
index 1cc836ee55..9230ebd4a8 100755
--- a/configure
+++ b/configure
@@ -330,7 +330,6 @@ meson_args=""
 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 @@ objcopy="${OBJCOPY-${cross_prefix}objcopy}"
 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 @@ darwin)
 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 @@ for opt do
   ;;
   --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 @@ cat << EOF
   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 @@ case "$slirp" in
     ;;
 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 @@ fi
 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 @@ if test "$skip_meson" = no; then
         -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 79ceff64a7..7b3cfb6316 100644
--- a/meson.build
+++ b/meson.build
@@ -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_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 @@ summary_info += {'genisoimage':       config_host['GENISOIMAGE']}
 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 03ae957102..59220b52c8 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,6 +8,8 @@ option('docdir', type : 'string', value : 'doc',
        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 @@ option('gprof', type: 'boolean', value: false,
        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 ad3a838e0b..bc5e9e4f77 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 @@ typedef struct SlirpState {
     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 QTAILQ_HEAD(, SlirpState) slirp_stacks =
 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 @@ static int net_slirp_init(NetClientState *peer, const char *model,
     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 @@ static int net_slirp_init(NetClientState *peer, const char *model,
         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 @@ static int net_slirp_init(NetClientState *peer, const char *model,
             }
         }
     }
-#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 @@ 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 */
 static void slirp_smb_cleanup(SlirpState *s)
@@ -909,7 +909,7 @@ static int slirp_smb(SlirpState* s, const char *exported_dir,
     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 98ae944148..01b10f7ae0 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 9a6e53a2e7..fb8812693c 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -101,6 +101,7 @@ meson_options_help() {
   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 @@ _meson_option_parse() {
     --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 ;;
-- 
2.34.1
next prev parent reply	other threads:[~2022-02-15  9:47 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15  9:31 [PULL 00/30] Misc mostly build system patches for 2022-02-15 Paolo Bonzini
2022-02-15  9:31 ` [PULL 01/30] target/i386: add TCG support for UMIP Paolo Bonzini
2022-02-15  9:31 ` [PULL 02/30] memory: Fix qemu crash on starting dirty log twice with stopped VM Paolo Bonzini
2022-02-15  9:31 ` [PULL 03/30] tests/qemu-iotests/testrunner: Print diff to stderr in TAP mode Paolo Bonzini
2022-02-15  9:31 ` [PULL 04/30] meson: use .allowed() method for features Paolo Bonzini
2022-02-15  9:31 ` [PULL 05/30] meson: use .require() and .disable_auto_if() " Paolo Bonzini
2022-02-15  9:31 ` [PULL 06/30] configure, meson: move AVX tests to meson Paolo Bonzini
2022-02-15  9:32 ` [PULL 07/30] configure, meson: move membarrier test " Paolo Bonzini
2022-02-15  9:32 ` [PULL 08/30] configure, meson: move AF_ALG " Paolo Bonzini
2022-02-15  9:32 ` [PULL 09/30] configure, meson: move libnuma detection " Paolo Bonzini
2022-02-15  9:32 ` [PULL 10/30] configure, meson: move TPM check " Paolo Bonzini
2022-02-15  9:32 ` [PULL 11/30] configure, meson: cleanup qemu-ga libraries Paolo Bonzini
2022-02-15  9:32 ` [PULL 12/30] configure, meson: move image format options to meson_options.txt Paolo Bonzini
2022-02-15  9:32 ` [PULL 13/30] configure, meson: move block layer " Paolo Bonzini
2022-02-15  9:32 ` [PULL 14/30] meson: define qemu_cflags/qemu_ldflags Paolo Bonzini
2022-02-15  9:32 ` [PULL 15/30] configure, meson: move some default-disabled options to meson_options.txt Paolo Bonzini
2023-04-11  9:42   ` Peter Maydell
2022-02-15  9:32 ` [PULL 16/30] configure, meson: move coroutine " Paolo Bonzini
2022-02-15  9:32 ` Paolo Bonzini [this message]
2022-02-15  9:32 ` [PULL 18/30] configure, meson: move guest-agent, tools to meson Paolo Bonzini
2022-03-17 22:34   ` Brad Smith
2022-02-15  9:32 ` [PULL 19/30] meson: refine check for whether to look for virglrenderer Paolo Bonzini
2022-02-15  9:32 ` [PULL 20/30] configure, meson: move OpenGL check to meson Paolo Bonzini
2022-02-15  9:32 ` [PULL 21/30] qga/vss-win32: fix midl arguments Paolo Bonzini
2022-02-15  9:32 ` [PULL 22/30] meson: drop --with-win-sdk Paolo Bonzini
2022-02-15  9:32 ` [PULL 23/30] qga/vss-win32: use widl if available Paolo Bonzini
2022-02-15  9:32 ` [PULL 24/30] qga/vss: use standard windows headers location Paolo Bonzini
2022-02-15  9:32 ` [PULL 25/30] configure, meson: replace VSS SDK checks and options with --enable-vss-sdk Paolo Bonzini
2022-02-15  9:32 ` [PULL 26/30] meson: do not make qga/vss-win32/meson.build conditional on C++ presence Paolo Bonzini
2022-02-15  9:32 ` [PULL 27/30] qga/vss-win32: require widl/midl, remove pre-built TLB file Paolo Bonzini
2022-02-15  9:32 ` [PULL 28/30] meson: require dynamic linking for VSS support Paolo Bonzini
2022-02-15  9:32 ` [PULL 29/30] meson, configure: move ntddscsi API check to meson Paolo Bonzini
2022-02-15  9:32 ` [PULL 30/30] configure, meson: move CONFIG_IASL to a Meson option Paolo Bonzini
2022-02-16  9:56 ` [PULL 00/30] Misc mostly build system patches for 2022-02-15 Peter Maydell
2022-02-16 14:03   ` Paolo Bonzini
2022-02-16 14:41     ` Peter Maydell
2022-02-16 21:06       ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=20220215093223.110827-18-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).