Upgrade external/boost to latest Boost 1.81.0

<https://dev-www.libreoffice.org/src/boost_1_81_0.tar.xz> has been generated (on
Fedora 37) with

> $ wget https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2
> $ printf '71feeed900fbccca04a3b4f2f84a7c217186f28a940ed8b7ed4725986baf99fa boost_1_81_0.tar.bz2' | sha256sum -c # cf. <https://www.boost.org/users/history/version_1_81_0.html>
> boost_1_81_0.tar.bz2: OK
> $ external/boost/repack_tarball.sh boost_1_81_0.tar.bz2
> Unpacking boost_1_81_0.tar.bz2 ...
> Removing unnecessary files ...
> Creating boost_1_81_0.tar.xz ...
> Cleaning up ...
> 1deb0a5a9e33a6626fcaa1d2efd4c0e74ca2b0eea87c1559e3917f3066b633d6  boost_1_81_0.tar.xz
> Done.

* external/boost/windows-no-utf8-locales.patch.0, introduced with
  f046fed2782f0d4244aff719ba70a56399a2583a "Don't ever attempt to initialise a
  std::locale with a UTF-8 locale on Windows", was presumably obsoleted by
  <https://github.com/boostorg/locale/commit/f45adfc9b963feacc827c3754e2549dd0cffaecb>
  "Use UTF-16 <-> UTF-8 codecvt on Windows".

* external/boost/libc++.patch.0 was obsoleted by
  <https://github.com/boostorg/config/commit/f0af4a9184457939b89110795ae2d293582c5f66>
  "The std lib unary/binary_function base classes are deprecated/removed from
  libcpp15."

* external/boost/0001-Change-mpl-integral_c-to-boost-integral_constant-to-.patch.2
  was obsoleted by
  <https://github.com/boostorg/numeric_conversion/commit/50a1eae942effb0a9b90724323ef8f2a67e7984a>
  "Change mpl::integral_c to boost::integral_constant to avoid Clang 16 errors
  when constructing out of range enums (refs #24, boostorg/mpl#69)".

* external/boost/0001-Avoid-boost-phoenix-placeholders-uarg1.10-ODR-violat.patch.2
  is needed to e.g. avoid
> ./.libs/libetonyek_internal.a(libetonyek_internal_la-KEY1DivElement.o):(.bss+0x3e): multiple definition of `boost::phoenix::placeholders::uarg1'; ./.libs/libetonyek_internal.a(libetonyek_internal_la-IWORKFormula.o):(.bss+0x3e): first defined here
  etc. while building ExternalProject_libetonyek, caused by
  <https://github.com/boostorg/phoenix/commit/8b6a9c26c115bc2cefea300b5c0abf7edf6dd9b7>
  "std::tuple support (Resolving #103) (#104)".

Change-Id: I48773166d0c50f2850d8bb37fa6215d9e5c0d51d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145044
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
diff --git a/download.lst b/download.lst
index 6cfc19a0..c41e59d 100644
--- a/download.lst
+++ b/download.lst
@@ -9,8 +9,8 @@ ABW_TARBALL := libabw-0.1.3.tar.xz
# so that git cherry-pick
# will not run into conflicts
# please repack the tarball using external/boost/repack_tarball.sh
BOOST_SHA256SUM := 322e567e98c466c0aa0e380ed8c647552fe4af48998648428f1b5f0c8eff4666
BOOST_TARBALL := boost_1_80_0.tar.xz
BOOST_SHA256SUM := 1deb0a5a9e33a6626fcaa1d2efd4c0e74ca2b0eea87c1559e3917f3066b633d6
BOOST_TARBALL := boost_1_81_0.tar.xz
# three static lines
# so that git cherry-pick
# will not run into conflicts
diff --git a/external/boost/0001-Avoid-boost-phoenix-placeholders-uarg1.10-ODR-violat.patch.2 b/external/boost/0001-Avoid-boost-phoenix-placeholders-uarg1.10-ODR-violat.patch.2
new file mode 100644
index 0000000..e098972
--- /dev/null
+++ b/external/boost/0001-Avoid-boost-phoenix-placeholders-uarg1.10-ODR-violat.patch.2
@@ -0,0 +1,27 @@
From 50973dc10ea16931245ea61a00b2ce9041acc5ba Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Wed, 4 Jan 2023 17:33:31 +0100
Subject: [PATCH] Avoid boost::phoenix::placeholders::uarg1..10 ODR violations

Those variables, defined in an include file, had external linkage, causing ODR
violations.  Make them const to implicitly give them internal linkage.
---
 include/boost/phoenix/stl/tuple.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/boost/phoenix/stl/tuple.hpp b/include/boost/phoenix/stl/tuple.hpp
index a83014a..7f61a40 100644
--- a/include/boost/phoenix/stl/tuple.hpp
+++ b/include/boost/phoenix/stl/tuple.hpp
@@ -110,7 +110,7 @@ namespace boost { namespace phoenix {
     namespace placeholders {
         #define BOOST_PP_LOCAL_LIMITS (1, BOOST_PHOENIX_ARG_LIMIT)
         #define BOOST_PP_LOCAL_MACRO(N)                                                \
-            auto uarg##N =                                                             \
+            auto const uarg##N =                                                       \
             boost::phoenix::get_<(N)-1>(boost::phoenix::placeholders::arg1);
         #include BOOST_PP_LOCAL_ITERATE()
     }
-- 
2.38.1

diff --git a/external/boost/0001-Change-mpl-integral_c-to-boost-integral_constant-to-.patch.2 b/external/boost/0001-Change-mpl-integral_c-to-boost-integral_constant-to-.patch.2
deleted file mode 100644
index 643ec0f..0000000
--- a/external/boost/0001-Change-mpl-integral_c-to-boost-integral_constant-to-.patch.2
+++ /dev/null
@@ -1,91 +0,0 @@
From 50a1eae942effb0a9b90724323ef8f2a67e7984a Mon Sep 17 00:00:00 2001
From: Peter Dimov <pdimov@gmail.com>
Date: Wed, 16 Nov 2022 10:43:31 +0200
Subject: [PATCH] Change mpl::integral_c to boost::integral_constant to avoid
 Clang 16 errors when constructing out of range enums (refs #24,
 https://github.com/boostorg/mpl/issues/69)

---
 .../numeric/conversion/detail/int_float_mixture.hpp    | 10 +++++-----
 .../boost/numeric/conversion/detail/sign_mixture.hpp   | 10 +++++-----
 .../numeric/conversion/detail/udt_builtin_mixture.hpp  | 10 +++++-----
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/include/boost/numeric/conversion/detail/int_float_mixture.hpp b/include/boost/numeric/conversion/detail/int_float_mixture.hpp
index 464e527..7690d07 100644
--- a/include/boost/numeric/conversion/detail/int_float_mixture.hpp
+++ b/include/boost/numeric/conversion/detail/int_float_mixture.hpp
@@ -16,15 +16,15 @@
 #include "boost/numeric/conversion/int_float_mixture_enum.hpp"
 #include "boost/numeric/conversion/detail/meta.hpp"
 
-#include "boost/mpl/integral_c.hpp"
+#include "boost/type_traits/integral_constant.hpp"
 
 namespace boost { namespace numeric { namespace convdetail
 {
   // Integral Constants for 'IntFloatMixture'
-  typedef mpl::integral_c<int_float_mixture_enum, integral_to_integral> int2int_c ;
-  typedef mpl::integral_c<int_float_mixture_enum, integral_to_float>    int2float_c ;
-  typedef mpl::integral_c<int_float_mixture_enum, float_to_integral>    float2int_c ;
-  typedef mpl::integral_c<int_float_mixture_enum, float_to_float>       float2float_c ;
+  typedef boost::integral_constant<int_float_mixture_enum, integral_to_integral> int2int_c ;
+  typedef boost::integral_constant<int_float_mixture_enum, integral_to_float>    int2float_c ;
+  typedef boost::integral_constant<int_float_mixture_enum, float_to_integral>    float2int_c ;
+  typedef boost::integral_constant<int_float_mixture_enum, float_to_float>       float2float_c ;
 
   // Metafunction:
   //
diff --git a/include/boost/numeric/conversion/detail/sign_mixture.hpp b/include/boost/numeric/conversion/detail/sign_mixture.hpp
index c7f9e42..fde1584 100644
--- a/include/boost/numeric/conversion/detail/sign_mixture.hpp
+++ b/include/boost/numeric/conversion/detail/sign_mixture.hpp
@@ -16,15 +16,15 @@
 #include "boost/numeric/conversion/sign_mixture_enum.hpp"
 #include "boost/numeric/conversion/detail/meta.hpp"
 
-#include "boost/mpl/integral_c.hpp"
+#include "boost/type_traits/integral_constant.hpp"
 
 namespace boost { namespace numeric { namespace convdetail
 {
   // Integral Constants for 'SignMixture'
-  typedef mpl::integral_c<sign_mixture_enum, unsigned_to_unsigned> unsig2unsig_c ;
-  typedef mpl::integral_c<sign_mixture_enum, signed_to_signed>     sig2sig_c ;
-  typedef mpl::integral_c<sign_mixture_enum, signed_to_unsigned>   sig2unsig_c ;
-  typedef mpl::integral_c<sign_mixture_enum, unsigned_to_signed>   unsig2sig_c ;
+  typedef boost::integral_constant<sign_mixture_enum, unsigned_to_unsigned> unsig2unsig_c ;
+  typedef boost::integral_constant<sign_mixture_enum, signed_to_signed>     sig2sig_c ;
+  typedef boost::integral_constant<sign_mixture_enum, signed_to_unsigned>   sig2unsig_c ;
+  typedef boost::integral_constant<sign_mixture_enum, unsigned_to_signed>   unsig2sig_c ;
 
   // Metafunction:
   //
diff --git a/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp b/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp
index 36dbc49..a39d29f 100644
--- a/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp
+++ b/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp
@@ -15,15 +15,15 @@
 #include "boost/numeric/conversion/udt_builtin_mixture_enum.hpp"
 #include "boost/numeric/conversion/detail/meta.hpp"
 
-#include "boost/mpl/integral_c.hpp"
+#include "boost/type_traits/integral_constant.hpp"
 
 namespace boost { namespace numeric { namespace convdetail
 {
   // Integral Constants for 'UdtMixture'
-  typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_builtin> builtin2builtin_c ;
-  typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_udt>     builtin2udt_c ;
-  typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_builtin>     udt2builtin_c ;
-  typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_udt>         udt2udt_c ;
+  typedef boost::integral_constant<udt_builtin_mixture_enum, builtin_to_builtin> builtin2builtin_c ;
+  typedef boost::integral_constant<udt_builtin_mixture_enum, builtin_to_udt>     builtin2udt_c ;
+  typedef boost::integral_constant<udt_builtin_mixture_enum, udt_to_builtin>     udt2builtin_c ;
+  typedef boost::integral_constant<udt_builtin_mixture_enum, udt_to_udt>         udt2udt_c ;
 
   // Metafunction:
   //
-- 
2.37.1 (Apple Git-137.1)

diff --git a/external/boost/UnpackedTarball_boost.mk b/external/boost/UnpackedTarball_boost.mk
index d3c9452..acdc5d3 100644
--- a/external/boost/UnpackedTarball_boost.mk
+++ b/external/boost/UnpackedTarball_boost.mk
@@ -27,17 +27,13 @@ boost_patches += clang-cl.patch.0

boost_patches += boost_1_63_0.undef.warning.patch.1

boost_patches += windows-no-utf8-locales.patch.0

boost_patches += msvc2017.patch.0

boost_patches += libc++.patch.0

boost_patches += boost-ios.patch.0

# <https://github.com/boostorg/numeric_conversion/pull/25> "Fix ill-formed constant expression
# errors":
boost_patches += 0001-Change-mpl-integral_c-to-boost-integral_constant-to-.patch.2
# <https://github.com/boostorg/phoenix/pull/116> "Avoid boost::phoenix::placeholders::uarg1..10 ODR
# violations":
boost_patches += 0001-Avoid-boost-phoenix-placeholders-uarg1.10-ODR-violat.patch.2

$(eval $(call gb_UnpackedTarball_UnpackedTarball,boost))

diff --git a/external/boost/boost.between.warning.patch b/external/boost/boost.between.warning.patch
index 47a11ab..8c9ba65 100644
--- a/external/boost/boost.between.warning.patch
+++ b/external/boost/boost.between.warning.patch
@@ -2,12 +2,12 @@ diff -ru boost.orig/boost/libs/locale/src/encoding/codepage.cpp boost/boost/libs
--- foo/misc/boost.orig/libs/locale/src/encoding/codepage.cpp
+++ foo/misc/boost/libs/locale/src/boost/locale/encoding/codepage.cpp
@@ -58,6 +58,9 @@
                         return cvt->convert(begin,end);
                     #endif
                     #endif
+		    // ensures we get a sensible warning in boost's gettext results about a real mismatch.
+		    if (to_charset && from_charset && !strcmp(to_charset, from_charset))
+			    return std::string(begin, end - begin);
                     throw invalid_charset_error(std::string(to_charset) + " or " + from_charset);
                 }
                 return cvt->convert(begin, end);
 #endif
 #endif
+            // ensures we get a sensible warning in boost's gettext results about a real mismatch.
+            if (to_charset && from_charset && !strcmp(to_charset, from_charset))
+                return std::string(begin, end - begin);
             throw invalid_charset_error(std::string(to_charset) + " or " + from_charset);
         }
 
diff --git a/external/boost/boost.fallback.encoding.patch b/external/boost/boost.fallback.encoding.patch
index abc0cf9..3ad39c4 100644
--- a/external/boost/boost.fallback.encoding.patch
+++ b/external/boost/boost.fallback.encoding.patch
@@ -5,9 +5,9 @@
         country.clear();
         variant.clear();
-        encoding = "us-ascii";
-        utf8=false;
-        utf8 = false;
+        encoding = "UTF-8";
+        utf8=true;
+        utf8 = true;
         parse_from_lang(locale_name);
     }
 
diff --git a/external/boost/boost.noiconv.patch b/external/boost/boost.noiconv.patch
index 71a9e3d..02f2063 100644
--- a/external/boost/boost.noiconv.patch
+++ b/external/boost/boost.noiconv.patch
@@ -2,50 +2,50 @@ diff -ru boost.orig/boost/libs/locale/src/encoding/codepage.cpp boost/boost/libs
--- foo/misc/boost.orig/libs/locale/src/encoding/codepage.cpp
+++ foo/misc/boost/libs/locale/src/boost/locale/encoding/codepage.cpp
@@ -39,6 +39,7 @@
                                             char const *from_charset,
                                             method_type how)
                 {
+                    #if defined(BOOST_LOCALE_WITH_ICONV) || defined(BOOST_LOCALE_WITH_ICU) || defined(BOOST_LOCALE_WITH_WCONV)
                     hold_ptr<converter_between> cvt;
                     #ifdef BOOST_LOCALE_WITH_ICONV
                     cvt.reset(new iconv_between());
                                     const char* from_charset,
                                     method_type how)
         {
+#if defined(BOOST_LOCALE_WITH_ICONV) || defined(BOOST_LOCALE_WITH_ICU) || defined(BOOST_LOCALE_WITH_WCONV)
             hold_ptr<converter_between> cvt;
 #ifdef BOOST_LOCALE_WITH_ICONV
             cvt.reset(new iconv_between());
@@ -55,6 +56,7 @@
                     if(cvt->open(to_charset,from_charset,how))
                         return cvt->convert(begin,end);
                     #endif
+                    #endif
                     throw invalid_charset_error(std::string(to_charset) + " or " + from_charset);
                 }
             if(cvt->open(to_charset, from_charset, how))
                 return cvt->convert(begin, end);
 #endif
+#endif
             throw invalid_charset_error(std::string(to_charset) + " or " + from_charset);
         }
 
@@ -65,6 +67,7 @@
                                         char const *charset,
                                         method_type how)
                 {
+                    #if defined(BOOST_LOCALE_WITH_ICONV) || defined(BOOST_LOCALE_WITH_ICU) || defined(BOOST_LOCALE_WITH_WCONV)
                     hold_ptr<converter_to_utf<CharType> > cvt;
                     #ifdef BOOST_LOCALE_WITH_ICONV
                     cvt.reset(new iconv_to_utf<CharType>());
         template<typename CharType>
         std::basic_string<CharType> convert_to(const char* begin, const char* end, const char* charset, method_type how)
         {
+#if defined(BOOST_LOCALE_WITH_ICONV) || defined(BOOST_LOCALE_WITH_ICU) || defined(BOOST_LOCALE_WITH_WCONV)
             hold_ptr<converter_to_utf<CharType>> cvt;
 #ifdef BOOST_LOCALE_WITH_ICONV
             cvt.reset(new iconv_to_utf<CharType>());
@@ -81,6 +84,7 @@
                     if(cvt->open(charset,how))
                         return cvt->convert(begin,end);
                     #endif
+                    #endif
                     throw invalid_charset_error(charset);
                 }
             if(cvt->open(charset, how))
                 return cvt->convert(begin, end);
 #endif
+#endif
             throw invalid_charset_error(charset);
         }
 
@@ -91,6 +95,7 @@
                                         char const *charset,
                                         method_type how)
                 {
+                    #if defined(BOOST_LOCALE_WITH_ICONV) || defined(BOOST_LOCALE_WITH_ICU) || defined(BOOST_LOCALE_WITH_WCONV)
                     hold_ptr<converter_from_utf<CharType> > cvt;
                     #ifdef BOOST_LOCALE_WITH_ICONV
                     cvt.reset(new iconv_from_utf<CharType>());
         template<typename CharType>
         std::string convert_from(const CharType* begin, const CharType* end, const char* charset, method_type how)
         {
+#if defined(BOOST_LOCALE_WITH_ICONV) || defined(BOOST_LOCALE_WITH_ICU) || defined(BOOST_LOCALE_WITH_WCONV)
             hold_ptr<converter_from_utf<CharType>> cvt;
 #ifdef BOOST_LOCALE_WITH_ICONV
             cvt.reset(new iconv_from_utf<CharType>());
@@ -107,6 +112,7 @@
                     if(cvt->open(charset,how))
                         return cvt->convert(begin,end);
                     #endif
+                    #endif
                     throw invalid_charset_error(charset);
                 }
             if(cvt->open(charset, how))
                 return cvt->convert(begin, end);
 #endif
+#endif
             throw invalid_charset_error(charset);
         }
 
diff --git a/external/boost/libc++.patch.0 b/external/boost/libc++.patch.0
deleted file mode 100644
index f912e6c..0000000
--- a/external/boost/libc++.patch.0
+++ /dev/null
@@ -1,12 +0,0 @@
--- boost/config/stdlib/libcpp.hpp
+++ boost/config/stdlib/libcpp.hpp
@@ -167,5 +167,9 @@
 #if !defined(BOOST_NO_CXX14_HDR_SHARED_MUTEX) && (_LIBCPP_VERSION < 5000)
 #  define BOOST_NO_CXX14_HDR_SHARED_MUTEX
 #endif
+
+#if __cplusplus >= 201103
+#  define BOOST_NO_CXX98_FUNCTION_BASE
+#endif
 
 //  --- end ---
diff --git a/external/boost/windows-no-utf8-locales.patch.0 b/external/boost/windows-no-utf8-locales.patch.0
deleted file mode 100644
index a6b9467..0000000
--- a/external/boost/windows-no-utf8-locales.patch.0
+++ /dev/null
@@ -1,20 +0,0 @@
Don't ever attempt to initialise a std::locale with a UTF-8 locale on Windows -*- Mode: Diff -*-

--- libs/locale/src/boost/locale/std/std_backend.cpp
+++ libs/locale/src/boost/locale/std/std_backend.cpp
@@ -109,12 +109,13 @@
                 #endif
             }
             else {
+                #if !defined(BOOST_WINDOWS)
                 if(loadable(lid)) {
                     name_ = lid;
                     utf_mode_ = utf8_native_with_wide;
                 }
-                #if defined(BOOST_WINDOWS)
-                else if(loadable(win_name)) {
+                #else
+                if(loadable(win_name)) {
                     name_ = win_name;
                     utf_mode_ = utf8_from_wide;
                 }