Bug 412582: remove MOZ_ENABLE_CAIRO_GFX from the build system, r=ted.mielczarek, a=beltzner
authormozilla@weilbacher.org
Mon, 28 Jan 2008 15:07:34 -0800
changeset 10856 862729f14171072083387b8aa2ba8f8efdb8e651
parent 10855 00cc6b6b6ac232fb92450f50e24d9d52a9bc9598
child 10857 390f9a624ba20a99cd4844eb02be02c5a3016f3c
push idunknown
push userunknown
push dateunknown
reviewersted.mielczarek, beltzner
bugs412582
milestone1.9b3pre
Bug 412582: remove MOZ_ENABLE_CAIRO_GFX from the build system, r=ted.mielczarek, a=beltzner
browser/app/Makefile.in
config/autoconf.mk.in
configure.in
content/canvas/src/Makefile.in
layout/build/Makefile.in
layout/generic/Makefile.in
modules/libpr0n/build/Makefile.in
modules/staticmod/Makefile.in
toolkit/library/libxul-config.mk
toolkit/library/libxul-rules.mk
view/src/Makefile.in
widget/src/build/Makefile.in
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -125,20 +125,17 @@ LIBS += \
 	$(MOZ_JS_LIBS) \
 	$(APP_XPCOM_LIBS) \
 	$(NSPR_LIBS) \
 	$(TK_LIBS) \
 	$(NULL)
 
 # Add explicit X11 dependency when building against X11 toolkits
 ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
-LIBS += $(XLDFLAGS) $(XLIBS)
-ifdef MOZ_ENABLE_CAIRO_GFX
-LIBS += $(ZLIB_LIBS)
-endif
+LIBS += $(XLDFLAGS) $(XLIBS) $(ZLIB_LIBS)
 endif
 
 ifdef MOZ_JPROF
 LIBS += -ljprof
 endif
 
 ifndef MOZ_WINCONSOLE
 ifdef MOZ_DEBUG
@@ -177,22 +174,20 @@ DEFINES		+= $(STATIC_DEFINES)
 CPPSRCS		+= $(STATIC_CPPSRCS)
 EXTRA_DSO_LIBS	+= $(STATIC_EXTRA_DSO_LIBS)
 REQUIRES	+= $(STATIC_REQUIRES)
 EXTRA_LIBS	+= $(STATIC_EXTRA_LIBS)
 endif
 
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
-ifdef MOZ_ENABLE_CAIRO_GFX
 OS_LIBS += $(call EXPAND_LIBNAME,usp10 msimg32)
 ifdef MOZ_ENABLE_GLITZ
 OS_LIBS += $(call EXPAND_LIBNAME,opengl32)
 endif
-endif
 
 RCINCLUDE = splash.rc
 ifndef GNU_CC
 RCFLAGS += -DMOZ_PHOENIX -I$(srcdir)
 else
 RCFLAGS += -DMOZ_PHOENIX --include-dir $(srcdir)
 endif
 ifdef BUILD_STATIC_LIBS
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -462,17 +462,16 @@ GTK_CONFIG	= @GTK_CONFIG@
 TK_CFLAGS	= @TK_CFLAGS@
 TK_LIBS		= @TK_LIBS@
 
 MOZ_TOOLKIT_REGISTRY_CFLAGS = \
 	$(TK_CFLAGS)
 
 CAIRO_FT_CFLAGS		= @CAIRO_FT_CFLAGS@
 
-MOZ_ENABLE_CAIRO_GFX	= @MOZ_ENABLE_CAIRO_GFX@
 MOZ_ENABLE_CAIRO_FT	= @MOZ_ENABLE_CAIRO_FT@
 MOZ_ENABLE_GLITZ        = @MOZ_ENABLE_GLITZ@
 MOZ_ENABLE_GTK2		= @MOZ_ENABLE_GTK2@
 MOZ_ENABLE_PHOTON	= @MOZ_ENABLE_PHOTON@
 MOZ_ENABLE_COCOA	= @MOZ_ENABLE_COCOA@
 MOZ_ENABLE_XREMOTE	= @MOZ_ENABLE_XREMOTE@
 
 MOZ_GTK2_CFLAGS		= @MOZ_GTK2_CFLAGS@
--- a/configure.in
+++ b/configure.in
@@ -4536,54 +4536,49 @@ case "$MOZ_WIDGET_TOOLKIT" in
 photon)
 	MOZ_ENABLE_PHOTON=1
 	AC_DEFINE(MOZ_WIDGET_PHOTON)
     ;;
 
 cairo-windows)
     MOZ_WIDGET_TOOLKIT=windows
     MOZ_GFX_TOOLKIT=cairo
-    MOZ_ENABLE_CAIRO_GFX=1
     ;;
 
 cairo-gtk2)
     MOZ_WIDGET_TOOLKIT=gtk2
     MOZ_GFX_TOOLKIT=cairo
-    MOZ_ENABLE_CAIRO_GFX=1
     MOZ_ENABLE_GTK2=1
     MOZ_ENABLE_XREMOTE=1
     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
     TK_LIBS='$(MOZ_GTK2_LIBS)'
     AC_DEFINE(MOZ_WIDGET_GTK2)
     ;;
 cairo-beos)
     MOZ_WIDGET_TOOLKIT=beos
     MOZ_GFX_TOOLKIT=cairo
-    MOZ_ENABLE_CAIRO_GFX=1
     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
     TK_LIBS='$(MOZ_CAIRO_LIBS)'
     ;;
 
 cairo-os2)
     MOZ_WIDGET_TOOLKIT=os2
     MOZ_GFX_TOOLKIT=cairo
-    MOZ_ENABLE_CAIRO_GFX=1
     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
     TK_LIBS='$(MOZ_CAIRO_LIBS)'
     ;;
 
 cairo-mac|cairo-cocoa)
     if test "$MOZ_WIDGET_TOOLKIT" = "cairo-cocoa"; then
         MOZ_WIDGET_TOOLKIT=cocoa
         AC_DEFINE(MOZ_WIDGET_COCOA)
         MOZ_ENABLE_COCOA=1
     else
         MOZ_WIDGET_TOOLKIT=mac
     fi
-    MOZ_ENABLE_CAIRO_GFX=1
     MOZ_GFX_TOOLKIT=cairo
     MOZ_USER_DIR="Mozilla"
     AC_DEFINE(XP_MACOSX)
     AC_DEFINE(TARGET_CARBON)
     AC_DEFINE(TARGET_API_MAC_CARBON)
     TK_LIBS='-framework Carbon'
     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
     CFLAGS="$CFLAGS $TK_CFLAGS"
@@ -4641,29 +4636,25 @@ AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
 
 AC_SUBST(GTK_CONFIG)
 AC_SUBST(TK_CFLAGS)
 AC_SUBST(TK_LIBS)
 
 AC_SUBST(MOZ_ENABLE_GTK2)
 AC_SUBST(MOZ_ENABLE_PHOTON)
 AC_SUBST(MOZ_ENABLE_COCOA)
-AC_SUBST(MOZ_ENABLE_CAIRO_GFX)
 AC_SUBST(MOZ_ENABLE_GLITZ)
 AC_SUBST(MOZ_ENABLE_XREMOTE)
 AC_SUBST(MOZ_GTK2_CFLAGS)
 AC_SUBST(MOZ_GTK2_LIBS)
 
 AC_SUBST(MOC)
 
-if test "$MOZ_ENABLE_CAIRO_GFX"
-then
-    AC_DEFINE(MOZ_THEBES)
-    AC_DEFINE(MOZ_CAIRO_GFX)
-fi
+AC_DEFINE(MOZ_THEBES)
+AC_DEFINE(MOZ_CAIRO_GFX)
 
 if test "$MOZ_ENABLE_GTK2"
 then
     AC_DEFINE(MOZ_X11)
     MOZ_X11=1
 fi
 AC_SUBST(MOZ_X11)
 
@@ -5521,41 +5512,33 @@ AC_SUBST(MOZ_ENABLE_CANVAS)
 dnl ========================================================
 dnl SVG
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(svg,
 [  --disable-svg            Disable SVG support],
     MOZ_SVG=,
     MOZ_SVG=1 )
 if test -n "$MOZ_SVG"; then
-  if test -z "$MOZ_ENABLE_CAIRO_GFX"; then
-    AC_MSG_ERROR([SVG requires cairo gfx])
-  else
-    AC_DEFINE(MOZ_SVG)
-  fi
-fi
-
-MOZ_SVG_FOREIGNOBJECT=$MOZ_ENABLE_CAIRO_GFX
+  AC_DEFINE(MOZ_SVG)
+fi
+
+MOZ_SVG_FOREIGNOBJECT=1
 dnl ========================================================
 dnl SVG <foreignObject>
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(svg-foreignobject,
    [  --disable-svg-foreignobject
                         Disable SVG <foreignObject> support],
    MOZ_SVG_FOREIGNOBJECT=,
    MOZ_SVG_FOREIGNOBJECT=1 )
 if test "$MOZ_SVG_FOREIGNOBJECT"; then
-  if test -z "$MOZ_ENABLE_CAIRO_GFX"; then
-    AC_MSG_ERROR([<foreignobject> requires cairo gfx])
+  if test "$MOZ_SVG"; then
+    AC_DEFINE(MOZ_SVG_FOREIGNOBJECT)
   else
-    if test "$MOZ_SVG"; then
-      AC_DEFINE(MOZ_SVG_FOREIGNOBJECT)
-    else
-      MOZ_SVG_FOREIGNOBEJCT=
-    fi
+    MOZ_SVG_FOREIGNOBEJCT=
   fi
 fi
 
 dnl ========================================================
 dnl Installer
 dnl ========================================================
 case "$target_os" in
     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
@@ -6885,125 +6868,123 @@ mk_add_options MOZ_CO_MODULE=mozilla/oth
 fi
 
 AC_SUBST(MOZ_LIBART_CFLAGS)
 AC_SUBST(MOZ_LIBART_LIBS)
 
 dnl ========================================================
 dnl Check for cairo
 dnl ========================================================
-if test "$MOZ_SVG" -o "$MOZ_ENABLE_CANVAS" -o "$MOZ_ENABLE_CAIRO_GFX" ; then
-   MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
-
-   MOZ_TREE_CAIRO=1
-   MOZ_ARG_ENABLE_BOOL(system-cairo,
-   [ --enable-system-cairo Use system cairo (located with pkgconfig)],
-   MOZ_TREE_CAIRO=,
-   MOZ_TREE_CAIRO=1 )
-
-   # Check for headers defining standard int types.
-   AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
-
-   if test "$MOZ_TREE_CAIRO"; then
-       # For now we assume that we will have a uint64_t available through
-       # one of the above headers or mozstdint.h.
-       AC_DEFINE(HAVE_UINT64_T)
-
-       # Define macros for cairo-features.h
-       if test "$MOZ_X11"; then
-           XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
-           XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
-           PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
-           PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
-           FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
-           MOZ_ENABLE_CAIRO_FT=1
-           CAIRO_FT_CFLAGS="$FT2_CFLAGS"
-       fi
-       if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
-           QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
-           ATSUI_FONT_FEATURE="#define CAIRO_HAS_ATSUI_FONT 1"
-       fi
-       if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
-           WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
-           WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
-           PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
-       fi
-       if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
-           OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
-           FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
-           PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
-           MOZ_ENABLE_CAIRO_FT=1
-           CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
-           CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
-       fi
-       if test "$MOZ_ENABLE_GLITZ"; then
-           GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
-       fi
-       if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
-           PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
-           BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
-           FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
-           MOZ_ENABLE_CAIRO_FT=1
-       fi
-       AC_SUBST(MOZ_ENABLE_CAIRO_FT)
-       AC_SUBST(CAIRO_FT_CFLAGS)
-
-       if test "$MOZ_DEBUG"; then
-         SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
-       else
-         SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
-       fi
-
-       PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
-
-       AC_SUBST(PS_SURFACE_FEATURE)
-       AC_SUBST(PDF_SURFACE_FEATURE)
-       AC_SUBST(SVG_SURFACE_FEATURE)
-       AC_SUBST(XLIB_SURFACE_FEATURE)
-       AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
-       AC_SUBST(QUARTZ_SURFACE_FEATURE)
-       AC_SUBST(NQUARTZ_SURFACE_FEATURE)
-       AC_SUBST(XCB_SURFACE_FEATURE)
-       AC_SUBST(WIN32_SURFACE_FEATURE)
-       AC_SUBST(OS2_SURFACE_FEATURE)
-       AC_SUBST(BEOS_SURFACE_FEATURE)
-       AC_SUBST(GLITZ_SURFACE_FEATURE)
-       AC_SUBST(DIRECTFB_SURFACE_FEATURE)
-       AC_SUBST(FT_FONT_FEATURE)
-       AC_SUBST(WIN32_FONT_FEATURE)
-       AC_SUBST(ATSUI_FONT_FEATURE)
-       AC_SUBST(PNG_FUNCTIONS_FEATURE)
-
-       if test "$_WIN32_MSVC"; then
-           MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
-           if test "$MOZ_ENABLE_GLITZ"; then
-               MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'$(DEPTH)/gfx/cairo/glitz/src/mozglitz.lib $(DEPTH)/gfx/cairo/glitz/src/wgl/mozglitzwgl.lib'
-           fi
-       else
-           MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/$(LIB_PREFIX)mozcairo.$(LIB_SUFFIX) $(DEPTH)/gfx/cairo/libpixman/src/$(LIB_PREFIX)mozlibpixman.$(LIB_SUFFIX)'" $CAIRO_FT_LIBS"
-
-           if test "$MOZ_X11"; then
-               MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
-           fi
-
-           if test "$MOZ_ENABLE_GLITZ"; then
-               MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src -lmozglitz'
-               if test "$MOZ_X11"; then
-                   MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/glx -lmozglitzglx -lGL'
-               fi
-               if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
-                   MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/wgl -lmozglitzwgl'
-               fi
-           fi
-       fi
-   else
-      PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
-      MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
-      MOZ_CAIRO_LIBS=$CAIRO_LIBS
-   fi
+MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
+
+MOZ_TREE_CAIRO=1
+MOZ_ARG_ENABLE_BOOL(system-cairo,
+[ --enable-system-cairo Use system cairo (located with pkgconfig)],
+MOZ_TREE_CAIRO=,
+MOZ_TREE_CAIRO=1 )
+
+# Check for headers defining standard int types.
+AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
+
+if test "$MOZ_TREE_CAIRO"; then
+    # For now we assume that we will have a uint64_t available through
+    # one of the above headers or mozstdint.h.
+    AC_DEFINE(HAVE_UINT64_T)
+
+    # Define macros for cairo-features.h
+    if test "$MOZ_X11"; then
+        XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
+        XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
+        PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
+        PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
+        FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
+        MOZ_ENABLE_CAIRO_FT=1
+        CAIRO_FT_CFLAGS="$FT2_CFLAGS"
+    fi
+    if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
+        QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
+        ATSUI_FONT_FEATURE="#define CAIRO_HAS_ATSUI_FONT 1"
+    fi
+    if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
+        WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
+        WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
+        PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
+    fi
+    if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
+        OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
+        FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
+        PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
+        MOZ_ENABLE_CAIRO_FT=1
+        CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
+        CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
+    fi
+    if test "$MOZ_ENABLE_GLITZ"; then
+        GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
+    fi
+    if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
+        PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
+        BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
+        FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
+        MOZ_ENABLE_CAIRO_FT=1
+    fi
+    AC_SUBST(MOZ_ENABLE_CAIRO_FT)
+    AC_SUBST(CAIRO_FT_CFLAGS)
+
+    if test "$MOZ_DEBUG"; then
+      SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
+    else
+      SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
+    fi
+
+    PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
+
+    AC_SUBST(PS_SURFACE_FEATURE)
+    AC_SUBST(PDF_SURFACE_FEATURE)
+    AC_SUBST(SVG_SURFACE_FEATURE)
+    AC_SUBST(XLIB_SURFACE_FEATURE)
+    AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
+    AC_SUBST(QUARTZ_SURFACE_FEATURE)
+    AC_SUBST(NQUARTZ_SURFACE_FEATURE)
+    AC_SUBST(XCB_SURFACE_FEATURE)
+    AC_SUBST(WIN32_SURFACE_FEATURE)
+    AC_SUBST(OS2_SURFACE_FEATURE)
+    AC_SUBST(BEOS_SURFACE_FEATURE)
+    AC_SUBST(GLITZ_SURFACE_FEATURE)
+    AC_SUBST(DIRECTFB_SURFACE_FEATURE)
+    AC_SUBST(FT_FONT_FEATURE)
+    AC_SUBST(WIN32_FONT_FEATURE)
+    AC_SUBST(ATSUI_FONT_FEATURE)
+    AC_SUBST(PNG_FUNCTIONS_FEATURE)
+
+    if test "$_WIN32_MSVC"; then
+        MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
+        if test "$MOZ_ENABLE_GLITZ"; then
+            MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'$(DEPTH)/gfx/cairo/glitz/src/mozglitz.lib $(DEPTH)/gfx/cairo/glitz/src/wgl/mozglitzwgl.lib'
+        fi
+    else
+        MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/$(LIB_PREFIX)mozcairo.$(LIB_SUFFIX) $(DEPTH)/gfx/cairo/libpixman/src/$(LIB_PREFIX)mozlibpixman.$(LIB_SUFFIX)'" $CAIRO_FT_LIBS"
+
+        if test "$MOZ_X11"; then
+            MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
+        fi
+
+        if test "$MOZ_ENABLE_GLITZ"; then
+            MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src -lmozglitz'
+            if test "$MOZ_X11"; then
+                MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/glx -lmozglitzglx -lGL'
+            fi
+            if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
+                MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/wgl -lmozglitzwgl'
+            fi
+        fi
+    fi
+else
+   PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
+   MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
+   MOZ_CAIRO_LIBS=$CAIRO_LIBS
 fi
 
 AC_SUBST(MOZ_TREE_CAIRO)
 AC_SUBST(MOZ_CAIRO_CFLAGS)
 AC_SUBST(MOZ_CAIRO_LIBS)
 
 dnl ========================================================
 dnl Check for lcms
--- a/content/canvas/src/Makefile.in
+++ b/content/canvas/src/Makefile.in
@@ -70,22 +70,19 @@ REQUIRES	= \
 		imglib2 \
 		mimetype \
 		exthandler \
 		uconv \
 		intl \
 		plugin \
 		cairo \
 		libpixman \
+		thebes \
 		$(NULL)
 
-ifdef MOZ_ENABLE_CAIRO_GFX
-REQUIRES += thebes
-endif
-
 # XXX some platforms can't handle building
 # an empty .a/lib.  Remove this dummy.cpp
 # whenever w have a rendering context
 # that doesn't depend on any non-default
 # libraries.
 CPPSRCS		= dummy.cpp \
 		$(NULL)
 
@@ -95,16 +92,9 @@ endif
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk
 
 CXXFLAGS	+= $(MOZ_CAIRO_CFLAGS) $(TK_CFLAGS)
 
-ifndef MOZ_ENABLE_CAIRO_GFX
-ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
-# needed for nsDrawingSurfaceMac.h
-CXXFLAGS += -I$(topsrcdir)/gfx/src/mac
-endif
-endif
-
 DEFINES += -D_IMPL_NS_LAYOUT
--- a/layout/build/Makefile.in
+++ b/layout/build/Makefile.in
@@ -59,19 +59,17 @@ GRE_MODULE	= 1
 LIBXUL_LIBRARY	= 1
 
 PACKAGE_FILE = layout.pkg
 PACKAGE_VARS += MOZ_XUL
 
 ifndef MOZ_ENABLE_LIBXUL
 EXTRA_DSO_LIBS	= gkgfx
 endif
-ifdef MOZ_ENABLE_CAIRO_GFX
 EXTRA_DSO_LIBS	+= thebes
-endif
 
 REQUIRES	= xpcom \
 		  string \
 		  content \
 		  gfx \
 		  widget \
 		  view \
 		  locale \
@@ -95,22 +93,19 @@ REQUIRES	= xpcom \
 		  xul \
 		  xultmpl \
 		  lwbrk \
 		  plugin \
 		  commandhandler \
 		  webbrwsr \
 		  uconv \
 		  txtsvc \
+		  thebes \
 		  $(NULL)
 
-ifdef MOZ_ENABLE_CAIRO_GFX
-REQUIRES += thebes
-endif
-
 CPPSRCS		= \
 		nsLayoutModule.cpp \
 		nsContentDLF.cpp \
 		nsLayoutStatics.cpp \
 		$(NULL)
 
 EXPORTS		= \
 		nsLayoutCID.h \
@@ -222,31 +217,20 @@ EXTRA_DSO_LDOPTS = \
 		$(MOZ_COMPONENT_LIBS) \
 		$(MOZ_JS_LIBS) \
 		$(NULL)
 
 ifdef NS_TRACE_MALLOC
 EXTRA_DSO_LIBS	+= tracemalloc
 endif
 
-ifdef MOZ_ENABLE_CAIRO_GFX
-EXTRA_DSO_LIBS += thebes
-else
-ifdef MOZ_ENABLE_CANVAS
-EXTRA_DSO_LDOPTS += $(MOZ_CAIRO_LIBS)
-endif
-endif
-
 ifdef MOZ_ENABLE_GTK2
 EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS) \
+		    -lXrender \
 		    $(NULL)
-ifdef MOZ_ENABLE_CAIRO_GFX
-EXTRA_DSO_LDOPTS += -lXrender \
-		    $(NULL)
-endif
 endif
 
 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
 EXTRA_DSO_LDOPTS += \
 	$(TK_LIBS) \
 	$(NULL)
 endif
 
--- a/layout/generic/Makefile.in
+++ b/layout/generic/Makefile.in
@@ -75,27 +75,25 @@ REQUIRES	= xpcom \
 		  lwbrk \
 		  imglib2 \
 		  accessibility \
 		  xpconnect \
 		  java \
 		  exthandler \
 		  intl \
 		  uconv \
+		  thebes \
+		  cairo \
 		  $(NULL)
 
 # Sun's Complex Text Layout support
 ifdef SUNCTL
 REQUIRES	+= ctl
 endif
 
-ifdef MOZ_ENABLE_CAIRO_GFX
-REQUIRES	+= thebes cairo
-endif
-
 EXPORTS		= \
 		nsFrameList.h \
 		nsHTMLParts.h \
 		nsHTMLReflowMetrics.h \
 		nsHTMLReflowState.h \
 		nsIAnonymousContentCreator.h \
 		nsICanvasFrame.h \
 		nsIFrame.h \
--- a/modules/libpr0n/build/Makefile.in
+++ b/modules/libpr0n/build/Makefile.in
@@ -85,22 +85,19 @@ SHARED_LIBRARY_LIBS = \
 		$(foreach d,$(filter-out icon,$(MOZ_IMG_DECODERS)), \
 			../decoders/${d}/$(LIB_PREFIX)img${d}_s.$(LIB_SUFFIX))\
 		$(foreach d,$(MOZ_IMG_ENCODERS), \
 			../encoders/${d}/$(LIB_PREFIX)img${d}e_s.$(LIB_SUFFIX))\
 		$(NULL)
 
 EXTRA_DSO_LIBS	= \
 		gkgfx \
+		thebes \
 		$(NULL)
 
-ifdef MOZ_ENABLE_CAIRO_GFX
-EXTRA_DSO_LIBS	+= thebes
-endif
-
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(JPEG_LIBS) \
 		$(PNG_LIBS) $(ZLIB_LIBS) \
 		$(LCMS_LIBS) \
 		$(EXTRA_DSO_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
--- a/modules/staticmod/Makefile.in
+++ b/modules/staticmod/Makefile.in
@@ -81,20 +81,18 @@ OS_LIBS	+= -framework Cocoa
 endif
 
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool imm32)
 # XXX temporary workaround until link ordering issue is solved
 ifdef GNU_CC
 OS_LIBS += $(call EXPAND_LIBNAME,winmm wsock32 gdi32)
 endif
-ifdef MOZ_ENABLE_CAIRO_GFX
 OS_LIBS += $(call EXPAND_LIBNAME, usp10)
 endif
-endif
 
 ifneq  (,$(MOZ_ENABLE_GTK2))
 OS_LIBS += $(XLDFLAGS) $(XT_LIBS)
 endif
 
 OS_LIBS += $(TK_LIBS)
 
 GARBAGE += module_list.h
--- a/toolkit/library/libxul-config.mk
+++ b/toolkit/library/libxul-config.mk
@@ -278,38 +278,19 @@ endif
 
 ifneq (,$(filter icon,$(MOZ_IMG_DECODERS)))
 ifndef MOZ_ENABLE_GTK2
 DEFINES += -DICON_DECODER
 COMPONENT_LIBS += imgicon
 endif
 endif
 
-ifdef MOZ_ENABLE_CAIRO_GFX
 STATIC_LIBS += thebes
 COMPONENT_LIBS += gkgfxthebes
 
-else # Platform-specific GFX layer
-  ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
-  COMPONENT_LIBS += gkgfxwin
-  endif
-  ifeq (beos,$(MOZ_WIDGET_TOOLKIT))
-  COMPONENT_LIBS += gfx_beos
-  endif
-  ifeq (os2,$(MOZ_WIDGET_TOOLKIT))
-  COMPONENT_LIBS += gfx_os2
-  endif
-  ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
-  COMPONENT_LIBS += gfx_mac
-  endif
-  ifdef MOZ_ENABLE_PHOTON
-  COMPONENT_LIBS += gfx_photon
-  endif
-endif
-
 ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
 COMPONENT_LIBS += gkwidget
 endif
 ifeq (beos,$(MOZ_WIDGET_TOOLKIT))
 COMPONENT_LIBS += widget_beos
 endif
 ifeq (os2,$(MOZ_WIDGET_TOOLKIT))
 COMPONENT_LIBS += wdgtos2
--- a/toolkit/library/libxul-rules.mk
+++ b/toolkit/library/libxul-rules.mk
@@ -64,27 +64,25 @@ DEFINES += \
 	-D_IMPL_NS_COM \
 	-D_IMPL_NS_STRINGAPI \
 	-DEXPORT_XPT_API \
 	-DEXPORT_XPTC_API \
 	-D_IMPL_NS_GFX \
 	-D_IMPL_NS_WIDGET \
 	$(NULL)
 
-ifdef MOZ_ENABLE_CAIRO_GFX
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 OS_LIBS += $(call EXPAND_LIBNAME,usp10)
 endif
 ifneq (,$(filter $(MOZ_WIDGET_TOOLKIT),mac cocoa))
 EXTRA_DSO_LDOPTS += -lcups
 ifdef MOZ_ENABLE_GLITZ
 EXTRA_DSO_LDOPTS += -lmozglitzagl -framework OpenGL -framework AGL
 endif
 endif
-endif # MOZ_ENABLE_CAIRO_GFX
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 EXTRA_DSO_LDOPTS += $(MOZ_PANGO_LIBS)
 endif
 
 EXTRA_DSO_LDOPTS += $(MOZ_CAIRO_LIBS)
 
 export:: dlldeps.cpp
--- a/view/src/Makefile.in
+++ b/view/src/Makefile.in
@@ -50,27 +50,23 @@ GRE_MODULE	= 1
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  gfx \
 		  widget \
 		  dom \
 		  pref \
+		  thebes \
+		  cairo \
 		  $(NULL)
 
-ifdef MOZ_ENABLE_CAIRO_GFX
-REQUIRES += thebes cairo
-endif
-
 EXTRA_DSO_LIBS = gkgfx
 
 CPPSRCS		= \
 		nsView.cpp \
 		nsScrollPortView.cpp \
 		nsViewManager.cpp \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
-ifdef MOZ_ENABLE_CAIRO_GFX
 CXXFLAGS += $(MOZ_CAIRO_CFLAGS)
-endif
--- a/widget/src/build/Makefile.in
+++ b/widget/src/build/Makefile.in
@@ -61,21 +61,19 @@ REQUIRES	= xpcom \
 		  timer \
 		  accessibility \
 		  thebes \
 		  cairo \
 		  $(NULL)
 
 CPPSRCS		= nsWinWidgetFactory.cpp
 
-EXTRA_DSO_LIBS	= gkgfx
-
-ifdef MOZ_ENABLE_CAIRO_GFX
-EXTRA_DSO_LIBS	+= thebes
-endif
+EXTRA_DSO_LIBS	= gkgfx \
+		  thebes \
+		  $(NULL)
 
 LOCAL_INCLUDES	= \
 		-I$(srcdir) \
 		-I$(srcdir)/../xpwidgets \
 		-I$(srcdir)/../windows \
 		$(NULL)
 
 OS_LIBS		+= $(call EXPAND_LIBNAME, uuid ole32 oleaut32 winspool)