From 472bb3d6d22e05b338f9e37a0615239ada09cc0b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 25 Nov 2017 00:07:01 +0100 Subject: [PATCH] Fix wxUSE_PRIVATE_FONTS definition in configure Only define it unconditionally for wxMSW and wxOSX, not wxGTK where we need to test that the required versions of FontConfig and Pango Fc are available. Also do all wxUSE_PRIVATE_FONTS-related checks in the same place, to make things more clear and avoid similar blunders in the future. --- configure | 178 ++++++++++++++++++++++++++------------------------- configure.in | 26 ++++---- 2 files changed, 105 insertions(+), 99 deletions(-) diff --git a/configure b/configure index b3b64b1826..9468d8bed0 100755 --- a/configure +++ b/configure @@ -936,6 +936,8 @@ WEBKIT_LIBS WEBKIT_CFLAGS COND_PYTHON PYTHON +PRIVATE_FONTS_LIBS +PRIVATE_FONTS_CFLAGS XTST_LIBS XTST_CFLAGS LIBNOTIFY_LIBS @@ -978,8 +980,6 @@ X_CFLAGS XMKMF DIRECTFB_LIBS DIRECTFB_CFLAGS -PRIVATE_FONTS_LIBS -PRIVATE_FONTS_CFLAGS GTK_CONFIG GTK_LIBS GTK_CFLAGS @@ -1369,8 +1369,6 @@ CXX CXXFLAGS CCC PKG_CONFIG -PRIVATE_FONTS_CFLAGS -PRIVATE_FONTS_LIBS DIRECTFB_CFLAGS DIRECTFB_LIBS XMKMF @@ -1404,6 +1402,8 @@ LIBNOTIFY_CFLAGS LIBNOTIFY_LIBS XTST_CFLAGS XTST_LIBS +PRIVATE_FONTS_CFLAGS +PRIVATE_FONTS_LIBS WEBKIT_CFLAGS WEBKIT_LIBS CAIRO_CFLAGS @@ -2354,10 +2354,6 @@ Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags PKG_CONFIG path to pkg-config utility - PRIVATE_FONTS_CFLAGS - C compiler flags for PRIVATE_FONTS, overriding pkg-config - PRIVATE_FONTS_LIBS - linker flags for PRIVATE_FONTS, overriding pkg-config DIRECTFB_CFLAGS C compiler flags for DIRECTFB, overriding pkg-config DIRECTFB_LIBS @@ -2410,6 +2406,10 @@ Some influential environment variables: linker flags for LIBNOTIFY, overriding pkg-config XTST_CFLAGS C compiler flags for XTST, overriding pkg-config XTST_LIBS linker flags for XTST, overriding pkg-config + PRIVATE_FONTS_CFLAGS + C compiler flags for PRIVATE_FONTS, overriding pkg-config + PRIVATE_FONTS_LIBS + linker flags for PRIVATE_FONTS, overriding pkg-config WEBKIT_CFLAGS C compiler flags for WEBKIT, overriding pkg-config WEBKIT_LIBS linker flags for WEBKIT, overriding pkg-config @@ -22510,85 +22510,6 @@ $as_echo "not found" >&6; } fi fi - - if test "$wxUSE_PRIVATE_FONTS" = "yes"; then - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PRIVATE_FONTS" >&5 -$as_echo_n "checking for PRIVATE_FONTS... " >&6; } - -if test -n "$PKG_CONFIG"; then - if test -n "$PRIVATE_FONTS_CFLAGS"; then - pkg_cv_PRIVATE_FONTS_CFLAGS="$PRIVATE_FONTS_CFLAGS" - else - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig >= 2.8.0 pangoft2 >= 1.38.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "fontconfig >= 2.8.0 pangoft2 >= 1.38.0") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_PRIVATE_FONTS_CFLAGS=`$PKG_CONFIG --cflags "fontconfig >= 2.8.0 pangoft2 >= 1.38.0" 2>/dev/null` -else - pkg_failed=yes -fi - fi -else - pkg_failed=untried -fi -if test -n "$PKG_CONFIG"; then - if test -n "$PRIVATE_FONTS_LIBS"; then - pkg_cv_PRIVATE_FONTS_LIBS="$PRIVATE_FONTS_LIBS" - else - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig >= 2.8.0 pangoft2 >= 1.38.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "fontconfig >= 2.8.0 pangoft2 >= 1.38.0") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_PRIVATE_FONTS_LIBS=`$PKG_CONFIG --libs "fontconfig >= 2.8.0 pangoft2 >= 1.38.0" 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 - PRIVATE_FONTS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "fontconfig >= 2.8.0 pangoft2 >= 1.38.0"` - else - PRIVATE_FONTS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fontconfig >= 2.8.0 pangoft2 >= 1.38.0"` - fi - # Put the nasty error message in config.log where it belongs - echo "$PRIVATE_FONTS_PKG_ERRORS" >&5 - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: run-time font loading won't be supported by wxFont" >&5 -$as_echo "$as_me: WARNING: 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: run-time font loading won't be supported by wxFont" >&5 -$as_echo "$as_me: WARNING: run-time font loading won't be supported by wxFont" >&2;} -else - PRIVATE_FONTS_CFLAGS=$pkg_cv_PRIVATE_FONTS_CFLAGS - PRIVATE_FONTS_LIBS=$pkg_cv_PRIVATE_FONTS_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - - $as_echo "#define wxUSE_PRIVATE_FONTS 1" >>confdefs.h - - CXXFLAGS="$PRIVATE_FONTS_CFLAGS $CXXFLAGS" - GUI_TK_LIBRARY="$GUI_TK_LIBRARY $PRIVATE_FONTS_LIBS" - -fi - fi fi if test "$wxUSE_DFB" = 1; then @@ -34405,9 +34326,90 @@ if test "$wxUSE_PREFERENCES_EDITOR" = "yes"; then fi if test "$wxUSE_PRIVATE_FONTS" = "yes"; then - $as_echo "#define wxUSE_PRIVATE_FONTS 1" >>confdefs.h + if test "$wxUSE_GTK" = 1; then + if test "$wxUSE_PRIVATE_FONTS" = "yes"; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PRIVATE_FONTS" >&5 +$as_echo_n "checking for PRIVATE_FONTS... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$PRIVATE_FONTS_CFLAGS"; then + pkg_cv_PRIVATE_FONTS_CFLAGS="$PRIVATE_FONTS_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig >= 2.8.0 pangoft2 >= 1.38.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "fontconfig >= 2.8.0 pangoft2 >= 1.38.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PRIVATE_FONTS_CFLAGS=`$PKG_CONFIG --cflags "fontconfig >= 2.8.0 pangoft2 >= 1.38.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$PRIVATE_FONTS_LIBS"; then + pkg_cv_PRIVATE_FONTS_LIBS="$PRIVATE_FONTS_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig >= 2.8.0 pangoft2 >= 1.38.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "fontconfig >= 2.8.0 pangoft2 >= 1.38.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PRIVATE_FONTS_LIBS=`$PKG_CONFIG --libs "fontconfig >= 2.8.0 pangoft2 >= 1.38.0" 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 + PRIVATE_FONTS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "fontconfig >= 2.8.0 pangoft2 >= 1.38.0"` + else + PRIVATE_FONTS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fontconfig >= 2.8.0 pangoft2 >= 1.38.0"` + fi + # Put the nasty error message in config.log where it belongs + echo "$PRIVATE_FONTS_PKG_ERRORS" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: run-time font loading won't be supported by wxFont" >&5 +$as_echo "$as_me: WARNING: 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: run-time font loading won't be supported by wxFont" >&5 +$as_echo "$as_me: WARNING: run-time font loading won't be supported by wxFont" >&2;} +else + PRIVATE_FONTS_CFLAGS=$pkg_cv_PRIVATE_FONTS_CFLAGS + PRIVATE_FONTS_LIBS=$pkg_cv_PRIVATE_FONTS_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + $as_echo "#define wxUSE_PRIVATE_FONTS 1" >>confdefs.h + + CXXFLAGS="$PRIVATE_FONTS_CFLAGS $CXXFLAGS" + GUI_TK_LIBRARY="$GUI_TK_LIBRARY $PRIVATE_FONTS_LIBS" fi + fi + elif test "$wxUSE_MAC" = 1 -o "$wxUSE_MSW" = 1; then + $as_echo "#define wxUSE_PRIVATE_FONTS 1" >>confdefs.h + + fi + fi if test "$wxUSE_DIALUP_MANAGER" = "yes"; then if test "$wxUSE_MAC" = 1; then diff --git a/configure.in b/configure.in index 7d00d5d9ff..4869d9a47c 100644 --- a/configure.in +++ b/configure.in @@ -2963,16 +2963,6 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config dnl AC_MSG_RESULT(not found) dnl fi fi - - if test "$wxUSE_PRIVATE_FONTS" = "yes"; then - PKG_CHECK_MODULES(PRIVATE_FONTS, [fontconfig >= 2.8.0 pangoft2 >= 1.38.0], - [ - AC_DEFINE(wxUSE_PRIVATE_FONTS) - CXXFLAGS="$PRIVATE_FONTS_CFLAGS $CXXFLAGS" - GUI_TK_LIBRARY="$GUI_TK_LIBRARY $PRIVATE_FONTS_LIBS" - ], - [AC_MSG_WARN([run-time font loading won't be supported by wxFont])]) - fi fi if test "$wxUSE_DFB" = 1; then @@ -6908,7 +6898,21 @@ if test "$wxUSE_PREFERENCES_EDITOR" = "yes"; then fi if test "$wxUSE_PRIVATE_FONTS" = "yes"; then - AC_DEFINE(wxUSE_PRIVATE_FONTS) + if test "$wxUSE_GTK" = 1; then + if test "$wxUSE_PRIVATE_FONTS" = "yes"; then + PKG_CHECK_MODULES(PRIVATE_FONTS, [fontconfig >= 2.8.0 pangoft2 >= 1.38.0], + [ + AC_DEFINE(wxUSE_PRIVATE_FONTS) + CXXFLAGS="$PRIVATE_FONTS_CFLAGS $CXXFLAGS" + GUI_TK_LIBRARY="$GUI_TK_LIBRARY $PRIVATE_FONTS_LIBS" + ], + [AC_MSG_WARN([run-time font loading won't be supported by wxFont])]) + fi + elif test "$wxUSE_MAC" = 1 -o "$wxUSE_MSW" = 1; then + dnl In these ports we don't need anything special. + AC_DEFINE(wxUSE_PRIVATE_FONTS) + fi + dnl And in the other ports wxUSE_PRIVATE_FONTS is not supported. fi if test "$wxUSE_DIALUP_MANAGER" = "yes"; then