1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 20:10:29 +01:00

Configure: Rewrite detection for Xft2 to properly use PKG_CONFIG macro

The goal is to use standard macros, which make code easier to maintain
(smaller, more consistent). We still keep the legacy "xfg-config" method
because we don't want to drop support for old hardware/software.

A side effect is the change in the name of the variables for the makefile,
but this goes in favour of consistency.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2021-05-22 16:39:07 +02:00
committed by Carlos R. Mafra
parent 0e274dc979
commit 0bbb122b94
6 changed files with 26 additions and 54 deletions

View File

@@ -8,7 +8,7 @@ noinst_PROGRAMS = fontl puzzle colorpick
LDADD= $(top_builddir)/WINGs/libWINGs.la $(top_builddir)/wrlib/libwraster.la \
$(top_builddir)/WINGs/libWUtil.la \
@XFTLIBS@ @INTLIBS@ @XLIBS@
@XFT_LIBS@ @INTLIBS@ @XLIBS@
colorpick_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.la

View File

@@ -25,6 +25,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
LDADD= $(top_builddir)/WINGs/libWINGs.la $(top_builddir)/wrlib/libwraster.la \
$(top_builddir)/WINGs/libWUtil.la \
@XFTLIBS@ @INTLIBS@
@XFT_LIBS@ @INTLIBS@
test_LDADD = wtableview.o wtabledelegates.o $(LDADD)

View File

@@ -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@ @XFTLIBS@ @FCLIBS@ @LIBM@ @PANGOLIBS@
libWINGs_la_LIBADD = libWUtil.la $(top_builddir)/wrlib/libwraster.la @XLIBS@ @XFT_LIBS@ @FCLIBS@ @LIBM@ @PANGOLIBS@
libWUtil_la_LIBADD = @LIBBSD@
EXTRA_DIST = BUGS make-rgb Examples Extras Tests
@@ -92,7 +92,7 @@ AM_CFLAGS =
AM_CPPFLAGS = -DRESOURCE_PATH=\"$(datadir)/WINGs\" \
-I$(top_srcdir)/WINGs/WINGs -I$(top_builddir)/WINGs/WINGs \
-I$(top_builddir)/wrlib -I$(top_srcdir)/src \
@XFTFLAGS@ @HEADER_SEARCH_PATH@
@XFT_CFLAGS@ @HEADER_SEARCH_PATH@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = WINGs.pc WUtil.pc
@@ -106,7 +106,7 @@ WINGs.pc: Makefile
@echo 'Version: $(VERSION)' >> $@
@echo 'Requires: wrlib WUtil' >> $@
@echo 'Libs: $(lib_search_path) -lWINGs' >> $@
@echo 'Libs.private: $(XFTLIBS) $(PANGOLIBS) $(XLIBS) -lm $(INTLIBS)' >> $@
@echo 'Libs.private: $(XFT_LIBS) $(PANGOLIBS) $(XLIBS) -lm $(INTLIBS)' >> $@
@echo 'Cflags: $(inc_search_path)' >> $@
WUtil.pc: Makefile

View File

@@ -6,7 +6,7 @@ noinst_PROGRAMS = wtest wmquery wmfile testmywidget
LDADD= $(top_builddir)/WINGs/libWINGs.la $(top_builddir)/wrlib/libwraster.la \
$(top_builddir)/WINGs/libWUtil.la \
@XFTLIBS@ @INTLIBS@ @XLIBS@
@XFT_LIBS@ @INTLIBS@ @XLIBS@
testmywidget_SOURCES = testmywidget.c mywidget.c mywidget.h
@@ -17,4 +17,4 @@ wtest_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.la
EXTRA_DIST = logo.xpm upbtn.xpm wm.html wm.png
AM_CPPFLAGS = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFTFLAGS@ @HEADER_SEARCH_PATH@
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFT_CFLAGS@ @HEADER_SEARCH_PATH@

View File

@@ -615,51 +615,24 @@ AC_SUBST(FCLIBS)
dnl Xft2 antialiased font support
dnl =============================
m4_define([XFT_MIN_VERSION], [2.1.0])
PKG_CHECK_MODULES([XFT], [xft >= ]XFT_MIN_VERSION,
[], dnl Module found, nothing to do
[XFT_CFLAGS=failed])
AS_IF([test "x$XFT_CFLAGS" = "xfailed"],
[dnl pkg-config did not find it, try the legacy method
AC_CHECK_PROG([XFTCONFIG], [xft-config], [xft-config])
AS_IF([test -z "$XFTCONFIG"],
[AC_MSG_ERROR([libXft2 is not installed, is too old or could not be found -- $XFT_PKG_ERRORS]) ])
XFT_LIBS=`$XFTCONFIG --libs`
XFT_CFLAGS=`$XFTCONFIG --cflags`
WM_CHECK_XFT_VERSION(XFT_MIN_VERSION,
[], dnl Version is ok, nothing to do
[AC_MSG_ERROR([Version of libXft is too old, consider upgrading to] XFT_MIN_VERSION [or newer]) ])
])
AC_SUBST(XFT_CFLAGS)
AC_SUBST(XFT_LIBS)
xft=yes
XFTLIBS=""
if test "x$PKG_CONFIG" != x -a "`$PKG_CONFIG xft; echo $?`" = 0; then
XFTCONFIG="$PKG_CONFIG xft"
pkgconfig_xft=yes
else
AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
fi
AC_MSG_CHECKING([for the Xft2 library])
if test "x$XFTCONFIG" != x; then
XFTLIBS=`$XFTCONFIG --libs`
XFTFLAGS=`$XFTCONFIG --cflags`
AC_MSG_RESULT([found])
else
AC_MSG_RESULT([not found])
echo
echo "ERROR!!! libXft2 is not installed or could not be found."
echo " Xft2 is a requirement for building Window Maker."
echo " Please install it (along with fontconfig) before continuing."
echo
exit 1
fi
minXFT="2.1.0"
goodxft="no"
dnl
dnl The macro below will use $XFTFLAGS (defined above) to find Xft.h
dnl
WM_CHECK_XFT_VERSION($minXFT, goodxft=yes, goodxft=no)
if test "$goodxft" = no; then
echo
echo "ERROR!!! libXft on this system is an old version."
echo " Please consider upgrading to at least version ${minXFT}."
echo
exit 1
fi
AC_SUBST(XFTFLAGS)
AC_SUBST(XFTLIBS)
dnl PANGO support
dnl =============
@@ -952,7 +925,6 @@ echo "Supported core features: :$supported_core"
echo "Supported X extensions: :$supported_xext"
echo "Supported graphic format libraries :$supported_gfx"
echo "Unsupported features :$unsupported"
echo "Antialiased text support in WINGs : $xft"
echo "Pango text layout support in WINGs : $pango"
echo "Translated languages to support :$supported_locales"
AS_IF([test "x$debug" = "xyes"],

View File

@@ -26,13 +26,13 @@ m4_pattern_allow([^WM_OSDEP(_[A-Z]*)?$])
# WM_CHECK_XFT_VERSION(MIN_VERSION, [ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])
#
# $XFTFLAGS should be defined before calling this macro,
# $XFT_CFLAGS should be defined before calling this macro,
# else it will not be able to find Xft.h
#
AC_DEFUN([WM_CHECK_XFT_VERSION],
[
CPPFLAGS_old="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $XFTFLAGS $inc_search_path"
CPPFLAGS="$CPPFLAGS $XFT_CFLAGS $inc_search_path"
xft_major_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
xft_minor_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
xft_micro_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`