diff mbox series

[2/2] tools: add configure option for libfsimage

Message ID 20230804060000.27710-3-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series tools: add some more configure options | expand

Commit Message

Jürgen Groß Aug. 4, 2023, 6 a.m. UTC
The only in-tree user of libfsimage is pygrub. Now that it is possible
to disable the build of pygrub, the same should be possible for
libfsimage.

Add an option for controlling the build of libfsimage. The default is
on if pygrub is being built, and off if it isn't. Without pygrub the
build of libfsimage can be enabled via --enable-libfsimage.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 config/Tools.mk.in |  1 +
 tools/Makefile     |  2 +-
 tools/configure    | 28 ++++++++++++++++++++++++++++
 tools/configure.ac | 13 +++++++++++++
 4 files changed, 43 insertions(+), 1 deletion(-)

Comments

Anthony PERARD Aug. 8, 2023, 10:35 a.m. UTC | #1
On Fri, Aug 04, 2023 at 08:00:00AM +0200, Juergen Gross wrote:
> The only in-tree user of libfsimage is pygrub. Now that it is possible
> to disable the build of pygrub, the same should be possible for
> libfsimage.
> 
> Add an option for controlling the build of libfsimage. The default is
> on if pygrub is being built, and off if it isn't. Without pygrub the
> build of libfsimage can be enabled via --enable-libfsimage.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> diff --git a/tools/configure.ac b/tools/configure.ac
> index 9947bcefc6..aea24eb982 100644
> --- a/tools/configure.ac
> +++ b/tools/configure.ac
> @@ -185,6 +185,19 @@ AS_IF([test "x$enable_rombios" = "xyes"], [
>  ])
>  AC_SUBST(rombios)
>  
> +AC_ARG_ENABLE([libfsimage],
> +    AS_HELP_STRING([--enable-libfsimage],
> +                   [Enable libfsimage, (DEFAULT is on if pygrub is enabled,
> +                    otherwise off)]),,[
> +    AS_IF([test "x$enable_pygrub" = "xno"], [
> +        enable_libfsimage="no"
> +    ], [
> +        enable_libfsimage="yes"
> +    ])
> +])
> +AS_IF([test "x$enable_libfsimage" = "xyes"], [libfsimage=y], [libfsimage=n])
> +AC_SUBST(libfsimage)
> +

Should we issue an error if one does "--disable-libfsimage
--enable-pygrub" ? Or just let the build of pygrub fails?
Also, "--disable-libfsimage" alone will keep "pygrub" enabled, so we
should probably check.

Thanks,
Andrew Cooper Aug. 8, 2023, 10:40 a.m. UTC | #2
On 08/08/2023 11:35 am, Anthony PERARD wrote:
> On Fri, Aug 04, 2023 at 08:00:00AM +0200, Juergen Gross wrote:
>> The only in-tree user of libfsimage is pygrub. Now that it is possible
>> to disable the build of pygrub, the same should be possible for
>> libfsimage.
>>
>> Add an option for controlling the build of libfsimage. The default is
>> on if pygrub is being built, and off if it isn't. Without pygrub the
>> build of libfsimage can be enabled via --enable-libfsimage.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>> diff --git a/tools/configure.ac b/tools/configure.ac
>> index 9947bcefc6..aea24eb982 100644
>> --- a/tools/configure.ac
>> +++ b/tools/configure.ac
>> @@ -185,6 +185,19 @@ AS_IF([test "x$enable_rombios" = "xyes"], [
>>  ])
>>  AC_SUBST(rombios)
>>  
>> +AC_ARG_ENABLE([libfsimage],
>> +    AS_HELP_STRING([--enable-libfsimage],
>> +                   [Enable libfsimage, (DEFAULT is on if pygrub is enabled,
>> +                    otherwise off)]),,[
>> +    AS_IF([test "x$enable_pygrub" = "xno"], [
>> +        enable_libfsimage="no"
>> +    ], [
>> +        enable_libfsimage="yes"
>> +    ])
>> +])
>> +AS_IF([test "x$enable_libfsimage" = "xyes"], [libfsimage=y], [libfsimage=n])
>> +AC_SUBST(libfsimage)
>> +
> Should we issue an error if one does "--disable-libfsimage
> --enable-pygrub" ? Or just let the build of pygrub fails?

In such a case, it wouldn't be a build failure.  It would fail at
runtime with an ImportError.

~Andrew
Jürgen Groß Aug. 8, 2023, 10:44 a.m. UTC | #3
On 08.08.23 12:40, Andrew Cooper wrote:
> On 08/08/2023 11:35 am, Anthony PERARD wrote:
>> On Fri, Aug 04, 2023 at 08:00:00AM +0200, Juergen Gross wrote:
>>> The only in-tree user of libfsimage is pygrub. Now that it is possible
>>> to disable the build of pygrub, the same should be possible for
>>> libfsimage.
>>>
>>> Add an option for controlling the build of libfsimage. The default is
>>> on if pygrub is being built, and off if it isn't. Without pygrub the
>>> build of libfsimage can be enabled via --enable-libfsimage.
>>>
>>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>> ---
>>> diff --git a/tools/configure.ac b/tools/configure.ac
>>> index 9947bcefc6..aea24eb982 100644
>>> --- a/tools/configure.ac
>>> +++ b/tools/configure.ac
>>> @@ -185,6 +185,19 @@ AS_IF([test "x$enable_rombios" = "xyes"], [
>>>   ])
>>>   AC_SUBST(rombios)
>>>   
>>> +AC_ARG_ENABLE([libfsimage],
>>> +    AS_HELP_STRING([--enable-libfsimage],
>>> +                   [Enable libfsimage, (DEFAULT is on if pygrub is enabled,
>>> +                    otherwise off)]),,[
>>> +    AS_IF([test "x$enable_pygrub" = "xno"], [
>>> +        enable_libfsimage="no"
>>> +    ], [
>>> +        enable_libfsimage="yes"
>>> +    ])
>>> +])
>>> +AS_IF([test "x$enable_libfsimage" = "xyes"], [libfsimage=y], [libfsimage=n])
>>> +AC_SUBST(libfsimage)
>>> +
>> Should we issue an error if one does "--disable-libfsimage
>> --enable-pygrub" ? Or just let the build of pygrub fails?
> 
> In such a case, it wouldn't be a build failure.  It would fail at
> runtime with an ImportError.

Indeed.

I'll update the patch to fail configure in such a case.


Juergen
diff mbox series

Patch

diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index 432d7496f1..b54ab21f96 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -49,6 +49,7 @@  CONFIG_QEMUU_EXTRA_ARGS:= @EXTRA_QEMUU_CONFIGURE_ARGS@
 CONFIG_LIBNL        := @libnl@
 CONFIG_GOLANG       := @golang@
 CONFIG_PYGRUB       := @pygrub@
+CONFIG_LIBFSIMAGE   := @libfsimage@
 
 CONFIG_SYSTEMD      := @systemd@
 SYSTEMD_CFLAGS      := @SYSTEMD_CFLAGS@
diff --git a/tools/Makefile b/tools/Makefile
index bbd75ebc1a..311a9098d7 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -18,7 +18,7 @@  SUBDIRS-$(CONFIG_X86) += firmware
 SUBDIRS-y += console
 SUBDIRS-y += xenmon
 SUBDIRS-$(XENSTAT_XENTOP) += xentop
-SUBDIRS-y += libfsimage
+SUBDIRS-$(CONFIG_LIBFSIMAGE) += libfsimage
 SUBDIRS-$(CONFIG_Linux) += vchan
 
 # do not recurse in to a dir we are about to delete
diff --git a/tools/configure b/tools/configure
index 130e0d9abf..60dca366ca 100755
--- a/tools/configure
+++ b/tools/configure
@@ -700,6 +700,7 @@  EXTRA_QEMUU_CONFIGURE_ARGS
 qemu_xen_systemd
 qemu_xen_path
 qemu_xen
+libfsimage
 rombios
 BCC
 LD86
@@ -818,6 +819,7 @@  enable_qemu_traditional
 enable_ipxe
 with_system_ipxe
 enable_rombios
+enable_libfsimage
 with_system_qemu
 with_stubdom_qmp_proxy
 with_system_seabios
@@ -1508,6 +1510,8 @@  Optional Features:
                           --with-system-ipxe)
   --enable-rombios        Enable ROMBIOS, (DEFAULT is on if qemu-traditional
                           or ipxe is enabled, otherwise off)
+  --enable-libfsimage     Enable libfsimage, (DEFAULT is on if pygrub is
+                          enabled, otherwise off)
   --enable-systemd        Enable systemd support (default is DISABLED)
   --enable-9pfs           Explicitly enable 9pfs support in QEMU build
                           (default is to defer to QEMU configure default)
@@ -4621,6 +4625,30 @@  else
 fi
 
 
+# Check whether --enable-libfsimage was given.
+if test "${enable_libfsimage+set}" = set; then :
+  enableval=$enable_libfsimage;
+else
+
+    if test "x$enable_pygrub" = "xno"; then :
+
+        enable_libfsimage="no"
+
+else
+
+        enable_libfsimage="yes"
+
+fi
+
+fi
+
+if test "x$enable_libfsimage" = "xyes"; then :
+  libfsimage=y
+else
+  libfsimage=n
+fi
+
+
 
 # Check whether --with-system-qemu was given.
 if test "${with_system_qemu+set}" = set; then :
diff --git a/tools/configure.ac b/tools/configure.ac
index 9947bcefc6..aea24eb982 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -185,6 +185,19 @@  AS_IF([test "x$enable_rombios" = "xyes"], [
 ])
 AC_SUBST(rombios)
 
+AC_ARG_ENABLE([libfsimage],
+    AS_HELP_STRING([--enable-libfsimage],
+                   [Enable libfsimage, (DEFAULT is on if pygrub is enabled,
+                    otherwise off)]),,[
+    AS_IF([test "x$enable_pygrub" = "xno"], [
+        enable_libfsimage="no"
+    ], [
+        enable_libfsimage="yes"
+    ])
+])
+AS_IF([test "x$enable_libfsimage" = "xyes"], [libfsimage=y], [libfsimage=n])
+AC_SUBST(libfsimage)
+
 AC_ARG_WITH([system-qemu],
     AS_HELP_STRING([--with-system-qemu@<:@=PATH@:>@],
        [Use system supplied qemu PATH or qemu (taken from $PATH) as qemu-xen