Bug 1305145 - Move freetype2 detection to Python configure. r=glandium
authorChris Manchester <cmanchester@mozilla.com>
Fri, 14 Oct 2016 11:06:31 -0700
changeset 364570 794ce41590cdaaa6489c72380db04935131dc590
parent 364569 4f67a3849c4564496925d36fc212ac2ed5252d6e
child 364571 074a25a74513493b327b8c7323246eb583b8935d
push id1369
push userjlorenzo@mozilla.com
push dateMon, 27 Feb 2017 14:59:41 +0000
treeherdermozilla-release@d75a1dba431f [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
@@ -3836,16 +3836,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,
@@ -5057,20 +5060,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,
@@ -5096,22 +5097,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