qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] *** configure: Add 'mkdir build' check ***
@ 2023-02-08 23:31 Dinah Baum
  2023-02-08 23:31 ` [PATCH 1/2] configure: Add 'mkdir build' check Dinah Baum
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dinah Baum @ 2023-02-08 23:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dinah Baum

QEMU configure script goes into an infinite error printing loop
when in read only directory due to 'build' dir never being created.

1 - Checking if 'mkdir dir' succeeds and if the directory is
writeable prevents this error.

2 - Since we exit early on error in (1), code for reading in
arguments has been moved before that

Changes since v1:
- Fix review comments from Peter Maydell 

Dinah Baum (2):
  configure: Add 'mkdir build' check
  configure: './configure --help' should work

 configure | 691 +++++++++++++++++++++++++++---------------------------
 1 file changed, 348 insertions(+), 343 deletions(-)

-- 
2.30.2



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] configure: Add 'mkdir build' check
  2023-02-08 23:31 [PATCH 0/2] *** configure: Add 'mkdir build' check *** Dinah Baum
@ 2023-02-08 23:31 ` Dinah Baum
  2023-02-16  5:48   ` Dinah B
  2023-02-16 14:21   ` Peter Maydell
  2023-02-08 23:31 ` [PATCH 2/2] configure: './configure --help' should work Dinah Baum
  2023-02-16 14:06 ` [PATCH 0/2] *** configure: Add 'mkdir build' check *** Peter Maydell
  2 siblings, 2 replies; 6+ messages in thread
From: Dinah Baum @ 2023-02-08 23:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dinah Baum, Paolo Bonzini, Alex Bennée, Thomas Huth

QEMU configure script goes into an infinite error printing loop
when in read only directory due to 'build' dir never being created.

Checking if 'mkdir dir' succeeds prevents this error.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/321
---
 configure | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 64960c6000..3b384914ce 100755
--- a/configure
+++ b/configure
@@ -31,10 +31,11 @@ then
         fi
     fi
 
-    mkdir build
-    touch $MARKER
+    if mkdir build
+    then
+        touch $MARKER
 
-    cat > GNUmakefile <<'EOF'
+        cat > GNUmakefile <<'EOF'
 # This file is auto-generated by configure to support in-source tree
 # 'make' command invocation
 
@@ -56,8 +57,12 @@ force: ;
 GNUmakefile: ;
 
 EOF
-    cd build
-    exec "$source_path/configure" "$@"
+        cd build
+        exec "$source_path/configure" "$@"
+    else
+        echo "ERROR: Unable to use ./build dir, try using a ../qemu/configure build"
+        exit 1
+    fi
 fi
 
 # Temporary directory used for files created while
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] configure: './configure --help' should work
  2023-02-08 23:31 [PATCH 0/2] *** configure: Add 'mkdir build' check *** Dinah Baum
  2023-02-08 23:31 ` [PATCH 1/2] configure: Add 'mkdir build' check Dinah Baum
@ 2023-02-08 23:31 ` Dinah Baum
  2023-02-16 14:06 ` [PATCH 0/2] *** configure: Add 'mkdir build' check *** Peter Maydell
  2 siblings, 0 replies; 6+ messages in thread
From: Dinah Baum @ 2023-02-08 23:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dinah Baum, Paolo Bonzini, Alex Bennée, Thomas Huth

Always initialize --help display option

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/321
---
 configure | 676 +++++++++++++++++++++++++++---------------------------
 1 file changed, 338 insertions(+), 338 deletions(-)

diff --git a/configure b/configure
index 3b384914ce..1fb4d145f1 100755
--- a/configure
+++ b/configure
@@ -14,6 +14,344 @@ export CCACHE_RECACHE=yes
 # make source path absolute
 source_path=$(cd "$(dirname -- "$0")"; pwd)
 
+werror=""
+
+print_error() {
+    (echo
+    echo "ERROR: $1"
+    while test -n "$2"; do
+        echo "       $2"
+        shift
+    done
+    echo) >&2
+}
+
+error_exit() {
+    print_error "$@"
+    exit 1
+}
+
+meson_option_build_array() {
+  printf '['
+  (if test "$targetos" = windows; then
+    IFS=\;
+  else
+    IFS=:
+  fi
+  for e in $1; do
+    printf '"""'
+    # backslash escape any '\' and '"' characters
+    printf "%s" "$e" | sed -e 's/\([\"]\)/\\\1/g'
+    printf '""",'
+  done)
+  printf ']\n'
+}
+
+. "$source_path/scripts/meson-buildoptions.sh"
+
+quote_sh() {
+    printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&',"
+}
+
+meson_options=
+meson_option_add() {
+  meson_options="$meson_options $(quote_sh "$1")"
+}
+meson_option_parse() {
+  meson_options="$meson_options $(_meson_option_parse "$@")"
+  if test $? -eq 1; then
+    echo "ERROR: unknown option $1"
+    echo "Try '$0 --help' for more information"
+    exit 1
+  fi
+}
+
+for opt do
+  optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
+  case "$opt" in
+  --help|-h) show_help=yes
+  ;;
+  --version|-V) exec cat "$source_path/VERSION"
+  ;;
+  --prefix=*) prefix="$optarg"
+  ;;
+  --cross-prefix=*)
+  ;;
+  --cc=*)
+  ;;
+  --host-cc=*) host_cc="$optarg"
+  ;;
+  --cxx=*)
+  ;;
+  --objcc=*) objcc="$optarg"
+  ;;
+  --make=*) make="$optarg"
+  ;;
+  --install=*)
+  ;;
+  --python=*) python="$optarg" ; explicit_python=yes
+  ;;
+  --skip-meson) skip_meson=yes
+  ;;
+  --meson=*) meson="$optarg"
+  ;;
+  --ninja=*) ninja="$optarg"
+  ;;
+  --smbd=*) smbd="$optarg"
+  ;;
+  --extra-cflags=*)
+  ;;
+  --extra-cxxflags=*)
+  ;;
+  --extra-objcflags=*)
+  ;;
+  --extra-ldflags=*)
+  ;;
+  --cross-cc-*)
+  ;;
+  --cross-prefix-*)
+  ;;
+  --enable-debug-info) meson_option_add -Ddebug=true
+  ;;
+  --disable-debug-info) meson_option_add -Ddebug=false
+  ;;
+  --enable-modules)
+      modules="yes"
+  ;;
+  --disable-modules)
+      modules="no"
+  ;;
+  --cpu=*)
+  ;;
+  --target-list=*) target_list="$optarg"
+                   if test "$target_list_exclude"; then
+                       error_exit "Can't mix --target-list with --target-list-exclude"
+                   fi
+  ;;
+  --target-list-exclude=*) target_list_exclude="$optarg"
+                   if test "$target_list"; then
+                       error_exit "Can't mix --target-list-exclude with --target-list"
+                   fi
+  ;;
+  --with-default-devices) meson_option_add -Ddefault_devices=true
+  ;;
+  --without-default-devices) meson_option_add -Ddefault_devices=false
+  ;;
+  --with-devices-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --with-devices-FOO option"
+  ;;
+  --with-devices-*) device_arch=${opt#--with-devices-};
+                    device_arch=${device_arch%%=*}
+                    cf=$source_path/configs/devices/$device_arch-softmmu/$optarg.mak
+                    if test -f "$cf"; then
+                        device_archs="$device_archs $device_arch"
+                        eval "devices_${device_arch}=\$optarg"
+                    else
+                        error_exit "File $cf does not exist"
+                    fi
+  ;;
+  --without-default-features) # processed above
+  ;;
+  --static)
+    static="yes"
+    QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
+  ;;
+  --bindir=*) bindir="$optarg"
+  ;;
+  --with-suffix=*) qemu_suffix="$optarg"
+  ;;
+  --host=*|--build=*|\
+  --disable-dependency-tracking|\
+  --sbindir=*|--sharedstatedir=*|\
+  --oldincludedir=*|--datarootdir=*|--infodir=*|\
+  --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
+    # These switches are silently ignored, for compatibility with
+    # autoconf-generated configure scripts. This allows QEMU's
+    # configure to be used by RPM and similar macros that set
+    # lots of directory switches by default.
+  ;;
+  --enable-debug-tcg) debug_tcg="yes"
+  ;;
+  --disable-debug-tcg) debug_tcg="no"
+  ;;
+  --enable-debug)
+      # Enable debugging options that aren't excessively noisy
+      debug_tcg="yes"
+      meson_option_parse --enable-debug-mutex ""
+      meson_option_add -Doptimization=0
+      fortify_source="no"
+  ;;
+  --enable-sanitizers) sanitizers="yes"
+  ;;
+  --disable-sanitizers) sanitizers="no"
+  ;;
+  --enable-tsan) tsan="yes"
+  ;;
+  --disable-tsan) tsan="no"
+  ;;
+  --disable-tcg) tcg="disabled"
+                 plugins="no"
+  ;;
+  --enable-tcg) tcg="enabled"
+  ;;
+  --disable-system) softmmu="no"
+  ;;
+  --enable-system) softmmu="yes"
+  ;;
+  --disable-user)
+      linux_user="no" ;
+      bsd_user="no" ;
+  ;;
+  --enable-user) ;;
+  --disable-linux-user) linux_user="no"
+  ;;
+  --enable-linux-user) linux_user="yes"
+  ;;
+  --disable-bsd-user) bsd_user="no"
+  ;;
+  --enable-bsd-user) bsd_user="yes"
+  ;;
+  --enable-pie) pie="yes"
+  ;;
+  --disable-pie) pie="no"
+  ;;
+  --enable-werror) werror="yes"
+  ;;
+  --disable-werror) werror="no"
+  ;;
+  --enable-stack-protector) stack_protector="yes"
+  ;;
+  --disable-stack-protector) stack_protector="no"
+  ;;
+  --enable-safe-stack) safe_stack="yes"
+  ;;
+  --disable-safe-stack) safe_stack="no"
+  ;;
+  --enable-cfi)
+      cfi="true";
+      meson_option_add -Db_lto=true
+  ;;
+  --disable-cfi) cfi="false"
+  ;;
+  --disable-fdt) fdt="disabled"
+  ;;
+  --enable-fdt) fdt="enabled"
+  ;;
+  --enable-fdt=git) fdt="internal"
+  ;;
+  --enable-fdt=*) fdt="$optarg"
+  ;;
+  --with-coroutine=*) coroutine="$optarg"
+  ;;
+  --with-git=*) git="$optarg"
+  ;;
+  --with-git-submodules=*)
+      git_submodules_action="$optarg"
+  ;;
+  --enable-plugins) if test "$mingw32" = "yes"; then
+                        error_exit "TCG plugins not currently supported on Windows platforms"
+                    else
+                        plugins="yes"
+                    fi
+  ;;
+  --disable-plugins) plugins="no"
+  ;;
+  --enable-containers) use_containers="yes"
+  ;;
+  --disable-containers) use_containers="no"
+  ;;
+  --gdb=*) gdb_bin="$optarg"
+  ;;
+  --enable-vfio-user-server) vfio_user_server="enabled"
+  ;;
+  --disable-vfio-user-server) vfio_user_server="disabled"
+  ;;
+  # everything else has the same name in configure and meson
+  --*) meson_option_parse "$opt" "$optarg"
+  ;;
+  esac
+done
+
+# test for any invalid configuration combinations
+if test "$plugins" = "yes" -a "$tcg" = "disabled"; then
+    error_exit "Can't enable plugins on non-TCG builds"
+fi
+
+if test x"$show_help" = x"yes" ; then
+cat << EOF
+
+Usage: configure [options]
+Options: [defaults in brackets after descriptions]
+
+Standard options:
+  --help                   print this message
+  --prefix=PREFIX          install in PREFIX [$prefix]
+  --target-list=LIST       set target list (default: build all)
+$(echo Available targets: $default_target_list | \
+  fold -s -w 53 | sed -e 's/^/                           /')
+  --target-list-exclude=LIST exclude a set of targets from the default target-list
+
+Advanced options (experts only):
+  --cross-prefix=PREFIX    use PREFIX for compile tools, PREFIX can be blank [$cross_prefix]
+  --cc=CC                  use C compiler CC [$cc]
+  --host-cc=CC             use C compiler CC [$host_cc] for code run at
+                           build time
+  --cxx=CXX                use C++ compiler CXX [$cxx]
+  --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]
+  --extra-cflags=CFLAGS    append extra C compiler flags CFLAGS
+  --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
+  --extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS
+  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS
+  --cross-cc-ARCH=CC       use compiler when building ARCH guest test cases
+  --cross-cc-cflags-ARCH=  use compiler flags when building ARCH guest tests
+  --cross-prefix-ARCH=PREFIX cross compiler prefix when building ARCH guest test cases
+  --make=MAKE              use specified make [$make]
+  --python=PYTHON          use specified python [$python]
+  --meson=MESON            use specified meson [$meson]
+  --ninja=NINJA            use specified ninja [$ninja]
+  --smbd=SMBD              use specified smbd [$smbd]
+  --with-git=GIT           use specified git [$git]
+  --with-git-submodules=update   update git submodules (default if .git dir exists)
+  --with-git-submodules=validate fail if git submodules are not up to date
+  --with-git-submodules=ignore   do not update or check git submodules (default if no .git dir)
+  --static                 enable static build [$static]
+  --bindir=PATH            install binaries in PATH
+  --with-suffix=SUFFIX     suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
+  --without-default-features default all --enable-* options to "disabled"
+  --without-default-devices  do not include any device that is not needed to
+                           start the emulator (only use if you are including
+                           desired devices in configs/devices/)
+  --with-devices-ARCH=NAME override default configs/devices
+  --enable-debug           enable common debug build options
+  --enable-sanitizers      enable default sanitizers
+  --enable-tsan            enable thread sanitizer
+  --disable-werror         disable compilation abort on warning
+  --disable-stack-protector disable compiler-provided stack protection
+  --cpu=CPU                Build for host CPU [$cpu]
+  --with-coroutine=BACKEND coroutine backend. Supported options:
+                           ucontext, sigaltstack, windows
+  --enable-plugins
+                           enable plugins via shared library loading
+  --disable-containers     don't use containers for cross-building
+  --gdb=GDB-path           gdb to use for gdbstub tests [$gdb_bin]
+EOF
+  meson_options_help
+cat << EOF
+  system          all system emulation targets
+  user            supported user emulation targets
+  linux-user      all linux usermode emulation targets
+  bsd-user        all BSD usermode emulation targets
+  pie             Position Independent Executables
+  modules         modules support (non-Windows)
+  debug-tcg       TCG debugging (default is disabled)
+  debug-info      debugging information
+  safe-stack      SafeStack Stack Smash Protection. Depends on
+                  clang/llvm >= 3.7 and requires coroutine backend ucontext.
+
+NOTE: The object files are built at the place where configure is launched
+EOF
+exit 0
+fi
+
 if test "$PWD" = "$source_path"
 then
     echo "Using './build' as the directory for build output"
@@ -93,25 +431,6 @@ invoke=$(printf " '%s'" "$0" "$@")
 test -n "$GITLAB_CI" && echo "configuring with: $invoke"
 { echo "$invoke"; echo; echo "#"; } >> config.log
 
-quote_sh() {
-    printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&',"
-}
-
-print_error() {
-    (echo
-    echo "ERROR: $1"
-    while test -n "$2"; do
-        echo "       $2"
-        shift
-    done
-    echo) >&2
-}
-
-error_exit() {
-    print_error "$@"
-    exit 1
-}
-
 do_compiler() {
   # Run the compiler, capturing its output to the log. First argument
   # is compiler binary to execute.
@@ -639,249 +958,6 @@ if test "$mingw32" = "yes" ; then
   qemu_suffix=""
 fi
 
-werror=""
-
-meson_option_build_array() {
-  printf '['
-  (if test "$targetos" = windows; then
-    IFS=\;
-  else
-    IFS=:
-  fi
-  for e in $1; do
-    printf '"""'
-    # backslash escape any '\' and '"' characters
-    printf "%s" "$e" | sed -e 's/\([\"]\)/\\\1/g'
-    printf '""",'
-  done)
-  printf ']\n'
-}
-
-. "$source_path/scripts/meson-buildoptions.sh"
-
-meson_options=
-meson_option_add() {
-  meson_options="$meson_options $(quote_sh "$1")"
-}
-meson_option_parse() {
-  meson_options="$meson_options $(_meson_option_parse "$@")"
-  if test $? -eq 1; then
-    echo "ERROR: unknown option $1"
-    echo "Try '$0 --help' for more information"
-    exit 1
-  fi
-}
-
-for opt do
-  optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
-  case "$opt" in
-  --help|-h) show_help=yes
-  ;;
-  --version|-V) exec cat "$source_path/VERSION"
-  ;;
-  --prefix=*) prefix="$optarg"
-  ;;
-  --cross-prefix=*)
-  ;;
-  --cc=*)
-  ;;
-  --host-cc=*) host_cc="$optarg"
-  ;;
-  --cxx=*)
-  ;;
-  --objcc=*) objcc="$optarg"
-  ;;
-  --make=*) make="$optarg"
-  ;;
-  --install=*)
-  ;;
-  --python=*) python="$optarg" ; explicit_python=yes
-  ;;
-  --skip-meson) skip_meson=yes
-  ;;
-  --meson=*) meson="$optarg"
-  ;;
-  --ninja=*) ninja="$optarg"
-  ;;
-  --smbd=*) smbd="$optarg"
-  ;;
-  --extra-cflags=*)
-  ;;
-  --extra-cxxflags=*)
-  ;;
-  --extra-objcflags=*)
-  ;;
-  --extra-ldflags=*)
-  ;;
-  --cross-cc-*)
-  ;;
-  --cross-prefix-*)
-  ;;
-  --enable-debug-info) meson_option_add -Ddebug=true
-  ;;
-  --disable-debug-info) meson_option_add -Ddebug=false
-  ;;
-  --enable-modules)
-      modules="yes"
-  ;;
-  --disable-modules)
-      modules="no"
-  ;;
-  --cpu=*)
-  ;;
-  --target-list=*) target_list="$optarg"
-                   if test "$target_list_exclude"; then
-                       error_exit "Can't mix --target-list with --target-list-exclude"
-                   fi
-  ;;
-  --target-list-exclude=*) target_list_exclude="$optarg"
-                   if test "$target_list"; then
-                       error_exit "Can't mix --target-list-exclude with --target-list"
-                   fi
-  ;;
-  --with-default-devices) meson_option_add -Ddefault_devices=true
-  ;;
-  --without-default-devices) meson_option_add -Ddefault_devices=false
-  ;;
-  --with-devices-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --with-devices-FOO option"
-  ;;
-  --with-devices-*) device_arch=${opt#--with-devices-};
-                    device_arch=${device_arch%%=*}
-                    cf=$source_path/configs/devices/$device_arch-softmmu/$optarg.mak
-                    if test -f "$cf"; then
-                        device_archs="$device_archs $device_arch"
-                        eval "devices_${device_arch}=\$optarg"
-                    else
-                        error_exit "File $cf does not exist"
-                    fi
-  ;;
-  --without-default-features) # processed above
-  ;;
-  --static)
-    static="yes"
-    QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
-  ;;
-  --bindir=*) bindir="$optarg"
-  ;;
-  --with-suffix=*) qemu_suffix="$optarg"
-  ;;
-  --host=*|--build=*|\
-  --disable-dependency-tracking|\
-  --sbindir=*|--sharedstatedir=*|\
-  --oldincludedir=*|--datarootdir=*|--infodir=*|\
-  --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
-    # These switches are silently ignored, for compatibility with
-    # autoconf-generated configure scripts. This allows QEMU's
-    # configure to be used by RPM and similar macros that set
-    # lots of directory switches by default.
-  ;;
-  --enable-debug-tcg) debug_tcg="yes"
-  ;;
-  --disable-debug-tcg) debug_tcg="no"
-  ;;
-  --enable-debug)
-      # Enable debugging options that aren't excessively noisy
-      debug_tcg="yes"
-      meson_option_parse --enable-debug-mutex ""
-      meson_option_add -Doptimization=0
-      fortify_source="no"
-  ;;
-  --enable-sanitizers) sanitizers="yes"
-  ;;
-  --disable-sanitizers) sanitizers="no"
-  ;;
-  --enable-tsan) tsan="yes"
-  ;;
-  --disable-tsan) tsan="no"
-  ;;
-  --disable-tcg) tcg="disabled"
-                 plugins="no"
-  ;;
-  --enable-tcg) tcg="enabled"
-  ;;
-  --disable-system) softmmu="no"
-  ;;
-  --enable-system) softmmu="yes"
-  ;;
-  --disable-user)
-      linux_user="no" ;
-      bsd_user="no" ;
-  ;;
-  --enable-user) ;;
-  --disable-linux-user) linux_user="no"
-  ;;
-  --enable-linux-user) linux_user="yes"
-  ;;
-  --disable-bsd-user) bsd_user="no"
-  ;;
-  --enable-bsd-user) bsd_user="yes"
-  ;;
-  --enable-pie) pie="yes"
-  ;;
-  --disable-pie) pie="no"
-  ;;
-  --enable-werror) werror="yes"
-  ;;
-  --disable-werror) werror="no"
-  ;;
-  --enable-stack-protector) stack_protector="yes"
-  ;;
-  --disable-stack-protector) stack_protector="no"
-  ;;
-  --enable-safe-stack) safe_stack="yes"
-  ;;
-  --disable-safe-stack) safe_stack="no"
-  ;;
-  --enable-cfi)
-      cfi="true";
-      meson_option_add -Db_lto=true
-  ;;
-  --disable-cfi) cfi="false"
-  ;;
-  --disable-fdt) fdt="disabled"
-  ;;
-  --enable-fdt) fdt="enabled"
-  ;;
-  --enable-fdt=git) fdt="internal"
-  ;;
-  --enable-fdt=*) fdt="$optarg"
-  ;;
-  --with-coroutine=*) coroutine="$optarg"
-  ;;
-  --with-git=*) git="$optarg"
-  ;;
-  --with-git-submodules=*)
-      git_submodules_action="$optarg"
-  ;;
-  --enable-plugins) if test "$mingw32" = "yes"; then
-                        error_exit "TCG plugins not currently supported on Windows platforms"
-                    else
-                        plugins="yes"
-                    fi
-  ;;
-  --disable-plugins) plugins="no"
-  ;;
-  --enable-containers) use_containers="yes"
-  ;;
-  --disable-containers) use_containers="no"
-  ;;
-  --gdb=*) gdb_bin="$optarg"
-  ;;
-  --enable-vfio-user-server) vfio_user_server="enabled"
-  ;;
-  --disable-vfio-user-server) vfio_user_server="disabled"
-  ;;
-  # everything else has the same name in configure and meson
-  --*) meson_option_parse "$opt" "$optarg"
-  ;;
-  esac
-done
-
-# test for any invalid configuration combinations
-if test "$plugins" = "yes" -a "$tcg" = "disabled"; then
-    error_exit "Can't enable plugins on non-TCG builds"
-fi
-
 case $git_submodules_action in
     update|validate)
         if test ! -e "$source_path/.git"; then
@@ -954,82 +1030,6 @@ for config in $mak_wilds; do
     fi
 done
 
-if test x"$show_help" = x"yes" ; then
-cat << EOF
-
-Usage: configure [options]
-Options: [defaults in brackets after descriptions]
-
-Standard options:
-  --help                   print this message
-  --prefix=PREFIX          install in PREFIX [$prefix]
-  --target-list=LIST       set target list (default: build all)
-$(echo Available targets: $default_target_list | \
-  fold -s -w 53 | sed -e 's/^/                           /')
-  --target-list-exclude=LIST exclude a set of targets from the default target-list
-
-Advanced options (experts only):
-  --cross-prefix=PREFIX    use PREFIX for compile tools, PREFIX can be blank [$cross_prefix]
-  --cc=CC                  use C compiler CC [$cc]
-  --host-cc=CC             use C compiler CC [$host_cc] for code run at
-                           build time
-  --cxx=CXX                use C++ compiler CXX [$cxx]
-  --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]
-  --extra-cflags=CFLAGS    append extra C compiler flags CFLAGS
-  --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
-  --extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS
-  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS
-  --cross-cc-ARCH=CC       use compiler when building ARCH guest test cases
-  --cross-cc-cflags-ARCH=  use compiler flags when building ARCH guest tests
-  --cross-prefix-ARCH=PREFIX cross compiler prefix when building ARCH guest test cases
-  --make=MAKE              use specified make [$make]
-  --python=PYTHON          use specified python [$python]
-  --meson=MESON            use specified meson [$meson]
-  --ninja=NINJA            use specified ninja [$ninja]
-  --smbd=SMBD              use specified smbd [$smbd]
-  --with-git=GIT           use specified git [$git]
-  --with-git-submodules=update   update git submodules (default if .git dir exists)
-  --with-git-submodules=validate fail if git submodules are not up to date
-  --with-git-submodules=ignore   do not update or check git submodules (default if no .git dir)
-  --static                 enable static build [$static]
-  --bindir=PATH            install binaries in PATH
-  --with-suffix=SUFFIX     suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
-  --without-default-features default all --enable-* options to "disabled"
-  --without-default-devices  do not include any device that is not needed to
-                           start the emulator (only use if you are including
-                           desired devices in configs/devices/)
-  --with-devices-ARCH=NAME override default configs/devices
-  --enable-debug           enable common debug build options
-  --enable-sanitizers      enable default sanitizers
-  --enable-tsan            enable thread sanitizer
-  --disable-werror         disable compilation abort on warning
-  --disable-stack-protector disable compiler-provided stack protection
-  --cpu=CPU                Build for host CPU [$cpu]
-  --with-coroutine=BACKEND coroutine backend. Supported options:
-                           ucontext, sigaltstack, windows
-  --enable-plugins
-                           enable plugins via shared library loading
-  --disable-containers     don't use containers for cross-building
-  --gdb=GDB-path           gdb to use for gdbstub tests [$gdb_bin]
-EOF
-  meson_options_help
-cat << EOF
-  system          all system emulation targets
-  user            supported user emulation targets
-  linux-user      all linux usermode emulation targets
-  bsd-user        all BSD usermode emulation targets
-  pie             Position Independent Executables
-  modules         modules support (non-Windows)
-  debug-tcg       TCG debugging (default is disabled)
-  debug-info      debugging information
-  safe-stack      SafeStack Stack Smash Protection. Depends on
-                  clang/llvm >= 3.7 and requires coroutine backend ucontext.
-
-NOTE: The object files are built at the place where configure is launched
-EOF
-exit 0
-fi
-
 # Remove old dependency files to make sure that they get properly regenerated
 rm -f ./*/config-devices.mak.d
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] configure: Add 'mkdir build' check
  2023-02-08 23:31 ` [PATCH 1/2] configure: Add 'mkdir build' check Dinah Baum
@ 2023-02-16  5:48   ` Dinah B
  2023-02-16 14:21   ` Peter Maydell
  1 sibling, 0 replies; 6+ messages in thread
From: Dinah B @ 2023-02-16  5:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Alex Bennée, Thomas Huth

[-- Attachment #1: Type: text/plain, Size: 1372 bytes --]

*ping*

Patch series:
https://lore.kernel.org/qemu-devel/20230208233111.398577-1-dinahbaum123@gmail.com/

-Dinah

On Wed, Feb 8, 2023 at 6:31 PM Dinah Baum <dinahbaum123@gmail.com> wrote:

> QEMU configure script goes into an infinite error printing loop
> when in read only directory due to 'build' dir never being created.
>
> Checking if 'mkdir dir' succeeds prevents this error.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/321
> ---
>  configure | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/configure b/configure
> index 64960c6000..3b384914ce 100755
> --- a/configure
> +++ b/configure
> @@ -31,10 +31,11 @@ then
>          fi
>      fi
>
> -    mkdir build
> -    touch $MARKER
> +    if mkdir build
> +    then
> +        touch $MARKER
>
> -    cat > GNUmakefile <<'EOF'
> +        cat > GNUmakefile <<'EOF'
>  # This file is auto-generated by configure to support in-source tree
>  # 'make' command invocation
>
> @@ -56,8 +57,12 @@ force: ;
>  GNUmakefile: ;
>
>  EOF
> -    cd build
> -    exec "$source_path/configure" "$@"
> +        cd build
> +        exec "$source_path/configure" "$@"
> +    else
> +        echo "ERROR: Unable to use ./build dir, try using a
> ../qemu/configure build"
> +        exit 1
> +    fi
>  fi
>
>  # Temporary directory used for files created while
> --
> 2.30.2
>
>

[-- Attachment #2: Type: text/html, Size: 2233 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] *** configure: Add 'mkdir build' check ***
  2023-02-08 23:31 [PATCH 0/2] *** configure: Add 'mkdir build' check *** Dinah Baum
  2023-02-08 23:31 ` [PATCH 1/2] configure: Add 'mkdir build' check Dinah Baum
  2023-02-08 23:31 ` [PATCH 2/2] configure: './configure --help' should work Dinah Baum
@ 2023-02-16 14:06 ` Peter Maydell
  2 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2023-02-16 14:06 UTC (permalink / raw)
  To: Dinah Baum; +Cc: qemu-devel, Paolo Bonzini

On Wed, 8 Feb 2023 at 23:32, Dinah Baum <dinahbaum123@gmail.com> wrote:
>
> QEMU configure script goes into an infinite error printing loop
> when in read only directory due to 'build' dir never being created.
>
> 1 - Checking if 'mkdir dir' succeeds and if the directory is
> writeable prevents this error.
>
> 2 - Since we exit early on error in (1), code for reading in
> arguments has been moved before that

Unfortunately this patch series changes the output of the --help
message, because it moves the code that prints it so that it
is before some of the other bits of configure that identify
various default values to print as part of the help message.
You can see this if you do './configure --help > help.txt'
before and after the changes and compare the outputs:



--- /tmp/old.help       2023-02-16 13:58:45.302662220 +0000
+++ /tmp/new-help       2023-02-16 13:56:05.579389660 +0000
@@ -1,47 +1,21 @@
-Using './build' as the directory for build output

 Usage: configure [options]
 Options: [defaults in brackets after descriptions]

 Standard options:
   --help                   print this message
-  --prefix=PREFIX          install in PREFIX [/usr/local]
+  --prefix=PREFIX          install in PREFIX []
   --target-list=LIST       set target list (default: build all)
-                           Available targets: aarch64-softmmu alpha-softmmu
-                           arm-softmmu avr-softmmu cris-softmmu hppa-softmmu
-                           i386-softmmu loongarch64-softmmu m68k-softmmu
-                           microblaze-softmmu microblazeel-softmmu mips-softmmu
-                           mips64-softmmu mips64el-softmmu mipsel-softmmu
-                           nios2-softmmu or1k-softmmu ppc-softmmu ppc64-softmmu
-                           riscv32-softmmu riscv64-softmmu rx-softmmu
-                           s390x-softmmu sh4-softmmu sh4eb-softmmu
-                           sparc-softmmu sparc64-softmmu tricore-softmmu
-                           x86_64-softmmu xtensa-softmmu xtensaeb-softmmu
-                           aarch64-linux-user aarch64_be-linux-user
-                           alpha-linux-user arm-linux-user armeb-linux-user
-                           cris-linux-user hexagon-linux-user hppa-linux-user
-                           i386-linux-user loongarch64-linux-user
-                           m68k-linux-user microblaze-linux-user
-                           microblazeel-linux-user mips-linux-user
-                           mips64-linux-user mips64el-linux-user
-                           mipsel-linux-user mipsn32-linux-user
-                           mipsn32el-linux-user nios2-linux-user
-                           or1k-linux-user ppc-linux-user ppc64-linux-user
-                           ppc64le-linux-user riscv32-linux-user
-                           riscv64-linux-user s390x-linux-user sh4-linux-user
-                           sh4eb-linux-user sparc-linux-user
-                           sparc32plus-linux-user sparc64-linux-user
-                           x86_64-linux-user xtensa-linux-user
-                           xtensaeb-linux-user
+                           Available targets:
   --target-list-exclude=LIST exclude a set of targets from the
default target-list

 Advanced options (experts only):
   --cross-prefix=PREFIX    use PREFIX for compile tools, PREFIX can be blank []
-  --cc=CC                  use C compiler CC [cc]
-  --host-cc=CC             use C compiler CC [cc] for code run at
+  --cc=CC                  use C compiler CC []
+  --host-cc=CC             use C compiler CC [] for code run at
                            build time
(etc)

You can see that the new output doesn't show the available target
list or the default values in [] for options like --cc and --host-cc.

This is kind of awkward to fix because some of the code we run to
figure out those default values probably assumes that the current
directory is writeable and/or that the build directory was created.

My suggestion is that because the case we're trying to fix is
really a corner case (accidentally running configure in a
read-only directory), and our hope for the future is to move
still more of this code out of configure and into meson.build,
that we should take the simple approach:
 * just do something like patch 1, which exits immediately if
   it finds that it couldn't create the build directory
 * accept that in this situation, --help doesn't work. This
   is already the case for some other early error paths, like
   the one where we failed to create the temporary directory TMPDIR1

I think that's OK if we have a suitably clear error message.
I'll go and review patch 1 specifically now, assuming this
approach.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] configure: Add 'mkdir build' check
  2023-02-08 23:31 ` [PATCH 1/2] configure: Add 'mkdir build' check Dinah Baum
  2023-02-16  5:48   ` Dinah B
@ 2023-02-16 14:21   ` Peter Maydell
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2023-02-16 14:21 UTC (permalink / raw)
  To: Dinah Baum; +Cc: qemu-devel, Paolo Bonzini, Alex Bennée, Thomas Huth

On Wed, 8 Feb 2023 at 23:32, Dinah Baum <dinahbaum123@gmail.com> wrote:
>
> QEMU configure script goes into an infinite error printing loop
> when in read only directory due to 'build' dir never being created.
>
> Checking if 'mkdir dir' succeeds prevents this error.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/321

This commit message needs your Signed-off-by: line on it. This is how
you say that you're legally OK to put the change into QEMU and that
you're happy for it to happen; the details are at
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#patch-emails-must-include-a-signed-off-by-line

It's just a line
Signed-off-by: Your Name <your@email>

> ---
>  configure | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/configure b/configure
> index 64960c6000..3b384914ce 100755
> --- a/configure
> +++ b/configure
> @@ -31,10 +31,11 @@ then
>          fi
>      fi
>
> -    mkdir build
> -    touch $MARKER
> +    if mkdir build
> +    then
> +        touch $MARKER
>
> -    cat > GNUmakefile <<'EOF'
> +        cat > GNUmakefile <<'EOF'
>  # This file is auto-generated by configure to support in-source tree
>  # 'make' command invocation
>
> @@ -56,8 +57,12 @@ force: ;
>  GNUmakefile: ;
>
>  EOF
> -    cd build
> -    exec "$source_path/configure" "$@"
> +        cd build
> +        exec "$source_path/configure" "$@"
> +    else
> +        echo "ERROR: Unable to use ./build dir, try using a ../qemu/configure build"
> +        exit 1
> +    fi
>  fi

Hi; I think that because the "happy path" inside this if..then is
quite large, we can make the code more readable by reversing the
sense of the condition and putting the error exit early, like this:

    if ! mkdir build || ! touch $MARKER ; then
       echo "ERROR ..."
       exit 1
    fi

    cat > GNUmakefile <<'EOF'
    etc etc as before

I'm also going to suggest a tweak to the error text:

   "ERROR: Could not create ./build directory. Check the permissions on
    your source directory, or try doing an out-of-tree build."

thanks
-- PMM


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-16 14:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-08 23:31 [PATCH 0/2] *** configure: Add 'mkdir build' check *** Dinah Baum
2023-02-08 23:31 ` [PATCH 1/2] configure: Add 'mkdir build' check Dinah Baum
2023-02-16  5:48   ` Dinah B
2023-02-16 14:21   ` Peter Maydell
2023-02-08 23:31 ` [PATCH 2/2] configure: './configure --help' should work Dinah Baum
2023-02-16 14:06 ` [PATCH 0/2] *** configure: Add 'mkdir build' check *** Peter Maydell

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).