Test for FontConfig availability in configure when using wxGTK

This library is now needed in order to implement wxFont private font
methods.
This commit is contained in:
Vadim Zeitlin 2017-11-07 18:23:11 +01:00
parent 28864d3ef6
commit ac4f99fa0d
6 changed files with 109 additions and 6 deletions

85
configure vendored
View File

@ -978,6 +978,8 @@ X_CFLAGS
XMKMF
DIRECTFB_LIBS
DIRECTFB_CFLAGS
FONTCONFIG_LIBS
FONTCONFIG_CFLAGS
GTK_CONFIG
GTK_LIBS
GTK_CFLAGS
@ -1366,6 +1368,8 @@ CXX
CXXFLAGS
CCC
PKG_CONFIG
FONTCONFIG_CFLAGS
FONTCONFIG_LIBS
DIRECTFB_CFLAGS
DIRECTFB_LIBS
XMKMF
@ -2348,6 +2352,10 @@ Some influential environment variables:
CXX C++ compiler command
CXXFLAGS C++ compiler flags
PKG_CONFIG path to pkg-config utility
FONTCONFIG_CFLAGS
C compiler flags for FONTCONFIG, overriding pkg-config
FONTCONFIG_LIBS
linker flags for FONTCONFIG, overriding pkg-config
DIRECTFB_CFLAGS
C compiler flags for DIRECTFB, overriding pkg-config
DIRECTFB_LIBS
@ -22471,6 +22479,83 @@ $as_echo "not found" >&6; }
fi
fi
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FONTCONFIG" >&5
$as_echo_n "checking for FONTCONFIG... " >&6; }
if test -n "$PKG_CONFIG"; then
if test -n "$FONTCONFIG_CFLAGS"; then
pkg_cv_FONTCONFIG_CFLAGS="$FONTCONFIG_CFLAGS"
else
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig\""; } >&5
($PKG_CONFIG --exists --print-errors "fontconfig") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_FONTCONFIG_CFLAGS=`$PKG_CONFIG --cflags "fontconfig" 2>/dev/null`
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
fi
if test -n "$PKG_CONFIG"; then
if test -n "$FONTCONFIG_LIBS"; then
pkg_cv_FONTCONFIG_LIBS="$FONTCONFIG_LIBS"
else
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig\""; } >&5
($PKG_CONFIG --exists --print-errors "fontconfig") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_FONTCONFIG_LIBS=`$PKG_CONFIG --libs "fontconfig" 2>/dev/null`
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
FONTCONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "fontconfig"`
else
FONTCONFIG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fontconfig"`
fi
# Put the nasty error message in config.log where it belongs
echo "$FONTCONFIG_PKG_ERRORS" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: fontconfig library not found, run-time font loading won't be supported by wxFont" >&5
$as_echo "$as_me: WARNING: fontconfig library not found, run-time font loading won't be supported by wxFont" >&2;}
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: fontconfig library not found, run-time font loading won't be supported by wxFont" >&5
$as_echo "$as_me: WARNING: fontconfig library not found, run-time font loading won't be supported by wxFont" >&2;}
else
FONTCONFIG_CFLAGS=$pkg_cv_FONTCONFIG_CFLAGS
FONTCONFIG_LIBS=$pkg_cv_FONTCONFIG_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define wxUSE_FONTCONFIG 1" >>confdefs.h
CXXFLAGS="$FONTCONFIG_CFLAGS $CXXFLAGS"
GUI_TK_LIBRARY="$GUI_TK_LIBRARY $FONTCONFIG_LIBS"
fi
fi
if test "$wxUSE_DFB" = 1; then

View File

@ -2962,6 +2962,14 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
dnl AC_MSG_RESULT(not found)
dnl fi
fi
PKG_CHECK_MODULES(FONTCONFIG, [fontconfig],
[
AC_DEFINE(wxUSE_FONTCONFIG)
CXXFLAGS="$FONTCONFIG_CFLAGS $CXXFLAGS"
GUI_TK_LIBRARY="$GUI_TK_LIBRARY $FONTCONFIG_LIBS"
],
[AC_MSG_WARN([fontconfig library not found, run-time font loading won't be supported by wxFont])])
fi
if test "$wxUSE_DFB" = 1; then

View File

@ -118,7 +118,7 @@ private:
wxDECLARE_DYNAMIC_CLASS(wxFont);
};
#ifndef __WXMSW__
#if wxUSE_FONTCONFIG
#define wxHAS_PRIVATE_FONTS 1
#endif

View File

@ -833,6 +833,10 @@
*/
#define wxUSE_PLUGINS 0
/*
* Use FontConfig library for private fonts support in wxFont.
*/
#define wxUSE_FONTCONFIG 0
/*
* Use GTK print for printing under GTK+ 2.10+
*/

View File

@ -902,6 +902,14 @@ typedef pid_t GPid;
* Use SDL for audio (Unix)
*/
#define wxUSE_LIBSDL 0
/*
* Use FontConfig library for private fonts support in wxFont.
*/
#ifdef VMS_GTK2
#define wxUSE_FONTCONFIG 1
#else
#define wxUSE_FONTCONFIG 0
#endif
/*
* Use GTK print for printing under GTK+ 2.10+
*/

View File

@ -20,6 +20,7 @@
#include "wx/font.h"
#ifndef WX_PRECOMP
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/utils.h"
#include "wx/settings.h"
@ -31,11 +32,6 @@
#include "wx/gtk/private.h"
#ifdef GDK_WINDOWING_X11
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>
#endif
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
@ -564,6 +560,8 @@ bool wxFont::GTKSetPangoAttrs(PangoLayout* layout) const
#ifdef wxHAS_PRIVATE_FONTS
#include <fontconfig/fontconfig.h>
namespace
{
FcConfig* gs_fcConfig = NULL;