From f049635fa5e779b9ef1905695b815809c3708908 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sat, 29 May 2021 18:59:24 +0200 Subject: [PATCH] Configure: Rewrite the detection for Pango library Make use of the standard macro for PKG_CONFIG; the default behaviour is now to use Pango if present, instead of requiring explicit user request, yet still not making it mandatory. The detection code was moved to a macro to keep the configure.ac script (relatively) small, and consistent with what is done for most other libs. Signed-off-by: Christophe CURIS --- WINGs/Makefile.am | 4 ++-- configure.ac | 25 ++++++++----------------- doc/build/Compilation.texi | 6 +++--- m4/windowmaker.m4 | 21 +++++++++++++++++++++ 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/WINGs/Makefile.am b/WINGs/Makefile.am index 549a3b07..74362910 100644 --- a/WINGs/Makefile.am +++ b/WINGs/Makefile.am @@ -12,7 +12,7 @@ lib_LTLIBRARIES = libWUtil.la libWINGs.la LDADD= libWUtil.la libWINGs.la $(top_builddir)/wrlib/libwraster.la @INTLIBS@ -libWINGs_la_LIBADD = libWUtil.la $(top_builddir)/wrlib/libwraster.la @XLIBS@ @XFT_LIBS@ @FCLIBS@ @LIBM@ @PANGOLIBS@ +libWINGs_la_LIBADD = libWUtil.la $(top_builddir)/wrlib/libwraster.la @XLIBS@ @XFT_LIBS@ @FCLIBS@ @LIBM@ @PANGO_LIBS@ libWUtil_la_LIBADD = @LIBBSD@ EXTRA_DIST = BUGS make-rgb Examples Extras Tests @@ -87,7 +87,7 @@ libWUtil_la_SOURCES = \ wutil.c -AM_CFLAGS = +AM_CFLAGS = @PANGO_CFLAGS@ AM_CPPFLAGS = -DRESOURCE_PATH=\"$(datadir)/WINGs\" \ -I$(top_srcdir)/WINGs/WINGs -I$(top_builddir)/WINGs/WINGs \ diff --git a/configure.ac b/configure.ac index e02a307a..2d06a27c 100644 --- a/configure.ac +++ b/configure.ac @@ -636,24 +636,15 @@ AC_SUBST(XFT_LIBS) dnl PANGO support dnl ============= -pango=no -AC_ARG_ENABLE(pango, AS_HELP_STRING([--enable-pango], [enable Pango text layout support]), - pango=$enableval, pango=no) +dnl The libray can be used by WINGs to get better support on UTF-8 for i18n +AC_ARG_ENABLE([pango], + [AS_HELP_STRING([--disable-pango], [disable Pango text layout support @<:@default=auto@:>@])], + [AS_CASE([$enableval], + [yes|no], [], + [AC_MSG_ERROR([bad value $enableval for --disable-pango])] )], + [enable_pango=auto]) +WM_CHECK_LIBPANGO -PANGOFLAGS= -PANGOLIBS= -if test "$pango" = yes; then - PANGOLIBS=`$PKG_CONFIG pangoxft --libs` - PANGOFLAGS=`$PKG_CONFIG pangoxft --cflags` - if test "x$PANGOLIBS" = "x" ; then - AC_MSG_RESULT([not found]) - else - AC_DEFINE(USE_PANGO, 1, [Define if Pango is to be used]) - AC_MSG_RESULT([found]) - fi -fi -inc_search_path="$inc_search_path $PANGOFLAGS" -AC_SUBST(PANGOLIBS) dnl ============================================== dnl Graphic Format Libraries diff --git a/doc/build/Compilation.texi b/doc/build/Compilation.texi index 10bf1219..dd5ff12c 100644 --- a/doc/build/Compilation.texi +++ b/doc/build/Compilation.texi @@ -224,7 +224,7 @@ Get the @emph{GNU} version from @uref{http://www.gnu.org/software/gettext/} This library can be used by the @emph{WINGs} toolkit to improve support for @emph{UTF-8} and for languages written in right-to-left direction, in some widgets. -You have to explicitly ask for its support through (@pxref{Configure Options}). +If detected, it will be automatically used; you may request explicit support/ignore through (@pxref{Configure Options}). You can get it from @uref{http://www.pango.org/Download} @item @emph{libbsd} @@ -484,8 +484,8 @@ even if your system provides it. @item --disable-magick Disable @emph{ImageMagick's MagickWand} support in @emph{WRaster}, used to support for image formats. -@item --enable-pango -Disabled by default, enable @emph{Pango} text layout support in @emph{WINGs}. +@item --disable-pango +Disable @emph{Pango} text layout support in @emph{WINGs}. @item --disable-png Disable PNG support in @emph{WRaster}; when enabled use @file{libpng}. diff --git a/m4/windowmaker.m4 b/m4/windowmaker.m4 index 685bf382..de2c79f1 100644 --- a/m4/windowmaker.m4 +++ b/m4/windowmaker.m4 @@ -50,6 +50,27 @@ AC_DEFUN([WM_CHECK_XFT_VERSION], ]) +# WM_CHECK_LIBPANGO +# ----------------- +# +# If the support was not disabled by user, check for the pango library using +# pkg-config, and if found place the appropriate stuff in the variables +# PANGO_CFLAGS (for compiler) and PANGO_LIBS (for linker) +AC_DEFUN([WM_CHECK_LIBPANGO], +[AS_IF([test "x$enable_pango" != "xno"], + [PKG_CHECK_MODULES([PANGO], [pangoxft], + [AC_DEFINE([USE_PANGO], [1], [defined when the pango library is used in WINGs]) + pango="yes"], + [pango="no"]) + AS_IF([test "x$enable_pango$pango" == "xyesno"], + [AC_MSG_ERROR([Pango library was not found - $PANGO_PKG_ERRORS])]) + ], + [pango="no"]) + AC_SUBST([PANGO_CFLAGS])dnl + AC_SUBST([PANGO_LIBS])dnl +]) + + # _WM_LIB_CHECK_FUNCTS # -------------------- # (internal shell functions)