[Spice-devel,common,3/5] build-sys: Add the SPICE_WARNING() and SPICE_PRINT_MESSAGES m4 macros

Submitted by Francois Gouget on Oct. 30, 2015, 10:46 a.m.

Details

Message ID alpine.DEB.2.20.1510301130250.28564@amboise
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Francois Gouget Oct. 30, 2015, 10:46 a.m.
A call to SPICE_WARNING() anywhere in the configure file results in the
warning being printed at the end of the configure run where it will be
be visible. This makes it possible to keep the SPICE_WARNING() calls
together with the related feature checks instead of having to put a
separate AC_MSG_WARN() call near the end.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
---
 m4/spice-deps.m4 | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

If it is accepted I also plan to use it for the updated Spice GStreamer 
patches.

Patch hide | download patch | download mbox

diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 59744d2..1c753bf 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -1,3 +1,18 @@ 
+# SPICE_WARNING(warning)
+# SPICE_PRINT_MESSAGES
+# ----------------------
+# Collect warnings and print them at the end so they are clearly visible.
+# ---------------------
+AC_DEFUN([SPICE_WARNING],[AS_VAR_APPEND([spice_warnings],["|$1"])])
+AC_DEFUN([SPICE_PRINT_MESSAGES],[ac_save_IFS="$IFS"
+IFS="|"
+for msg in $spice_warnings; do
+    IFS="$ac_save_IFS"
+    AS_VAR_IF([msg],[],,[echo >&2
+        AC_MSG_WARN([$msg])])
+done
+IFS="$ac_save_IFS"])# SPICE_WARNING
+
 # SPICE_CHECK_SYSDEPS()
 # ---------------------
 # Checks for header files and library functions needed by spice-common.

Comments

Hey,

This looks good, but I was wondering whether this is being copied/pasted
from some other configure.ac/m4 file, or if this is the initial
implementation?
We'll need to readd the AS_VAR_APPEND fallback which was removed in
f7ec855af3d , otherwise looks fine

Christophe

On Fri, Oct 30, 2015 at 11:46:59AM +0100, Francois Gouget wrote:
> A call to SPICE_WARNING() anywhere in the configure file results in the
> warning being printed at the end of the configure run where it will be
> be visible. This makes it possible to keep the SPICE_WARNING() calls
> together with the related feature checks instead of having to put a
> separate AC_MSG_WARN() call near the end.
> 
> Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
> ---
>  m4/spice-deps.m4 | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> If it is accepted I also plan to use it for the updated Spice GStreamer 
> patches.
> 
> diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
> index 59744d2..1c753bf 100644
> --- a/m4/spice-deps.m4
> +++ b/m4/spice-deps.m4
> @@ -1,3 +1,18 @@
> +# SPICE_WARNING(warning)
> +# SPICE_PRINT_MESSAGES
> +# ----------------------
> +# Collect warnings and print them at the end so they are clearly visible.
> +# ---------------------
> +AC_DEFUN([SPICE_WARNING],[AS_VAR_APPEND([spice_warnings],["|$1"])])
> +AC_DEFUN([SPICE_PRINT_MESSAGES],[ac_save_IFS="$IFS"
> +IFS="|"
> +for msg in $spice_warnings; do
> +    IFS="$ac_save_IFS"
> +    AS_VAR_IF([msg],[],,[echo >&2
> +        AC_MSG_WARN([$msg])])
> +done
> +IFS="$ac_save_IFS"])# SPICE_WARNING
> +
>  # SPICE_CHECK_SYSDEPS()
>  # ---------------------
>  # Checks for header files and library functions needed by spice-common.
> -- 
> 2.6.1
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
On Fri, Oct 30, 2015 at 04:45:20PM +0100, Christophe Fergeau wrote:
> Hey,
> 
> This looks good, but I was wondering whether this is being copied/pasted
> from some other configure.ac/m4 file, or if this is the initial
> implementation?
> We'll need to readd the AS_VAR_APPEND fallback which was removed in
> f7ec855af3d , otherwise looks fine

Ah, and maybe an empty line after all the warnings would look a bit
nicer.

Christophe
On Fri, 30 Oct 2015, Christophe Fergeau wrote:

> Hey,
> 
> This looks good, but I was wondering whether this is being copied/pasted
> from some other configure.ac/m4 file, or if this is the initial
> implementation?

It comes from Wine which is also LGPL:
https://source.winehq.org/git/wine.git/blob/HEAD:/COPYING.LIB
https://source.winehq.org/git/wine.git/blob/HEAD:/aclocal.m4


> We'll need to readd the AS_VAR_APPEND fallback which was removed in
> f7ec855af3d , otherwise looks fine

Ok. I'll resubmit.
On Mon, Nov 02, 2015 at 08:55:50PM +0100, Francois Gouget wrote:
> On Fri, 30 Oct 2015, Christophe Fergeau wrote:
> 
> > Hey,
> > 
> > This looks good, but I was wondering whether this is being copied/pasted
> > from some other configure.ac/m4 file, or if this is the initial
> > implementation?
> 
> It comes from Wine which is also LGPL:
> https://source.winehq.org/git/wine.git/blob/HEAD:/COPYING.LIB
> https://source.winehq.org/git/wine.git/blob/HEAD:/aclocal.m4
> 
> 
> > We'll need to readd the AS_VAR_APPEND fallback which was removed in
> > f7ec855af3d , otherwise looks fine
> 
> Ok. I'll resubmit.

I can easily add this myself before pushing.

Christophe
On Tue, 3 Nov 2015, Christophe Fergeau wrote:
[...]
> > > We'll need to readd the AS_VAR_APPEND fallback which was removed in
> > > f7ec855af3d , otherwise looks fine
> > 
> > Ok. I'll resubmit.
> 
> I can easily add this myself before pushing.

Well, I resubmitted a few hours ago with the trailing empty line 
and some formatting tweaks:
http://lists.freedesktop.org/archives/spice-devel/2015-November/023048.html