diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in index 867258e262db..0faa67c64dbd 100644 --- a/config_host/config_features.h.in +++ b/config_host/config_features.h.in @@ -76,6 +76,11 @@ #define HAVE_FEATURE_READONLY_INSTALLSET 0 +/* + * Whether curl is available + */ +#define HAVE_FEATURE_CURL 0 + /* * Whether we support breakpad as crash reporting lib. */ diff --git a/configure.ac b/configure.ac index be1c11e45d38..899724df2547 100644 --- a/configure.ac +++ b/configure.ac @@ -10802,6 +10802,13 @@ AC_SUBST(SYSTEM_GENCMN) AC_SUBST(ICU_MAJOR) AC_SUBST(ICU_MINOR) +dnl ================================================================== +dnl CURL +dnl ================================================================== +if test "$enable_curl" == "yes"; then + AC_DEFINE([HAVE_FEATURE_CURL]) +fi + dnl ================================================================== dnl Breakpad dnl ================================================================== @@ -10810,6 +10817,9 @@ AC_MSG_CHECKING([whether to enable breakpad]) if test "$enable_breakpad" != yes; then AC_MSG_RESULT([no]) else + if test "$enable_curl" != "yes"; then + AC_MSG_ERROR([--disable-breakpad must be used when --disable-curl is used]) + fi AC_MSG_RESULT([yes]) ENABLE_BREAKPAD="TRUE" AC_DEFINE(ENABLE_BREAKPAD) @@ -10838,6 +10848,15 @@ fi AC_SUBST(ENABLE_BREAKPAD) AC_SUBST(DEFAULT_CRASHDUMP_VALUE) +dnl ================================================================== +dnl libcmis +dnl ================================================================== +if test "$enable_libcmis" == "yes"; then + if test "$enable_curl" != "yes"; then + AC_MSG_ERROR([--disable-libcmis must be used when --disable-curl is used]) + fi +fi + dnl =================================================================== dnl Orcus dnl =================================================================== @@ -11000,7 +11019,7 @@ no) AC_MSG_RESULT([yes]) # curl is already mandatory (almost) and checked elsewhere if test "$enable_curl" = "no"; then - AC_MSG_ERROR(["--with-webdav conflicts with --disable-curl"]) + AC_MSG_ERROR(["--without-webdav must be used when --disable-curl is used"]) fi WITH_WEBDAV=TRUE ;; diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk index 0ae136c70e50..641efda7eda2 100644 --- a/desktop/Library_sofficeapp.mk +++ b/desktop/Library_sofficeapp.mk @@ -24,9 +24,10 @@ $(eval $(call gb_Library_use_externals,sofficeapp, \ icu_headers \ icui18n \ icuuc \ + $(if $(ENABLE_CURL), \ $(if $(filter-out EMSCRIPTEN iOS,$(OS)), \ curl \ - )\ + ))\ $(if $(ENABLE_ONLINE_UPDATE_MAR),\ orcus-parser \ orcus )\ diff --git a/lingucomponent/Module_lingucomponent.mk b/lingucomponent/Module_lingucomponent.mk index 87e1b1f4d585..ea31defcf5f6 100644 --- a/lingucomponent/Module_lingucomponent.mk +++ b/lingucomponent/Module_lingucomponent.mk @@ -25,11 +25,13 @@ $(eval $(call gb_Module_add_targets,lingucomponent,\ )) endif +ifeq ($(ENABLE_CURL),TRUE) ifneq ($(ENABLE_WASM_STRIP_LANGUAGETOOL),TRUE) $(eval $(call gb_Module_add_targets,lingucomponent,\ Library_LanguageTool \ )) endif +endif $(eval $(call gb_Module_add_targets,lingucomponent,\ $(if $(filter iOS MACOSX,$(OS)),Library_MacOSXSpell) \ diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 960852fe3a44..daf0dd6ff3f1 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -912,7 +912,7 @@ sal_uInt16 AbstractMailMergeWizard_Impl::GetRestartPage() const std::optional AbstractSwTranslateLangSelectDlg_Impl::GetSelectedLanguage() { -#if !ENABLE_WASM_STRIP_EXTRA +#if HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA return SwTranslateLangSelectDlg::GetSelectedLanguage(); #else return {}; @@ -980,7 +980,7 @@ std::shared_ptr SwAbstractDialogFactory_Impl::CreateSwBreakD std::shared_ptr SwAbstractDialogFactory_Impl::CreateSwTranslateLangSelectDlg(weld::Window* pParent, SwWrtShell &rSh) { -#if !ENABLE_WASM_STRIP_EXTRA +#if HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA return std::make_shared(std::make_unique(pParent, rSh)); #else (void) pParent; diff --git a/sw/source/uibase/inc/translatehelper.hxx b/sw/source/uibase/inc/translatehelper.hxx index 64b6dd35d90d..9e473d68e039 100644 --- a/sw/source/uibase/inc/translatehelper.hxx +++ b/sw/source/uibase/inc/translatehelper.hxx @@ -17,6 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #pragma once + +#include + +#include +#include + #include class SwWrtShell; @@ -34,8 +40,10 @@ struct SW_DLLPUBLIC TranslateAPIConfig final }; SW_DLLPUBLIC OString ExportPaMToHTML(SwPaM* pCursor); SW_DLLPUBLIC void PasteHTMLToPaM(SwWrtShell& rWrtSh, SwPaM* pCursor, const OString& rData); +#if HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA SW_DLLPUBLIC void TranslateDocument(SwWrtShell& rWrtSh, const TranslateAPIConfig& rConfig); SW_DLLPUBLIC void TranslateDocumentCancellable(SwWrtShell& rWrtSh, const TranslateAPIConfig& rConfig, bool& rCancelTranslation); +#endif } diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index f65e6953ce0e..c92384dbd103 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include + #include #include @@ -107,12 +111,12 @@ #include #include #include -#if !ENABLE_WASM_STRIP_EXTRA +#if HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA #include #include #include #include -#endif // ENABLE_WASM_STRIP_EXTRA +#endif // HAVE_FEATURE_CURL && ENABLE_WASM_STRIP_EXTRA #include #include #include @@ -1977,7 +1981,7 @@ void SwTextShell::Execute(SfxRequest &rReq) break; case SID_FM_TRANSLATE: { -#if !ENABLE_WASM_STRIP_EXTRA +#if HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA const SfxPoolItem* pTargetLangStringItem = nullptr; if (pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_TARGETLANG_STR, false, &pTargetLangStringItem)) { @@ -2001,7 +2005,7 @@ void SwTextShell::Execute(SfxRequest &rReq) std::shared_ptr pDialogController(pAbstractDialog->getDialogController()); weld::DialogController::runAsync(pDialogController, [] (sal_Int32 /*nResult*/) { }); } -#endif // ENABLE_WASM_STRIP_EXTRA +#endif // HAVE_FEATURE_CURL && ENABLE_WASM_STRIP_EXTRA } break; case SID_SPELLCHECK_IGNORE: @@ -2521,7 +2525,7 @@ void SwTextShell::GetState( SfxItemSet &rSet ) case SID_FM_TRANSLATE: { -#if !ENABLE_WASM_STRIP_EXTRA +#if HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA if (!officecfg::Office::Common::Misc::ExperimentalMode::get() && !comphelper::LibreOfficeKit::isActive()) { diff --git a/sw/source/uibase/shells/translatehelper.cxx b/sw/source/uibase/shells/translatehelper.cxx index d949715dd973..6a1eb06a5f17 100644 --- a/sw/source/uibase/shells/translatehelper.cxx +++ b/sw/source/uibase/shells/translatehelper.cxx @@ -16,6 +16,10 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ + +#include + +#include #include #include #include @@ -90,7 +94,7 @@ void PasteHTMLToPaM(SwWrtShell& rWrtSh, SwPaM* pCursor, const OString& rData) } } -#if !ENABLE_WASM_STRIP_EXTRA +#if HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA void TranslateDocument(SwWrtShell& rWrtSh, const TranslateAPIConfig& rConfig) { bool bCancel = false; @@ -208,5 +212,5 @@ void TranslateDocumentCancellable(SwWrtShell& rWrtSh, const TranslateAPIConfig& if (xStatusIndicator.is()) xStatusIndicator->end(); } -#endif // !ENABLE_WASM_STRIP_EXTRA +#endif // HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA }