Bug 1305145 - Move freetype2 detection to Python configure. r=glandium
☠☠ backed out by acee3d0166dc ☠ ☠
authorChris Manchester <cmanchester@mozilla.com>
Fri, 14 Oct 2016 11:06:31 -0700
changeset 360959 ab38e43fdcb6cb9e0d63fb4f4a7de7f30ab8accc
parent 360958 aece1b8a86732fae5e0577c6567fb90e31e191ee
child 360960 0f39b7305d41a70759f6cae8571fba860a0d3b65
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-beta@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1305145
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1305145 - Move freetype2 detection to Python configure. r=glandium MozReview-Commit-ID: 1O4SdH0HvzL
old-configure.in
toolkit/moz.configure
--- a/old-configure.in
+++ b/old-configure.in
@@ -3873,16 +3873,19 @@ if test -n "$MOZ_TREE_FREETYPE"; then
    CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
    CAIRO_FT_OSLIBS=''
    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
    AC_SUBST_LIST(CAIRO_FT_CFLAGS)
 fi
 
+AC_SUBST_LIST(FT2_CFLAGS)
+AC_SUBST_LIST(FT2_LIBS)
+
 AC_CHECK_PROGS(WGET, wget, "")
 AC_SUBST(WGET)
 
 dnl ========================================================
 dnl Maintenance Service
 dnl ========================================================
 
 MOZ_ARG_ENABLE_BOOL(maintenance-service,
@@ -5126,20 +5129,18 @@ if test -z "${GLIB_GMODULE_LIBS}" \
     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
 fi
 
 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
 
 if test "$USE_FC_FREETYPE"; then
     if test "$COMPILE_ENVIRONMENT"; then
         dnl ========================================================
-        dnl = Check for freetype2 and its functionality
+        dnl = Check for freetype2 functionality
         dnl ========================================================
-        PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
-
         if test "$_HAVE_FREETYPE2"; then
             _SAVE_LIBS="$LIBS"
             _SAVE_CFLAGS="$CFLAGS"
             LIBS="$LIBS $FT2_LIBS"
             CFLAGS="$CFLAGS $FT2_CFLAGS"
 
             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
                 ac_cv_member_FT_Bitmap_Size_y_ppem,
@@ -5165,22 +5166,17 @@ if test "$USE_FC_FREETYPE"; then
             CFLAGS="$_SAVE_CFLAGS"
         fi
 
         _SAVE_CPPFLAGS="$CPPFLAGS"
         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
         CPPFLAGS="$_SAVE_CPPFLAGS"
-    else
-        AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
     fi
-
-    FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
-    FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
 fi
 
 dnl ========================================================
 dnl Check for pixman and cairo
 dnl ========================================================
 
 MOZ_TREE_CAIRO=1
 MOZ_ARG_ENABLE_BOOL(system-cairo,
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -280,20 +280,42 @@ pkg_check_modules('MOZ_PANGO',
                   'pango >= 1.22.0 pangoft2 >= 1.22.0 pangocairo >= 1.22.0',
                   when=toolkit_gtk)
 
 # Fontconfig
 # ==============================================================
 fontconfig_info = pkg_check_modules('_FONTCONFIG', 'fontconfig >= 2.7.0',
                                     when=fc_freetype)
 
-add_old_configure_assignment('_FONTCONFIG_CFLAGS',
-                             delayed_getattr(fontconfig_info, 'cflags'))
-add_old_configure_assignment('_FONTCONFIG_LIBS',
-                             delayed_getattr(fontconfig_info, 'libs'))
+@depends(fc_freetype)
+def check_for_freetype2(fc_freetype):
+    if fc_freetype:
+        return True
+
+# Check for freetype2. Flags are combined with fontconfig flags.
+freetype2_info = pkg_check_modules('_FT2', 'freetype2 >= 6.1.0',
+                                   when=check_for_freetype2)
+
+@depends(fontconfig_info, freetype2_info)
+def freetype2_combined_info(fontconfig_info, freetype2_info):
+    if not freetype2_info:
+        return
+    if not fontconfig_info:
+        return freetype2_info
+    return namespace(
+        cflags=freetype2_info.cflags + fontconfig_info.cflags,
+        libs=freetype2_info.libs + fontconfig_info.libs,
+    )
+
+add_old_configure_assignment('_HAVE_FREETYPE2',
+                             depends_if(freetype2_info)(lambda _: True))
+add_old_configure_assignment('FT2_LIBS',
+                             delayed_getattr(freetype2_combined_info, 'libs'))
+add_old_configure_assignment('FT2_CFLAGS',
+                             delayed_getattr(freetype2_combined_info, 'cflags'))
 
 
 # Apple platform decoder support
 # ==============================================================
 @depends(toolkit)
 def applemedia(toolkit):
     if toolkit in ('cocoa', 'uikit'):
         return True