[Spice-commits] configure.ac m4/pushvars.m4
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Mar 6 18:30:01 UTC 2019
configure.ac | 13 +++++++++++--
m4/pushvars.m4 | 15 +++++++++++++++
2 files changed, 26 insertions(+), 2 deletions(-)
New commits:
commit 0858cfd2113fc59f2c0ed3bf3f34051ac1883231
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Thu Jul 19 14:42:07 2018 +0100
build: Check we can link libpng statically
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 at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/configure.ac b/configure.ac
index fbcb8da..8f25879 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,8 +103,17 @@ 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]))
+ )
+ )
+)
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)])
More information about the Spice-commits
mailing list