config_host/config_features.h.in            |    5 +++++
 configure.ac                                |   21 ++++++++++++++++++++-
 desktop/Library_sofficeapp.mk               |    3 ++-
 lingucomponent/Module_lingucomponent.mk     |    2 ++
 sw/source/ui/dialog/swdlgfact.cxx           |    4 ++--
 sw/source/uibase/inc/translatehelper.hxx    |    8 ++++++++
 sw/source/uibase/shells/textsh1.cxx         |   14 +++++++++-----
 sw/source/uibase/shells/translatehelper.cxx |    8 ++++++--
 8 files changed, 54 insertions(+), 11 deletions(-)

New commits:
commit 5bf7c2fa57946cc3323a1d4ee1b2f31d805ae06f
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Sep 14 11:03:48 2023 +0300
Commit:     Mike Kaganski <[email protected]>
CommitDate: Thu Sep 14 12:55:33 2023 +0200

    Fix --disable-curl build
    
    Change-Id: I3020d41eb6d0988cc886495a88a073a23bc8161c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156910
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

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<SwLanguageListItem> 
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<AbstractSwBreakDlg> 
SwAbstractDialogFactory_Impl::CreateSwBreakD
 
 std::shared_ptr<AbstractSwTranslateLangSelectDlg> 
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<AbstractSwTranslateLangSelectDlg_Impl>(std::make_unique<SwTranslateLangSelectDlg>(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 <sal/config.h>
+
+#include <config_features.h>
+#include <config_wasm_strip.h>
+
 #include <swtypes.hxx>
 
 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 <sal/config.h>
+
+#include <config_features.h>
+
 #include <com/sun/star/i18n/WordType.hpp>
 #include <com/sun/star/linguistic2/XThesaurus.hpp>
 
@@ -107,12 +111,12 @@
 #include <comphelper/scopeguard.hxx>
 #include <authfld.hxx>
 #include <config_wasm_strip.h>
-#if !ENABLE_WASM_STRIP_EXTRA
+#if HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA
 #include <officecfg/Office/Common.hxx>
 #include <officecfg/Office/Linguistic.hxx>
 #include <svl/visitem.hxx>
 #include <translatelangselect.hxx>
-#endif // ENABLE_WASM_STRIP_EXTRA
+#endif // HAVE_FEATURE_CURL && ENABLE_WASM_STRIP_EXTRA
 #include <translatehelper.hxx>
 #include <IDocumentContentOperations.hxx>
 #include <IDocumentUndoRedo.hxx>
@@ -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<weld::DialogController> 
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 <sal/config.h>
+
+#include <config_features.h>
 #include <config_wasm_strip.h>
 #include <wrtsh.hxx>
 #include <pam.hxx>
@@ -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
 }

Reply via email to