diff -urN libreoffice-5.1.2.2-orig/Repository.mk libreoffice-5.1.2.2/Repository.mk
--- libreoffice-5.1.2.2-orig/Repository.mk	2016-03-30 00:50:44 +0900
+++ libreoffice-5.1.2.2/Repository.mk	2016-04-23 16:43:56 +0900
@@ -208,7 +208,7 @@
 	scd \
 	scfilt \
 	scui \
-	wpftcalc \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)),wpftcalc) \
 	$(if $(ENABLE_COINMP)$(ENABLE_LPSOLVE),solver) \
 	$(call gb_Helper_optional,SCRIPTING,vbaobj) \
 ))
@@ -216,7 +216,7 @@
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,graphicfilter, \
 	svgfilter \
 	flash \
-	wpftdraw \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)),wpftdraw) \
 	graphicfilter \
 ))
 
@@ -236,7 +236,7 @@
 	placeware \
 	PresenterScreen \
 	PresentationMinimizer \
-	wpftimpress \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)),wpftimpress) \
 ))
 
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,onlineupdate, \
@@ -413,7 +413,7 @@
 	$(if $(USING_X11), \
 		vclplug_gen \
 	) \
-	writerperfect \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)),writerperfect) \
 	xmlscript \
 	xmlfa \
 	xmlfd \
@@ -473,7 +473,7 @@
 	swui \
 	t602filter \
 	$(call gb_Helper_optional,SCRIPTING,vbaswobj) \
-	wpftwriter \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)),wpftwriter) \
 	writerfilter \
 ))
 
diff -urN libreoffice-5.1.2.2-orig/RepositoryExternal.mk libreoffice-5.1.2.2/RepositoryExternal.mk
--- libreoffice-5.1.2.2-orig/RepositoryExternal.mk	2016-03-30 00:50:44 +0900
+++ libreoffice-5.1.2.2/RepositoryExternal.mk	2016-04-23 16:43:56 +0900
@@ -1690,6 +1690,8 @@
 endif # DISABLE_OPENSSL
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
+
 ifneq ($(SYSTEM_CDR),)
 
 define gb_LinkTarget__use_cdr
@@ -1716,6 +1718,8 @@
 
 endif # SYSTEM_CDR
 
+endif # BUILD_OLD_DOC_FILTERS
+
 
 ifneq ($(SYSTEM_EBOOK),)
 
@@ -1752,6 +1756,8 @@
 endif # SYSTEM_EBOOK
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
+
 ifneq ($(SYSTEM_ETONYEK),)
 
 define gb_LinkTarget__use_etonyek
@@ -1904,6 +1910,8 @@
 
 endif # SYSTEM_ODFGEN
 
+endif # BUILD_OLD_DOC_FILTERS
+
 
 ifneq ($(SYSTEM_REVENGE),)
 
@@ -1971,6 +1979,8 @@
 endif # SYSTEM_REVENGE
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
+
 ifneq ($(SYSTEM_ABW),)
 
 define gb_LinkTarget__use_abw
@@ -2323,6 +2333,8 @@
 
 endif # SYSTEM_MWAW
 
+endif # BUILD_OLD_DOC_FILTERS
+
 
 ifneq ($(SYSTEM_LCMS2),)
 
diff -urN libreoffice-5.1.2.2-orig/config_host.mk.in libreoffice-5.1.2.2/config_host.mk.in
--- libreoffice-5.1.2.2-orig/config_host.mk.in	2016-03-30 00:50:44 +0900
+++ libreoffice-5.1.2.2/config_host.mk.in	2016-04-23 16:43:56 +0900
@@ -47,6 +47,7 @@
 export BUILD_TYPE=@BUILD_TYPE@
 export BUILD_UNOWINREG=@BUILD_UNOWINREG@
 export BUILD_VER_STRING=@BUILD_VER_STRING@
+export BUILD_OLD_DOC_FILTERS=@BUILD_OLD_DOC_FILTERS@
 export BUILD_X64=@BUILD_X64@
 export BZIP2_CFLAGS=$(gb_SPACE)@BZIP2_CFLAGS@
 export BZIP2_LIBS=$(gb_SPACE)@BZIP2_LIBS@
diff -urN libreoffice-5.1.2.2-orig/configure.ac libreoffice-5.1.2.2/configure.ac
--- libreoffice-5.1.2.2-orig/configure.ac	2016-03-30 00:50:44 +0900
+++ libreoffice-5.1.2.2/configure.ac	2016-04-23 16:43:56 +0900
@@ -802,6 +802,7 @@
     enable_coinmp=yes
     enable_lpsolve=no
     enable_report_builder=no
+    enable_old_doc_filters=no
     with_theme="tango"
     test_cups=no
     test_dbus=no
@@ -1650,6 +1651,11 @@
         [Specify external thesaurus dir.]),
 ,)
 
+AC_ARG_ENABLE(old-doc-filters,
+    AS_HELP_STRING([--disable-old-doc-filters],
+        [Don't include import/export filters for old document formats.]),,
+    [enable_old_doc_filters=yes])
+
 AC_ARG_WITH(system-zlib,
     AS_HELP_STRING([--with-system-zlib],
         [Use zlib already on system.]),,
@@ -7693,47 +7699,102 @@
 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
 
+if test "$enable_old_doc_filters" = "no"; then
+    BUILD_OLD_DOC_FILTERS=NO
+else
+    BUILD_OLD_DOC_FILTERS=YES
+fi
+AC_SUBST(BUILD_OLD_DOC_FILTERS)
+
 dnl ===================================================================
 dnl Check for system libetonyek
 dnl ===================================================================
-libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
-libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.5])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libetonyek to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_ETONYEK=
+else
+    libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
+    libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.5])
+fi
 
 dnl ===================================================================
 dnl Check for system libfreehand
 dnl ===================================================================
-libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libfreehand to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_FREEHAND=
+else
+    libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
+fi
 
 dnl ===================================================================
 dnl Check for system libodfgen
 dnl ===================================================================
-libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libodfgen to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_ODFGEN=
+else
+    libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
+fi
 
 dnl ===================================================================
 dnl Check for system libcdr
 dnl ===================================================================
-libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libcdr to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_CDR=
+else
+    libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
+fi
 
 dnl ===================================================================
 dnl Check for system libmspub
 dnl ===================================================================
-libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libmspub to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_MSPUB=
+else
+    libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
+fi
 
 dnl ===================================================================
 dnl Check for system libmwaw
 dnl ===================================================================
-libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
-libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.7])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libmwaw to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_MWAW=
+else
+    libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
+    libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.7])
+fi
 
 dnl ===================================================================
 dnl Check for system libpagemaker
 dnl ===================================================================
-libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libpagemaker to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_PAGEMAKER=
+else
+    libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
+fi
 
 dnl ===================================================================
 dnl Check for system libvisio
 dnl ===================================================================
-libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libvisio to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_VISIO=
+else
+    libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
+fi
 
 dnl ===================================================================
 dnl Check for system libcmis
@@ -7750,11 +7811,17 @@
 dnl ===================================================================
 dnl Check for system libwpd
 dnl ===================================================================
-AS_IF([test "$COM" = "MSC"],
-      [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
-      [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
-)
-libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libwpd to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_WPD=NO
+else
+    AS_IF([test "$COM" = "MSC"],
+          [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
+          [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
+    )
+    libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
+fi
 
 dnl ===================================================================
 dnl Check for system lcms2
@@ -7811,18 +7878,36 @@
 dnl ===================================================================
 dnl Check for system libabw
 dnl ===================================================================
-libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libabw to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_ABW=
+else
+    libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
+fi
 
 dnl ===================================================================
 dnl Check for system libwps
 dnl ===================================================================
-libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
-libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.2])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libwps to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_WPS=
+else
+    libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
+    libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.2])
+fi
 
 dnl ===================================================================
 dnl Check for system libwpg
 dnl ===================================================================
-libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libwpg to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_WPG=NO
+else
+    libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
+fi
 
 # ===================================================================
 # Check for system libxslt
diff -urN libreoffice-5.1.2.2-orig/postprocess/Rdb_services.mk libreoffice-5.1.2.2/postprocess/Rdb_services.mk
--- libreoffice-5.1.2.2-orig/postprocess/Rdb_services.mk	2016-03-30 00:50:44 +0900
+++ libreoffice-5.1.2.2/postprocess/Rdb_services.mk	2016-04-23 16:43:56 +0900
@@ -120,10 +120,12 @@
 		sccomp/source/solver/lpsolvesolver \
 	) \
 	writerfilter/util/writerfilter \
-	writerperfect/source/draw/wpftdraw \
-	writerperfect/source/impress/wpftimpress \
-	writerperfect/source/writer/wpftwriter \
-	writerperfect/source/calc/wpftcalc \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)), \
+		writerperfect/source/draw/wpftdraw \
+		writerperfect/source/impress/wpftimpress \
+		writerperfect/source/writer/wpftwriter \
+		writerperfect/source/calc/wpftcalc \
+	) \
 	$(if $(filter MACOSX,$(OS)), \
 		$(call gb_Helper_optional,AVMEDIA,avmedia/source/macavf/avmediaMacAVF) \
 		$(if $(filter TRUE,$(ENABLE_MACOSX_SANDBOX)),, \
diff -urN libreoffice-5.1.2.2-orig/scp2/InstallModule_ooo.mk libreoffice-5.1.2.2/scp2/InstallModule_ooo.mk
--- libreoffice-5.1.2.2-orig/scp2/InstallModule_ooo.mk	2016-03-30 00:50:44 +0900
+++ libreoffice-5.1.2.2/scp2/InstallModule_ooo.mk	2016-04-23 16:43:56 +0900
@@ -18,6 +18,7 @@
 ))
 
 $(eval $(call gb_InstallModule_define_if_set,scp2/ooo,\
+	BUILD_OLD_DOC_FILTERS \
 	ENABLE_GTK \
 	ENABLE_MACOSX_SANDBOX \
 	ENABLE_NPAPI_FROM_BROWSER \
diff -urN libreoffice-5.1.2.2-orig/scp2/source/ooo/file_ooo.scp libreoffice-5.1.2.2/scp2/source/ooo/file_ooo.scp
--- libreoffice-5.1.2.2-orig/scp2/source/ooo/file_ooo.scp	2016-03-30 00:50:44 +0900
+++ libreoffice-5.1.2.2/scp2/source/ooo/file_ooo.scp	2016-04-23 16:50:24 +0900
@@ -297,7 +297,9 @@
 #endif
 UI_FILELIST(uui, "UIConfig/uui.filelist")
 UI_FILELIST(vcl, "UIConfig/vcl.filelist")
+#ifdef BUILD_OLD_DOC_FILTERS
 UI_FILELIST(writerperfect, "UIConfig/writerperfect.filelist")
+#endif
 UI_FILELIST(xmlsec, "UIConfig/xmlsec.filelist")
 
 UI_FILELIST_ALL_LANG(basicide, modules/BasicIDE)
diff -urN libreoffice-5.1.2.2-orig/writerperfect/Module_writerperfect.mk libreoffice-5.1.2.2/writerperfect/Module_writerperfect.mk
--- libreoffice-5.1.2.2-orig/writerperfect/Module_writerperfect.mk	2016-03-30 00:50:44 +0900
+++ libreoffice-5.1.2.2/writerperfect/Module_writerperfect.mk	2016-04-23 16:43:56 +0900
@@ -19,6 +19,8 @@
 
 $(eval $(call gb_Module_Module,writerperfect))
 
+ifneq (NO,$(BUILD_OLD_DOC_FILTERS))
+
 $(eval $(call gb_Module_add_targets,writerperfect,\
 	Library_wpftcalc \
 	Library_wpftdraw \
@@ -43,4 +45,6 @@
 	StaticLibrary_writerperfect_importtestbase \
 ))
 
+endif
+
 # vim: set noet sw=4 ts=4:
