]> xenbits.xensource.com Git - osstest.git/commitdiff
ts-xen-build: Pass --enable if --disable found in usage, and v.v.
authorIan Jackson <iwj@xenproject.org>
Wed, 27 Oct 2021 10:53:50 +0000 (11:53 +0100)
committerIan Jackson <iwj@xenproject.org>
Thu, 28 Oct 2021 12:23:37 +0000 (13:23 +0100)
The existing code works in practice if the usage message always lists
the non-default, since the unlisted-in-usage options that would be
supported, but are elided, are in any case the default.

But configure might *compute* its defaults.  In which case it will
list only one of them in the usage message.  If the computed default
is not the same as the usual default (the one implied by listing the
opposite in the usage message) we would wrongly not pass the option.

So grep for both enable and disable.

Signed-off-by: Ian Jackson <iwj@xenproject.org>
Reviewed-by: Juergen Gross <jgross@suse.com>
ts-xen-build

index d6f6bfacbc20c0968fd36f0dc92da45858b8055f..c294a51eafc26e53b5417529b943224902870acf 100755 (executable)
@@ -142,12 +142,20 @@ END
 }
 
 sub build () {
+    # We want to explicitly enable and disable some things.  But not
+    # all versions of Xen support all configuration options.  We
+    # detect presence of an option by grepping configure.  That finds
+    # them in the usage message.  The usage message has only one of
+    # the two, depending on the usual default.  (Presence of --enable
+    # in the usage output means --disable is supported, and vice
+    # versa.)  So we search for both enable and disable, and if either
+    # is found, we use the one we want.
     my $enable_opts = ''; # shell script to set "enable_opts" shell var
     my $enable_disable = sub {
        my ($subdir, $feat, $enable) = @_;
        my $opt = "--".($enable ? 'enable' : 'disable')."-$feat";
        $enable_opts .= <<END;
-                if grep -q -- $opt \\
+                if egrep -q -- '--disable-$feat|--enable-$feat' \\
                                ${subdir}configure ; then
                    enable_opts="\$enable_opts $opt"
                 fi