[libvirt] [PATCH v2] autogen.sh: tell user the correct make command

Daniel P. Berrange posted 1 patch 6 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20171212155723.890-1-berrange@redhat.com
autogen.sh | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
[libvirt] [PATCH v2] autogen.sh: tell user the correct make command
Posted by Daniel P. Berrange 6 years, 4 months ago
When autogen.sh finishes it helpfully prints

  "Now type 'make' to compile libvirt."

which is fine if on a host with GNU make, but on *BSD running
'make' will end in tears. We should tell users to run 'gmake'
on these platforms. If 'gmake' doesn't exist then we should
report an error too

  "GNU make is required to build libvirt"

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 autogen.sh | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/autogen.sh b/autogen.sh
index d5d836aa71..ea94528de6 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -175,6 +175,18 @@ if test "$OBJ_DIR"; then
     }
 fi
 
+# Make sure we can find GNU make and tell the user
+# the right command to run
+if make -v 2>&1 | grep -q "GNU Make"; then
+    MAKE=make
+else
+    if which gmake >/dev/null 2>&1; then
+        MAKE=gmake
+    else
+        die "GNU make is required to build libvirt"
+    fi
+fi
+
 if test -z "$*" && test -z "$extra_args" && test -f config.status; then
     echo "Running config.status..."
     ./config.status --recheck || {
@@ -193,4 +205,4 @@ else
 fi
 
 echo
-echo "Now type 'make' to compile libvirt."
+echo "Now type '$MAKE' to compile libvirt."
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] autogen.sh: tell user the correct make command
Posted by Andrea Bolognani 6 years, 4 months ago
On Tue, 2017-12-12 at 15:57 +0000, Daniel P. Berrange wrote:
> When autogen.sh finishes it helpfully prints
> 
>   "Now type 'make' to compile libvirt."
> 
> which is fine if on a host with GNU make, but on *BSD running
> 'make' will end in tears. We should tell users to run 'gmake'
> on these platforms. If 'gmake' doesn't exist then we should
> report an error too
> 
>   "GNU make is required to build libvirt"
> 
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  autogen.sh | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/autogen.sh b/autogen.sh
> index d5d836aa71..ea94528de6 100755
> --- a/autogen.sh
> +++ b/autogen.sh
> @@ -175,6 +175,18 @@ if test "$OBJ_DIR"; then
>      }
>  fi
>  
> +# Make sure we can find GNU make and tell the user
> +# the right command to run
> +if make -v 2>&1 | grep -q "GNU Make"; then
> +    MAKE=make
> +else
> +    if which gmake >/dev/null 2>&1; then
> +        MAKE=gmake
> +    else
> +        die "GNU make is required to build libvirt"
> +    fi
> +fi

Alternative approach which doesn't assume 'gmake' is necessarily
going to be GNU make - even though it is, for all intents and
purposes, a fairly reasonable assumption:

    MAKE=
    for cmd in make gmake; do
        if $cmd -v 2>&1 | grep -q "GNU Make"; then
            MAKE=$cmd
            break
        fi
    done
    test "$MAKE" || {
        die "GNU make is required to build libvirt"
    }

Or you can leave it as it is, your call.

> +
>  if test -z "$*" && test -z "$extra_args" && test -f config.status; then
>      echo "Running config.status..."
>      ./config.status --recheck || {
> @@ -193,4 +205,4 @@ else
>  fi
>  
>  echo
> -echo "Now type 'make' to compile libvirt."
> +echo "Now type '$MAKE' to compile libvirt."

Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] autogen.sh: tell user the correct make command
Posted by Daniel P. Berrange 6 years, 4 months ago
On Wed, Dec 13, 2017 at 11:00:34AM +0100, Andrea Bolognani wrote:
> On Tue, 2017-12-12 at 15:57 +0000, Daniel P. Berrange wrote:
> > When autogen.sh finishes it helpfully prints
> > 
> >   "Now type 'make' to compile libvirt."
> > 
> > which is fine if on a host with GNU make, but on *BSD running
> > 'make' will end in tears. We should tell users to run 'gmake'
> > on these platforms. If 'gmake' doesn't exist then we should
> > report an error too
> > 
> >   "GNU make is required to build libvirt"
> > 
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > ---
> >  autogen.sh | 14 +++++++++++++-
> >  1 file changed, 13 insertions(+), 1 deletion(-)
> > 
> > diff --git a/autogen.sh b/autogen.sh
> > index d5d836aa71..ea94528de6 100755
> > --- a/autogen.sh
> > +++ b/autogen.sh
> > @@ -175,6 +175,18 @@ if test "$OBJ_DIR"; then
> >      }
> >  fi
> >  
> > +# Make sure we can find GNU make and tell the user
> > +# the right command to run
> > +if make -v 2>&1 | grep -q "GNU Make"; then
> > +    MAKE=make
> > +else
> > +    if which gmake >/dev/null 2>&1; then
> > +        MAKE=gmake
> > +    else
> > +        die "GNU make is required to build libvirt"
> > +    fi
> > +fi
> 
> Alternative approach which doesn't assume 'gmake' is necessarily
> going to be GNU make - even though it is, for all intents and
> purposes, a fairly reasonable assumption:
> 
>     MAKE=
>     for cmd in make gmake; do
>         if $cmd -v 2>&1 | grep -q "GNU Make"; then
>             MAKE=$cmd
>             break
>         fi
>     done
>     test "$MAKE" || {
>         die "GNU make is required to build libvirt"
>     }
> 
> Or you can leave it as it is, your call.

Yeah, lets do this, it is nicer.

> 
> Reviewed-by: Andrea Bolognani <abologna@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list