On Wed, Feb 27, 2019 at 10:52:05AM +0000, Frediano Ziglio wrote: > Catch the problem during configure instead of having to wait the > build to fail. > On Fedora try for instance to remove mingw64-zlib-static package, > the missing dependency won't be detected during configure. > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > configure.ac | 10 ++++++++-- > m4/pushvars.m4 | 15 +++++++++++++++ > 2 files changed, 23 insertions(+), 2 deletions(-) > create mode 100644 m4/pushvars.m4 > > diff --git a/configure.ac b/configure.ac > index fbcb8da..e5d4b2c 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -103,8 +103,14 @@ dnl --------------------------------------------------------------------------- > dnl - Check library dependencies > dnl --------------------------------------------------------------------------- > > -PKG_CHECK_MODULES(LIBPNG, [libpng]) > -PKG_CHECK_MODULES(ZLIB, [zlib]) > +PKG_CHECK_MODULES_STATIC(LIBPNG, [libpng]) > +PKG_CHECK_MODULES_STATIC(ZLIB, [zlib]) > +ACX_SET_VAR(CFLAGS, "$CFLAGS $LIBPNG_CFLAGS -Wall", > +ACX_SET_VAR(LDFLAGS, "$LDFLAGS -static", > +ACX_SET_VAR(LIBS, "$LIBS $LIBPNG_LIBS", > +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <png.h>]], [[ > + return !!png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL) > + ]])], [], AC_MSG_ERROR([static libpng not found]))))) Maybe add some indenting to make it explicit that the ACX_SET_VAR calls are not setting the variables forever, but only for the lifetime of the AC_LINK_IFELSE, I had written a mail saying most of it is not needed before looking closer at ACX_SET_VAR ;) Apart from this, Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> Christophe > > dnl --------------------------------------------------------------------------- > dnl - Makefiles, etc. > diff --git a/m4/pushvars.m4 b/m4/pushvars.m4 > new file mode 100644 > index 0000000..86a27fc > --- /dev/null > +++ b/m4/pushvars.m4 > @@ -0,0 +1,15 @@ > +AC_DEFUN([ACX_PUSH_VAR], > +[m4_pushdef([SAVE$1],save_$1[_]__line__)dnl > +SAVE$1="$$1" > +$1=[$2]]) > + > +AC_DEFUN([ACX_POP_VAR], > +[$1="$SAVE$1" > +unset SAVE$1 dnl > +m4_popdef([SAVE$1])dnl > +]) > + > +AC_DEFUN([ACX_SET_VAR], > +[ACX_PUSH_VAR($1, [$2]) > +[$3] > +ACX_POP_VAR($1)]) > -- > 2.20.1 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/spice-devel
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel