[gimp/wip/smcv/libwmf-pkg-config: 3/3] build: Prefer to find libwmf using pkg-config
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/smcv/libwmf-pkg-config: 3/3] build: Prefer to find libwmf using pkg-config
- Date: Wed, 26 Aug 2020 23:32:32 +0000 (UTC)
commit 00024db3824f4443ef5778de68672ab911e42835
Author: Simon McVittie <smcv debian org>
Date: Thu Aug 27 00:19:44 2020 +0100
build: Prefer to find libwmf using pkg-config
Traditional -config scripts are awkward for cross-compilation, multilib
systems (lib/lib64), and multiarch systems like Debian; only one copy
of the -config script can be in the PATH. As a result, some OS
distributions are starting to deprecate or even remove them.
pkg-config is designed to be a replacement for traditional -config
scripts, and is cross-compilation-friendly: the PKG_CHECK_MODULES macro
looks for an architecture-specific executable like
x86_64-linux-gnu-pkg-config, which can look in an architecture-specific
search path for library metadata, before falling back to a generic
pkg-config executable.
As a bonus, pkg-config also compares version numbers correctly
(see #2454).
libwmf having pkg-config metadata seems to be a relatively new thing,
so I've kept the -config script code path too, using it if pkg-config
does not find libwmf.
Bug-Debian: https://bugs.debian.org/956183
Signed-off-by: Simon McVittie <smcv debian org>
configure.ac | 41 ++++++++++++++++++++---------------------
1 file changed, 20 insertions(+), 21 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 342743a32e..85637f172b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2008,29 +2008,28 @@ AC_SUBST(FILE_PDF_SAVE)
AC_ARG_WITH(wmf, [ --without-wmf build without WMF support])
have_libwmf=no
-if test "x$with_wmf" != xno; then
- AC_PATH_PROG(WMF_CONFIG, libwmf-config, no)
- if test "x$WMF_CONFIG" != "xno" ; then
- have_libwmf=yes
- AC_MSG_CHECKING(for libwmf >= wmf_required_version)
- wmf_version=`$WMF_CONFIG --version`
- if expr $wmf_version \>= wmf_required_version >/dev/null; then
- AC_MSG_RESULT([yes (version $wmf_version)])
- FILE_WMF='file-wmf$(EXEEXT)'
- WMF_LIBS=`$WMF_CONFIG --libs`
- WMF_CFLAGS=`$WMF_CONFIG --cflags`
- else
- have_libwmf=yes
- PKG_CHECK_MODULES(WMF, libwmf >= wmf_required_version,
- FILE_WMF='file-wmf$(EXEEXT)',
- have_libwmf="no (libwmf not found)")
- fi
- else
- have_libwmf="no (libwmf not found)"
- fi
-fi
+AS_IF([test "x$with_wmf" != xno], [
+ PKG_CHECK_MODULES([WMF], libwmf >= wmf_required_version,
+ [have_libwmf=yes], [have_libwmf="no (libwmf not found)"])
+
+ AS_IF([test "x$have_libwmf" != xyes], [
+ # No pkg-config; try falling back to the traditional -config script
+ AC_PATH_PROG([WMF_CONFIG], [libwmf-config], [no])
+ AS_IF([test "x$WMF_CONFIG" != xno], [
+ AC_MSG_CHECKING(for libwmf >= wmf_required_version using $WMF_CONFIG)
+ wmf_version=`$WMF_CONFIG --version`
+ AS_IF(expr $wmf_version \>= wmf_required_version >/dev/null, [
+ AC_MSG_RESULT([yes (version $wmf_version)])
+ have_libwmf=yes
+ WMF_LIBS=`$WMF_CONFIG --libs`
+ WMF_CFLAGS=`$WMF_CONFIG --cflags`
+ ])
+ ])
+ ])
+])
if test "x$have_libwmf" = xyes; then
+ FILE_WMF='file-wmf$(EXEEXT)'
MIME_TYPES="$MIME_TYPES;image/x-wmf"
fi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]