diff -up pango-1.40.3/configure.ac.delay_load pango-1.40.3/configure.ac --- pango-1.40.3/configure.ac.delay_load 2016-09-13 05:50:19.000000000 +0200 +++ pango-1.40.3/configure.ac 2016-09-23 14:22:19.120974626 +0200 @@ -301,6 +301,31 @@ if test "$pango_os_win32" = "yes"; then fi # +# Checks for delay-loaded fontconfig/freetype runtime dependencies +# +AC_ARG_ENABLE(delay-load, + [AC_HELP_STRING([--enable-delay-load], + [makes the pangoft2 backend and the fontconfig/freetype dependencies optional at runtime (win32 only)])],, + [enable_delay_load=no]) + +AC_MSG_CHECKING([whether to enable the use of delay-loaded fontconfig/freetype dependencies]) +if test $have_win32 = false; then + enable_delay_load=false +fi +AM_CONDITIONAL(ENABLE_DELAY_LOAD, test x"$enable_delay_load" = x"yes") +AC_MSG_RESULT([$enable_delay_load]) + +if test x"$enable_delay_load" = x"yes" ; then + AC_CHECK_TOOL([GENDEF], [gendef]) + + AC_MSG_CHECKING([whether gendef was found]) + if test x"$GENDEF" = x"" ; then + AC_MSG_ERROR([The gendef tool (required for delay loading the pangoft2 backend and the fontconfig/freetype dependencies) couldn't be detected]) + fi + AC_MSG_RESULT([yes]) +fi + +# # Checks for CoreText # diff -up pango-1.40.3/pango/Makefile.am.delay_load pango-1.40.3/pango/Makefile.am --- pango-1.40.3/pango/Makefile.am.delay_load 2016-08-29 14:51:18.000000000 +0200 +++ pango-1.40.3/pango/Makefile.am 2016-09-23 14:25:23.972800493 +0200 @@ -329,8 +329,36 @@ libpangocairo_1_0_la_SOURCES += pangocai endif if HAVE_CAIRO_FREETYPE +if ENABLE_DELAY_LOAD +# Create delay-loaded import libraries for pangoft2, fontconfig and freetype +libpangoft2-delay-loaded-$(PANGO_API_VERSION).dll.a: libpangoft2-$(PANGO_API_VERSION).la + $(GENDEF) - .libs/libpangoft2-1.0-0.dll > pangoft2.def; \ + $(DLLTOOL) --def pangoft2.def --kill-at --output-delaylib libpangoft2-delay-loaded-$(PANGO_API_VERSION).dll.a + +libfontconfig-delay-loaded.dll.a: + DLL=$(bindir)/libfontconfig-1.dll; \ + if test ! -f "$$DLL" ; then \ + echo "*** File $$DLL could not be found, unable to create delay-loaded import library"; \ + exit 1; \ + fi; \ + $(GENDEF) - "$$DLL" > fontconfig_delay_load.def; \ + $(DLLTOOL) --def fontconfig_delay_load.def --kill-at --output-delaylib libfontconfig-delay-loaded.dll.a + +libfreetype-delay-loaded.dll.a: + DLL=$(bindir)/libfreetype-6.dll; \ + if test ! -f "$$DLL" ; then \ + echo "*** File $$DLL could not be found, unable to create delay-loaded import library"; \ + exit 1; \ + fi; \ + $(GENDEF) - "$$DLL" > freetype_delay_load.def; \ + $(DLLTOOL) --def freetype_delay_load.def --kill-at --output-delaylib libfreetype-delay-loaded.dll.a + +libpangocairo_1_0_la_LDFLAGS += -Wl,libpangoft2-delay-loaded-$(PANGO_API_VERSION).dll.a -Wl,libfontconfig-delay-loaded.dll.a -Wl,libfreetype-delay-loaded.dll.a +libpangocairo_1_0_la_DEPENDENCIES += libpangoft2-delay-loaded-$(PANGO_API_VERSION).dll.a libfontconfig-delay-loaded.dll.a libfreetype-delay-loaded.dll.a libpangoft2-$(PANGO_API_VERSION).la +else libpangocairo_1_0_la_LIBADD += libpangoft2-$(PANGO_API_VERSION).la $(FREETYPE_LIBS) libpangocairo_1_0_la_DEPENDENCIES += libpangoft2-$(PANGO_API_VERSION).la +endif PANGOCAIRO_FONT_BACKEND_GI_MODULE = PangoFT2-1.0.gir libpangocairo_1_0_la_SOURCES += \ @@ -444,6 +472,9 @@ CLEANFILES = \ s-enum-types-h \ pango-enum-types.c \ s-enum-types-c \ + libpangoft2-delay-loaded-$(PANGO_API_VERSION).dll.a pangoft2.def \ + libfontconfig-delay-loaded.dll.a fontconfig_delay_load.def \ + libfreetype-delay-loaded.dll.a freetype_delay_load.def \ $(INTROSPECTION_GIRS) \ $(INTROSPECTION_GIRS:.gir=.typelib)