From c84f9942d7d57463c4790c8e0aad67c096c71415 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Wed, 4 Nov 2020 13:09:01 +0000 Subject: Better error reporting if zlib or libpng are not static MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tell the specific library which is not static. Previously any would be reported as libpng. This fixes https://gitlab.freedesktop.org/spice/win32/vd_agent/-/issues/17 Signed-off-by: Frediano Ziglio Acked-by: Jakub Janků --- configure.ac | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 312b88a..b55389d 100644 --- a/configure.ac +++ b/configure.ac @@ -103,8 +103,27 @@ dnl --------------------------------------------------------------------------- dnl - Check library dependencies dnl --------------------------------------------------------------------------- -PKG_CHECK_MODULES_STATIC(LIBPNG, [libpng]) +ACX_SET_VAR(CFLAGS, "$CFLAGS -Wall", + ACX_SET_VAR(LDFLAGS, "$LDFLAGS -static", + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ + printf("hello"); + return 0 + ]])], [], AC_MSG_ERROR([some base static library (possibly pthread) not found])) + ) +) + PKG_CHECK_MODULES_STATIC(ZLIB, [zlib]) +ACX_SET_VAR(CFLAGS, "$CFLAGS $ZLIB_CFLAGS -Wall", + ACX_SET_VAR(LDFLAGS, "$LDFLAGS -static", + ACX_SET_VAR(LIBS, "$LIBS $ZLIB_LIBS", + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ + return !!zlibVersion() + ]])], [], AC_MSG_ERROR([static zlib not found])) + ) + ) +) + +PKG_CHECK_MODULES_STATIC(LIBPNG, [libpng]) ACX_SET_VAR(CFLAGS, "$CFLAGS $LIBPNG_CFLAGS -Wall", ACX_SET_VAR(LDFLAGS, "$LDFLAGS -static", ACX_SET_VAR(LIBS, "$LIBS $LIBPNG_LIBS", -- cgit v1.2.3